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 |
|
19 #ifndef C_CCPSERVERSESSION_H |
|
20 #define C_CCPSERVERSESSION_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 #ifdef CONTENT_PUBLISHER_DEBUG |
|
27 class CCPDebug; |
|
28 #endif |
|
29 class CLiwGenericParamList; |
|
30 class CLiwDefaultMap; |
|
31 class CLiwDefaultList; |
|
32 class CCPServer; |
|
33 class CCPDataManager; |
|
34 class CCPLiwMap; |
|
35 class CCPActionHandlerThread; |
|
36 class CCPNotificationHandler; |
|
37 struct TPointersForSession; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 /** |
|
41 * Server side session representation |
|
42 * |
|
43 * @since Series 60 5.0 |
|
44 */ |
|
45 class CCPServerSession : public CSession2 |
|
46 { |
|
47 |
|
48 public: |
|
49 // New methods |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 */ |
|
54 static CCPServerSession* NewL( TPointersForSession& aPasser ); |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 */ |
|
59 static CCPServerSession* NewLC( TPointersForSession& aPasser ); |
|
60 |
|
61 /** |
|
62 * Destroy the object and release all memory objects |
|
63 */ |
|
64 virtual ~CCPServerSession(); |
|
65 |
|
66 public: |
|
67 // From CSession |
|
68 |
|
69 /** |
|
70 * Called after a service request from client |
|
71 * @param aMessage message from client (containing requested operation |
|
72 * and any data) |
|
73 */ |
|
74 void ServiceL( const RMessage2& aMessage ); |
|
75 |
|
76 /** |
|
77 * Selects correct function from message |
|
78 * @param aMessage message from client (containing requested operation |
|
79 * and any data) |
|
80 */ |
|
81 void DispatchMessageL( const RMessage2& aMessage, TBool& aPanicedClient ); |
|
82 |
|
83 private: |
|
84 // New methods |
|
85 |
|
86 /** |
|
87 * Standard C++ constructor. |
|
88 */ |
|
89 CCPServerSession(); |
|
90 |
|
91 /** |
|
92 * Perform the second phase construction of a CCPServerSession object |
|
93 */ |
|
94 void ConstructL( TPointersForSession& aPasser ); |
|
95 |
|
96 /** |
|
97 * Add Data request |
|
98 * @param Message from client |
|
99 */ |
|
100 void AddDataL( const RMessage2& aMessage ); |
|
101 |
|
102 /** |
|
103 * Get data request - first phase |
|
104 * @param Message from client |
|
105 */ |
|
106 void GetListSizeL( const RMessage2& aMessage ); |
|
107 |
|
108 /** |
|
109 * Get data request - second phase |
|
110 * @param Message from client |
|
111 */ |
|
112 void GetListDataL( const RMessage2& aMessage ); |
|
113 |
|
114 /** |
|
115 * Remove data request |
|
116 * @param Message from client |
|
117 */ |
|
118 void RemoveDataL( const RMessage2& aMessage ); |
|
119 |
|
120 /** |
|
121 * Executes action request |
|
122 * @param Message from client |
|
123 */ |
|
124 void ExecuteActionL( const RMessage2& aMessage ); |
|
125 |
|
126 /** |
|
127 * Executes action request |
|
128 * @param aActionParams list with actions |
|
129 */ |
|
130 void ExecuteL( const CLiwGenericParamList& aActionParams ); |
|
131 |
|
132 /** |
|
133 * Register for notification request |
|
134 * @param Message from client |
|
135 */ |
|
136 void RegisterObserverL( const RMessage2& aMessage ); |
|
137 |
|
138 /** |
|
139 * Adds new observer |
|
140 * @param Message from client |
|
141 */ |
|
142 void AddObserverL( const RMessage2& aMessage ); |
|
143 |
|
144 /** |
|
145 * Removes observer |
|
146 * @param Message from client |
|
147 */ |
|
148 void RemoveObserverL( const RMessage2& aMessage ); |
|
149 |
|
150 /** |
|
151 * Unregister from notification request |
|
152 * @param Message from client |
|
153 */ |
|
154 void UnregisterObserverL(); |
|
155 |
|
156 /** |
|
157 * Send information about change in database to client |
|
158 * @param Message from client |
|
159 */ |
|
160 void GetChangeInfoDataL( const RMessage2& aMessage ); |
|
161 |
|
162 /** |
|
163 * Converts CLiwGenericParamList to descriptor and |
|
164 * sends to client |
|
165 * @param Message to complete |
|
166 * @param Parameters for message |
|
167 */ |
|
168 void ExternalizeAndWriteToClientL( const RMessage2& aMessage, |
|
169 const CLiwGenericParamList* outParamList ); |
|
170 |
|
171 /** |
|
172 * Unpacks message from client to map |
|
173 * @param Message to complete |
|
174 * @return CCPLiwMap with data from client |
|
175 */ |
|
176 CCPLiwMap* UnpackFromClientLC( const RMessage2& aMessage ); |
|
177 |
|
178 /** |
|
179 * Send notification |
|
180 * @param aNotificationList |
|
181 */ |
|
182 void SendNotificationL( CCPLiwMap* aMap, |
|
183 CLiwDefaultList* aNotificationList ); |
|
184 |
|
185 /** |
|
186 * Get and Execute Activate or Deactivate action from the DB |
|
187 * @param Map containing ids of item |
|
188 */ |
|
189 void GetAndExecuteActionL( CCPLiwMap* aMap, CLiwDefaultList* aNotificationList, |
|
190 TBool aInsertTrigger = EFalse ); |
|
191 |
|
192 /** |
|
193 * Get Server Lock |
|
194 * @return ETrue if aMessege cannot be processed |
|
195 * because Backup or Restore is running |
|
196 **/ |
|
197 TBool GetServerLock( const RMessage2& aMessage ); |
|
198 |
|
199 private: |
|
200 |
|
201 /* |
|
202 * Own. |
|
203 * Handler for asynchronous request for notifications |
|
204 */ |
|
205 CCPNotificationHandler* iNotificationHandler; |
|
206 |
|
207 /* |
|
208 * Not own. |
|
209 * True if message is register |
|
210 */ |
|
211 TBool isRegister; |
|
212 |
|
213 /* |
|
214 * Not own. |
|
215 * Pointer to Content Publisher Server |
|
216 */ |
|
217 CCPServer* iServer; |
|
218 |
|
219 /* |
|
220 * Not own. |
|
221 * Manager to send and receive data beetween server and storage |
|
222 */ |
|
223 CCPDataManager* iDataManager; |
|
224 |
|
225 /* |
|
226 * Own. |
|
227 * List write to message with getList function |
|
228 */ |
|
229 CLiwGenericParamList* iParamList; |
|
230 |
|
231 /* |
|
232 * Not Own. |
|
233 * Manager to prepare and execute action |
|
234 */ |
|
235 CCPActionHandlerThread* iActionHandlerThread; |
|
236 |
|
237 #ifdef CONTENT_PUBLISHER_DEBUG |
|
238 CCPDebug* iDebug; |
|
239 #endif |
|
240 }; |
|
241 |
|
242 #endif // C_CCPSERVERSESSION_H |
|