SyncClient Class Reference
[Client]

This class wraps the common operations executed by a typical client. More...

#include <SyncClient.h>

Inheritance diagram for SyncClient:
[legend]
Collaboration diagram for SyncClient:
[legend]

List of all members.

Public Member Functions

virtual int sync (AbstractSyncConfig &config, SyncSource **sources)
virtual int sync (AbstractSyncConfig &config, char **sourceNames=NULL)
 Execute a synchronization with sources that are chosen based on the sourceNames param or, if sourceNames is NULL, based on the configuration: in this case all available sources will be used.
SyncReportgetSyncReport ()
void setTransportAgent (TransportAgent *t)
 Sets a defined TransportAgent to be used during sync.
void setLastSyncResults (AbstractSyncConfig &config)
 Sets the last sync results in the passed config, and the last source resupt for all active sources in SyncReport.

Protected Member Functions

virtual int prepareSync (AbstractSyncConfig &)
 A callback into a derived class which is called after reading the SyncML configuration and before creating sources.
virtual int createSyncSource (const char *, const int, AbstractSyncSourceConfig *, SyncSource **source)
 A factory method that is used by the sync() call to create the sync sources that are to be synchronized.
virtual int beginSync (SyncSource **)
 Callback invoked after creating all sources.
virtual int endSync (SyncSource **)
 Callback invoked after the sync process.
virtual int continueAfterPrepareSync ()
 Callback invoked after the prepareSync function.
virtual int continueAfterSync ()
 Callback invoked after the sync function.

Protected Attributes

SyncReport syncReport
 The report of the synchronization process.
TransportAgent * transportAgent
 If not NULL, this TransportAgent will be used during sync.


Detailed Description

This class wraps the common operations executed by a typical client.

It contains default implementations for calls invoked by the library core to parameterize or control the synchronization. A client can override these calls by subclassing SyncClient and using an instance of its own class instead.

Warning: the library contains global data in several different places. Therefore it is not possible to execute multiple sessions in parallel.


Member Function Documentation

virtual int SyncClient::beginSync ( SyncSource **   )  [inline, protected, virtual]

Callback invoked after creating all sources.

Returns:
0 for success, an error code otherwise - an error code stops immediately

virtual int SyncClient::continueAfterPrepareSync (  )  [inline, protected, virtual]

Callback invoked after the prepareSync function.

Returns:
0 for success, an error code otherwise - an error code stops immediately

Reimplemented in WindowsSyncClient.

virtual int SyncClient::continueAfterSync (  )  [inline, protected, virtual]

Callback invoked after the sync function.

Returns:
: 0 for success, an error code otherwise

virtual int SyncClient::createSyncSource ( const char *  ,
const   int,
AbstractSyncSourceConfig ,
SyncSource **  source 
) [inline, protected, virtual]

A factory method that is used by the sync() call to create the sync sources that are to be synchronized.

Not used by the sync(SyncSource**) call.

Parameters:
name name of the sync source
pos position of the SyncSource in the SSConfig array (index: 0 - numSources-1)
config a pointer to the source's configuration: this includes all properties that the client library knows and uses itself (only valid during this call) This pointer is owned by AbstractSyncConfig, sources uses it to initialize the internal config by reference.
Return values:
source the sync source created by the client or NULL if there is no sync source currently associated with the config or it is inactive; instance is a new SyncSource* and it's freed by the caller (see finally)
Returns:
0 for success, an error code otherwise - an error code aborts the whole synchronization and the value of *source is ignored

virtual int SyncClient::endSync ( SyncSource **   )  [inline, protected, virtual]

Callback invoked after the sync process.

Returns:
: 0 for success, an error code otherwise

virtual int SyncClient::prepareSync ( AbstractSyncConfig  )  [inline, protected, virtual]

A callback into a derived class which is called after reading the SyncML configuration and before creating sources.

Not used by the sync(SyncSource**) call.

Parameters:
config a reference to SyncManager configuration can be used to read client specific properties
Returns:
0 for success, an error code otherwise - an error code aborts the whole synchronization

void SyncClient::setLastSyncResults ( AbstractSyncConfig config  ) 

Sets the last sync results in the passed config, and the last source resupt for all active sources in SyncReport.

The values are read from the SyncReport and SyncSourceReport array. This method is called at the end of sync, to save the last error informations.

void SyncClient::setTransportAgent ( TransportAgent *  t  ) 

Sets a defined TransportAgent to be used during sync.

Note: the passed pointer will be owned and deleted by the APIs, so it MUST NOT be deleted by the caller.

virtual int SyncClient::sync ( AbstractSyncConfig config,
char **  sourceNames = NULL 
) [virtual]

Execute a synchronization with sources that are chosen based on the sourceNames param or, if sourceNames is NULL, based on the configuration: in this case all available sources will be used.

  • calls prepareSync() to give a derived class the chance to setup syncing and get ready for creating sources
  • iterates over sources to sync, asks for the corresponding client source with createSource()
  • calls beginSync() to give the derived class a class to do after all sources have been configured successfully
  • executes the synchronization: call sync(sources**)

This version of the call is easier to use for clients whose sync sources are determined by the configuration or by an array of desired sources to sync

Parameters:
config,: the configuration to be used for this sync
sourceNames,: optional, a NULL terminated array of source names that we want to sync. If NULL, sources to sync are chosen from the configuration.
Returns:
0 on success, an error otherwise


Member Data Documentation

The report of the synchronization process.

Sources reports are initializated during sync(sources**) call.

TransportAgent* SyncClient::transportAgent [protected]

If not NULL, this TransportAgent will be used during sync.

Clients can set thir own TransportAgent calling method setTransportAgent(). Note: it's not owned by the SyncClient, if not NULL it will be deleted by SyncManager at the end of the sync.


The documentation for this class was generated from the following file:

Generated on Tue Apr 6 13:00:43 2010 for Funambol Outlook Plug-in Library by  doxygen 1.5.7.1