mds_plat/metadata_engine_api/inc/mdesession.h
changeset 0 c53acadfccc6
child 7 3cebc1a84278
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     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
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __MDESESSION_H__
       
    20 #define __MDESESSION_H__
       
    21 
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <badesca.h>
       
    25 
       
    26 #include <mdccommon.h>
       
    27 
       
    28 
       
    29 /* Forward declarations. */
       
    30 class CMdESession;
       
    31 class CMdEObjectDef;
       
    32 class CMdERelationDef;
       
    33 class CMdEEventDef;
       
    34 class CMdEObject;
       
    35 class TMdEObject;
       
    36 class CMdERelation;
       
    37 class TMdERelation;
       
    38 class CMdEEvent;
       
    39 class CMdEObjectQuery;
       
    40 class CMdERelationQuery;
       
    41 class CMdEEventQuery;
       
    42 class CMdELogicCondition;
       
    43 class CMdEInstanceItem;
       
    44 class RMdEEngineSession;
       
    45 class MMdEQueryObserver;
       
    46 class CMdENamespaceDef;
       
    47 class RMdEDataBuffer;
       
    48 class CMdECondition;
       
    49 
       
    50 
       
    51 
       
    52 /**
       
    53  * Observer interface for a metadata engine session.
       
    54  * 
       
    55  * 
       
    56  * 
       
    57  * Examples of MdE session usage:
       
    58  * 
       
    59  * The class that needs a MdE session needs to implement MMdESessionObserver interface to get
       
    60  * a notification of completed session opening or an error that has occurred.
       
    61  * 
       
    62  * class CMdESessionExample : public MMdESessionObserver
       
    63  * {
       
    64  * 		void HandleSessionOpened(CMdESession& aSession, TInt aError);
       
    65  *   	void HandleSessionError(CMdESession& aSession, TInt aError);
       
    66  * 		...
       
    67  * 
       
    68  * 		CMdESession* iMdeSession;
       
    69  * };
       
    70  * 
       
    71  * The session is opened simply by creating an instance of CMdESession.
       
    72  * 
       
    73  * void CMdESessionExample::OpenSession()
       
    74  * {
       
    75  * 		iMdeSession = CMdESession::NewL( *this );
       
    76  * }
       
    77  * 
       
    78  * void CMdESessionExample::HandleSessionOpened(CMdESession& aSession, TInt aError)
       
    79  *	{
       
    80  *		if ( KErrNone != aError ) {
       
    81  * 			// Error occurred when opening session. iMdeSession must be deleted and new
       
    82  * 			// session opened if we wish to use MdE.
       
    83  * 
       
    84  * 			delete iMdeSession; iMdeSession = NULL;
       
    85  * 			return;
       
    86  * 		}
       
    87  * 		
       
    88  * 		// The session was opened successfully.
       
    89  * 		...
       
    90  *	}
       
    91  * 
       
    92  * void CMdESessionError::HandleSessionError(CMdESession& aSession, TInt aError)
       
    93  * {
       
    94  * 		// This function is called when an error has occurred in the session by some
       
    95  * 		// external source (e.g. other clients). It’s important to notice, that 
       
    96  * 		// this method is called when the session has already been opened, not when 
       
    97  * 		// error happens during opening. Session can't be used anymore and it must be deleted.
       
    98  * 
       
    99  * 		delete iMdeSession; iMdeSession = NULL;
       
   100  * }
       
   101  */
       
   102 class MMdESessionObserver
       
   103 	{
       
   104 public:
       
   105 
       
   106 	/**
       
   107 	 * Called to notify the observer that opening the session has been 
       
   108 	 * completed and, if the opening succeeded, the session is ready for use.
       
   109 	 *
       
   110 	 * @param aSession session
       
   111 	 * @param aError   <code>KErrNone</code>, if opening the session succeeded;
       
   112 	 *                 or one of the system-wide error codes, if opening the 
       
   113 	 *                 session failed
       
   114 	 */
       
   115 	virtual void HandleSessionOpened(CMdESession& aSession, TInt aError) = 0;
       
   116 
       
   117 	/**
       
   118 	 * Called to notify the observer about errors, which are not a direct 
       
   119 	 * consequence of the operations initiated by the client but caused by 
       
   120 	 * some external source (e.g., other clients). The error cannot be 
       
   121 	 * recovered and all on-going operations initiated by the client have been 
       
   122 	 * aborted. Any attempts to continue using the session will cause a panic. 
       
   123 	 * The client should close the session immediately and try to open a new 
       
   124 	 * session, if it needs to continue using the metadata engine.
       
   125 	 *
       
   126 	 * @param aSession session
       
   127 	 * @param aError one of the system-wide error codes
       
   128 	 */
       
   129 	virtual void HandleSessionError(CMdESession& aSession, TInt aError) = 0;
       
   130     };
       
   131 
       
   132 
       
   133 /**
       
   134  * Observer interface for modifications of the metadata engine schema.
       
   135  */
       
   136 class MMdESchemaObserver
       
   137 	{
       
   138 public:
       
   139 
       
   140 	/**
       
   141 	 * Called to notify the observer that the schema has been modified.
       
   142 	 *
       
   143 	 * @param none
       
   144 	 */
       
   145 	virtual void HandleSchemaModified() = 0;
       
   146     };
       
   147     
       
   148 /**
       
   149  * Observer interface for modifications of the objects in the metadata engine 
       
   150  * database.
       
   151  * 
       
   152  * Examples of observers.
       
   153  * A class that is interested in observing events in the DB must implement observer interfaces
       
   154  * and register as observer. Following examples show how this is done for objects but observing
       
   155  * relations and events works the same way.
       
   156  * 
       
   157  * class CMdeObserverExample : public MMdEObjectObserver, public MMdEObjectPresentObserver
       
   158  * {
       
   159  *		void HandleObjectNotification(CMdESession& aSession, TObserverNotificationType aType,
       
   160  *						const RArray<TItemId>& aObjectIdArray);
       
   161  *		void HandleObjectPresentNotification(CMdESession& aSession, TBool aPresent,
       
   162  *		 				const RArray<TItemId>& aObjectIdArray);
       
   163  * 		...
       
   164  * 		CMdESession* iMdeSession;
       
   165  * };
       
   166  * 
       
   167  * void CMdeObserverExample::ConstructL()
       
   168  * {
       
   169  * 		// Register this class as observer and start listening to object remove events.
       
   170  * 		// The logic condition can be as complicated as is necessary. In this example
       
   171  * 		// the condition as simple as possible.
       
   172  *		CMdELogicCondition* condition = CMdELogicCondition::NewL( ELogicConditionOperatorAnd );
       
   173  *		iMdeSession->AddObjectObserverL( *this, condition, ENotifyRemove, 
       
   174  *   		&iMdeSession->GetDefaultNamespaceDefL() );
       
   175  * 
       
   176  * 		// Start listening to changes in object present status.
       
   177  * 		iMdeSession->AddObjectPresentObserverL( *this );
       
   178  * }
       
   179  * 
       
   180  * @see MMdEObjectObserver::HandleObjectNotification
       
   181  * void CMdeObserverExample::HandleObjectNotification(CMdESession& aSession, TObserverNotificationType aType,
       
   182  *						const RArray<TItemId>& aObjectIdArray)
       
   183  * {
       
   184  *	 	if ( aType == ENotifyAdd )
       
   185  * 		{	
       
   186  * 		// object was added to DB
       
   187  * 		} else if ( aType == ENotifyModify )
       
   188  * 		{
       
   189  * 		// object was modified
       
   190  * 		} else if ( aType == ENotifyRemove )
       
   191  * 		{
       
   192  * 		// object was removed from DB
       
   193  * 		}
       
   194  * 
       
   195  * 		// aObjectIdArray contains ids for all objects that were added/modified/removed
       
   196  * }
       
   197  * 
       
   198  * void CMdeObserverExample::HandleObjectPresentNotification(CMdESession& aSession, 
       
   199  *			TBool aPresent, const RArray<TItemId>& aObjectIdArray)
       
   200  *	{
       
   201  * 		if ( aPresent )
       
   202  * 		{
       
   203  * 			// objects in aObjectIdArray were set as present
       
   204  * 		}
       
   205  *  }
       
   206  */
       
   207 class MMdEObjectObserver
       
   208 	{
       
   209 public:
       
   210 
       
   211 	/**
       
   212 	 * Called to notify the observer that new objects has been
       
   213 	 * added/modified/removed in the metadata engine database.
       
   214 	 * 
       
   215 	 * @param aSession session
       
   216 	 * @param aType defines if object was added/modified/remove
       
   217 	 * @param aObjectIdArray IDs of added object
       
   218 	 * @see CMdESession::AddObjectObserverL
       
   219 	 * @see CMdELogicCondition
       
   220 	 */
       
   221 	virtual void HandleObjectNotification(CMdESession& aSession, 
       
   222 						TObserverNotificationType aType,
       
   223 						const RArray<TItemId>& aObjectIdArray) = 0;
       
   224     };
       
   225     
       
   226 /**
       
   227  * Observer interface for modifications of the objects in the metadata engine 
       
   228  * database.
       
   229  */
       
   230 class MMdEObjectPresentObserver
       
   231 	{
       
   232 public:
       
   233 
       
   234 	/**
       
   235 	 * Called to notify the observer that objects has been set
       
   236 	 * to present or not present state in the metadata engine database.
       
   237 	 *
       
   238 	 * @param aSession session
       
   239 	 * @param aPresent state: ETrue - present or  EFales - not present
       
   240 	 * @param aObjectIdArray object IDs which are set to present state
       
   241 	 */
       
   242 	virtual void HandleObjectPresentNotification(CMdESession& aSession, 
       
   243 			TBool aPresent, const RArray<TItemId>& aObjectIdArray) = 0;
       
   244     };
       
   245 
       
   246 /**
       
   247  * Observer interface for modifications of the relations in the metadata 
       
   248  * engine database.
       
   249  */
       
   250 class MMdERelationPresentObserver
       
   251 	{
       
   252 public:
       
   253 
       
   254 	/**
       
   255 	 * Called to notify the observer that objects has been set
       
   256 	 * to present or not present state in the metadata engine database.
       
   257 	 *
       
   258 	 * @param aSession session
       
   259 	 * @param aPresent state: ETrue - present or  EFales - not present
       
   260 	 * @param aObjectIdArray object IDs which are set to present state
       
   261 	 */
       
   262 	virtual void HandleRelationPresentNotification(CMdESession& aSession,
       
   263 			TBool aPresent, const RArray<TItemId>& aRelationIdArray) = 0;
       
   264     };
       
   265 
       
   266 
       
   267 /**
       
   268  * Observer interface for modifications of relations in the metadata engine 
       
   269  * database. This observer returns only relations IDs.
       
   270  */
       
   271 class MMdERelationObserver
       
   272 	{
       
   273 public:
       
   274 
       
   275 	/**
       
   276 	 * Called to notify the observer that new relations has been
       
   277 	 * added/modified/removed in the metadata engine database.
       
   278 	 *
       
   279 	 * @param aSession session
       
   280 	 * @param aType defines if relation was added/modified/remove
       
   281 	 * @param aRelationIdArray IDs of relations
       
   282 	 */
       
   283 	virtual void HandleRelationNotification(CMdESession& aSession, 
       
   284 			TObserverNotificationType aType,
       
   285 			const RArray<TItemId>& aRelationIdArray) = 0;
       
   286     };
       
   287 
       
   288 /**
       
   289  * Observer interface for modifications of relations in the metadata engine 
       
   290  * database. This observer returns relations (not only IDs).
       
   291  */
       
   292 class MMdERelationItemObserver
       
   293 	{
       
   294 public:
       
   295 
       
   296 	/**
       
   297 	 * Called to notify the observer that new relations has been
       
   298 	 * added/modified/removed in the metadata engine database.
       
   299 	 *
       
   300 	 * @param aSession session
       
   301 	 * @param aType if relation was added/modified/remove
       
   302 	 * @param aRelationArray relations
       
   303 	 */
       
   304 	virtual void HandleRelationItemNotification(CMdESession& aSession, 
       
   305 			TObserverNotificationType aType,
       
   306 			const RArray<TMdERelation>& aRelationArray) = 0;
       
   307     };
       
   308 
       
   309 /**
       
   310  * Observer interface for additions or removes of new events to the metadata 
       
   311  * engine database.
       
   312  */
       
   313 class MMdEEventObserver
       
   314 	{
       
   315 public:
       
   316 
       
   317 	/**
       
   318 	 * Called to notify the observer that new events has been
       
   319 	 * added or removed in the metadata engine database.
       
   320 	 *
       
   321 	 * @param aSession session
       
   322 	 * @param aType if event was added or removed
       
   323 	 * @param aEventIdArray IDs of added events
       
   324 	 */
       
   325 	virtual void HandleEventNotification(CMdESession& aSession, 
       
   326 			TObserverNotificationType aType,
       
   327 			const RArray<TItemId>& aEventIdArray) = 0;
       
   328 
       
   329     };
       
   330 
       
   331 /**
       
   332  * Metadata engine session.
       
   333  */
       
   334 NONSHARABLE_CLASS(CMdESession) : public CBase
       
   335 	{
       
   336 public:
       
   337 
       
   338 	/* Constructors and destructor. */
       
   339 
       
   340 	/**
       
   341 	 * Opens a new metadata engine session.
       
   342 	 *
       
   343 	 * @param aObserver observer to notify when opening the session has been 
       
   344 	 *                  completed
       
   345 	 *
       
   346 	 * @return metadata engine session
       
   347 	 */
       
   348 	IMPORT_C static CMdESession* NewL(MMdESessionObserver& aObserver);
       
   349 
       
   350 	/**
       
   351 	 * Opens a new metadata engine session and leaves the session in the 
       
   352 	 * cleanup stack.
       
   353 	 *
       
   354 	 * @param aObserver observer to notify when opening the session has been 
       
   355 	 *                  completed
       
   356      *
       
   357 	 * @return  metadata engine session
       
   358 	 */
       
   359 	IMPORT_C static CMdESession* NewLC(MMdESessionObserver& aObserver);
       
   360 
       
   361 	/**
       
   362 	 * Destructor.
       
   363 	 */
       
   364 	virtual ~CMdESession();
       
   365 
       
   366 	/* Methods for managing namespace definitions. */
       
   367 
       
   368 	/**
       
   369 	 * Returns the number of namespace definitions.
       
   370 	 *
       
   371 	 * @return number of namespace definitions
       
   372 	 */
       
   373 	virtual TInt NamespaceDefCount() const = 0;
       
   374 
       
   375 	/**
       
   376 	 * Returns the namespace definition at the specified index.
       
   377 	 *
       
   378 	 * @param aIndex index
       
   379 	 *
       
   380 	 * @return namespace definition
       
   381 	 */
       
   382 	virtual CMdENamespaceDef& NamespaceDefL(TInt aIndex) = 0;
       
   383 
       
   384 	/**
       
   385 	 * Returns the namespace definition with the specified name.
       
   386 	 *
       
   387 	 * @param aName name
       
   388 	 *
       
   389 	 * @return namespace definition; or 0, if there is no object definition
       
   390 	 *         with the specified name
       
   391 	 */
       
   392 	virtual CMdENamespaceDef& GetNamespaceDefL(const TDesC& aName) = 0;
       
   393 
       
   394 	 /* Returns the default namespace definition.
       
   395 	 *
       
   396 	 * @return  the default namespace definition.
       
   397 	 */
       
   398 	virtual CMdENamespaceDef& GetDefaultNamespaceDefL() = 0;
       
   399 
       
   400 	/**
       
   401 	 * Adds a new relation definition to namespace,
       
   402 	 *
       
   403 	 * Example:
       
   404 	 *  void AddRelationL()
       
   405 	 *  {
       
   406 	 *    _LIT( TestRelation, "TestRelation" );
       
   407 	 *    TBuf <15> relname( TestRelation );
       
   408 	 * 	  iMdeSession->AddRelationDefL( *iDefaultNamespaceDef, relname );
       
   409 	 *  }
       
   410 	 * 
       
   411 	 * @param aNamespaceDef namespace definition to which relation belongs
       
   412 	 * @param aName         relation definitions name
       
   413 	 */
       
   414 	virtual void AddRelationDefL(const CMdENamespaceDef &aNamespaceDef, 
       
   415 			const TDesC &aName) = 0;
       
   416 
       
   417 	/**
       
   418 	 * Adds a new event definition to namespace.
       
   419 	 * 
       
   420 	 * Example:
       
   421 	 *  void AddEventDefL()
       
   422 	 *  {
       
   423 	 *    _LIT( TestEvent, "TestEvent" );
       
   424 	 *    TBuf <10> eventName( TestEvent );
       
   425 	 * 	  iMdeSession->AddRelationDefL( *iDefaultNamespaceDef, eventName );
       
   426 	 *  }
       
   427 	 *
       
   428 	 * @param aNamespaceDef namespace definition to which event belongs
       
   429 	 * @param aName         event definitions name
       
   430 	 */
       
   431 	virtual void AddEventDefL(const CMdENamespaceDef &aNamespaceDef, 
       
   432 			const TDesC &aName) = 0;
       
   433 
       
   434 	/* Methods for managing objects. */
       
   435 
       
   436     /**
       
   437      * Adds multiple instance items to metadata database.
       
   438      * The array contains the items, any other type than object, relation or 
       
   439      * event causes a leave.
       
   440 	 *
       
   441      * @param aItems list of items to add
       
   442      * @return first item error
       
   443      */
       
   444 	virtual TInt AddItemsL( RPointerArray<CMdEInstanceItem>& aItems ) = 0;
       
   445 
       
   446     /**
       
   447      * Commits multiple instance items to metadata database.
       
   448      * The array contains the items, any other type than object, relation or 
       
   449      * event causes a leave.
       
   450      * 
       
   451      * @param aItems list of items to add
       
   452      * @return first item error
       
   453      */
       
   454 	virtual TInt UpdateItemsL( RPointerArray<CMdEInstanceItem>& aItems ) = 0;
       
   455 
       
   456    /**
       
   457      * Adds multiple instance items asynchronously to metadata database.
       
   458      * The array contains the items, any other type than object, relation or 
       
   459      * event causes a leave. Returned serialized list of item IDs must be 
       
   460      * deserialized with DeserializeItemsL method.
       
   461      * 
       
   462      * Example:
       
   463      *  class CExampleActiveObject : public CActive
       
   464      *  {
       
   465      *    void CActiveObject::AddItemsL();
       
   466      *    ...
       
   467      *    RPointerArray<CMdEInstanceItem> iItems;
       
   468      *    RMdEDataBuffer iResultBuffer;
       
   469      *  };
       
   470      * 
       
   471      *  void CExampleActiveObject::AddItemsL()
       
   472      *  {
       
   473      *    iMdeSession->AddItemsAsyncL( iItems, iStatus, iResultBuffer );
       
   474      *    SetActive();
       
   475      *  }
       
   476      * 
       
   477      * When adding items is finished, RunL() will be called.
       
   478      * 
       
   479      * @param aItems List of item to add.
       
   480      * @param aStatus Returns the result code after the asynchronous call 
       
   481      *                completes.
       
   482      * @param aSerializedItemIds Returned serialized list of item IDs.
       
   483      */
       
   484 	virtual void AddItemsAsyncL( 
       
   485 			RPointerArray<CMdEInstanceItem>& aItems, 
       
   486 			TRequestStatus& aStatus,
       
   487 			RMdEDataBuffer& aSerializedItemIds) = 0;
       
   488 
       
   489    /**
       
   490      * Commits multiple instance items asynchronously to metadata database.
       
   491      * The array contains the items, any other type than object, relation or 
       
   492      * event causes a leave. Returned serialized list of item IDs must be 
       
   493      * deserialized with DeserializeItemsL method.
       
   494      * 
       
   495      * Example:
       
   496      *  class CExampleActiveObject : public CActive
       
   497      *   {
       
   498      *     void CActiveObject::UpdateItemsL();
       
   499      *     ...
       
   500      *     RPointerArray<CMdEInstanceItem> iItems;
       
   501      *     RMdEDataBuffer iResultBuffer;
       
   502      *   };
       
   503      * 
       
   504      *   void CExampleActiveObject::UpdateItemsL()
       
   505      *   {
       
   506      *     iMdeSession->UpdateItemsAsyncL( iItems, iStatus, iResultBuffer );
       
   507      *     SetActive();
       
   508      *   }
       
   509      * 
       
   510      * @param aItems List of item to add.
       
   511      * @param aStatus Returns the result code after the asynchronous call 
       
   512      *                completes.
       
   513      * @param aSerializedItemIds Returned serialized list of item IDs.
       
   514      */
       
   515 	virtual void UpdateItemsAsyncL( 
       
   516 			RPointerArray<CMdEInstanceItem>& aItems, 
       
   517 			TRequestStatus& aStatus,
       
   518 			RMdEDataBuffer& aSerializedItemIds ) = 0;
       
   519 
       
   520 	/**
       
   521 	 * Constructs a new empty object. Note that the object is not inserted in 
       
   522 	 * the database. The ownership of the new object is passed to the caller 
       
   523 	 * (that is, the caller is responsible for deleting the object).
       
   524 	 *
       
   525 	 * Example:
       
   526 	 *  _LIT( KObjectDef, "ObjectDefName" );
       
   527 	 *  TBuf<13> objDefStr( KObjectDef );
       
   528 	 *  CMdENamespaceDef& defNS = iMdESession->GetDefaultNamespaceDefL();
       
   529 	 *	CMdEObjectDef& mdeObjectDef = defNS.GetObjectDefL( objDefStr );
       
   530 	 *  CMdEObject* mdeObject = iMdESession->NewObjectL( mdeObjectDef, aUri );
       
   531 	 * 
       
   532 	 * @param aDef definition of the new object
       
   533 	 * @param aUri URI of the new object
       
   534 	 * @param aMediaId media ID of the new object (default 0)
       
   535 	 *
       
   536 	 * @return new object
       
   537 	 */
       
   538 	virtual CMdEObject* NewObjectL( CMdEObjectDef& aDef, const TDesC& aUri, 
       
   539                                     TUint32 aMediaId = 0 ) = 0;
       
   540 
       
   541 	/**
       
   542 	 * Constructs a new empty object and leaves it in the cleanup stack. 
       
   543 	 * Note that the object is not inserted in the database. The ownership of 
       
   544 	 * the new object is passed to the caller (that is, the caller is 
       
   545 	 * responsible for deleting the object).
       
   546 	 * 
       
   547  	 * Example:
       
   548 	 *  _LIT( KObjectDef, "ObjectDefName" );
       
   549 	 *  TBuf<13> objDefStr( KObjectDef );
       
   550 	 *  CMdENamespaceDef& defNS = iMdESession->GetDefaultNamespaceDefL();
       
   551 	 *	CMdEObjectDef& mdeObjectDef = defNS.GetObjectDefL( objDefStr );
       
   552 	 *  CMdEObject* mdeObject = iMdESession->NewObjectLC( mdeObjectDef, aUri );
       
   553 	 *
       
   554 	 * @param aDef definition of the new object
       
   555 	 * @param aUri URI of the new object
       
   556 	 * @param aMediaId media ID of the new object (default 0)
       
   557 	 *
       
   558 	 * @return new object
       
   559 	 */
       
   560 	virtual CMdEObject* NewObjectLC( CMdEObjectDef& aDef, const TDesC& aUri, 
       
   561                                      TUint32 aMediaId = 0 ) = 0;
       
   562 
       
   563     /**
       
   564      * Adds the specified new object to metadata database.
       
   565      * aObject is modified so that it has the new item ID.
       
   566      * If object adding fails object's ID is KNoId, 
       
   567      * otherwise object adding is successful.
       
   568      *
       
   569      * @param aObject object to be added
       
   570      *
       
   571      * @return item ID of the added object
       
   572      */
       
   573     virtual TItemId AddObjectL(CMdEObject& aObject) = 0;
       
   574 
       
   575     /**
       
   576      * Adds multiple object items to the metadata engine database.
       
   577      * The array contains the object items. aObjects are modified 
       
   578      * so that those has the new item IDs. If object adding fails
       
   579      * object's ID is KNoId, otherwise object adding is successful.
       
   580      *
       
   581      * @param aObjects  list of objects to be added
       
   582      * @return first object error
       
   583      */
       
   584     virtual TInt AddObjectsL(RPointerArray<CMdEObject>& aObjects) = 0;
       
   585 
       
   586 	/**
       
   587 	 * Deserialize serialized list of item IDs
       
   588 	 *
       
   589 	 * @param aSerializedItemIds serialized list of item IDs
       
   590 	 * @param aResultObjects     if not NULL object IDs are deserialized from 
       
   591 	 *                           buffer to this ID array
       
   592 	 * @param aResultEvents      if not NULL event IDs are deserialized from 
       
   593 	 *                           buffer to this ID array
       
   594 	 * @param aResultRelations   if not NULL relation IDs are deserialized 
       
   595 	 *                           from buffer to this ID array
       
   596 	 *
       
   597 	 * @return error code of first failed item, if no errors KErrNone
       
   598 	 */
       
   599 	virtual TInt DeserializeIdsL( RMdEDataBuffer& aSerializedItemIds, 
       
   600 			RArray<TItemId>* aResultObjects = NULL, 
       
   601 			RArray<TItemId>* aResultEvents = NULL, 
       
   602 			RArray<TItemId>* aResultRelations = NULL ) = 0;
       
   603 						   
       
   604 	/**
       
   605 	 * Deserialize serialized list of items
       
   606 	 *
       
   607 	 * @param aSerializedItems serialized list of items
       
   608 	 * @param aItems items are deserialized from buffer to this item array
       
   609 	 *
       
   610 	 * @return first item error
       
   611 	 */
       
   612 	virtual TInt DeserializeItemsL( RMdEDataBuffer& aSerializedItems, 
       
   613 			RPointerArray<CMdEInstanceItem>& aItems ) = 0;
       
   614 
       
   615 	/**
       
   616 	 * Removes the object with the specified identifier from metadata database.
       
   617 	 *
       
   618 	 * @param aId identifier
       
   619 	 * @param aNamespaceDef namespace where object is removed, if NULL default 
       
   620 	 *                      namespace is used
       
   621 	 * @return KNoId if removing has failed, otherwise removed object's ID
       
   622 	 */
       
   623 	virtual TItemId RemoveObjectL( TItemId aId, 
       
   624 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   625 
       
   626 	/**
       
   627 	 * Removes the object with the specified URI from metadata database.
       
   628 	 *
       
   629 	 * @param aUri URI
       
   630 	 * @param aNamespaceDef namespace from remove object, if NULL default 
       
   631 	 *                      namespace is used
       
   632 	 * @return KNoId if removing has failed, otherwise removed object's ID
       
   633 	 */
       
   634 	virtual TItemId RemoveObjectL( const TDesC& aUri, 
       
   635 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   636 
       
   637 	/**
       
   638 	 * Removes the array of objects with the specified identifier from 
       
   639 	 * metadata database.
       
   640 	 *
       
   641 	 * @param aId object IDs to be removed
       
   642 	 * @param aResult result array where succefully removed object IDs are 
       
   643 	 *                added (KNoId is added from those objects which removing 
       
   644 	 *                has failed)
       
   645 	 * @param aNamespaceDef namespace where object is removed, if NULL default 
       
   646 	 *                      namespace is used
       
   647 	 * @return first item error
       
   648 	 */
       
   649 	virtual TInt RemoveObjectsL( 
       
   650 			const RArray<TItemId>& aId, RArray<TItemId>& aResult, 
       
   651 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   652 
       
   653 	/**
       
   654 	 * Removes the array of objects with the specified URI from metadata 
       
   655 	 * database.
       
   656 	 *
       
   657 	 * @param aUri object URIs to be removed
       
   658 	 * @param aResult result array where succefully removed object IDs are 
       
   659 	 *                added (KNoId is added from those objects which removing 
       
   660 	 *                has failed)
       
   661 	 * @param aNamespaceDef namespace where object is removed, if NULL default 
       
   662 	 *                      namespace is used
       
   663 	 * @return first item error
       
   664 	 */
       
   665 	virtual TInt RemoveObjectsL( 
       
   666 			const RPointerArray<TDesC>& aUri, RArray<TItemId>& aResult, 
       
   667 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   668 
       
   669 	/**
       
   670 	 * Asynchronously removes the array of objects with the specified 
       
   671 	 * object IDs from metadata database. Returned serialized list of item IDs 
       
   672 	 * must be deserialized with DeserializeIdsL method.
       
   673 	 *
       
   674 	 * @param aId object IDs to be removed
       
   675      * @param aStatus returns the result code after the asynchronous call 
       
   676      *                completes.
       
   677      * @param aSerializedObjectIds returned serialized list of object IDs
       
   678 	 * @param aNamespaceDef namespace where object is removed, if NULL default 
       
   679 	 *                      namespace is used
       
   680 	 */
       
   681 	virtual void RemoveObjectsAsyncL( 
       
   682 			const RArray<TItemId>& aId, TRequestStatus& aStatus, 
       
   683 			RMdEDataBuffer& aSerializedObjectIds, 
       
   684 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   685 
       
   686 	/**
       
   687 	 * Asynchronously removes the array of objects with the specified URI from 
       
   688 	 * metadata database. Returned serialized list of item IDs must be 
       
   689 	 * deserialized with DeserializeIdsL method.
       
   690 	 *
       
   691 	 * @param aUri object URIs to be removed
       
   692      * @param aStatus returns the result code after the asynchronous call 
       
   693      *                completes.
       
   694      * @param aSerializedObjectIds returned serialized list of object IDs
       
   695 	 * @param aNamespaceDef namespace where object is removed, if NULL default 
       
   696 	 *                      namespace is used
       
   697 	 */
       
   698 	virtual void RemoveObjectsAsyncL( 
       
   699 			const RPointerArray<TDesC>& aUri, TRequestStatus& aStatus, 
       
   700 			RMdEDataBuffer& aSerializedObjectIds, 
       
   701 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   702 	
       
   703 	/**
       
   704 	 * Returns the object with the specified ID and specified object 
       
   705 	 * definition.
       
   706 	 *
       
   707 	 * Example:
       
   708 	 *   CMdENamespaceDef& defaultNamespace = iSession->GetDefaultNamespaceDefL();
       
   709      * 	 CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject );
       
   710 	 * 	 CMdEObject* object = iSession->GetObjectL( aObjectId, imageObjDef );
       
   711 	 * 
       
   712 	 * @param aId object ID
       
   713 	 * @param aObjectDef object definition
       
   714 	 *
       
   715 	 * @return object or NULL, if there is no object with the specified 
       
   716 	 *         identifier in the metadata engine database
       
   717 	 */
       
   718 	virtual CMdEObject* GetObjectL( const TItemId aId, 
       
   719 			CMdEObjectDef& aObjectDef ) = 0;
       
   720 
       
   721 	/**
       
   722 	 * Returns the object (object may contain only properties defined in 
       
   723 	 * "Object") with the specified ID and specified namespace (if namespace 
       
   724 	 * is NULL, the default namespace is used).
       
   725 	 *
       
   726 	 * @param aId object ID
       
   727 	 * @param aNamespaceDef namespace
       
   728 	 *
       
   729 	 * @return  object or NULL, if there is no object with the specified 
       
   730 	 *          identifier in the metadata engine database
       
   731 	 */
       
   732 	virtual CMdEObject* GetObjectL( const TItemId aId, 
       
   733 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   734 
       
   735 	/**
       
   736 	 * Returns the object (object will contain all it's properties) 
       
   737 	 * with the specified ID and specified namespace 
       
   738 	 * (if namespace is NULL, the default namespace is used).
       
   739 	 *
       
   740 	 * @param aId object ID
       
   741 	 * @param aNamespaceDef namespace
       
   742 	 *
       
   743 	 * @return  object or NULL, if there is no object with the specified 
       
   744 	 *          identifier in the metadata engine database
       
   745 	 */
       
   746 	virtual CMdEObject* GetFullObjectL( const TItemId aId, 
       
   747 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   748 
       
   749 	/**
       
   750 	 * Returns the object with the specified GUID and specified object 
       
   751 	 * definition.
       
   752 	 * 
       
   753 	 * Example:
       
   754 	 *   CMdENamespaceDef& defaultNamespace = iSession->GetDefaultNamespaceDefL();
       
   755      * 	 CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject );
       
   756      *   CMdEObject* object = iMdeSession->GetObjectL( 12345, 67890, imageObjDef );
       
   757 	 *
       
   758 	 * @param aGuidHigh GUID high
       
   759 	 * @param aGuidLow GUID low
       
   760 	 * @param aObjectDef object definition
       
   761 	 *
       
   762 	 * @return  object or NULL, if there is no object with the specified 
       
   763 	 *          identifier in the metadata engine database
       
   764 	 */
       
   765 	virtual CMdEObject* GetObjectL( 
       
   766 			const TInt64 aGuidHigh, const TInt64 aGuidLow, 
       
   767 			CMdEObjectDef& aObjectDef ) = 0;
       
   768 
       
   769 	/**
       
   770 	 * Returns the object (object may contain only properties definied in 
       
   771 	 * "Object") with the specified GUID and specified namespace (if namespace 
       
   772 	 * is NULL, the default namespace is used).
       
   773 	 *
       
   774 	 * Example:
       
   775      *   CMdEObject* object = iMdeSession->GetObjectL( 12345, 67890 );
       
   776 	 * 
       
   777 	 * @param aGuidHigh  GUID high
       
   778 	 * @param aGuidLow  GUID low
       
   779 	 * @param aNamespaceDef namespace
       
   780 	 *
       
   781 	 * @return  object or NULL, if there is no object with the specified 
       
   782 	 *          identifier in the metadata engine database
       
   783 	 */
       
   784 	virtual CMdEObject* GetObjectL( 
       
   785 			const TInt64 aGuidHigh, const TInt64 aGuidLow, 
       
   786 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   787 
       
   788 	/**
       
   789 	 * Returns the object (object will contain all it's properties) 
       
   790 	 * with the specified GUID and specified namespace 
       
   791 	 * (if namespace is NULL, the default namespace is used).
       
   792 	 * 
       
   793 	 * Example:
       
   794      *   CMdEObject* object = iMdeSession->GetFullObjectL( 12345, 67890 );
       
   795 	 *
       
   796 	 * @param aGuidHigh GUID high
       
   797 	 * @param aGuidLow GUID low
       
   798 	 * @param aNamespaceDef namespace
       
   799 	 *
       
   800 	 * @return  object or NULL, if there is no object with the specified 
       
   801 	 *          identifier in the metadata engine database
       
   802 	 */
       
   803 	virtual CMdEObject* GetFullObjectL( 
       
   804 			const TInt64 aGuidHigh, const TInt64 aGuidLow, 
       
   805 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   806 
       
   807 	/**
       
   808 	 * Returns the object with the specified URI and specified object 
       
   809 	 * definition.
       
   810 	 *
       
   811 	 * Example:
       
   812 	 *   CMdENamespaceDef& defaultNamespace = iSession->GetDefaultNamespaceDefL();
       
   813      * 	 CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject );
       
   814      *   CMdEObject* object = iMdeSession->GetObjectL( aUri, imageObjDef );
       
   815 	 *
       
   816 	 * @param aUri object URI
       
   817 	 * @param aObjectDef object definition
       
   818 	 *
       
   819 	 * @return  object or NULL, if there is no object with the specified 
       
   820 	 *          identifier in the metadata engine database
       
   821 	 */
       
   822 	virtual CMdEObject* GetObjectL( const TDesC& aUri, 
       
   823 			CMdEObjectDef& aObjectDef ) = 0;
       
   824 
       
   825 	/**
       
   826 	 * Returns the object (object may contain only properties definied in 
       
   827 	 * "Object") with the specified URI specified namespace (if namespace is 
       
   828 	 * NULL, the default namespace is used).
       
   829 	 *
       
   830 	 * @param aUri object URI
       
   831 	 * @param aNamespaceDef namespace
       
   832 	 *
       
   833 	 * @return  object or NULL, if there is no object with the specified 
       
   834 	 *          identifier in the metadata engine database
       
   835 	 */
       
   836 	virtual CMdEObject* GetObjectL( const TDesC& aUri, 
       
   837 			CMdENamespaceDef* aNamespaceDef = NULL) = 0;
       
   838 
       
   839 	/**
       
   840 	 * Returns the object (object will contain all it's properties) with the 
       
   841 	 * specified URI specified namespace (if namespace is NULL, the default 
       
   842 	 * namespace is used).
       
   843 	 *
       
   844 	 * @param aUri object URI
       
   845 	 * @param aNamespaceDef namespace
       
   846 	 *
       
   847 	 * @return  object or NULL, if there is no object with the specified 
       
   848 	 *          identifier in the metadata engine database
       
   849 	 */
       
   850 	virtual CMdEObject* GetFullObjectL( const TDesC& aUri, 
       
   851 			CMdENamespaceDef* aNamespaceDef = NULL) = 0;
       
   852 
       
   853 	/**
       
   854 	 * Opens the object with the specified ID and specified object 
       
   855 	 * definition for modifications. The object is locked so that nobody else 
       
   856 	 * can open it for modifications. The modifications are committed by 
       
   857 	 * calling the <code>CommitObject()</code> method, which releases the lock.
       
   858 	 * The modifications can be canceled by calling the 
       
   859 	 * <code>CancelObject()</code> method, which also releases the lock.
       
   860 	 *
       
   861 	 * Example:
       
   862 	 *  CMdENamespaceDef& defaultNamespace = iMdeSession->GetDefaultNamespaceDefL();
       
   863      *	CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject );
       
   864 	 *  CMdEObject* image = iMdESession->OpenObjectL( 17, imageDef );
       
   865 	 * 
       
   866 	 *  CMdEPropertyDef& lastModDatePropDef = imageDef.GetPropertyDefL(
       
   867      *   		Object::KLastModifiedDateProperty );
       
   868      * 
       
   869      *  CMdEProperty* lastModDateProp = NULL;
       
   870      *  image->Property( lastModDatePropDef, lastModDateProp, 0 );
       
   871      * 
       
   872      *  TTime currenttime( 0 );
       
   873      *	currenttime.UniversalTime();
       
   874      * 
       
   875      *  if ( lastModDateProp )
       
   876      *      {
       
   877      *      lastModDateProp->SetTimeValueL( currenttime );
       
   878      *      }
       
   879      *  else
       
   880      *      {
       
   881      *      image->AddTimePropertyL( lastModDatePropDef, currenttime );
       
   882      *      }
       
   883      *  }
       
   884      *  iMdeSession->CommitObjectL( *image );
       
   885 	 *  
       
   886 	 * 
       
   887 	 * @param aId  object ID
       
   888 	 * @param aObjectDef object definition
       
   889 	 *
       
   890 	 * @return  Object or NULL, if there is no object with the specified 
       
   891      *          identifier in the metadata engine database.
       
   892 	 */
       
   893 	virtual CMdEObject* OpenObjectL( const TItemId aId, 
       
   894 			CMdEObjectDef& aObjectDef ) = 0;
       
   895 
       
   896 	/**
       
   897 	 * Opens the object (object may contain only properties definied in "Object") 
       
   898 	 * with the specified ID and specified namespace 
       
   899 	 * (if namespace is NULL, the default namespace is used) for modifications.
       
   900 	 * The object is locked so that nobody else can open it for modifications.
       
   901 	 * The modifications are committed by calling the <code>CommitObject()</code>
       
   902 	 * method, which releases the lock. The modifications can be canceled by
       
   903 	 * calling the <code>CancelObject()</code> method, which also releases the
       
   904 	 * lock.
       
   905 	 *
       
   906 	 * @param aId  object ID.
       
   907 	 * @param aNamespaceDef namespace
       
   908 	 *
       
   909 	 * @return  Object or NULL, if there is no object with the specified 
       
   910      *          identifier in the metadata engine database.
       
   911 	 */
       
   912 	virtual CMdEObject* OpenObjectL( const TItemId aId, 
       
   913 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   914 
       
   915 	/**
       
   916 	 * Opens the object (object will contain all it's properties) 
       
   917 	 * with the specified ID and specified namespace 
       
   918 	 * (if namespace is NULL, the default namespace is used) for modifications.
       
   919 	 * The object is locked so that nobody else can open it for modifications.
       
   920 	 * The modifications are committed by calling the <code>CommitObject()</code>
       
   921 	 * method, which releases the lock. The modifications can be canceled by
       
   922 	 * calling the <code>CancelObject()</code> method, which also releases the
       
   923 	 * lock.
       
   924 	 *
       
   925 	 * @param aId  object ID.
       
   926 	 * @param aNamespaceDef namespace
       
   927 	 *
       
   928 	 * @return  Object or NULL, if there is no object with the specified 
       
   929      *          identifier in the metadata engine database.
       
   930 	 */
       
   931 	virtual CMdEObject* OpenFullObjectL( const TItemId aId, 
       
   932 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   933 
       
   934 
       
   935 	/**
       
   936 	 * Opens the object with the specified GUID and specified object 
       
   937 	 * definition for modifications. The object is locked so that nobody else 
       
   938 	 * can open it for modifications. The modifications are committed by 
       
   939 	 * calling the <code>CommitObject()</code> method, which releases the lock.
       
   940 	 * The modifications can be canceled by calling the 
       
   941 	 * <code>CancelObject()</code> method, which also releases the lock.
       
   942 	 *
       
   943 	 * @param aGuidHigh  GUID high
       
   944 	 * @param aGuidLow  GUID low
       
   945 	 * @param aObjectDef object definition
       
   946 	 *
       
   947 	 * @return  Object or NULL, if there is no object with the specified 
       
   948      *          identifier in the metadata engine database.
       
   949 	 */
       
   950 	virtual CMdEObject* OpenObjectL( 
       
   951 			const TInt64 aGuidHigh, const TInt64 aGuidLow, 
       
   952 			CMdEObjectDef& aObjectDef ) = 0;
       
   953 
       
   954 	/**
       
   955 	 * Opens the object (object may contain only properties definied in "Object") 
       
   956 	 * with the specified GUID and specified namespace 
       
   957 	 * (if namespace is NULL, the default namespace is used) for modifications.
       
   958 	 * The object is locked so that nobody else can open it for modifications.
       
   959 	 * The modifications are committed by calling the <code>CommitObject()</code>
       
   960 	 * method, which releases the lock. The modifications can be canceled by
       
   961 	 * calling the <code>CancelObject()</code> method, which also releases the
       
   962 	 * lock.
       
   963 	 *
       
   964 	 * @param aGuidHigh  GUID high
       
   965 	 * @param aGuidLow  GUID low
       
   966 	 * @param aNamespaceDef namespace
       
   967 	 *
       
   968 	 * @return  Object or NULL, if there is no object with the specified 
       
   969      *          identifier in the metadata engine database.
       
   970 	 */
       
   971 	virtual CMdEObject* OpenObjectL( 
       
   972 			const TInt64 aGuidHigh, const TInt64 aGuidLow, 
       
   973 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   974 
       
   975 	/**
       
   976 	 * Opens the object (object will contain all it's properties) 
       
   977 	 * with the specified GUID and specified namespace 
       
   978 	 * (if namespace is NULL, the default namespace is used) for modifications.
       
   979 	 * The object is locked so that nobody else can open it for modifications.
       
   980 	 * The modifications are committed by calling the <code>CommitObject()</code>
       
   981 	 * method, which releases the lock. The modifications can be canceled by
       
   982 	 * calling the <code>CancelObject()</code> method, which also releases the
       
   983 	 * lock.
       
   984 	 *
       
   985 	 * @param aGuidHigh  GUID high
       
   986 	 * @param aGuidLow  GUID low
       
   987 	 * @param aNamespaceDef namespace
       
   988 	 *
       
   989 	 * @return  Object or NULL, if there is no object with the specified 
       
   990      *          identifier in the metadata engine database.
       
   991 	 */
       
   992 	virtual CMdEObject* OpenFullObjectL( 
       
   993 			const TInt64 aGuidHigh, const TInt64 aGuidLow, 
       
   994 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
   995 
       
   996 
       
   997 	/**
       
   998 	 * Opens the object with the specified URI for modifications and specified 
       
   999 	 * object definition. The object is locked so that nobody else can open it 
       
  1000 	 * for modifications. The modifications are committed by calling the 
       
  1001 	 * <code>CommitObject()</code> method, which releases the lock. The 
       
  1002 	 * modifications can be canceled by calling the <code>CancelObject()</code> 
       
  1003 	 * method, which also releases the lock.
       
  1004 	 *
       
  1005 	 * @param aUri  object URI
       
  1006 	 * @param aObjectDef object definition
       
  1007 	 *
       
  1008 	 * @return  Object or NULL, if there is no object with the specified 
       
  1009      *          identifier in the metadata engine database.
       
  1010 	 */
       
  1011 	virtual CMdEObject* OpenObjectL( const TDesC& aUri, 
       
  1012 			CMdEObjectDef& aObjectDef ) = 0;
       
  1013 
       
  1014 	/**
       
  1015 	 * Opens the object (object may contain only properties definied in "Object") 
       
  1016 	 * with the specified ID and specified namespace 
       
  1017 	 * (if namespace is NULL, the default namespace is used) for modifications.
       
  1018 	 * The object is locked so that nobody else can open it for modifications.
       
  1019 	 * The modifications are committed by calling the <code>CommitObject()</code>
       
  1020 	 * method, which releases the lock. The modifications can be canceled by
       
  1021 	 * calling the <code>CancelObject()</code> method, which also releases the
       
  1022 	 * lock.
       
  1023 	 *
       
  1024 	 * @param aUri  Object URI.
       
  1025 	 * @param aNamespaceDef namespace
       
  1026 	 *
       
  1027 	 * @return  Object or NULL, if there is no object with the specified 
       
  1028      *          identifier in the metadata engine database.
       
  1029 	 */
       
  1030 	virtual CMdEObject* OpenObjectL( const TDesC& aUri, 
       
  1031 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
  1032 
       
  1033 	/**
       
  1034 	 * Opens the object (object will contain all it's properties) 
       
  1035 	 * with the specified ID and specified namespace 
       
  1036 	 * (if namespace is NULL, the default namespace is used) for modifications.
       
  1037 	 * The object is locked so that nobody else can open it for modifications.
       
  1038 	 * The modifications are committed by calling the <code>CommitObject()</code>
       
  1039 	 * method, which releases the lock. The modifications can be canceled by
       
  1040 	 * calling the <code>CancelObject()</code> method, which also releases the
       
  1041 	 * lock.
       
  1042 	 *
       
  1043 	 * @param aUri  Object URI.
       
  1044 	 * @param aNamespaceDef namespace
       
  1045 	 *
       
  1046 	 * @return  Object or NULL, if there is no object with the specified 
       
  1047      *          identifier in the metadata engine database.
       
  1048 	 */
       
  1049 	virtual CMdEObject* OpenFullObjectL( const TDesC& aUri, 
       
  1050 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
  1051 
       
  1052 	/**
       
  1053 	 * Gets metadata object id, definition and some flags by URI. Does not return the whole object.
       
  1054 	 * 
       
  1055 	 * @param aObject on return contains information about the metadata object
       
  1056 	 * @param aUri metadata object URI
       
  1057 	 * @param aNamespaceDef namespace definition. If namespace is NULL then the default namespace is used.
       
  1058 	 */
       
  1059 	virtual void CheckObjectL( TMdEObject& aObject, const TDesC& aUri, 
       
  1060 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
  1061 
       
  1062 	/**
       
  1063 	 * Gets metadata object id, definition and some flags by id. Does not return the whole object.
       
  1064 	 * 
       
  1065 	 * @param aObject on return contains information about the metadata object
       
  1066 	 * @param aId metadata object id
       
  1067 	 * @param aNamespaceDef namespace definition. If namespace is NULL then the default namespace is used.
       
  1068 	 */
       
  1069 	virtual void CheckObjectL( TMdEObject& aObject, TItemId aId, 
       
  1070 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
  1071 
       
  1072 	/**
       
  1073 	 * Gets an array of TMdEObject objects that contain metadata object ids, definitions and 
       
  1074 	 * some flags by object ids. Does not return whole objects.
       
  1075 	 * 
       
  1076 	 * @param aObjects on return contains an array of objects containing information about metadata objects
       
  1077 	 * @param aIds array of metadata object ids
       
  1078 	 * @param aNamespaceDef namespace definition. If namespace is NULL then the default namespace is used.
       
  1079 	 */
       
  1080 	virtual void CheckObjectL( RArray<TMdEObject>& aObjects, 
       
  1081 			const RArray<TItemId>& aIds, 
       
  1082 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
  1083 	
       
  1084 	/**
       
  1085      * Commits the modifications made to the object to the database
       
  1086 	 * and releases the modification lock.
       
  1087      * 
       
  1088 	 * @param aObject  Object.
       
  1089      */
       
  1090     virtual void CommitObjectL(CMdEObject& aObject) = 0;
       
  1091 
       
  1092 	/**
       
  1093      * Commits the modifications made to objects to the database
       
  1094 	 * and releases the modification locks.
       
  1095      * 
       
  1096 	 * @param aObject  Object.
       
  1097      */
       
  1098     virtual void CommitObjectsL(RPointerArray<CMdEObject>& aObjects) = 0;
       
  1099 
       
  1100     /**
       
  1101      * Cancels the modifications made to the object and releases the
       
  1102 	 * modification lock.
       
  1103      * 
       
  1104 	 * @param aObject  Object.
       
  1105      */
       
  1106     virtual TItemId CancelObjectL(CMdEObject& aObject) = 0;
       
  1107 
       
  1108 
       
  1109 	/* Methods for managing relations. */
       
  1110 
       
  1111 	/**
       
  1112 	 * Returns the relation with the specified ID and specified namespace 
       
  1113 	 * (if namespace is NULL, the default namespace is used).
       
  1114 	 * 
       
  1115 	 * Note that the ownership of the returned relation is passed to the 
       
  1116 	 * caller of the method (that is, the caller is responsible for deleting 
       
  1117 	 * the relation).
       
  1118 	 *
       
  1119 	 * @param aId  relation ID
       
  1120 	 * @param aNamespaceDef namespace
       
  1121 	 *
       
  1122 	 * @return  relation or NULL, if there is no relation with the specified ID
       
  1123 	 *          in the metadata engine database
       
  1124 	 */
       
  1125 	virtual CMdERelation* GetRelationL(TItemId aId, 
       
  1126 			CMdENamespaceDef* aNamespacedef = NULL) = 0;
       
  1127 
       
  1128 	/**
       
  1129 	 * Constructs a new empty relation. Note that the relation is not inserted 
       
  1130 	 * in the database. The ownership of the new relation is passed to the 
       
  1131 	 * caller (that is, the caller is responsible for deleting the relation).
       
  1132 	 * 
       
  1133 	 * Example:
       
  1134      *	 CMdERelationDef& relationDef = namespaceDef.GetRelationDefL( MdeConstants::Relations::KContains );
       
  1135      *
       
  1136      *	 CMdERelation* relation = iMdeSession->NewRelationLC( relationDef, albumObject->Id(), audioObject->Id() );
       
  1137      *	 iMdeSession->AddRelationL( *relation );
       
  1138 	 *
       
  1139 	 * @param aDef  definition of the new relation
       
  1140 	 * @param aLeftObjectId id of the left side of the relation
       
  1141 	 * @param aRightObjectId id of the right side of the relation
       
  1142 	 * @param aParameter the relation parameter
       
  1143 	 *
       
  1144 	 * @return  new relation
       
  1145 	 */
       
  1146 	virtual CMdERelation* NewRelationLC(CMdERelationDef& aDef, 
       
  1147 			TItemId aLeftObjectId, TItemId aRightObjectId, 
       
  1148 			TInt32 aParameter = 0) = 0;
       
  1149 
       
  1150 	/**
       
  1151 	 * Constructs a new empty relation. Note that the relation is not inserted 
       
  1152 	 * in the database. The ownership of the new relation is passed to the 
       
  1153 	 * caller (that is, the caller is responsible for deleting the relation).
       
  1154 	 *
       
  1155 	 * Example:
       
  1156      *	 CMdERelationDef& relationDef = namespaceDef.GetRelationDefL( MdeConstants::Relations::KContains );
       
  1157      *
       
  1158      *	 CMdERelation* relation = iMdeSession->NewRelationL( relationDef, albumObject->Id(), audioObject->Id() );
       
  1159      *	 iMdeSession->AddRelationL( *relation );
       
  1160 	 * 
       
  1161 	 * @param aDef  definition of the new relation
       
  1162 	 * @param aLeftObjectId id of the left side of the relation
       
  1163 	 * @param aRightObjectId id of the right side of the relation
       
  1164 	 * @param aParameter the relation parameter
       
  1165 	 *
       
  1166 	 * @return  new relation
       
  1167 	 */
       
  1168 	virtual CMdERelation* NewRelationL(CMdERelationDef& aDef, 
       
  1169 			TItemId aLeftObjectId, TItemId aRightObjectId, 
       
  1170 			TInt32 aParameter = 0) = 0;
       
  1171 
       
  1172 	/**
       
  1173 	 * Adds a new relation to the metadata engine database.
       
  1174 	 *
       
  1175 	 * @param relation
       
  1176 	 *
       
  1177 	 * @return  identifier of the new relation
       
  1178 	 */
       
  1179 	virtual TItemId AddRelationL( CMdERelation& aRelation ) = 0;
       
  1180 
       
  1181 	/**
       
  1182 	 * Commits changes made to the relation to the metadata engine database.
       
  1183      *
       
  1184      * @param relation
       
  1185 	 *
       
  1186 	 * @return  identifier of the new relation
       
  1187 	 */
       
  1188 	virtual TItemId UpdateRelationL( CMdERelation& aRelation ) = 0;
       
  1189 
       
  1190 	/**
       
  1191 	 * Removes the relation with the specified identifier and specified 
       
  1192 	 * namespace (if namespace is NULL, the default namespace is used)
       
  1193 	 * from the metadata engine database.
       
  1194 	 *
       
  1195 	 * @param aId   ID of the relation to remove.
       
  1196 	 * @param aNamespaceDef namespace
       
  1197 	 *
       
  1198 	 * @return  relation ID or KNoId, if there is no relation with the 
       
  1199 	 *          specified ID in the metadata engine database
       
  1200 	 */
       
  1201 	virtual TItemId RemoveRelationL( TItemId aId, 
       
  1202 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
  1203 	
       
  1204 	/**
       
  1205 	 * Removes multiple relations with the specified IDs and specified 
       
  1206 	 * namespace (if namespace is NULL, the default namespace is used)
       
  1207 	 * from the metadata engine database.
       
  1208 	 *
       
  1209 	 * @param aId IDs of relations to remove.
       
  1210 	 * @param aSuccessful Successfully removed IDs of relations (if removing 
       
  1211 	 *                    has failed KNoId is added).
       
  1212 	 * @param aNamespaceDef namespace
       
  1213 	 */
       
  1214 	virtual TInt RemoveRelationsL( 
       
  1215 			const RArray<TItemId>& aId, RArray<TItemId>& aSuccessful, 
       
  1216 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
  1217 
       
  1218 	/**
       
  1219 	 * Removes multiple relations asynchronous with the specified IDs and 
       
  1220 	 * specified namespace (if namespace is NULL, the default namespace is 
       
  1221 	 * used) from the metadata engine database. Returned serialized list of 
       
  1222 	 * item IDs must be deserialized with DeserializeIdsL method.
       
  1223 	 *
       
  1224 	 * @param aId IDs of relations to remove.
       
  1225      * @param aStatus returns the result code after the asynchronous call 
       
  1226      *                completes.
       
  1227      * @param aSerializedRelationIds returned serialized list of relation IDs
       
  1228 	 * @param aNamespaceDef namespace
       
  1229 	 */
       
  1230 	virtual void RemoveRelationsAsyncL( 
       
  1231 			const RArray<TItemId>& aId, TRequestStatus& aStatus, 
       
  1232 			RMdEDataBuffer& aSerializedRelationIds, 
       
  1233 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
  1234 
       
  1235 	/* Methods for managing events. */
       
  1236 
       
  1237 	/**
       
  1238 	 * Constructs a new empty event. Note that the event is not inserted in the
       
  1239 	 * database. The ownership of the new event is passed to the caller (that 
       
  1240 	 * is, the caller is responsible for deleting the event).
       
  1241 	 *
       
  1242 	 * Example:
       
  1243 	 *   CMdEEventDef* eventDef = &iDefaultNamespace->GetEventDefL( Events::KCreated );
       
  1244 	 *   CMdEEvent* event = iMdeSession->NewEventLC( *eventDef, objectId, time );
       
  1245 	 * 
       
  1246 	 * @param aDef  definition of the new event
       
  1247 	 * @param aObjectId the target object id
       
  1248 	 * @param aTime time of the event
       
  1249 	 * @param aSource source of the event
       
  1250 	 * @param aParticipant participant of the event
       
  1251 	 *
       
  1252 	 * @return  new event
       
  1253 	 */
       
  1254 	virtual CMdEEvent* NewEventLC(CMdEEventDef& aDef, 
       
  1255 			TItemId aObjectId, TTime aTime, 
       
  1256 			const TDesC* aSource = NULL, const TDesC* aParticipant = NULL) = 0;
       
  1257 
       
  1258 	/**
       
  1259 	 * Constructs a new empty event. Note that the event is not inserted in the
       
  1260 	 * database. The ownership of the new event is passed to the caller (that 
       
  1261 	 * is, the caller is responsible for deleting the event).
       
  1262 	 *
       
  1263 	 * Example:
       
  1264 	 *   CMdEEventDef* eventDef = &iDefaultNamespace->GetEventDefL( Events::KCreated );
       
  1265 	 *   CMdEEvent* event = iMdeSession->NewEventL( *eventDef, objectId, time );
       
  1266 	 * 
       
  1267 	 * @param aDef  definition of the new event
       
  1268 	 * @param aObjectId the target object id
       
  1269 	 * @param aTime time of the event
       
  1270 	 * @param aSource source of the event
       
  1271 	 * @param aParticipant participant of the event
       
  1272 	 *
       
  1273 	 * @return  new event
       
  1274 	 */
       
  1275 	virtual CMdEEvent* NewEventL(CMdEEventDef& aDef, 
       
  1276 			TItemId aObjectId, TTime aTime, 
       
  1277 			const TDesC* aSource = NULL, const TDesC* aParticipant = NULL) = 0;
       
  1278 
       
  1279 	/**
       
  1280 	 * Returns the event with the specified identifier and specified namespace 
       
  1281 	 * (if namespace is NULL, the default namespace is used).
       
  1282 	 * Note that the ownership of the returned event is passed to the caller of
       
  1283 	 * the method (that is, the caller is responsible for deleting the event).
       
  1284 	 *
       
  1285 	 * @param aId  Identifier.
       
  1286 	 * @param aNamespaceDef namespace
       
  1287 	 *
       
  1288 	 * @return  Event or NULL, if there is no event with the specified 
       
  1289 	 *          identifier in the metadata engine database.
       
  1290 	 */
       
  1291 	virtual CMdEEvent* GetEventL(TItemId aId, 
       
  1292 			CMdENamespaceDef* aNamespaceDef = NULL) = 0;
       
  1293 
       
  1294 	/**
       
  1295 	 * Adds a new event to the metadata engine database.
       
  1296 	 *
       
  1297 	 * @param event
       
  1298 	 *
       
  1299 	 * @return  Identifier of the new event.
       
  1300 	 */
       
  1301 	virtual TItemId AddEventL( CMdEEvent& aEvent ) = 0;
       
  1302 
       
  1303 	/**
       
  1304 	 * Removes the event with the specified identifier and specified namespace 
       
  1305 	 * (if namespace is NULL, the default namespace is used) from the metadata 
       
  1306 	 * engine database.
       
  1307 	 *
       
  1308 	 * @param aId   ID of the event to remove.
       
  1309 	 * @param aNamespaceDef namespace
       
  1310 	 *
       
  1311 	 * @return  event ID or KNoId, if there is no event with the specified ID
       
  1312 	 *          in the metadata engine database
       
  1313 	 */
       
  1314 	virtual TItemId RemoveEventL( TItemId aId, 
       
  1315 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
  1316 	
       
  1317 	/**
       
  1318 	 * Removes multiple events with the specified IDs and specified 
       
  1319 	 * namespace (if namespace is NULL, the default namespace is used)
       
  1320 	 * from the metadata engine database.
       
  1321 	 *
       
  1322 	 * @param aId IDs of events to remove.
       
  1323 	 * @param aSuccessful Successfully removed IDs of events (if removing has 
       
  1324 	 *                    failed KNoId is added).
       
  1325 	 * @param aNamespaceDef namespace
       
  1326 	 */
       
  1327 	virtual TInt RemoveEventsL(
       
  1328 			const RArray<TItemId>& aId, RArray<TItemId>& aSuccessful, 
       
  1329 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
  1330 	
       
  1331 	/**
       
  1332 	 * Removes multiple events asynchronous with the specified IDs and 
       
  1333 	 * specified namespace (if namespace is NULL, the default namespace is 
       
  1334 	 * used) from the metadata engine database. Returned serialized list of 
       
  1335 	 * item IDs must be deserialized with DeserializeIdsL method.
       
  1336 	 *
       
  1337 	 * @param aId IDs of events to remove.
       
  1338      * @param aStatus returns the result code after the asynchronous call 
       
  1339      *                completes.
       
  1340      * @param aSerializedEventIds returned serialized list of event IDs
       
  1341 	 * @param aNamespaceDef namespace
       
  1342 	 */
       
  1343 	virtual void RemoveEventsAsyncL(
       
  1344 			const RArray<TItemId>& aId, TRequestStatus& aStatus, 
       
  1345 			RMdEDataBuffer& aSerializedEventIds, 
       
  1346 			CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
       
  1347 
       
  1348 
       
  1349 	/* Methods for searching objects, relations, and events. */
       
  1350 
       
  1351     /**
       
  1352 	 * Creates a new object query.
       
  1353 	 * 
       
  1354 	 * Note that the ownership of the returned query is passed to the caller of
       
  1355 	 * the method (that is, the caller is responsible for deleting the query).
       
  1356 	 *
       
  1357 	 * @param aNamespaceDef namespace where query will be run
       
  1358 	 * @param aObjectDef object definition which defines objects which will be 
       
  1359 	 *                   queried
       
  1360 	 * @param aObserver observer which callback methods will be called
       
  1361 	 *
       
  1362 	 * @return  New object query.
       
  1363      */
       
  1364     virtual CMdEObjectQuery* NewObjectQueryL(CMdENamespaceDef& aNamespaceDef, 
       
  1365     		CMdEObjectDef& aObjectDef, MMdEQueryObserver* aObserver = 0) = 0;
       
  1366 
       
  1367     /**
       
  1368 	 * Creates a new object query.
       
  1369 	 * 
       
  1370 	 * Note that the ownership of the returned query is passed to the caller of
       
  1371 	 * the method (that is, the caller is responsible for deleting the query).
       
  1372 	 *
       
  1373 	 * @param aObjectDef Object definition which defines the parent object.
       
  1374 	 * @param aObjectDefs Object definitions which defines objects which will 
       
  1375 	 *                    be queried. Ownership of aObjectDefs will change to 
       
  1376 	 *                    query.
       
  1377 	 * @param aObserver Observer which callback methods will be called.
       
  1378 	 *
       
  1379 	 * @return  New object query.
       
  1380      */
       
  1381     virtual CMdEObjectQuery* NewObjectQueryL(
       
  1382     		CMdEObjectDef& aObjectDef, 
       
  1383     		RPointerArray<CMdEObjectDef>* aObjectDefs, 
       
  1384     		MMdEQueryObserver* aObserver = 0) = 0;
       
  1385 
       
  1386     /**
       
  1387 	 * Creates a new relation query.
       
  1388 	 * 
       
  1389 	 * Note that the ownership of the returned query is passed to the caller of
       
  1390 	 * the method (that is, the caller is responsible for deleting the query).
       
  1391 	 *
       
  1392 	 * @param aNamespaceDef namespace where query will be run
       
  1393 	 * @param aObserver observer which callback methods will be called
       
  1394 	 *
       
  1395      * @return  New relation query.
       
  1396      */
       
  1397     virtual CMdERelationQuery* NewRelationQueryL(
       
  1398     		CMdENamespaceDef& aNamespaceDef, 
       
  1399     		MMdEQueryObserver* aObserver = 0) = 0;
       
  1400 
       
  1401     /**
       
  1402 	 * Creates a new event query.
       
  1403 	 * 
       
  1404 	 * Note that the ownership of the returned query is passed to the caller of
       
  1405 	 * the method (that is, the caller is responsible for deleting the query).
       
  1406 	 *
       
  1407 	 * @param aNamespaceDef namespace where query will be run
       
  1408 	 * @param aObserver observer which callback methods will be called
       
  1409 	 *
       
  1410      * @return  New event query.
       
  1411      */
       
  1412     virtual CMdEEventQuery* NewEventQueryL(CMdENamespaceDef& aNamespaceDef, 
       
  1413     		MMdEQueryObserver* aObserver = 0) = 0;
       
  1414 
       
  1415 
       
  1416 	/* Methods for managing observers. */
       
  1417 
       
  1418 	/**
       
  1419 	 * Adds a new schema observer to the session. No duplicate
       
  1420 	 * observers are allowed.
       
  1421 	 *
       
  1422 	 * @param aObserver  observer
       
  1423 	 */
       
  1424 	virtual void AddSchemaObserverL(MMdESchemaObserver& aObserver) = 0;
       
  1425 
       
  1426 	/**
       
  1427 	 * Removes the specified schema observer from the session.
       
  1428 	 *
       
  1429 	 * @param aObserver  observer
       
  1430 	 */
       
  1431 	virtual void RemoveSchemaObserverL(MMdESchemaObserver& aObserver) = 0;
       
  1432 
       
  1433 	/**
       
  1434 	 * Adds a new object observer to the session. No duplicate observers are 
       
  1435      * allowed.
       
  1436      *
       
  1437      * The following restrictions are placed on the condition nodes:
       
  1438      * - Only CMdEObjectCondition and CMdEPropertyCondition nodes can be
       
  1439      *   used. CMdERangePropertyConditions are not allowed.
       
  1440      * - No nested logic conditions are allowed.
       
  1441 	 *
       
  1442 	 * @param aObserver   Observer.
       
  1443 	 * @param aCondition  Condition that the objects, about which the observer
       
  1444 	 *                    wants to receive notifications, must fulfill or NULL,
       
  1445 	 *                    to receive notifications of all objects.
       
  1446      *                    Ownership of the condition is transferred to the
       
  1447      *                    session.
       
  1448      * @param aNotificationType what event type (add, modify, remove) should
       
  1449      *                          be notified to client
       
  1450      * @param aNamespaceDef specified namespace (if namespace is NULL, the 
       
  1451      *                      default namespace is used)
       
  1452      * 
       
  1453      * @leave KErrAlreadyExists if the same observer has already been added
       
  1454 	 */
       
  1455 	virtual void AddObjectObserverL(MMdEObjectObserver& aObserver,
       
  1456 			CMdELogicCondition* aCondition = NULL, 
       
  1457 			TUint32 aNotificationType = ENotifyAdd | ENotifyModify | ENotifyRemove,
       
  1458 			CMdENamespaceDef* aNamespaceDef = NULL) = 0;
       
  1459 
       
  1460 	/**
       
  1461 	 * Removes the specified object observer from the session.
       
  1462 	 *
       
  1463 	 * @param aObserver  observer
       
  1464      * @param aNamespaceDef specified namespace (if namespace is NULL, the 
       
  1465      *                      default namespace is used)
       
  1466 	 */
       
  1467 	virtual void RemoveObjectObserverL(MMdEObjectObserver& aObserver, 
       
  1468 			CMdENamespaceDef* aNamespaceDef = NULL) = 0;
       
  1469 
       
  1470 	/**
       
  1471 	 * Adds a new object present observer to the session. No duplicate 
       
  1472 	 * observers are allowed.
       
  1473      *
       
  1474 	 * @param aObserver   Observer
       
  1475 	 * 
       
  1476      * @leave KErrAlreadyExists if the same observer has already been added
       
  1477 	 */
       
  1478 	virtual void AddObjectPresentObserverL(
       
  1479 			MMdEObjectPresentObserver& aObserver) = 0;
       
  1480 
       
  1481 	/**
       
  1482 	 * Removes the specified object present observer from the session.
       
  1483 	 *
       
  1484 	 * @param aObserver  observer
       
  1485 	 */
       
  1486 	virtual void RemoveObjectPresentObserverL(
       
  1487 			MMdEObjectPresentObserver& aObserver)= 0;
       
  1488 
       
  1489 	/**
       
  1490 	 * Adds a new relation observer to the session. No duplicate observers 
       
  1491      * are allowed.
       
  1492 	 *
       
  1493      * The following restrictions are placed on the condition nodes:
       
  1494      * - Only CMdERelationCondition nodes are allowed.
       
  1495      * - No nested logic conditions are allowed.
       
  1496      *
       
  1497 	 * @param aObserver   Observer.
       
  1498 	 * @param aCondition  Condition that the relations, about which the observer
       
  1499 	 *                    wants to receive notifications, must fulfill
       
  1500 	 *                    or NULL, to receive notifications of all relations.
       
  1501      *                    Ownership of the condition is transferred to the
       
  1502      *                    session.
       
  1503      * @param aNotificationType what event type (add, modify, remove) should
       
  1504      *                          be notified to client
       
  1505      * @param aNamespaceDef specified namespace (if namespace is NULL, the 
       
  1506      *                      default namespace is used)
       
  1507      * 
       
  1508      * @leave KErrAlreadyExists if the same observer has already been added
       
  1509 	 */
       
  1510 	virtual void AddRelationObserverL(MMdERelationObserver& aObserver,
       
  1511 			CMdECondition* aCondition = NULL, 
       
  1512 			TUint32 aNotificationType = ENotifyAdd | ENotifyModify | ENotifyRemove,
       
  1513 			CMdENamespaceDef* aNamespaceDef = NULL)= 0;
       
  1514 	/**
       
  1515 	 * Removes the specified relation observer from the session.
       
  1516 	 *
       
  1517 	 * @param aObserver  Observer.
       
  1518      * @param aNamespaceDef specified namespace (if namespace is NULL, the 
       
  1519      *                      default namespace is used)
       
  1520 	 */
       
  1521 	virtual void RemoveRelationObserverL(MMdERelationObserver& aObserver, 
       
  1522 			CMdENamespaceDef* aNamespaceDef = NULL) = 0;
       
  1523 
       
  1524 	/**
       
  1525 	 * Adds a new relation item observer to the session.
       
  1526 	 * No duplicate observers are allowed.
       
  1527 	 *
       
  1528      * The following restrictions are placed on the condition nodes:
       
  1529      * - Only CMdERelationCondition nodes are allowed.
       
  1530      * - No nested logic conditions are allowed.
       
  1531      *
       
  1532 	 * @param aObserver   Observer.
       
  1533 	 * @param aCondition  Condition that the relations, about which the observer
       
  1534 	 *                    wants to receive notifications, must fulfill
       
  1535 	 *                    or NULL, to receive notifications of all relations.
       
  1536      *                    Ownership of the condition is transferred to the
       
  1537      *                    session.
       
  1538      * @param aNotificationType what event type (add, modify, remove) should
       
  1539      *                          be notified to client
       
  1540      * @param aNamespaceDef specified namespace (if namespace is NULL, the 
       
  1541      *                      default namespace is used)
       
  1542      * 
       
  1543      * @leave KErrAlreadyExists if the same observer has already been added
       
  1544 	 */
       
  1545 	virtual void AddRelationItemObserverL(MMdERelationItemObserver& aObserver,
       
  1546 			CMdECondition* aCondition = NULL, 
       
  1547 			TUint32 aNotificationType = /*ENotifyAdd | ENotifyModify |*/ ENotifyRemove,
       
  1548 			CMdENamespaceDef* aNamespaceDef = NULL)= 0;
       
  1549 	/**
       
  1550 	 * Removes the specified relation observer from the session.
       
  1551 	 *
       
  1552 	 * @param aObserver  Observer.
       
  1553      * @param aNamespaceDef specified namespace (if namespace is NULL, the 
       
  1554      *                      default namespace is used)
       
  1555 	 */
       
  1556 	virtual void RemoveRelationItemObserverL(MMdERelationItemObserver& aObserver, 
       
  1557 			CMdENamespaceDef* aNamespaceDef = NULL) = 0;
       
  1558 	
       
  1559 	/**
       
  1560 	 * Adds a new realation present observer to the session. No duplicate observers are 
       
  1561      * allowed.
       
  1562      *
       
  1563 	 * @param aObserver   Observer.
       
  1564 	 * 
       
  1565      * @leave KErrAlreadyExists if the same observer has already been added
       
  1566 	 */
       
  1567 	virtual void AddRelationPresentObserverL(
       
  1568 			MMdERelationPresentObserver& aObserver) = 0;
       
  1569 
       
  1570 	/**
       
  1571 	 * Removes the specified relation present observer from the session.
       
  1572 	 *
       
  1573 	 * @param aObserver  observer
       
  1574 	 */
       
  1575 	virtual void RemoveRelationPresentObserverL(
       
  1576 			MMdERelationPresentObserver& aObserver)= 0;
       
  1577 
       
  1578 	/**
       
  1579 	 * Adds a new event observer to the session. No duplicate observers 
       
  1580      * are allowed.
       
  1581      *
       
  1582      * The following restrictions are placed on the condition nodes:
       
  1583      * - Only CMdEEventCondition nodes are allowed.
       
  1584      * - No nested logic conditions are allowed.
       
  1585 	 *
       
  1586 	 * @param aObserver   Observer.
       
  1587 	 * @param aCondition  Condition that the events, about which the observer
       
  1588 	 *                    wants to receive notifications, must fulfill
       
  1589 	 *                    or NULL, to receive notifications of all events.
       
  1590      * @param aNotificationType what event type (add or remove) should
       
  1591      *                          be notified to client
       
  1592      * @param aNamespaceDef specified namespace (if namespace is NULL, the 
       
  1593      *                      default namespace is used)
       
  1594      * 
       
  1595      * @leave KErrAlreadyExists if the same observer has already been added
       
  1596 	 */
       
  1597 	virtual void AddEventObserverL(MMdEEventObserver& aObserver,
       
  1598 			CMdECondition* aCondition = NULL, 
       
  1599 			TUint32 aNotificationType = ENotifyAdd | ENotifyRemove,
       
  1600 			CMdENamespaceDef* aNamespaceDef = NULL) = 0;
       
  1601 
       
  1602 	/**
       
  1603 	 * Removes the specified event observer from the session.
       
  1604 	 *
       
  1605 	 * @param aObserver  Observer.
       
  1606      * @param aNamespaceDef specified namespace (if namespace is NULL, the 
       
  1607      *                      default namespace is used)
       
  1608 	 */
       
  1609 	virtual void RemoveEventObserverL(MMdEEventObserver& aObserver, 
       
  1610 			CMdENamespaceDef* aNamespaceDef = NULL) = 0;
       
  1611 
       
  1612 
       
  1613     /* Methods for import/export */
       
  1614 
       
  1615 	/**
       
  1616 	 * Imports schemadata from file to default database.
       
  1617 	 *
       
  1618 	 * @param aFileName  filename where the schemadata to import is.
       
  1619 	 */
       
  1620 	virtual void ImportSchemaL( const TDesC& aFileName ) = 0;
       
  1621 
       
  1622 	/**
       
  1623 	 * Imports metadata from file to default database.
       
  1624 	 *
       
  1625 	 * @param aFileName  filename where the metadata to import is.
       
  1626 	 * @return The number of failed imports
       
  1627 	 */
       
  1628 	virtual TInt ImportMetadataL( const TDesC& aFileName ) = 0;
       
  1629 
       
  1630 	/**
       
  1631 	 * Imports metadata asynchronously from file to default database.
       
  1632 	 *
       
  1633 	 * @param aFileName Filename where the metadata to import is.
       
  1634 	 * @param aResult The number of failed imports and possible error code.
       
  1635 	 * @param aStatus Returned status of method call.
       
  1636 	 */
       
  1637 	virtual void ImportMetadata( const TDesC& aFileName, 
       
  1638 			TPckgBuf<TInt>& aResult, TRequestStatus& aStatus ) = 0;
       
  1639 
       
  1640 	/**
       
  1641 	 * Exports metadata to file.
       
  1642 	 *
       
  1643 	 * @param aFileName  filename where the metadata is to be exported.
       
  1644      * @param aNamespaceDef specified namespace (if namespace is NULL, the 
       
  1645      *                      default namespace is used), ownership doesn't 
       
  1646      *                      change
       
  1647      * @param aObjectDefs object types to export (if NULL all objects are 
       
  1648      *                    exported), ownership doesn't change
       
  1649      * @param aRelationDefs relation types to export (if NULL all relations 
       
  1650      *                      are exported), ownership doesn't change
       
  1651      * @param aEventDefs event types to export (if NULL all events are 
       
  1652      *                   exported), ownership doesn't change
       
  1653 	 */
       
  1654 	virtual void ExportMetadataL( const TDesC& aFileName, 
       
  1655 			const CMdENamespaceDef* aNamespaceDef = NULL, 
       
  1656 	        const RPointerArray<CMdEObjectDef>* aObjectDefs = NULL, 
       
  1657 	        const RPointerArray<CMdERelationDef>* aRelationDefs = NULL, 
       
  1658             const RPointerArray<CMdEEventDef>* aEventDefs = NULL ) = 0;
       
  1659 
       
  1660 	/**
       
  1661 	 * Exports metadata asynchronously to file.
       
  1662 	 *
       
  1663 	 * @param aFileName Filename where the metadata is to be exported.
       
  1664 	 * @param aStatus Returns the result code after the asynchronous call 
       
  1665      *                completes.
       
  1666 	 * @param aBuffer Serialized buffer of export types, must be valid until 
       
  1667 	 *                aStatus is completed and can be closed after that.
       
  1668      * @param aNamespaceDef Specified namespace (if namespace is NULL, the 
       
  1669      *                      default namespace is used), ownership doesn't 
       
  1670      *                      change.
       
  1671      * @param aObjectDefs Object types to export (if NULL all objects are 
       
  1672      *                    exported), ownership doesn't change.
       
  1673      * @param aRelationDefs Relation types to export (if NULL all relations 
       
  1674      *                      are exported), ownership doesn't change.
       
  1675      * @param aEventDefs Event types to export (if NULL all events are 
       
  1676      *                   exported), ownership doesn't change.
       
  1677 	 */
       
  1678 	virtual void ExportMetadataL( const TDesC& aFileName, 
       
  1679 			TRequestStatus& aStatus, RMdEDataBuffer& aBuffer, 
       
  1680         	const CMdENamespaceDef* aNamespaceDef = NULL, 
       
  1681 	        const RPointerArray<CMdEObjectDef>* aObjectDefs = NULL, 
       
  1682             const RPointerArray<CMdERelationDef>* aRelationDefs = NULL, 
       
  1683             const RPointerArray<CMdEEventDef>* aEventDefs = NULL ) = 0;
       
  1684 	/**
       
  1685 	 * Load whole schema from server side.
       
  1686 	 */
       
  1687 	virtual void LoadSchemaL() = 0;
       
  1688 
       
  1689 	/**
       
  1690 	 * Get engine session reference.
       
  1691 	 */
       
  1692     virtual RMdEEngineSession& EngineSession() = 0;
       
  1693 
       
  1694 	/**
       
  1695 	 * Get schema version's major and minor version.
       
  1696 	 *
       
  1697 	 * @param aMajorVersion returned major version
       
  1698 	 * @param aMinorVersion returned minor version
       
  1699 	 */
       
  1700 	virtual void GetSchemaVersionL(
       
  1701 			TInt& aMajorVersion, TInt& aMinorVersion) = 0;
       
  1702 
       
  1703 	/**
       
  1704 	 * Set object to "present" state by GUID.
       
  1705 	 *
       
  1706 	 * @param aGuidHigh Guid's high part
       
  1707 	 * @param aGuidLow Guid's low part
       
  1708 	 *
       
  1709 	 * @leave KErrNotFound MdE can't find object in "not present" state 
       
  1710 	 *                     with matching GUID
       
  1711 	 */
       
  1712 	virtual void SetObjectToPresentByGuidL( 
       
  1713 			const TInt64& aGuidHigh, const TInt64& aGuidLow ) = 0;
       
  1714 	
       
  1715 protected:
       
  1716 
       
  1717 	/* Constructors. */
       
  1718 
       
  1719 	/**
       
  1720 	 * Constructor.
       
  1721 	 */
       
  1722 	CMdESession();
       
  1723 
       
  1724 	/**
       
  1725 	 * Second-phase constructor.
       
  1726 	 */
       
  1727 	void SessionConstruct();
       
  1728 	};
       
  1729 
       
  1730 // includes only for client more convinient usage
       
  1731 #include <mdeitem.h>
       
  1732 #include <mdenamespacedef.h>
       
  1733 #include <mdepropertydef.h>
       
  1734 #include <mdeobjectdef.h>
       
  1735 #include <mderelationdef.h>
       
  1736 #include <mdeeventdef.h>
       
  1737 #include <mdeproperty.h>
       
  1738 #include <mdeobject.h>
       
  1739 #include <mderelation.h>
       
  1740 #include <mdeevent.h>
       
  1741 #include <mdedatabuffer.h>
       
  1742 
       
  1743 #endif  // __MDESESSION_H__