|
1 /* |
|
2 * Copyright (c) 2005-2009 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: Metadata engine client session implementation* |
|
15 */ |
|
16 |
|
17 |
|
18 #ifndef __MDESESSIONIMPL_H__ |
|
19 #define __MDESESSIONIMPL_H__ |
|
20 |
|
21 #include "mdesession.h" |
|
22 #include "mdeenginesession.h" |
|
23 #include "mdscommoninternal.h" |
|
24 |
|
25 |
|
26 // forward declarations |
|
27 class CMdENotifierAO; |
|
28 class CMdEDataBuffer; |
|
29 class CMdCSerializationBuffer; |
|
30 class CMdESessionStartupAO; |
|
31 class CMdESessionAsyncHandler; |
|
32 |
|
33 class RMdESessionAsyncRequest |
|
34 { |
|
35 friend class CMdESessionAsyncHandler; |
|
36 private: |
|
37 enum TRequestType |
|
38 { |
|
39 EAddRequest, |
|
40 EUpdateRequest, |
|
41 ERemoveRequest |
|
42 }; |
|
43 |
|
44 RMdESessionAsyncRequest(TRequestType aRequestType, |
|
45 CMdCSerializationBuffer* aBuffer, |
|
46 CMdCSerializationBuffer& aResultBuffer, |
|
47 TRequestStatus& aRequestStatus); |
|
48 |
|
49 void Close(); |
|
50 |
|
51 private: |
|
52 TRequestType iRequestType; |
|
53 CMdCSerializationBuffer* iBuffer; |
|
54 CMdCSerializationBuffer* iResultBuffer; |
|
55 TRequestStatus* iRequestStatus; |
|
56 }; |
|
57 |
|
58 NONSHARABLE_CLASS(CMdESessionAsyncHandler) : public CActive |
|
59 { |
|
60 public: |
|
61 void AddRequest( CMdCSerializationBuffer* aBuffer, |
|
62 CMdCSerializationBuffer& aResultBuffer, |
|
63 TRequestStatus& aRequestStatus ); |
|
64 |
|
65 void UpdateRequest( CMdCSerializationBuffer * aBuffer, |
|
66 CMdCSerializationBuffer& aResultBuffer, |
|
67 TRequestStatus& aRequestStatus ); |
|
68 |
|
69 void RemoveRequest( CMdCSerializationBuffer* aBuffer, |
|
70 CMdCSerializationBuffer& aResultBuffer, |
|
71 TRequestStatus& aRequestStatus ); |
|
72 |
|
73 static CMdESessionAsyncHandler* NewL(CMdESessionImpl& aSession, |
|
74 RMdEEngineSession &aEngineSession); |
|
75 |
|
76 static CMdESessionAsyncHandler* NewLC( CMdESessionImpl& aSession, |
|
77 RMdEEngineSession &aEngineSession ); |
|
78 |
|
79 ~CMdESessionAsyncHandler(); |
|
80 |
|
81 |
|
82 private: |
|
83 void RunL(); |
|
84 |
|
85 TInt RunError(TInt aError); |
|
86 |
|
87 void DoCancel(); |
|
88 |
|
89 CMdESessionAsyncHandler(CMdESessionImpl& aSession, |
|
90 RMdEEngineSession &aEngineSession); |
|
91 |
|
92 void ConstructL(); |
|
93 |
|
94 private: |
|
95 RArray<RMdESessionAsyncRequest> iRequests; |
|
96 CMdESessionImpl& iSession; |
|
97 RMdEEngineSession& iEngineSession; |
|
98 }; |
|
99 |
|
100 /** |
|
101 * Metadata engine session implementation. |
|
102 */ |
|
103 NONSHARABLE_CLASS(CMdESessionImpl) : public CMdESession |
|
104 { |
|
105 friend class CMdESessionStartupAO; |
|
106 |
|
107 public: // Constructors and destructor. |
|
108 |
|
109 /** |
|
110 * Constructor. |
|
111 * |
|
112 * @param aObserver observer to notify when opening the session has |
|
113 * been completed |
|
114 */ |
|
115 CMdESessionImpl( MMdESessionObserver& aObserver ); |
|
116 |
|
117 /** |
|
118 * Second-phase constructor. |
|
119 */ |
|
120 void ConstructL(); |
|
121 |
|
122 /** |
|
123 * Destructor. |
|
124 */ |
|
125 virtual ~CMdESessionImpl(); |
|
126 |
|
127 /** From MdESession */ |
|
128 TInt NamespaceDefCount() const; |
|
129 |
|
130 /** From MdESession */ |
|
131 CMdENamespaceDef& NamespaceDefL(TInt aIndex); |
|
132 |
|
133 /** From MdESession */ |
|
134 CMdENamespaceDef& GetNamespaceDefL(const TDesC& aName); |
|
135 |
|
136 CMdENamespaceDef& GetNamespaceDefL(TDefId aId); |
|
137 |
|
138 /** From MdESession */ |
|
139 CMdENamespaceDef& GetDefaultNamespaceDefL(); |
|
140 |
|
141 /** From MdESession */ |
|
142 CMdEObject* NewObjectL( CMdEObjectDef& aDef, const TDesC& aUri, |
|
143 TUint32 aMediaId = 0 ); |
|
144 |
|
145 /** From MdESession */ |
|
146 CMdEObject* NewObjectLC( CMdEObjectDef& aDef, const TDesC& aUri, |
|
147 TUint32 aMediaId = 0 ); |
|
148 |
|
149 /** From MdESession */ |
|
150 TInt AddObjectsL(RPointerArray<CMdEObject>& aObjects); |
|
151 |
|
152 /** From MdESession */ |
|
153 void CommitObjectL(CMdEObject& aObject); |
|
154 |
|
155 /** From MdESession */ |
|
156 void CommitObjectsL(RPointerArray<CMdEObject>& aObjects); |
|
157 |
|
158 /** From MdESession */ |
|
159 TItemId CancelObjectL(CMdEObject& aObject); |
|
160 |
|
161 /** From MdESession */ |
|
162 CMdERelation* NewRelationLC(CMdERelationDef& aDef, |
|
163 TItemId aLeftObjectId, TItemId aRightObjectId, |
|
164 TInt32 aParameter); |
|
165 |
|
166 /** From MdESession */ |
|
167 CMdERelation* NewRelationL(CMdERelationDef& aDef, |
|
168 TItemId aLeftObjectId, TItemId aRightObjectId, |
|
169 TInt32 aParameter); |
|
170 |
|
171 /** From MdESession */ |
|
172 CMdEEvent* NewEventLC(CMdEEventDef& aDef, TItemId aObjectId, |
|
173 TTime aTime, const TDesC* aSource, const TDesC* aParticipant); |
|
174 |
|
175 /** From MdESession */ |
|
176 CMdEEvent* NewEventL(CMdEEventDef& aDef, TItemId aObjectId, |
|
177 TTime aTime, const TDesC* aSource, const TDesC* aParticipant); |
|
178 |
|
179 /** From MdESession */ |
|
180 void AddSchemaObserverL(MMdESchemaObserver& aObserver); |
|
181 |
|
182 /** From MdESession */ |
|
183 void RemoveSchemaObserverL(MMdESchemaObserver& aObserver); |
|
184 |
|
185 /** From MdESession */ |
|
186 void AddRelationDefL(const CMdENamespaceDef &aNamespaceDef, |
|
187 const TDesC &aName); |
|
188 |
|
189 /** From MdESession */ |
|
190 void AddEventDefL(const CMdENamespaceDef &aNamespaceDef, |
|
191 const TDesC &aName); |
|
192 |
|
193 /* From MdESession */ |
|
194 TItemId AddObjectL(CMdEObject& aObject); |
|
195 |
|
196 /* From MdESession */ |
|
197 TInt DeserializeIdsL( RMdEDataBuffer& aSerializedItemIds, |
|
198 RArray<TItemId>* aResultObjects = NULL, |
|
199 RArray<TItemId>* aResultEvents = NULL, |
|
200 RArray<TItemId>* aResultRelations = NULL ); |
|
201 |
|
202 /* From MdESession */ |
|
203 TInt DeserializeItemsL( RMdEDataBuffer& aSerializedItems, |
|
204 RPointerArray<CMdEInstanceItem>& aItems ); |
|
205 |
|
206 /* From MdESession */ |
|
207 TItemId RemoveObjectL( TItemId aId, CMdENamespaceDef* aNamespaceDef ); |
|
208 |
|
209 /* From MdESession */ |
|
210 TItemId RemoveObjectL( const TDesC& aUri, |
|
211 CMdENamespaceDef* aNamespaceDef ); |
|
212 |
|
213 /* From MdESession */ |
|
214 TInt RemoveObjectsL( const RArray<TItemId>& aId, |
|
215 RArray<TItemId>& aResult, CMdENamespaceDef* aNamespaceDef ); |
|
216 |
|
217 /* From MdESession */ |
|
218 TInt RemoveObjectsL( const RPointerArray<TDesC>& aUri, |
|
219 RArray<TItemId>& aResult, CMdENamespaceDef* aNamespaceDef ); |
|
220 |
|
221 /* From MdESession */ |
|
222 void RemoveObjectsAsyncL( |
|
223 const RArray<TItemId>& aId, TRequestStatus& aStatus, |
|
224 RMdEDataBuffer& aSerializedObjectIds, |
|
225 CMdENamespaceDef* aNamespaceDef ); |
|
226 |
|
227 /* From MdESession */ |
|
228 void RemoveObjectsAsyncL( |
|
229 const RPointerArray<TDesC>& aUri, TRequestStatus& aStatus, |
|
230 RMdEDataBuffer& aSerializedObjectIds, |
|
231 CMdENamespaceDef* aNamespaceDef ); |
|
232 |
|
233 /* From MdESession */ |
|
234 CMdEObject* GetObjectL( const TItemId aId, |
|
235 CMdEObjectDef& aObjectDef ); |
|
236 |
|
237 /* From MdESession */ |
|
238 CMdEObject* OpenObjectL( const TItemId aId, |
|
239 CMdEObjectDef& aObjectDef ); |
|
240 |
|
241 /* From MdESession */ |
|
242 CMdEObject* GetObjectL( |
|
243 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
244 CMdEObjectDef& aObjectDef ); |
|
245 |
|
246 /* From MdESession */ |
|
247 CMdEObject* OpenObjectL( |
|
248 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
249 CMdEObjectDef& aObjectDef ); |
|
250 |
|
251 /* From MdESession. */ |
|
252 CMdEObject* GetObjectL( const TDesC& aUri, |
|
253 CMdEObjectDef& aObjectDef ); |
|
254 |
|
255 /* From MdESession. */ |
|
256 CMdEObject* OpenObjectL( const TDesC& aUri, |
|
257 CMdEObjectDef& aObjectDef ); |
|
258 |
|
259 /* From MdESession */ |
|
260 CMdEObject* GetObjectL( const TItemId aId, |
|
261 CMdENamespaceDef* aNamespaceDef ); |
|
262 |
|
263 /* From MdESession */ |
|
264 CMdEObject* OpenObjectL( const TItemId aId, |
|
265 CMdENamespaceDef* aNamespaceDef ); |
|
266 |
|
267 /* From MdESession */ |
|
268 CMdEObject* GetObjectL( |
|
269 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
270 CMdENamespaceDef* aNamespaceDef ); |
|
271 |
|
272 /* From MdESession */ |
|
273 CMdEObject* OpenObjectL( |
|
274 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
275 CMdENamespaceDef* aNamespaceDef ); |
|
276 |
|
277 /* From MdESession. */ |
|
278 CMdEObject* GetObjectL( const TDesC& aUri, |
|
279 CMdENamespaceDef* aNamespaceDef ); |
|
280 |
|
281 /* From MdESession. */ |
|
282 CMdEObject* OpenObjectL( const TDesC& aUri, |
|
283 CMdENamespaceDef* aNamespaceDef ); |
|
284 |
|
285 /* From MdESession */ |
|
286 CMdEObject* GetFullObjectL( const TItemId aId, |
|
287 CMdENamespaceDef* aNamespaceDef ); |
|
288 |
|
289 /* From MdESession */ |
|
290 CMdEObject* OpenFullObjectL( const TItemId aId, |
|
291 CMdENamespaceDef* aNamespaceDef ); |
|
292 |
|
293 /* From MdESession */ |
|
294 CMdEObject* GetFullObjectL( |
|
295 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
296 CMdENamespaceDef* aNamespaceDef ); |
|
297 |
|
298 /* From MdESession */ |
|
299 CMdEObject* OpenFullObjectL( |
|
300 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
301 CMdENamespaceDef* aNamespaceDef ); |
|
302 |
|
303 /* From MdESession. */ |
|
304 CMdEObject* GetFullObjectL( const TDesC& aUri, |
|
305 CMdENamespaceDef* aNamespaceDef ); |
|
306 |
|
307 /* From MdESession. */ |
|
308 CMdEObject* OpenFullObjectL( const TDesC& aUri, |
|
309 CMdENamespaceDef* aNamespaceDef ); |
|
310 |
|
311 void CheckObjectL( TMdEObject& aObject, const TDesC& aUri, |
|
312 CMdENamespaceDef* aNamespaceDef ); |
|
313 |
|
314 void CheckObjectL( TMdEObject& aObject, TItemId aId, |
|
315 CMdENamespaceDef* aNamespaceDef ); |
|
316 |
|
317 void CheckObjectL( RArray<TMdEObject>& aObjects, |
|
318 const RArray<TItemId>& aIds, |
|
319 CMdENamespaceDef* aNamespaceDef ); |
|
320 |
|
321 /* From MdESession. */ |
|
322 TItemId AddRelationL( CMdERelation& aRelation ); |
|
323 |
|
324 /* From MdESession. */ |
|
325 TItemId UpdateRelationL( CMdERelation& aRelation ); |
|
326 |
|
327 /* From MdESession. */ |
|
328 TInt AddItemsL( RPointerArray<CMdEInstanceItem>& aItems ); |
|
329 |
|
330 /* From MdESession. */ |
|
331 TInt UpdateItemsL( RPointerArray<CMdEInstanceItem>& aItems ); |
|
332 |
|
333 /* From MdESession. */ |
|
334 void AddItemsAsyncL( |
|
335 RPointerArray<CMdEInstanceItem>& aItems, |
|
336 TRequestStatus& aStatus, |
|
337 RMdEDataBuffer& aSerializedItemIds ); |
|
338 |
|
339 /* From MdESession. */ |
|
340 void UpdateItemsAsyncL( |
|
341 RPointerArray<CMdEInstanceItem>& aItems, |
|
342 TRequestStatus& aStatus, |
|
343 RMdEDataBuffer& aSerializedItemIds ); |
|
344 |
|
345 /* From MdESession. */ |
|
346 CMdERelation* GetRelationL(TItemId aId, |
|
347 CMdENamespaceDef* aNamespaceDef); |
|
348 |
|
349 /* From MdESession. */ |
|
350 TItemId RemoveRelationL(TItemId aId, |
|
351 CMdENamespaceDef* aNamespaceDef); |
|
352 |
|
353 /* From MdESession. */ |
|
354 TInt RemoveRelationsL(const RArray<TItemId>& aId, |
|
355 RArray<TItemId>& aSuccessful, CMdENamespaceDef* aNamespaceDef); |
|
356 |
|
357 /* From MdESession. */ |
|
358 void RemoveRelationsAsyncL( |
|
359 const RArray<TItemId>& aId, TRequestStatus& aStatus, |
|
360 RMdEDataBuffer& aSerializedRelationIds, |
|
361 CMdENamespaceDef* aNamespaceDef ); |
|
362 |
|
363 /* From MdESession. */ |
|
364 CMdEObjectQuery* NewObjectQueryL(CMdENamespaceDef& aNamespaceDef, |
|
365 CMdEObjectDef& aObjectDef, MMdEQueryObserver* aObserver); |
|
366 |
|
367 /* From MdESession. */ |
|
368 CMdEObjectQuery* NewObjectQueryL(CMdEObjectDef& aObjectDef, |
|
369 RPointerArray<CMdEObjectDef>* aObjectDefs, |
|
370 MMdEQueryObserver* aObserver); |
|
371 |
|
372 /* From MdESession. */ |
|
373 CMdEEvent* GetEventL(TItemId aId, CMdENamespaceDef* aNamespaceDef); |
|
374 |
|
375 /* From MdESession. */ |
|
376 TItemId AddEventL( CMdEEvent& aEvent ); |
|
377 |
|
378 /* From MdESession. */ |
|
379 TItemId RemoveEventL( TItemId aId, CMdENamespaceDef* aNamespaceDef ); |
|
380 |
|
381 /* From MdESession. */ |
|
382 TInt RemoveEventsL( const RArray<TItemId>& aId, |
|
383 RArray<TItemId>& aSuccessful, |
|
384 CMdENamespaceDef* aNamespaceDef ); |
|
385 |
|
386 /* From MdESession. */ |
|
387 void RemoveEventsAsyncL( |
|
388 const RArray<TItemId>& aId, TRequestStatus& aStatus, |
|
389 RMdEDataBuffer& aSerializedEventIds, |
|
390 CMdENamespaceDef* aNamespaceDef ); |
|
391 |
|
392 /* From MdESession. */ |
|
393 CMdERelationQuery* NewRelationQueryL(CMdENamespaceDef& aNamespaceDef, |
|
394 MMdEQueryObserver* aObserver); |
|
395 |
|
396 /* From MdESession. */ |
|
397 CMdEEventQuery* NewEventQueryL(CMdENamespaceDef& aNamespaceDef, |
|
398 MMdEQueryObserver* aObserver); |
|
399 |
|
400 /* From MdESession. */ |
|
401 void AddObjectObserverL(MMdEObjectObserver& aObserver, |
|
402 CMdELogicCondition* aCondition, |
|
403 TUint32 aNotificationType, |
|
404 CMdENamespaceDef* aNamespaceDef); |
|
405 |
|
406 /* From MdESession. */ |
|
407 void RemoveObjectObserverL(MMdEObjectObserver& aObserver, |
|
408 CMdENamespaceDef* aNamespaceDef); |
|
409 |
|
410 /* From MdESession. */ |
|
411 void AddObjectPresentObserverL( |
|
412 MMdEObjectPresentObserver& aObserver); |
|
413 |
|
414 /* From MdESession. */ |
|
415 void RemoveObjectPresentObserverL( |
|
416 MMdEObjectPresentObserver& aObserver); |
|
417 |
|
418 /* From MdESession. */ |
|
419 void AddRelationObserverL(MMdERelationObserver& aObserver, |
|
420 CMdECondition* aCondition, |
|
421 TUint32 aNotificationType, |
|
422 CMdENamespaceDef* aNamespaceDef); |
|
423 |
|
424 /* From MdESession. */ |
|
425 void RemoveRelationObserverL(MMdERelationObserver& aObserver, |
|
426 CMdENamespaceDef* aNamespaceDef); |
|
427 |
|
428 /* From MdESession. */ |
|
429 void AddRelationItemObserverL(MMdERelationItemObserver& aObserver, |
|
430 CMdECondition* aCondition, |
|
431 TUint32 aNotificationType, |
|
432 CMdENamespaceDef* aNamespaceDef); |
|
433 |
|
434 /* From MdESession. */ |
|
435 void RemoveRelationItemObserverL(MMdERelationItemObserver& aObserver, |
|
436 CMdENamespaceDef* aNamespaceDef); |
|
437 |
|
438 /* From MdESession. */ |
|
439 void AddRelationPresentObserverL( |
|
440 MMdERelationPresentObserver& aObserver); |
|
441 |
|
442 /* From MdESession. */ |
|
443 void RemoveRelationPresentObserverL( |
|
444 MMdERelationPresentObserver& aObserver); |
|
445 |
|
446 /* From MdESession. */ |
|
447 void AddEventObserverL(MMdEEventObserver& aObserver, |
|
448 CMdECondition* aCondition, |
|
449 TUint32 aNotificationType, |
|
450 CMdENamespaceDef* aNamespaceDef); |
|
451 |
|
452 /* From MdESession. */ |
|
453 void RemoveEventObserverL(MMdEEventObserver& aObserver, |
|
454 CMdENamespaceDef* aNamespaceDef); |
|
455 |
|
456 /** Finds an existing observer notifier */ |
|
457 TInt FindNotifier( TUint32 aNotifyType, TAny* aObserver, |
|
458 CMdENamespaceDef& aNamespaceDef ); |
|
459 |
|
460 /** With this call Notifier announces it is in error state */ |
|
461 void NotifierInError( CMdENotifierAO* aNotifier ); |
|
462 |
|
463 /* From MdESession. */ |
|
464 void ImportSchemaL( const TDesC& aFileName ); |
|
465 |
|
466 /* From MdESession. */ |
|
467 TInt ImportMetadataL(const TDesC& aFileName ); |
|
468 |
|
469 /* From MdESession. */ |
|
470 void ImportMetadata( const TDesC& aFileName, TPckgBuf<TInt>& aResult, |
|
471 TRequestStatus& aStatus ); |
|
472 |
|
473 /* From MdESession. */ |
|
474 void ExportMetadataL( const TDesC& aFileName, |
|
475 const CMdENamespaceDef* aNamespaceDef = NULL, |
|
476 const RPointerArray<CMdEObjectDef>* aObjectDefs = NULL, |
|
477 const RPointerArray<CMdERelationDef>* aRelationDefs = NULL, |
|
478 const RPointerArray<CMdEEventDef>* aEventDefs = NULL ); |
|
479 |
|
480 /* From MdESession. */ |
|
481 void ExportMetadataL( const TDesC& aFileName, TRequestStatus& aStatus, |
|
482 RMdEDataBuffer& aBuffer, |
|
483 const CMdENamespaceDef* aNamespaceDef = NULL, |
|
484 const RPointerArray<CMdEObjectDef>* aObjectDefs = NULL, |
|
485 const RPointerArray<CMdERelationDef>* aRelationDefs = NULL, |
|
486 const RPointerArray<CMdEEventDef>* aEventDefs = NULL ); |
|
487 |
|
488 void LoadSchemaL(); |
|
489 |
|
490 RMdEEngineSession& EngineSession(); |
|
491 |
|
492 /* From MdESession. */ |
|
493 void GetSchemaVersionL(TInt& aMajorVersion, TInt& aMinorVersion); |
|
494 |
|
495 /* From MdESession. */ |
|
496 void SetObjectToPresentByGuidL( |
|
497 const TInt64& aGuidHigh, const TInt64& aGuidLow ); |
|
498 |
|
499 void GetCountL( CMdCSerializationBuffer* aBuffer, TUint32& aResult ); |
|
500 |
|
501 void GetItemIdL( CMdCSerializationBuffer* aBuffer, |
|
502 RArray<TItemId>& aIdArray ); |
|
503 |
|
504 void GetDistinctValuesL( CMdCSerializationBuffer& aBuffer, |
|
505 CDesCArray& aResults ); |
|
506 |
|
507 /** |
|
508 * Should be called to notify the base class about errors, which are |
|
509 * not a direct consequence of the operations initiated by the client |
|
510 * but caused by some external source (e.g., other clients). Attempts |
|
511 * to recover from the error have failed. All on-going operations |
|
512 * initiated by the client should be aborted before calling this |
|
513 * method. After calling this method any attempts to use the session |
|
514 * will cause a panic. |
|
515 * |
|
516 * @param aError one of the system-wide error codes |
|
517 */ |
|
518 void NotifyError(TInt aError); |
|
519 |
|
520 protected: |
|
521 |
|
522 /* |
|
523 * Loads the schema |
|
524 */ |
|
525 void DoLoadSchemaL(); |
|
526 |
|
527 void Close(); |
|
528 |
|
529 /* Methods to notify the base class about different events. */ |
|
530 |
|
531 /** |
|
532 * Should be called to notify the base class that opening the session |
|
533 * has been completed and, if the opening succeeded, the session is |
|
534 * ready for use. |
|
535 * |
|
536 * @param aError <code>KErrNone</code>, if opening the session |
|
537 * succeeded; or one of the system-wide error codes, |
|
538 * if opening the session failed |
|
539 */ |
|
540 void NotifySessionOpened(TInt aError); |
|
541 |
|
542 /* Utility methods for concrete session implementations. */ |
|
543 |
|
544 /** |
|
545 * Panics if the session has not been succesfully opened. |
|
546 */ |
|
547 void CheckOpened() const; |
|
548 |
|
549 public: |
|
550 |
|
551 void DeserializeQueryResultL( CMdCSerializationBuffer& aBuffer, |
|
552 RPointerArray<CMdEInstanceItem>& aItems ); |
|
553 |
|
554 protected: |
|
555 CMdCSerializationBuffer* SerializeItemsL( |
|
556 RPointerArray<CMdEInstanceItem>& aItems ); |
|
557 |
|
558 TItemId AddItemL( CMdEInstanceItem& aItem ); |
|
559 |
|
560 void DeserializeAddingResultsL( |
|
561 RPointerArray<CMdEInstanceItem>& aItems, |
|
562 CMdCSerializationBuffer& aResultBuffer ); |
|
563 |
|
564 /** |
|
565 * Creates a serialized buffer with id marked to be removed |
|
566 * |
|
567 * @param aNamespaceDef namespace where items should be removed |
|
568 * @param aObjects objects id to remove (could be NULL) |
|
569 * @param aEvents events id to remove (could be NULL) |
|
570 * @param aRelations relation id to remove (could be NULL) |
|
571 * @return serialized buffer |
|
572 */ |
|
573 CMdCSerializationBuffer* RemoveCommonL( |
|
574 CMdENamespaceDef& aNamespaceDef, |
|
575 const RPointerArray<TDesC16>* aObjects, |
|
576 const RArray<TItemId>* aEvents, |
|
577 const RArray<TItemId>* aRelations ); |
|
578 |
|
579 /** |
|
580 * Creates a serialized buffer with id marked to be removed |
|
581 * |
|
582 * @param aNamespaceDef namespace where items should be removed |
|
583 * @param aObjects objects uri to remove (could be NULL) |
|
584 * @param aEvents events id to remove (could be NULL) |
|
585 * @param aRelations relation id to remove (could be NULL) |
|
586 * @return serialized buffer |
|
587 */ |
|
588 CMdCSerializationBuffer* RemoveCommonL( |
|
589 CMdENamespaceDef& aNamespaceDef, |
|
590 const RArray<TItemId>* aObjects, |
|
591 const RArray<TItemId>* aEvents, |
|
592 const RArray<TItemId>* aRelations ); |
|
593 |
|
594 /** |
|
595 * Creates a serialized buffer with defs id items to be exported |
|
596 * |
|
597 * @param aNamespaceDef namespace from where items should be removed |
|
598 * (NULL means from every) |
|
599 * @param aObjectDefs objectDefs to export |
|
600 * @param aRelationDefs |
|
601 * @param aEventDefs |
|
602 * @return serialized items ids |
|
603 */ |
|
604 CMdCSerializationBuffer* ExportCommonL( |
|
605 const CMdENamespaceDef* aNamespaceDef, |
|
606 const RPointerArray<CMdEObjectDef>* aObjectDefs, |
|
607 const RPointerArray<CMdERelationDef>* aRelationDefs, |
|
608 const RPointerArray<CMdEEventDef>* aEventDefs ); |
|
609 |
|
610 private: |
|
611 /** |
|
612 * If aId is KNoId it isn't used. If aUri is KNullDesC, it isn't used. |
|
613 */ |
|
614 CMdEObject* GetObjectL( CMdEObjectDef& aObjectDef, const TItemId aId, |
|
615 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
616 const TDesC& aUri, TMdCQueryLockType aLocktype, |
|
617 TBool aIncludeFreetexts ); |
|
618 |
|
619 /** |
|
620 * Return namespace definition or default namespace definition |
|
621 * |
|
622 * @param aNamespaceDef namespace definition or NULL |
|
623 * @return default namespace definition if parameter was NULL, |
|
624 * othrewise namespace definition which was given as parameter |
|
625 */ |
|
626 CMdENamespaceDef* GetNamespaceDefL( CMdENamespaceDef* aNamespaceDef ); |
|
627 |
|
628 private: // data members |
|
629 |
|
630 /** |
|
631 * |
|
632 */ |
|
633 CMdESessionStartupAO* iSessionStartupAO; |
|
634 |
|
635 /** |
|
636 * array of observer notifier active objects |
|
637 */ |
|
638 RPointerArray<CMdENotifierAO> iNotifiers; |
|
639 |
|
640 /** Open observer. */ |
|
641 MMdESessionObserver* iSessionObserver; |
|
642 |
|
643 /** Schema observers. */ |
|
644 RPointerArray<MMdESchemaObserver> iSchemaObserverArray; |
|
645 |
|
646 RChunk iSchemaChunk; |
|
647 |
|
648 CMdCSerializationBuffer* iSchemaBuffer; |
|
649 |
|
650 RPointerArray<CMdENamespaceDef> iNamespaceDefs; |
|
651 |
|
652 CMdESessionAsyncHandler* iAsyncHandler; |
|
653 |
|
654 TUint32 iNextQueryId; |
|
655 |
|
656 protected: |
|
657 |
|
658 /** |
|
659 * iSession, client server session |
|
660 */ |
|
661 RMdEEngineSession iSession; |
|
662 |
|
663 enum TSessionState |
|
664 { |
|
665 EMdESessionClosed = 0, |
|
666 EMdESessionOpen, |
|
667 EMdESessionError, |
|
668 }; |
|
669 TSessionState iSessionState; |
|
670 }; |
|
671 |
|
672 #endif // __MDESESSIONIMPL_H__ |