equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
59 } |
59 } |
60 |
60 |
61 OS_EXPORT CbsServerConnection::~CbsServerConnection() |
61 OS_EXPORT CbsServerConnection::~CbsServerConnection() |
62 { |
62 { |
63 JELOG2(EWMA); |
63 JELOG2(EWMA); |
64 removeDir(mMessageStoreDirName); |
|
65 } |
64 } |
66 |
65 |
67 void CbsServerConnection::initializeL() |
66 void CbsServerConnection::initializeL() |
68 { |
67 { |
69 JELOG2(EWMA); |
68 JELOG2(EWMA); |
190 } |
189 } |
191 // Create Message Store |
190 // Create Message Store |
192 const java::runtime::ApplicationInfo& appInf = |
191 const java::runtime::ApplicationInfo& appInf = |
193 java::runtime::ApplicationInfo::getInstance(); |
192 java::runtime::ApplicationInfo::getInstance(); |
194 const std::wstring& root = appInf.getRootPath(); |
193 const std::wstring& root = appInf.getRootPath(); |
195 error = createMessageStore(root + CBS_STORE_PATH); |
194 // At this point mIsAppLaunched will be true if it not push connection. |
|
195 error = createMessageStore(root + CBS_STORE_PATH, mIsAppLaunched); |
196 if (error != KErrNone) |
196 if (error != KErrNone) |
197 { |
197 { |
198 ELOG1(EWMA,"CBS : create message store failed : %d",error); |
198 ELOG1(EWMA,"CBS : create message store failed : %d",error); |
199 std::string errTxt("ERROR!!! CBS : create message store failed"); |
199 std::string errTxt("ERROR!!! CBS : create message store failed"); |
200 throw PushException(COMMON_SRV_CONN_PLUGIN_ERROR,errTxt,__FILE__, |
200 throw PushException(COMMON_SRV_CONN_PLUGIN_ERROR,errTxt,__FILE__, |
212 throw PushException(COMMON_SRV_CONN_PLUGIN_ERROR,errTxt,__FILE__, |
212 throw PushException(COMMON_SRV_CONN_PLUGIN_ERROR,errTxt,__FILE__, |
213 __FUNCTION__,__LINE__); |
213 __FUNCTION__,__LINE__); |
214 } |
214 } |
215 |
215 |
216 mOpenMonitor->wait(); |
216 mOpenMonitor->wait(); |
217 // If there are any messages already available in the message store |
|
218 // notify the listener |
|
219 if (mMessagesOnStore > 0) |
|
220 { |
|
221 mListener->msgArrived(); |
|
222 } |
|
223 mIsListening = true; |
217 mIsListening = true; |
224 } |
218 } |
225 } |
219 } |
226 |
220 |
227 |
221 |
317 delete[] messagePath; |
311 delete[] messagePath; |
318 readStream.exceptions(std::ofstream::goodbit); |
312 readStream.exceptions(std::ofstream::goodbit); |
319 readStream.close(); |
313 readStream.close(); |
320 return KErrGeneral; |
314 return KErrGeneral; |
321 } |
315 } |
322 catch (ExceptionBase ex) |
316 catch (ExceptionBase &ex) |
323 { |
317 { |
324 delete[] messagePath; |
318 delete[] messagePath; |
325 return KErrGeneral; |
319 return KErrGeneral; |
326 } |
320 } |
327 return KErrNone; |
321 return KErrNone; |
695 delete[] messagePath; |
689 delete[] messagePath; |
696 writeStream.exceptions(std::ofstream::goodbit); |
690 writeStream.exceptions(std::ofstream::goodbit); |
697 writeStream.close(); |
691 writeStream.close(); |
698 User::Leave(KErrGeneral); |
692 User::Leave(KErrGeneral); |
699 } |
693 } |
700 catch (ExceptionBase ex) |
694 catch (ExceptionBase &ex) |
701 { |
695 { |
702 User::Leave(KErrGeneral); |
696 User::Leave(KErrGeneral); |
703 } |
697 } |
704 delete[] messagePath; |
698 delete[] messagePath; |
705 if (mCbsPartiallyReceived) |
699 if (mCbsPartiallyReceived) |