syncmlfw/ds/hostserver/dshostclient/inc/nsmldshostclientsession.h
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Client module of DS Host Servers
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __NSMLDSHOSTCLIENTSESSION_H__ 
       
    20 #define __NSMLDSHOSTCLIENTSESSION_H__
       
    21 
       
    22 // ------------------------------------------------------------------------------------------------
       
    23 // Includes
       
    24 // ------------------------------------------------------------------------------------------------
       
    25 #include <e32base.h>
       
    26 #include <e32std.h>
       
    27 #include <badesca.h>
       
    28 #include <SyncMLDef.h>
       
    29 #include <SmlDataProvider.h>
       
    30 #include <SyncMLDataFilter.h>
       
    31 
       
    32 // ------------------------------------------------------------------------------------------------
       
    33 // Class forwards
       
    34 // ------------------------------------------------------------------------------------------------
       
    35 struct TNSmlFilterCapData;
       
    36 class CNSmlFilter;
       
    37 class RSmlFilter;
       
    38 class RSmlFilterDef;
       
    39 class CNSmlDbCaps;
       
    40 struct TNSmlDPInformation;
       
    41 class RNSmlDbItemModificationSet;
       
    42 
       
    43 // ------------------------------------------------------------------------------------------------
       
    44 //	client for DS Host Servers.
       
    45 //
       
    46 //  @lib nsmldshostclient.lib
       
    47 // ------------------------------------------------------------------------------------------------
       
    48 class RNSmlDSHostClient : public RSessionBase
       
    49 	{
       
    50 	enum TNSmlDSItemState
       
    51 		{
       
    52 		ENSmlClosed,
       
    53 		ENSmlItemCreating,
       
    54 		ENSmlItemUpdating
       
    55 		};
       
    56 private:
       
    57 	// ------------------------------------------------------------------------------------------------
       
    58 	// Buffer + dynamic streams for that buffer. 
       
    59 	//
       
    60 	// @lib nsmldshostserver.lib
       
    61 	// ------------------------------------------------------------------------------------------------
       
    62 		struct TStreamBuffers
       
    63 			{
       
    64 			CBufBase* iBuffer;
       
    65 			RWriteStream* iWrite;
       
    66 			RReadStream* iRead;
       
    67 			};
       
    68 public: 
       
    69 	/**
       
    70 	* Connects client to Host Server.
       
    71 	* @param aServerName. The name of server.
       
    72 	* @param aVersion. The version of server.
       
    73 	* @return TInt. KErrNone or one of the system wide error codes.
       
    74 	*/
       
    75 	TInt Connect( const TDesC& aServerName, const TVersion& aVersion );
       
    76 	
       
    77 	/**
       
    78 	* Closes connection between client and Host Server.
       
    79 	*/
       
    80 	void Close();
       
    81 	
       
    82 	/**
       
    83 	* Creates chunk that is used to transfer data between client and server.
       
    84 	* @return TInt. KErrNone or one of the system wide error codes.
       
    85 	*/
       
    86 	TInt CreateChunk() const;
       
    87 	
       
    88 	/**
       
    89 	* Sends Chunk handle to SyncML DS Host Servers.
       
    90 	* @return TInt. KErrNone or one of the system wide error codes.
       
    91 	*/
       
    92 	TInt SendChunkHandle() const;
       
    93 	
       
    94 	/**
       
    95 	* Creates Data Providers.
       
    96 	* @param aIds. The array of IDs of Data Providers.
       
    97 	* @param aResultArray. The result for each Data Provider. KErrNone or one of the system wide error codes.
       
    98 	* 		 Order of results must be same as IDs of Data Providers.
       
    99 	*/
       
   100 	void CreateDataProvidersL( const RArray<TSmlDataProviderId>& aIds, RArray<TInt>& aResultArray );
       
   101 	
       
   102 	/**
       
   103 	* Creates all possible Data Providers.
       
   104 	* @param aIds. At return the array of IDs of Data Providers.
       
   105 	* @param aExceptIds. Those Data Providers are not created.
       
   106 	*/
       
   107 	void CreateAllDataProvidersL( RArray<TSmlDataProviderId>& aIds, const RArray<TSmlDataProviderId>& aExceptIds );
       
   108 	
       
   109 	/**
       
   110 	* fetches information on data provider
       
   111 	* The caller has the responsibility to free all the memory reserved for returned struct.
       
   112 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   113 	* @return TNSmlDPInformation*. Struct filled with fetched information. 
       
   114 	*/
       
   115 	TNSmlDPInformation* DataProviderInformationL( const TSmlDataProviderId aId, TInt& aResultCode ) const;
       
   116 	
       
   117 	/**
       
   118 	* Asks if Data Provider supports some operation.
       
   119 	* @param aOpId. The ID of Operation.
       
   120 	* @param aId. The ID of Data Provider.
       
   121 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   122 	* @return TBool, ETrue if operation is supported and EFalse if not.
       
   123 	*/
       
   124 	TBool SupportsOperationL( TUid aOpId, const TSmlDataProviderId aId, TInt& aResultCode ) const;
       
   125 	
       
   126 	/**
       
   127 	* Creates Data Store format of Data Provider.
       
   128 	* @param aDataStoreFormat. At return the datastore format of the Data Provider.
       
   129 	* @param aId. The ID of Data Provider.
       
   130 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   131 	* @return CNSmlDbCaps*.
       
   132 	*/
       
   133 	CNSmlDbCaps* StoreFormatL(  const TSmlDataProviderId aId, TInt& aResultCode );
       
   134 	
       
   135 	/**
       
   136 	* Creates list of Data Store names of Data Provider.
       
   137 	* @param aNameList. returns the names of datastores that the Data Provider can open.
       
   138 	* @param aId. The ID of Data Provider.
       
   139 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   140 	*/
       
   141 	void ListStoresL( CDesCArray* aNameList, const TSmlDataProviderId aId, TInt& aResultCode );
       
   142 	
       
   143 	/**
       
   144 	* Creates default name for Data Store of Data Provider.
       
   145 	* @param aId. The ID of Data Provider.
       
   146 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   147 	* @return HBufC* that includes default Data Store name.
       
   148 	*/
       
   149 	HBufC* DefaultStoreL( const TSmlDataProviderId aId, TInt& aResultCode ) const;
       
   150 			
       
   151 	/**
       
   152 	* This method returns the set of filters that can be used to send to the Sync Partner.
       
   153 	* @param aId. The ID of Data Provider.
       
   154 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   155 	* @return RPointerArray<CSyncMLFilter>*. Array, that includes filter.
       
   156 	*/
       
   157 	RPointerArray<CSyncMLFilter>* SupportedServerFiltersL( const TSmlDataProviderId aId, TSyncMLFilterMatchType& aMatchType, TSyncMLFilterChangeInfo& aChangeInfo, TInt& aResultCode ) const;
       
   158 	
       
   159 	/**
       
   160 	* This method updates dynamic filters up-to-date.
       
   161 	* @param aFilters. The array that includes filters
       
   162 	* @param aChangeInfo. The change information about changes that data provider did
       
   163 	* @param aId. The ID of Data Provider.
       
   164 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   165 	*/
       
   166 	void CheckServerFiltersL( const TSmlDataProviderId aId, RPointerArray<CSyncMLFilter>& aFilters, TSyncMLFilterChangeInfo& aChangeInfo, TInt& aResultCode ) const;
       
   167 	
       
   168 	/**
       
   169 	* This method checks what filters are supported by server.
       
   170 	* @param aServerDataStoreFormat. The store format of Sync Partner.
       
   171 	* @param aFilterInfoArr. Array of filter information
       
   172 	* @param aFilters. The array that includes filters
       
   173 	* @param aChangeInfo. The change information about changes that data provider did
       
   174 	* @param aId. The ID of Data Provider.
       
   175 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   176 	*/
       
   177 	void CheckSupportedServerFiltersL( const TSmlDataProviderId aId, const CNSmlDbCaps& aServerDataStoreFormat, const CArrayFix<TNSmlFilterCapData>& aFilterInfoArr, RPointerArray<CSyncMLFilter>& aFilters, TSyncMLFilterChangeInfo& aChangeInfo, TInt& aResultCode ) const;
       
   178 	
       
   179 	/**
       
   180 	* Get Filters.
       
   181 	* @param aId. The ID of Data Provider.
       
   182 	* @param aFilterArray. The filters to be used for the query generation
       
   183 	* @param aFilter. Results
       
   184 	* @param aMatchType. The filter match type to be used
       
   185 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   186 	*/	
       
   187 	void GetFilterL( const TSmlDataProviderId aId, const TDesC& aStoreName, const RPointerArray<CSyncMLFilter>& aFilterArray, CNSmlFilter*& aFilter, TSyncMLFilterMatchType aMatchType, TInt& aResultCode );
       
   188 	
       
   189 	/**
       
   190 	* Opens the data store specified by aStoreName asynchronously.
       
   191 	* @param aContext. Identifies the specific synchronisation relationship to use.
       
   192 	* @param aId. The ID of Data Provider.
       
   193 	* @param aStoreName. The name of the data store that is used.
       
   194 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   195 	*/
       
   196 	void OpenL( const TSmlDataProviderId aId, const TDesC& aStoreName, const TDesC& aServerId, const TDesC& aRemoteDB, TInt& aResultCode ) const;
       
   197 			
       
   198 	/**
       
   199 	* Cancel the current asynchronous request.
       
   200 	* @param aId. The ID of Data Provider.
       
   201 	* @param aStoreName. The name of the data store that is used.
       
   202 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   203 	*/
       
   204 	void CancelRequest( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   205 	
       
   206 	/**
       
   207 	* Starts the transaction mode.
       
   208 	* @param aId. The ID of Data Provider.
       
   209 	* @param aStoreName. The name of the data store that is used.
       
   210 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   211 	*/
       
   212 	void BeginTransaction( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   213 	
       
   214 	/**
       
   215 	* Method will be called at the end of a successful transaction.
       
   216 	* @param aId. The ID of Data Provider.
       
   217 	* @param aStoreName. The name of the data store that is used.
       
   218 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   219 	*/
       
   220 	void CommitTransaction( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   221 	
       
   222 	/**
       
   223 	* Method will be called to abort an ongoing transaction.
       
   224 	* @param aId. The ID of Data Provider.
       
   225 	* @param aStoreName. The name of the data store that is used.
       
   226 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   227 	*/
       
   228 	void RevertTransaction( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   229 	
       
   230 	/**
       
   231 	* Starts the batch mode.
       
   232 	* @param aId. The ID of Data Provider.
       
   233 	* @param aStoreName. The name of the data store that is used.
       
   234 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   235 	*/
       
   236 	void BeginBatch( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   237 	
       
   238 	/**
       
   239 	* Method will be called at the end of the batch mode.
       
   240 	* @param aResultArray is used to store result for each operation
       
   241 	*		 (in the order they were submitted) during batch.
       
   242 	* @param aId. The ID of Data Provider.
       
   243 	* @param aStoreName. The name of the data store that is used.
       
   244 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   245 	*/
       
   246 	void CommitBatchL( RArray<TInt>& aResultArray, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   247 	
       
   248 	/**
       
   249 	* Method will be called to abort an ongoing batch mode.
       
   250 	* @param aId. The ID of Data Provider.
       
   251 	* @param aStoreName. The name of the data store that is used.
       
   252 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   253 	*/
       
   254 	void CancelBatch( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   255 	
       
   256 	/**
       
   257 	* Sets the SyncML server (SyncPartner) Data Format
       
   258 	* @param aServerDataStoreFormat. The data store format of Sync Partner.
       
   259 	* @param aId. The ID of Data Provider.
       
   260 	* @param aStoreName. The name of the data store that is used.
       
   261 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   262 	*/
       
   263 	void SetRemoteDataStoreFormatL( const CNSmlDbCaps& aServerDataStoreFormat, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   264 	
       
   265 	/**
       
   266 	* Sets the SyncML server (SyncPartner) Data Format
       
   267 	* @param aServerMaxObjectSize. The maximum object size of Sync Partner.
       
   268 	* @param aId. The ID of Data Provider.
       
   269 	* @param aStoreName. The name of the data store that is used.
       
   270 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   271 	*/
       
   272 	void SetRemoteMaxObjectSizeL( TInt aServerMaxObjectSize, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   273 	
       
   274 	/**
       
   275 	* Gets the maximum object size of Data Store which is reported to the SyncML partner.
       
   276 	* @param aId. The ID of Data Provider.
       
   277 	* @param aStoreName. The name of the data store that is used.
       
   278 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   279 	* @return TInt. The maximum object size of Data Store.
       
   280 	*/
       
   281 	TInt MaxObjectSize( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode  ) const;
       
   282 	
       
   283 	/**
       
   284 	* Opens item at Data Store.
       
   285 	* @param aUid. The UID of item.
       
   286 	* @param aFieldChange. Data Provider change to ETrue if there is only some field changes at item.
       
   287 	* @param aSize. The Data Provider puts the size of item to this parameter.
       
   288 	* @param aParent. Data Provider puts the UID of parent of item to this parameter.
       
   289 	* @param aMimeType. Data Provider puts the mime type of item to this parameter.
       
   290 	* @param aMimeVer. Data Provider puts the mime version of item to this parameter.
       
   291 	* @param aId. The ID of Data Provider.
       
   292 	* @param aStoreName. The name of the data store that is used.
       
   293 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   294 	*/
       
   295 	void OpenItemL( TSmlDbItemUid aUid, TBool& aFieldChange, TInt& aSize, TSmlDbItemUid& aParent, HBufC8*& aMimeType, HBufC8*& aMimeVer, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   296 	
       
   297 	/**
       
   298 	* Creates new item to Data Store.
       
   299 	* @param aUid. The Data Provider puts the UID of new item to this parameter. It can be also put just after commit method.
       
   300 	* @param aSize. The size of new item.
       
   301 	* @param aParent. The UID of parent of new item.
       
   302 	* @param aMimeType. The mime type of new item.
       
   303 	* @param aMimeVer. The mime version of new item.
       
   304 	* @param aId. The ID of Data Provider.
       
   305 	* @param aStoreName. The name of the data store that is used.
       
   306 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   307 	*/
       
   308 	void CreateItemL( TSmlDbItemUid& aUid, TInt aSize, TSmlDbItemUid aParent, const TDesC8& aMimeType, const TDesC8& aMimeVer, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   309 	
       
   310 	/**
       
   311 	* Replaces old item at Data Store.
       
   312 	* @param aUid. The UID of item. If item is added to the Data Store then The Data Provider
       
   313 	*		 puts the UID of new item to this parameter. It can be also put just after commit method.
       
   314 	* @param aSize. The size of item.
       
   315 	* @param aParent. The UID of parent of item.
       
   316 	* @param aFieldChange. If this is true then replace is only partial,
       
   317 	* @param aId. The ID of Data Provider.
       
   318 	* @param aStoreName. The name of the data store that is used.
       
   319 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   320 	*/
       
   321 	void ReplaceItemL( TSmlDbItemUid aUid, TInt aSize, TSmlDbItemUid aParent, TBool aFieldChange, TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   322 	
       
   323 	/**
       
   324 	* Reads data from item at Data Store. Item must be opened before this method can be called.
       
   325 	* This method is called until aBuffer is not used totally or method leaves with KErrEof.
       
   326 	* @param aBuffer. The Data Provider puts readed data to this parameter,
       
   327 	* @param aId. The ID of Data Provider.
       
   328 	* @param aStoreName. The name of the data store that is used.
       
   329 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   330 	*/
       
   331 	void ReadItemL( TDes8& aBuffer, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   332 	
       
   333 	/**
       
   334 	* Writes data to item to Data Provider. CreateItemL or ReplaceItemL method must be called before
       
   335 	* this method can be called. This method is called until all data to current item is written.
       
   336 	* @param aData. The data that is written to item at Data Store,
       
   337 	* @param aId. The ID of Data Provider.
       
   338 	* @param aStoreName. The name of the data store that is used.
       
   339 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   340 	*/
       
   341 	void WriteItemL( const TDesC8& aData, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   342 	
       
   343 	/**
       
   344 	* After item is written to Data Provider it can be saved to the Data Store.
       
   345 	* This method can be called just after WriteItemL method.
       
   346 	* @param aId. The ID of Data Provider.
       
   347 	* @param aStoreName. The name of the data store that is used.
       
   348 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   349 	*/
       
   350 	void CommitItem( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   351 	
       
   352 	/**
       
   353 	* Closes opened item.
       
   354 	* This method can be called just if some item is open.
       
   355 	* @param aId. The ID of Data Provider.
       
   356 	* @param aStoreName. The name of the data store that is used.
       
   357 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   358 	*/
       
   359 	void CloseItem( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   360 	
       
   361 	/**
       
   362 	* Moves item to new location.
       
   363 	* @param aUid. The UID of item.
       
   364 	* @param aNewParent. The UID of new parent of item.
       
   365 	* @param aId. The ID of Data Provider.
       
   366 	* @param aStoreName. The name of the data store that is used.
       
   367 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   368 	*/
       
   369 	void MoveItemL( TSmlDbItemUid aUid, TSmlDbItemUid aNewParent, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   370 	
       
   371 	/**
       
   372 	* Deletes one item at Data Store permanently.
       
   373 	* @param aUid. The UID of item.
       
   374 	* @param aId. The ID of Data Provider.
       
   375 	* @param aStoreName. The name of the data store that is used.
       
   376 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   377 	*/
       
   378 	void DeleteItemL( TSmlDbItemUid aUid, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   379 	
       
   380 	/**
       
   381 	* Soft deletes one item at Data Store.
       
   382 	* @param aUid. The UID of item.
       
   383 	* @param aId. The ID of Data Provider.
       
   384 	* @param aStoreName. The name of the data store that is used.
       
   385 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   386 	*/
       
   387 	void SoftDeleteItemL( TSmlDbItemUid aUid, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   388 	
       
   389 	/**
       
   390 	* Deletes all items at Data Store permanently.
       
   391 	* @param aId. The ID of Data Provider.
       
   392 	* @param aStoreName. The name of the data store that is used.
       
   393 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   394 	*/
       
   395 	void DeleteAllItems( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   396 	
       
   397 	/**
       
   398 	* Checks if the Data Store has sync history. If not then slow sync is proposed to Sync Partner.
       
   399 	* @param aId. The ID of Data Provider.
       
   400 	* @param aStoreName. The name of the data store that is used.
       
   401 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   402 	* @return TBool. ETrue, if Data Store has sync history, EFalse otherwise.
       
   403 	*/
       
   404 	TBool HasSyncHistory( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   405 	
       
   406 	/**
       
   407 	* The Data Provider returns UIDs of items that are added after previous synchronization.
       
   408 	* If the Data Provider uses hierarchical synchronization then added folders must be placed
       
   409 	* first (from root to leaves) to UID set and finally items.
       
   410 	* @param aUidSet. The set of added items.
       
   411 	* @param aId. The ID of Data Provider.
       
   412 	* @param aStoreName. The name of the data store that is used.
       
   413 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   414 	*/
       
   415 	void AddedItemsL( RNSmlDbItemModificationSet& aUidSet, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   416 	
       
   417 	/**
       
   418 	* The Data Provider returns UIDs of items that are deleted after previous synchronization.
       
   419 	* If the Data Provider uses hierarchical synchronization then deleted items must be placed
       
   420 	* first to UID set and folders after items (from leaves to root).
       
   421 	* @param aUidSet. The set of deleted items.
       
   422 	* @param aId. The ID of Data Provider.
       
   423 	* @param aStoreName. The name of the data store that is used.
       
   424 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   425 	*/
       
   426 	void DeletedItemsL( RNSmlDbItemModificationSet& aUidSet, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   427 	
       
   428 	/**
       
   429 	* The Data Provider returns UIDs of items that are soft deleted after previous synchronization.
       
   430 	* If the Data Provider uses hierarchical synchronization then soft deleted items must be placed
       
   431 	* first to UID set and folders after items (from leaves to root).
       
   432 	* @param aUidSet. The set of soft deleted items.
       
   433 	* @param aId. The ID of Data Provider.
       
   434 	* @param aStoreName. The name of the data store that is used.
       
   435 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   436 	*/
       
   437 	void SoftDeleteItemsL( RNSmlDbItemModificationSet& aUidSet, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   438 	
       
   439 	/**
       
   440 	* The Data Provider returns UIDs of items that are modified after previous synchronization.
       
   441 	* If the Data Provider uses hierarchical synchronization then modified folders must be placed
       
   442 	* first (from root to leaves) to UID set and finally items.
       
   443 	* @param aUidSet. The set of modified items.
       
   444 	* @param aId. The ID of Data Provider.
       
   445 	* @param aStoreName. The name of the data store that is used.
       
   446 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   447 	*/
       
   448 	void ModifiedItemsL( RNSmlDbItemModificationSet& aUidSet, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   449 	
       
   450 	/**
       
   451 	* The Data Provider returns UIDs of items that are moved after previous synchronization.
       
   452 	* If the Data Provider uses hierarchical synchronization then moved folders must be placed
       
   453 	* first (from root to leaves) to UID set and finally items.
       
   454 	* @param aUidSet. The set of moved items.
       
   455 	* @param aId. The ID of Data Provider.
       
   456 	* @param aStoreName. The name of the data store that is used.
       
   457 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   458 	*/
       
   459 	void MovedItemsL( RNSmlDbItemModificationSet& aUidSet, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   460 			
       
   461 	/**
       
   462 	* The Data Provider returns UIDs of items that are added, deleted, modified, softdeleted or moved after previous synchronization.
       
   463 	* @param aUidSet. The set of items.
       
   464 	* @param aId. The ID of Data Provider.
       
   465 	* @param aStoreName. The name of the data store that is used.
       
   466 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   467 	*/
       
   468 	void AllItemsL( RNSmlDbItemModificationSet& aUidSet, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   469 	
       
   470 	/**
       
   471 	* Reset change info from the Data Provider. The following synchronization will be slow sync.
       
   472 	* @param aId. The ID of Data Provider.
       
   473 	* @param aStoreName. The name of the data store that is used.
       
   474 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   475 	*/
       
   476 	void ResetChangeInfo( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   477 	
       
   478 	/**
       
   479 	* This method is called after some changes are synchronized to Sync Partner. If some changes
       
   480 	* were synchronized correctly then those UIDs are included to aItems.
       
   481 	* @param aItems. The UIDs of items that were correctly synchronized to Sync Partner.
       
   482 	* @param aId. The ID of Data Provider.
       
   483 	* @param aStoreName. The name of the data store that is used.
       
   484 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   485 	*/
       
   486 	void CommitChangeInfoL( const MSmlDataItemUidSet& aItems, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode );
       
   487 	
       
   488 	/**
       
   489 	* This method is called after some changes are synchronized to Sync Partner. This method is used if
       
   490 	* all changes were synchronized correctly.
       
   491 	* @param aId. The ID of Data Provider.
       
   492 	* @param aStoreName. The name of the data store that is used.
       
   493 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   494 	*/
       
   495 	void CommitChangeInfo( const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const;
       
   496 	
       
   497 	/**
       
   498 	* Replaces the give old server ID with new one.
       
   499     * @param aOldServerId Old remote server ID.
       
   500 	* @param aNewValue New remote server ID.
       
   501 	* @param aResultCode. The result of method. KErrNone if everything goes correctly.
       
   502 	*/
       
   503 	void UpdateServerIdL( TDesC& aOldServerId, TDesC& aNewValue, TInt& aResultCode  );
       
   504 	
       
   505 private:
       
   506 	/**
       
   507 	* Starts Host Server.
       
   508 	* @param aServerExeName. The name of server.
       
   509 	* @return TInt. KErrNone or one of the system wide error codes.
       
   510 	*/
       
   511 	TInt LaunchServer( const TDesC& aServerName ) const;
       
   512 	
       
   513 	/**
       
   514 	* write stream with dynamic buffer.
       
   515 	* @return RWriteStream&. write stream to memory.
       
   516 	*/
       
   517 	TStreamBuffers* StreamBufferLC() const;
       
   518 	
       
   519 	/**
       
   520 	* handles clean up of stream buffer.
       
   521 	* @param aP. read stream.
       
   522 	*/
       
   523 	static void CleanupStreamBuffer( TAny* aP );
       
   524 	
       
   525 	/**
       
   526 	* Ensures that chunk has at least required size or max size of reserved memory.
       
   527 	* @param aRequiredSize. required size.
       
   528 	* 
       
   529 	*/
       
   530 	void AdjustChunkLC( TInt aRequiredSize ) const;
       
   531 	
       
   532 	/**
       
   533 	* Adjusts memory so that at least needed size is reserved.
       
   534 	* @param iNeededSize. Memory needed for chunk in bytes.
       
   535 	*/
       
   536 	void AdjustChunkIfNeededLC( TInt iNeededSize ) const;
       
   537 	
       
   538 	/**
       
   539 	* restores chunk memory.
       
   540 	* @param aP. pointer to TMemPtr
       
   541 	*/
       
   542 	static void CancelAdjust( TAny* aP );
       
   543 	
       
   544 	/**
       
   545 	* internalizes filters from stream
       
   546 	* @param aStream. source stream
       
   547 	* @param aFilters. filters read from stream.
       
   548 	*/
       
   549 	void InternalizeFiltersL( RReadStream& aStream, RPointerArray<CSyncMLFilter>& aFilters ) const;
       
   550 	
       
   551 	/**
       
   552 	* externalizes filters to stream
       
   553 	* @param aStream. target stream
       
   554 	* @param aFilters. filters to write.
       
   555 	*/
       
   556 	void ExternalizeFiltersL( RWriteStream& aStream, const RPointerArray<CSyncMLFilter>& aFilters ) const;
       
   557 	
       
   558 	/**
       
   559 	* creates filter from chunk
       
   560 	* @param aFilter. filter created
       
   561 	*/
       
   562 	void GetFilterFromChunkL( CNSmlFilter*& aFilter );
       
   563 	
       
   564 	void AddFilterPropertiesL( const RPointerArray<CSmlDataProperty>& properties, CNSmlFilter& aFilter ) const;
       
   565 
       
   566 private:
       
   567 
       
   568 	mutable RChunk					iChunk;				// Handle to chunk that is used to transfer data between client and server.
       
   569 	RPointerArray<TSmlDbItemUid> 	iAddedUidsBuffer;	// Added Uids are transferred back to client after Commit.
       
   570 	TSmlDbItemUid*					iAddedUidBuffer;	// Buffer for normal add command.
       
   571 	TInt							iMode;				// Normal, Batch or Transaction.
       
   572 	TNSmlDSItemState				iItemState;
       
   573 	};
       
   574 	
       
   575 #endif
       
   576 	
       
   577 // End of File