|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Server Session |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_CCPSERVERSESSION_H |
|
19 #define C_CCPSERVERSESSION_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 |
|
24 // FORWARD DECLARATIONS |
|
25 #ifdef CONTENT_PUBLISHER_DEBUG |
|
26 class CCPDebug; |
|
27 #endif |
|
28 class CLiwGenericParamList; |
|
29 class CLiwDefaultMap; |
|
30 class CLiwDefaultList; |
|
31 class CCPServer; |
|
32 class CCPDataManager; |
|
33 class CCPLiwMap; |
|
34 class CCPActionHandlerThread; |
|
35 class CCPNotificationHandler; |
|
36 struct TPointersForSession; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 /** |
|
40 * Server side session representation |
|
41 * |
|
42 * @since Series 60 5.0 |
|
43 */ |
|
44 class CCPServerSession : public CSession2 |
|
45 { |
|
46 |
|
47 public: |
|
48 // New methods |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 */ |
|
53 static CCPServerSession* NewL(TPointersForSession& aPasser); |
|
54 |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 */ |
|
58 static CCPServerSession* NewLC(TPointersForSession& aPasser); |
|
59 |
|
60 /** |
|
61 * Destroy the object and release all memory objects |
|
62 */ |
|
63 virtual ~CCPServerSession(); |
|
64 |
|
65 public: |
|
66 // From CSession |
|
67 |
|
68 /** |
|
69 * Called after a service request from client |
|
70 * @param aMessage message from client (containing requested operation |
|
71 * and any data) |
|
72 */ |
|
73 void ServiceL(const RMessage2& aMessage); |
|
74 |
|
75 /** |
|
76 * Selects correct function from message |
|
77 * @param aMessage message from client (containing requested operation and any data) |
|
78 * @param aCompleteRequest flag for marking need of completing request |
|
79 */ |
|
80 void DispatchMessageL(const RMessage2& aMessage, TBool& aCompleteRequest); |
|
81 |
|
82 private: |
|
83 // New methods |
|
84 |
|
85 /** |
|
86 * Standard C++ constructor. |
|
87 */ |
|
88 CCPServerSession(); |
|
89 |
|
90 /** |
|
91 * Perform the second phase construction of a CCPServerSession object |
|
92 */ |
|
93 void ConstructL(TPointersForSession& aPasser); |
|
94 |
|
95 /** |
|
96 * Add Data request |
|
97 * @param Message from client |
|
98 */ |
|
99 void AddDataL(const RMessage2& aMessage); |
|
100 |
|
101 /** |
|
102 * Specific add data request - data is not actually added to database |
|
103 * but notification is send. |
|
104 * @param Message from client |
|
105 */ |
|
106 void AddDataNonPersistentL(const RMessage2& aMessage); |
|
107 |
|
108 /** |
|
109 * Get data request - first phase |
|
110 * @param Message from client |
|
111 */ |
|
112 void GetListSizeL(const RMessage2& aMessage); |
|
113 |
|
114 /** |
|
115 * Get data request - second phase |
|
116 * @param Message from client |
|
117 */ |
|
118 void GetListDataL(const RMessage2& aMessage); |
|
119 |
|
120 /** |
|
121 * Remove data request |
|
122 * @param Message from client |
|
123 */ |
|
124 void RemoveDataL(const RMessage2& aMessage); |
|
125 |
|
126 /** |
|
127 * Executes action request |
|
128 * @param Message from client |
|
129 */ |
|
130 void ExecuteActionL(const RMessage2& aMessage); |
|
131 |
|
132 /** |
|
133 * Executes actions and sends notifications |
|
134 * @param aMap input map from client |
|
135 * @param aEnableCache indicates if action data should be cached |
|
136 * @param aOptions command options |
|
137 */ |
|
138 void ExecuteActionL(const CCPLiwMap* aMap, |
|
139 TBool aEnableCache, TUint aOptions); |
|
140 |
|
141 /** |
|
142 * Executes multiple actions request |
|
143 * @param Message from client |
|
144 */ |
|
145 void ExecuteMultipleActionsL(const RMessage2& aMessage); |
|
146 |
|
147 /** |
|
148 * Executes action request |
|
149 * @param aActionParams list with actions |
|
150 */ |
|
151 void ExecuteL(const CLiwGenericParamList& aActionParams); |
|
152 |
|
153 /** |
|
154 * Register for notification request |
|
155 * @param Message from client |
|
156 */ |
|
157 void RegisterObserverL(const RMessage2& aMessage); |
|
158 |
|
159 /** |
|
160 * Adds new observer |
|
161 * @param Message from client |
|
162 */ |
|
163 void AddObserverL(const RMessage2& aMessage); |
|
164 |
|
165 /** |
|
166 * Removes observer |
|
167 * @param Message from client |
|
168 */ |
|
169 void RemoveObserverL(const RMessage2& aMessage); |
|
170 |
|
171 /** |
|
172 * Unregister from notification request |
|
173 * @param Message from client |
|
174 */ |
|
175 void UnregisterObserverL(); |
|
176 |
|
177 /** |
|
178 * Send information about change in database to client |
|
179 * @param Message from client |
|
180 */ |
|
181 void GetChangeInfoDataL(const RMessage2& aMessage); |
|
182 |
|
183 /** |
|
184 * Converts CLiwGenericParamList to descriptor and |
|
185 * sends to client |
|
186 * @param Message to complete |
|
187 * @param Parameters for message |
|
188 */ |
|
189 void ExternalizeAndWriteToClientL(const RMessage2& aMessage, |
|
190 const CLiwGenericParamList* outParamList); |
|
191 |
|
192 /** |
|
193 * Unpacks message from client to map |
|
194 * @param Message to complete |
|
195 * @return CCPLiwMap with data from client |
|
196 */ |
|
197 CCPLiwMap* UnpackFromClientLC(const RMessage2& aMessage); |
|
198 |
|
199 /** |
|
200 * Send notification |
|
201 * @param aNotificationList |
|
202 */ |
|
203 void SendNotificationL(CCPLiwMap* aMap, |
|
204 CLiwDefaultList* aNotificationList); |
|
205 |
|
206 /** |
|
207 * Get and Execute Activate or Deactivate action from the DB |
|
208 * @param Map containing ids of item |
|
209 */ |
|
210 void GetAndExecuteActionL( CCPLiwMap* aMap, CLiwDefaultList* aNotificationList, |
|
211 TBool aInsertTrigger = EFalse ); |
|
212 |
|
213 /** |
|
214 * Get Server Lock |
|
215 * @return ETrue if aMessege cannot be processed |
|
216 * because Backup or Restore is running |
|
217 **/ |
|
218 TBool GetServerLock(const RMessage2& aMessage); |
|
219 |
|
220 /** |
|
221 * Unpacks data for ExecuteMultipleActions from client |
|
222 * @param Message from client |
|
223 * @return list containing input data from the client |
|
224 **/ |
|
225 CLiwGenericParamList* UnpackForMultiExecuteLC(const RMessage2& aMessage); |
|
226 |
|
227 /** |
|
228 * Checks map validity of input data and returns list |
|
229 * that can be used to call execute |
|
230 * @param aMaps input data |
|
231 * @return list containing input maps for Execute |
|
232 **/ |
|
233 CLiwDefaultList* CheckValidityLC(const CLiwList* aMaps); |
|
234 |
|
235 private: |
|
236 |
|
237 /* |
|
238 * Own. |
|
239 * Handler for asynchronous request for notifications |
|
240 */ |
|
241 CCPNotificationHandler* iNotificationHandler; |
|
242 |
|
243 /* |
|
244 * Not own. |
|
245 * True if message is register |
|
246 */ |
|
247 TBool isRegister; |
|
248 |
|
249 /* |
|
250 * Not own. |
|
251 * Pointer to Content Publisher Server |
|
252 */ |
|
253 CCPServer* iServer; |
|
254 |
|
255 /* |
|
256 * Not own. |
|
257 * Manager to send and receive data beetween server and storage |
|
258 */ |
|
259 CCPDataManager* iDataManager; |
|
260 |
|
261 /* |
|
262 * Own. |
|
263 * List write to message with getList function |
|
264 */ |
|
265 CLiwGenericParamList* iParamList; |
|
266 |
|
267 /* |
|
268 * Not Own. |
|
269 * Manager to prepare and execute action |
|
270 */ |
|
271 CCPActionHandlerThread* iActionHandlerThread; |
|
272 |
|
273 #ifdef CONTENT_PUBLISHER_DEBUG |
|
274 CCPDebug* iDebug; |
|
275 #endif |
|
276 }; |
|
277 |
|
278 #endif // C_CCPSERVERSESSION_H |