|
1 /* |
|
2 * Copyright (c) 2006 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: Contains CNcdSubscriptionManager class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NCD_SUBSCRIPTION_MANAGER_IMPL_H |
|
20 #define NCD_SUBSCRIPTION_MANAGER_IMPL_H |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <e32cmn.h> |
|
25 #include <badesca.h> |
|
26 |
|
27 #include "catalogscommunicable.h" |
|
28 #include "ncdparserobserver.h" |
|
29 #include "ncdnodeclassids.h" |
|
30 |
|
31 class RWriteStream; |
|
32 class RReadStream; |
|
33 |
|
34 class CNcdStorageManager; |
|
35 class CNcdNodeIdentifier; |
|
36 class MCatalogsBaseMessage; |
|
37 class MNcdStorage; |
|
38 class CNcdSubscriptionsSourceIdentifier; |
|
39 class MNcdStorageDataItem; |
|
40 class CNcdPurchaseOptionImpl; |
|
41 class CNcdSubscriptionGroup; |
|
42 class CNcdClientsSubscriptions; |
|
43 class CNcdNodeManager; |
|
44 class CNcdSubscription; |
|
45 |
|
46 class CNcdKeyValuePair; |
|
47 |
|
48 class MNcdSubscriptionManagerObserver; |
|
49 class CNcdSubscriptionDataCompleter; |
|
50 |
|
51 class CNcdOperationManager; |
|
52 class MCatalogsContext; |
|
53 |
|
54 /** |
|
55 * CSubscriptionManager manages all subscription info. |
|
56 * |
|
57 * |
|
58 * @lib ?library |
|
59 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
60 */ |
|
61 class CNcdSubscriptionManager : public CCatalogsCommunicable |
|
62 { |
|
63 |
|
64 public: |
|
65 |
|
66 /** |
|
67 * NewL |
|
68 * |
|
69 * @return CNcdSubscriptionManager* Pointer to the created object |
|
70 * of this class. |
|
71 */ |
|
72 static CNcdSubscriptionManager* NewL( |
|
73 CNcdStorageManager& aStorageManager, |
|
74 CNcdNodeManager& aNodeManager ); |
|
75 |
|
76 /** |
|
77 * NewLC |
|
78 * |
|
79 * @return CNcdSubscriptionManager* Pointer to the created object |
|
80 * of this class. |
|
81 */ |
|
82 static CNcdSubscriptionManager* NewLC( |
|
83 CNcdStorageManager& aStorageManager, |
|
84 CNcdNodeManager& aNodeManager ); |
|
85 |
|
86 |
|
87 /** |
|
88 * Destructor |
|
89 * |
|
90 * |
|
91 */ |
|
92 virtual ~CNcdSubscriptionManager(); |
|
93 |
|
94 /** |
|
95 * Setter for operation manager. Needed to create operations for |
|
96 * subscription completion. |
|
97 */ |
|
98 void SetOperationManager( CNcdOperationManager* aManager ); |
|
99 |
|
100 /** |
|
101 * Function to return sources of subscriptions for given client. |
|
102 * Can be used for example when querying subscriptions info from |
|
103 * servers. Returns info to identify where the queries should be sent |
|
104 * etc. |
|
105 * |
|
106 * @note If same subscription could exist behind different URI:s |
|
107 * only one URI is returned. |
|
108 * |
|
109 * @param aClientUid Uid to identify client whose subscriptions |
|
110 * sources are needed. |
|
111 * @return Array containing objects to identify sources for |
|
112 * subscriptions. |
|
113 * @exception Leave KErrNotFound if nothing is found. Otherwise |
|
114 * System wide error code. |
|
115 */ |
|
116 RPointerArray<CNcdSubscriptionsSourceIdentifier> |
|
117 SubscriptionsSourcesL( TUid aClientUid ) const; |
|
118 |
|
119 /** |
|
120 * This function is called when subscription info of one server |
|
121 * should be reset from given protocol elements. Server is |
|
122 * identified by the server URI which is given as a parameter. |
|
123 * If subscription info of given subscription is already found |
|
124 * from the client's data structures, it is updated. If not, |
|
125 * it is created. If some subscriptions are found locally but |
|
126 * not from the received list of subscriptions then those |
|
127 * local subscriptions are deleted. |
|
128 * |
|
129 * @note If existing subscription is not found and it is created |
|
130 * the created subscription will have incomplete info. |
|
131 * This is because protocol element does not contain all |
|
132 * info. That is why this function will start the retrieval |
|
133 * of the missing data from corresponding node if present. |
|
134 * |
|
135 * @note Array given as parameter is not closed or reset in |
|
136 * this function. |
|
137 * |
|
138 * |
|
139 * @param aClientUid Uid to identify client whose subscriptions |
|
140 * are given |
|
141 * @param aUri Uri of the server that is used to retrieve info |
|
142 * related to given subscription. |
|
143 * @param aServersSubscriptions The data is set in the protocol parser |
|
144 * and can be used to update or create |
|
145 * subscription info. |
|
146 * @param aContext Not used. |
|
147 * @param aObserver Observer which should be called with |
|
148 * InternalizeComplete when internalization |
|
149 * completes. |
|
150 * |
|
151 */ |
|
152 void InternalizeSubscriptionsFromServerL( |
|
153 TUid aClientUid, |
|
154 const TDesC& aUri, |
|
155 RPointerArray<MNcdPreminetProtocolSubscription>& |
|
156 aServersSubscriptions, |
|
157 MCatalogsContext* aContext, |
|
158 MNcdSubscriptionManagerObserver* aObserver ); |
|
159 |
|
160 |
|
161 /** |
|
162 * This function is called when subscription info should be updated |
|
163 * or constructed from a protocol element. If subscription info |
|
164 * of given subscription is already found, it is updated. If not, |
|
165 * it is created. |
|
166 * |
|
167 * @note If existing subscription is not found and it is created |
|
168 * the created subscription will have incomplete info. |
|
169 * This is because protocol element does not contain all |
|
170 * info. That is why this function will start the retrieval |
|
171 * of the missing data from corresponding node if present. |
|
172 * |
|
173 * |
|
174 * @param aClientUid Uid to identify client whose subscription |
|
175 * is passed in aSubscription parameter |
|
176 * @param aUri Uri of the server that is used to retrieve info |
|
177 * related to given subscription. (Same as of the node's |
|
178 * uri.) |
|
179 * @param aSubscription The data is set in the protocol parser and can |
|
180 * be used to update or create subscription info. |
|
181 * @param aContext Not used. |
|
182 * @param aObserver Observer which should be called with |
|
183 * InternalizeComplete when internalization |
|
184 * completes. |
|
185 */ |
|
186 void InternalizeSubscriptionL( |
|
187 TUid aClientUid, |
|
188 const TDesC& aUri, |
|
189 MNcdPreminetProtocolSubscription& aSubscription, |
|
190 MCatalogsContext* aContext, |
|
191 MNcdSubscriptionManagerObserver* aObserver ); |
|
192 |
|
193 |
|
194 /** |
|
195 * This function is called when a subscription should be removed |
|
196 * from the cache and from the database |
|
197 * |
|
198 * @exception Leave KErrNotFound if used subscription is not found. |
|
199 * @exception Otherwise leave System wide error code. |
|
200 */ |
|
201 void RemoveSubscriptionL( const CNcdNodeIdentifier& aData, |
|
202 const TDesC& aPurchaseOptionId ); |
|
203 |
|
204 /** |
|
205 * Returns the subscription defined by parameters. |
|
206 * |
|
207 * @param aNodeId The node id. |
|
208 * @param aNodeNameSpace The node namespace. |
|
209 * @param aPurchaseOptionId The purchase option id. |
|
210 * @param aClientUid The client uid. |
|
211 * @return The subscription. |
|
212 * @exception KErrNotFound If there is no such subscription group. |
|
213 */ |
|
214 CNcdSubscription& SubscriptionL( const TDesC& aNodeId, |
|
215 const TDesC& aNodeNameSpace, |
|
216 const TDesC& aPurchaseOptionId, |
|
217 const TUid& aClientUid ); |
|
218 |
|
219 /** |
|
220 * Clears the subscription database completely. |
|
221 * |
|
222 * @aContext The context identifying the client. |
|
223 */ |
|
224 void ClearSubscriptionDbL( const MCatalogsContext& aContext ); |
|
225 |
|
226 /** |
|
227 * Notifies the enrolled listeners by completing the pending messages. |
|
228 * |
|
229 * @param aClientUid The client of which listeners are notified. |
|
230 */ |
|
231 void NotifyListeners( TUid aClientUid ); |
|
232 |
|
233 /** |
|
234 * Removes finished completer from the list and deletes it. |
|
235 * |
|
236 * @param aFinishedCompleter Pointer to the finished completer. |
|
237 */ |
|
238 void SubscriptionCompleted( |
|
239 CNcdSubscriptionDataCompleter* aFinishedCompleter ); |
|
240 |
|
241 /** |
|
242 * This function stores (and replaces if exists) data of given |
|
243 * group into database with given clientuid. |
|
244 * This function uses SaveDataIntoDatabaseL |
|
245 * |
|
246 */ |
|
247 void SaveGroupIntoDatabaseL( TUid aClientUid, |
|
248 CNcdSubscriptionGroup& aGroup ); |
|
249 |
|
250 public: // CCatalogsCommunicable |
|
251 |
|
252 /** |
|
253 * @see CCatalogsCommunicable::ReceiveMessage |
|
254 */ |
|
255 virtual void ReceiveMessage( MCatalogsBaseMessage* aMessage, |
|
256 TInt aFunctionNumber ); |
|
257 |
|
258 /** |
|
259 * @see CCatalogsCommunicable::CounterPartLost |
|
260 */ |
|
261 virtual void CounterPartLost( const MCatalogsSession& aSession ); |
|
262 |
|
263 |
|
264 protected: |
|
265 |
|
266 /** |
|
267 * Constructor |
|
268 */ |
|
269 CNcdSubscriptionManager( CNcdStorageManager& aStorageManager, |
|
270 CNcdNodeManager& aNodeManager ); |
|
271 |
|
272 /** |
|
273 * ConstructL |
|
274 */ |
|
275 virtual void ConstructL(); |
|
276 |
|
277 |
|
278 // Functions that are called from the ReceiveMessageL, which is meant |
|
279 // to be used by the client side. |
|
280 |
|
281 void ReleaseRequest( MCatalogsBaseMessage& aMessage ); |
|
282 |
|
283 /** |
|
284 * This function is called when the proxy wants to get the |
|
285 * data from the serverside. This function calls the |
|
286 * ExternalizeClientsSubscriptionsL which may be overloaded in the |
|
287 * child classes |
|
288 * @param aMessage Contains data from the proxy and can be used |
|
289 * to send data back to proxy |
|
290 */ |
|
291 void InternalizeRequestL( MCatalogsBaseMessage& aMessage ); |
|
292 |
|
293 /** |
|
294 * This function is called when proxy wants to get the subscription |
|
295 * group identifiers from server side. |
|
296 * |
|
297 * @param aMessage Used to send data to proxy. |
|
298 */ |
|
299 void SubscriptionGroupIdentifiersRequestL( |
|
300 MCatalogsBaseMessage& aMessage ); |
|
301 |
|
302 |
|
303 private: |
|
304 |
|
305 // Prevent if not implemented |
|
306 CNcdSubscriptionManager( |
|
307 const CNcdSubscriptionManager& aObject ); |
|
308 CNcdSubscriptionManager& operator=( |
|
309 const CNcdSubscriptionManager& aObject ); |
|
310 |
|
311 /** |
|
312 * Function for checking that subscriptions of given goups have |
|
313 * all needed data and if not get the data from the corresponding |
|
314 * nodes. Does also the needed callback of observer and notifying |
|
315 * of subscription manager's listeners |
|
316 * |
|
317 * @note Given groups should be of the same client |
|
318 * |
|
319 * @param aClientUid Id of the client that should be notified |
|
320 * of manager content change. |
|
321 * @param aServersGroups Groups that should be checked. |
|
322 * @param aObserver Observer that is informed of internalisation |
|
323 * completion. |
|
324 * @param aContext Not used. |
|
325 * @exception Leave with System wide error code. |
|
326 */ |
|
327 void CNcdSubscriptionManager::CompleteSubscriptionsDataL( |
|
328 TUid aClientUid, |
|
329 RPointerArray<CNcdSubscriptionGroup>& aServersGroups, |
|
330 MCatalogsContext* aContext, |
|
331 MNcdSubscriptionManagerObserver* aObserver ); |
|
332 |
|
333 /** |
|
334 * Function that goes through given subscription groups and |
|
335 * checks whether they have subscriptions whose data is |
|
336 * incomplete. If such subscriptions are found, appends copy of |
|
337 * node identifier and purchase option id where from the |
|
338 * subscription is bought into the given arrays. |
|
339 * |
|
340 * @param aGroups Groups that should be checked. |
|
341 * @param aNodeIds Array for Node Id appending. |
|
342 * @param aPurchaseOptionIDs Array for purchase option id |
|
343 * appending. |
|
344 * @exception Leave with System wide error code. |
|
345 */ |
|
346 void IdentifiersForCompletionL( |
|
347 RPointerArray<CNcdSubscriptionGroup>& aGroups, |
|
348 RPointerArray<CNcdNodeIdentifier>& aNodeIds, |
|
349 CDesCArrayFlat& aPurchaseOptionIDs ); |
|
350 |
|
351 /** |
|
352 * Function to return index pointing to subscriptions of a |
|
353 * client with given uid. |
|
354 * |
|
355 * @param aUid Uid to identify client whose subscriptions |
|
356 * are needed. |
|
357 * @return Index of subscriptions of searched client. |
|
358 * @exception Leave KErrNotFound if not found. |
|
359 */ |
|
360 TInt IsInCacheL( TUid aUid ) const; |
|
361 |
|
362 /** |
|
363 * Function to return index pointing to subscriptions of a |
|
364 * client with given uid. If it is not found, a object to |
|
365 * contain subscriptions of a client with given uid is created. |
|
366 * |
|
367 * @param aUid Uid to identify client whose subscriptions |
|
368 * are needed. |
|
369 * @return Index of subscriptions of searched or created client. |
|
370 */ |
|
371 TInt ClientsSubscriptionsL( TUid aClientUid ); |
|
372 |
|
373 /** |
|
374 * Function to return index pointing to a group searched from |
|
375 * groups given as array parameter. |
|
376 * |
|
377 * @param aGroups Array to search for certain subscription group. |
|
378 * @param aEntityId Id info that should be found from the group |
|
379 * @param aNamespace Namespace info that should be found from the |
|
380 * group. |
|
381 * @return Index of searched group if found. |
|
382 * @exception Leave KErrNotFound if not found. |
|
383 */ |
|
384 TInt FindGroupL( |
|
385 const RPointerArray<CNcdSubscriptionGroup>& aGroups, |
|
386 const TDesC& aEntityId, |
|
387 const TDesC& aNamespace ) const; |
|
388 |
|
389 /** |
|
390 * Function to return reference to subscription group identified |
|
391 * by given parameters. Client is identified with given uid. |
|
392 * |
|
393 * @param aUid Uid to identify client whose subscriptions |
|
394 * are needed. |
|
395 * @param aEntityId Id info that should be found from the group |
|
396 * @param aNamespace Namespace info that should be found from the |
|
397 * group. |
|
398 * @return Reference to subscription group found. |
|
399 * |
|
400 * @exception Leave KErrNotFound if not found. |
|
401 */ |
|
402 CNcdSubscriptionGroup& FindGroupL( |
|
403 TUid aClientUid, |
|
404 const TDesC& aEntityId, |
|
405 const TDesC& aNamespace ) const; |
|
406 |
|
407 |
|
408 /** |
|
409 * Function to return reference to subscription group identified |
|
410 * by given uri and purchase option. |
|
411 * If object containing clients subscription groups is not found it |
|
412 * is created. Also if searched subscription group is not found, |
|
413 * it is created. Created objects are inserted to corresponding |
|
414 * arrays under subscription manager. |
|
415 * |
|
416 * @param aUri Uri of the server that is used to retrieve info |
|
417 * related to given subscription. (Same as of the node's |
|
418 * uri.) |
|
419 * @param aData Purchaseoption that was used to buy the subscription. |
|
420 * It is used to construct the subscription info. |
|
421 * @return Reference to subscription group found or created. |
|
422 */ |
|
423 CNcdSubscriptionGroup& ClientsSubscriptionGroupL( |
|
424 const TDesC& aUri, |
|
425 const CNcdPurchaseOptionImpl& aData ); |
|
426 |
|
427 /** |
|
428 * Function to return reference to subscription group identified |
|
429 * by given parameters. Client is identified with given uid. |
|
430 * If object containing clients subscription groups is not found it |
|
431 * is created. Also if searched subscription group is not found, |
|
432 * it is created. Created objects are inserted to corresponding |
|
433 * arrays under subscription manager. |
|
434 * |
|
435 * @param aUid Uid to identify client whose subscriptions |
|
436 * are needed. |
|
437 * @param aEntityId Id info that should be found from the group |
|
438 * @param aNamespace Namespace info that should be found from the |
|
439 * group. |
|
440 * @param aUri Uri of the server that is used to retrieve info |
|
441 * related to searched subscription. (Same as of the node's |
|
442 * uri.) |
|
443 * @return Reference to subscription group found or created. |
|
444 */ |
|
445 CNcdSubscriptionGroup& ClientsSubscriptionGroupL( |
|
446 TUid aClientUid, |
|
447 const TDesC& aEntityId, |
|
448 const TDesC& aNamespace, |
|
449 const TDesC& aUri ); |
|
450 |
|
451 /** |
|
452 * Function to return subscriptiongroups that are received |
|
453 * from given server. |
|
454 * |
|
455 * @param aUid Uid to identify client whose subscriptions |
|
456 * are needed. |
|
457 * @param aUri Uri of the server that is used to retrieve info |
|
458 * related to searched subscription. |
|
459 * @return Array of subscription groups found. |
|
460 */ |
|
461 RPointerArray<CNcdSubscriptionGroup> ServersGroupsL( |
|
462 TUid aClientUid, |
|
463 const TDesC& aUri ) const; |
|
464 |
|
465 /** |
|
466 * This function internalizes subscriptions and marks them recently |
|
467 * updated. Also writes the altered group into database. |
|
468 * |
|
469 * @note If existing subscription is not found and it is created |
|
470 * the created subscription will have incomplete info. |
|
471 * This is because protocol element does not contain all |
|
472 * info. (name of the subscription) |
|
473 * |
|
474 * @note Arrays given as parameter are not closed or reset in |
|
475 * this function. |
|
476 * |
|
477 * |
|
478 * @param aClientUid Uid to identify client whose subscriptions |
|
479 * are given |
|
480 * @param aUri Uri of the server that is used to retrieve info |
|
481 * related to given subscription. |
|
482 * @param aSubscriptions The data is set in the protocol parser and can |
|
483 * be used to update or create subscription info. |
|
484 * |
|
485 */ |
|
486 void InternalizeAndMarkSubscriptionsL( |
|
487 TUid aClientUid, |
|
488 const TDesC& aUri, |
|
489 RPointerArray<MNcdPreminetProtocolSubscription>& |
|
490 aServersSubscriptions ); |
|
491 |
|
492 /** |
|
493 * This function internalizes subscription and marks it recently |
|
494 * updated. Also writes the altered group into database. |
|
495 * |
|
496 * @note If existing subscription is not found and it is created |
|
497 * the created subscription will have incomplete info. |
|
498 * This is because protocol element does not contain all |
|
499 * info. (name of the subscription) |
|
500 * |
|
501 * |
|
502 * @param aClientUid Uid to identify client whose subscriptions |
|
503 * are given |
|
504 * @param aUri Uri of the server that is used to retrieve info |
|
505 * related to given subscription. |
|
506 * @param aSubscription The data is set in the protocol parser and can |
|
507 * be used to update or create subscription info. |
|
508 * |
|
509 */ |
|
510 void InternalizeAndMarkSubscriptionL( |
|
511 TUid aClientUid, |
|
512 const TDesC& aUri, |
|
513 MNcdPreminetProtocolSubscription& aSubscription ); |
|
514 |
|
515 /** |
|
516 * This function is called when subscription info should be updated |
|
517 * or constructed from a protocol element. If subscription info |
|
518 * of given subscription is already found, it is updated. If not, |
|
519 * it is created. |
|
520 * |
|
521 * @note If existing subscription is not found and it is created |
|
522 * the created subscription will have incomplete info. |
|
523 * This is because protocol element does not contain all |
|
524 * info. |
|
525 * |
|
526 * |
|
527 * @param aClientUid Uid to identify client whose subscription |
|
528 * is passed in aSubscription parameter |
|
529 * @param aUri Uri of the server that is used to retrieve info |
|
530 * related to given subscription. (Same as of the node's |
|
531 * uri.) |
|
532 * @param aSubscription The data is set in the protocol parser and can |
|
533 * be used to update or create subscription info. |
|
534 */ |
|
535 void InternalizeSubscriptionL( |
|
536 TUid aClientUid, |
|
537 const TDesC& aUri, |
|
538 MNcdPreminetProtocolSubscription& aSubscription ); |
|
539 |
|
540 /** |
|
541 * Function that goes through given subscription groups (array) |
|
542 * and checks if there are subscriptions that have not been |
|
543 * marked as recently updated. If such are found they are removed. |
|
544 * They are also removed from the database. |
|
545 * |
|
546 * @param aUid Uid to identify client whose subscriptions |
|
547 * are handled. |
|
548 * @param aGroups Array of subscription groups. |
|
549 */ |
|
550 void RemoveUnmarkedSubscriptionsL( |
|
551 TUid aClientUid, |
|
552 RPointerArray<CNcdSubscriptionGroup>& aGroups ); |
|
553 |
|
554 /** |
|
555 * Function to return sources of subscriptions for indexed client. |
|
556 * Can be used for example when querying subscriptions info from |
|
557 * servers. Returns info to identify where the queries should be sent |
|
558 * etc. |
|
559 * |
|
560 * @note Given index has to be valid and contain a valid object. |
|
561 * |
|
562 * @param aClientIndex Index to identify client whose subscriptions |
|
563 * sources are needed. |
|
564 * @return Array containing objects to identify sources for |
|
565 * subscriptions. |
|
566 * @exception Leave KErrNotFound if no subscriptions found from indexed |
|
567 * client. Otherwise system wide error code. |
|
568 */ |
|
569 RPointerArray<CNcdSubscriptionsSourceIdentifier> |
|
570 SubscriptionsSourcesL( TInt aClientIndex ) const; |
|
571 |
|
572 |
|
573 /** |
|
574 * This function writes client's (identified with familyid from context) |
|
575 * subscription info to the given stream. If info is not found it is |
|
576 * loaded from database. If still not found zero is returned as the |
|
577 * amount of subscription groups. |
|
578 * |
|
579 * |
|
580 * Uses ExternalizeDataForRequestL to write the received data |
|
581 * to the given stream. |
|
582 */ |
|
583 virtual void ExternalizeClientsSubscriptionsL( |
|
584 MCatalogsSession& aSession, |
|
585 const RPointerArray<CNcdKeyValuePair>& aGroupIdentifiers, |
|
586 RWriteStream& aStream ); |
|
587 |
|
588 /** |
|
589 * This function is used to start the database action |
|
590 * that will get all data for given client. |
|
591 * |
|
592 */ |
|
593 virtual void LoadClientsInfoFromStorageL( TUid aUid ); |
|
594 |
|
595 /** |
|
596 * Writes subscription info of given client (identified with index) |
|
597 * into given stream. If index is less than 0, writes zero |
|
598 * to the stream as an indication of no subscription info. |
|
599 * |
|
600 * @param aStream The data content of this class object will be written |
|
601 * into this stream. |
|
602 */ |
|
603 virtual void ExternalizeDataForRequestL( |
|
604 TInt aIndex, |
|
605 MCatalogsSession& aSession, |
|
606 const RPointerArray<CNcdKeyValuePair>& aGroupIdentifiers, |
|
607 RWriteStream& aStream ); |
|
608 |
|
609 /** |
|
610 * This function creates data id for given subscription group |
|
611 * that can be used to identify the group in database. |
|
612 * |
|
613 */ |
|
614 HBufC* GenerateGroupDataIdL( CNcdSubscriptionGroup& aGroup ); |
|
615 |
|
616 /** |
|
617 * This function removes data of given group from database with |
|
618 * given clientuid. This function uses SaveGroupIntoDatabaseL. |
|
619 * |
|
620 */ |
|
621 void RemoveGroupFromDatabaseL( TUid aClientUid, |
|
622 CNcdSubscriptionGroup& aGroup ); |
|
623 |
|
624 /** |
|
625 * This function removes data of given dataitem from database. |
|
626 * |
|
627 */ |
|
628 void RemoveDataFromDatabaseL( |
|
629 TUid aUid, |
|
630 const TDesC& aNamespace, |
|
631 const TDesC& aDataId, |
|
632 NcdNodeClassIds::TNcdNodeClassType aClassType ); |
|
633 |
|
634 |
|
635 /** |
|
636 * This function stores (and replaces if exists) data of given |
|
637 * dataitem into database by calling externalize. |
|
638 * |
|
639 */ |
|
640 void SaveDataIntoDatabaseL( |
|
641 TUid aUid, |
|
642 const TDesC& aNamespace, |
|
643 const TDesC& aDataId, |
|
644 MNcdStorageDataItem& aDataItem, |
|
645 NcdNodeClassIds::TNcdNodeClassType aClassType ); |
|
646 |
|
647 |
|
648 // Returns a storage matching the namespace or creates a new one |
|
649 // if necessary |
|
650 MNcdStorage* StorageL( TUid aUid, const TDesC& aNamespace ) const; |
|
651 |
|
652 /** |
|
653 * Called when a listener wants to enroll. |
|
654 * @param aMessage The message from the listener. |
|
655 */ |
|
656 void ListenerEnrolledL( MCatalogsBaseMessage& aMessage ); |
|
657 |
|
658 /** |
|
659 * Notifies all the enrolled listeners by completing the pending messages |
|
660 * with the given error code. |
|
661 * |
|
662 * @param aError The error code. |
|
663 */ |
|
664 void NotifyAllListeners( TInt aError ); |
|
665 |
|
666 |
|
667 private: // data |
|
668 |
|
669 // Storage manager is used to load and to save data from |
|
670 // databases. |
|
671 CNcdStorageManager& iStorageManager; |
|
672 |
|
673 // Node manager is used to access nodes. |
|
674 CNcdNodeManager& iNodeManager; |
|
675 |
|
676 // Operation manager used in subscription completion |
|
677 CNcdOperationManager* iOperationManager; |
|
678 |
|
679 // The message is set when ReceiveMessage is called. The message |
|
680 // is used in the CounterPartLost-function that informs the message |
|
681 // if the session has been lost. |
|
682 MCatalogsBaseMessage* iMessage; |
|
683 |
|
684 // Subscription groups |
|
685 RPointerArray<CNcdClientsSubscriptions> iClientSubscriptions; |
|
686 |
|
687 // Pending messages waiting for change in subscription states. |
|
688 RPointerArray<MCatalogsBaseMessage> iPendingMessages; |
|
689 |
|
690 // Objects that handle data completion of subscriptions |
|
691 RPointerArray<CNcdSubscriptionDataCompleter> iSubscriptionDataCompleters; |
|
692 |
|
693 }; |
|
694 |
|
695 |
|
696 #endif // NCD_SUBSCRIPTION_MANAGER_IMPL_H |