TestEvolutionSyncSource Class Reference

Inheritance diagram for TestEvolutionSyncSource:

Inheritance graph
[legend]
Collaboration diagram for TestEvolutionSyncSource:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 TestEvolutionSyncSource (const string &type, const EvolutionSyncSourceParams &params)
virtual int beginSync () throw ()
virtual int endSync () throw ()
virtual SyncItem * getFirstItem () throw ()
virtual SyncItem * getNextItem () throw ()
virtual SyncItem * getFirstNewItem () throw ()
virtual SyncItem * getNextNewItem () throw ()
virtual SyncItem * getFirstUpdatedItem () throw ()
virtual SyncItem * getNextUpdatedItem () throw ()
virtual SyncItem * getFirstDeletedItem () throw ()
virtual SyncItem * getNextDeletedItem () throw ()
virtual SyncItem * getFirstItemKey () throw ()
virtual SyncItem * getNextItemKey () throw ()
virtual void setItemStatus (const char *key, int status) throw ()
virtual int addItem (SyncItem &item) throw ()
virtual int updateItem (SyncItem &item) throw ()
virtual int deleteItem (SyncItem &item) throw ()
virtual int removeAllItems () throw ()
const char * getName () throw ()
virtual Databases getDatabases ()
virtual void open ()
virtual SyncItem * createItem (const string &uid)
virtual void close ()
virtual void exportData (ostream &out)
virtual string fileSuffix () const
virtual const char * getMimeType () const
virtual const char * getMimeVersion () const
virtual const char * getSupportedTypes () const
virtual void beginSyncThrow (bool needAll, bool needPartial, bool deleteLocal)
virtual void endSyncThrow ()
virtual int addItemThrow (SyncItem &item)
virtual int updateItemThrow (SyncItem &item)
virtual int deleteItemThrow (SyncItem &item)
virtual void logItem (const string &uid, const string &info, bool debug=false)
virtual void logItem (const SyncItem &item, const string &info, bool debug=false)

Public Attributes

auto_ptr< EvolutionSyncSourcem_source


Detailed Description

a wrapper class which automatically does an open() in the constructor and a close() in the destructor and ensures that the sync mode is "none" = testing mode

Definition at line 53 of file client-test-app.cpp.


Constructor & Destructor Documentation

TestEvolutionSyncSource::TestEvolutionSyncSource ( const string &  type,
const EvolutionSyncSourceParams params 
) [inline]


Member Function Documentation

virtual int TestEvolutionSyncSource::addItem ( SyncItem &  item  )  throw () [inline, virtual]

Called by the sync engine to add an item that the server has sent. The sync source is expected to add it to its database, then set the key to the local key assigned to the new item. Alternatively the sync source can match the new item against one of the existing items and return that key.

Parameters:
item the item as sent by the server
Returns:
SyncML status code

Reimplemented from EvolutionSyncSource.

Definition at line 90 of file client-test-app.cpp.

References m_source.

virtual int TestEvolutionSyncSource::addItemThrow ( SyncItem &  item  )  [inline, virtual]

Implements EvolutionSyncSource.

Definition at line 109 of file client-test-app.cpp.

References m_source.

virtual int TestEvolutionSyncSource::beginSync (  )  throw () [inline, virtual]

Called by the engine from inside SyncClient::sync() at the begin of the sync.

The SyncSource can do every initialization it needs. The server has been contacted, so in particular getSyncMode() can now be used to find out what the sync mode for this synchronization run will be. After this call the iterators for SyncItems must return valid results for the current sync mode.

The synchronization stops if this function return a non-zero value.

Returns:
- 0 on success, an error otherwise

Reimplemented from EvolutionSyncSource.

Definition at line 66 of file client-test-app.cpp.

References m_source.

virtual void TestEvolutionSyncSource::beginSyncThrow ( bool  needAll,
bool  needPartial,
bool  deleteLocal 
) [inline, virtual]

source specific part of beginSync() - throws exceptions in case of error

Parameters:
needAll fill m_allItems
needPartial fill m_new/deleted/modifiedItems
deleteLocal erase all items

Implements EvolutionSyncSource.

Definition at line 105 of file client-test-app.cpp.

References m_source.

virtual void TestEvolutionSyncSource::close (  )  [inline, virtual]

closes the data source so that it can be reopened

Just as open() it should not affect the state of the database unless some previous action requires it.

Implements EvolutionSyncSource.

Definition at line 99 of file client-test-app.cpp.

References m_source.

virtual SyncItem* TestEvolutionSyncSource::createItem ( const string &  uid  )  [inline, virtual]

Extract information for the item identified by UID and store it in a new SyncItem. The caller must free that item. May throw exceptions.

The information that has to be set in the new item is:

  • content
  • UID
  • mime type

Parameters:
uid identifies the item

Implements EvolutionSyncSource.

Definition at line 98 of file client-test-app.cpp.

References m_source.

virtual int TestEvolutionSyncSource::deleteItem ( SyncItem &  item  )  throw () [inline, virtual]

Called by the sync engine to update an item that the source already should have. The item's key is the local key of that item, no data is provided.

Parameters:
item the item as sent by the server

Reimplemented from EvolutionSyncSource.

Definition at line 92 of file client-test-app.cpp.

References m_source.

virtual int TestEvolutionSyncSource::deleteItemThrow ( SyncItem &  item  )  [inline, virtual]

Implements EvolutionSyncSource.

Definition at line 111 of file client-test-app.cpp.

References m_source.

virtual int TestEvolutionSyncSource::endSync (  )  throw () [inline, virtual]

Called by the engine from inside SyncClient::sync() at the end of the sync.

The SyncSource can do any needed commit action to save the state of the items. The engine commits to the server the changes applied in the transaction only if this function return 0.

FIXME: the return code is currently ignored by the sync engine

Returns:
- 0 on success, an error otherwise

Reimplemented from EvolutionSyncSource.

Definition at line 72 of file client-test-app.cpp.

References m_source.

virtual void TestEvolutionSyncSource::endSyncThrow (  )  [inline, virtual]

Implements EvolutionSyncSource.

Definition at line 108 of file client-test-app.cpp.

References m_source.

virtual void TestEvolutionSyncSource::exportData ( ostream &  out  )  [inline, virtual]

Dump all data from source unmodified into the given stream.

Implements EvolutionSyncSource.

Definition at line 100 of file client-test-app.cpp.

References m_source.

virtual string TestEvolutionSyncSource::fileSuffix (  )  const [inline, virtual]

file suffix for database files

Implements EvolutionSyncSource.

Definition at line 101 of file client-test-app.cpp.

References m_source.

virtual Databases TestEvolutionSyncSource::getDatabases (  )  [inline, virtual]

returns a list of all know data sources for the kind of items supported by this sync source

Implements EvolutionSyncSource.

Definition at line 96 of file client-test-app.cpp.

References m_source.

virtual SyncItem* TestEvolutionSyncSource::getFirstDeletedItem (  )  throw () [inline, virtual]

Return the first SyncItem of updated one. It is used in case of fast sync and retrieve the new data source content.

Reimplemented from EvolutionSyncSource.

Definition at line 85 of file client-test-app.cpp.

References m_source.

virtual SyncItem* TestEvolutionSyncSource::getFirstItem (  )  throw () [inline, virtual]

Return the first SyncItem of all. It is used in case of slow sync and retrieve the entire data source content.

Reimplemented from EvolutionSyncSource.

Definition at line 79 of file client-test-app.cpp.

References m_source.

virtual SyncItem* TestEvolutionSyncSource::getFirstItemKey (  )  throw () [inline, virtual]

Return the key of the first SyncItem of all. It is used in case of refresh sync and retrieve all the keys of the data source.

Reimplemented from EvolutionSyncSource.

Definition at line 87 of file client-test-app.cpp.

References m_source.

virtual SyncItem* TestEvolutionSyncSource::getFirstNewItem (  )  throw () [inline, virtual]

Return the first SyncItem of new one. It is used in case of fast sync and retrieve the new data source content.

Reimplemented from EvolutionSyncSource.

Definition at line 81 of file client-test-app.cpp.

References m_source.

virtual SyncItem* TestEvolutionSyncSource::getFirstUpdatedItem (  )  throw () [inline, virtual]

Return the first SyncItem of updated one. It is used in case of fast sync and retrieve the new data source content.

Reimplemented from EvolutionSyncSource.

Definition at line 83 of file client-test-app.cpp.

References m_source.

virtual const char* TestEvolutionSyncSource::getMimeType (  )  const [inline, virtual]

Returns the preferred mime type of the items handled by the sync source. Example: "text/x-vcard"

Implements EvolutionSyncSource.

Definition at line 102 of file client-test-app.cpp.

References m_source.

virtual const char* TestEvolutionSyncSource::getMimeVersion (  )  const [inline, virtual]

Returns the version of the mime type used by client. Example: "2.1"

Implements EvolutionSyncSource.

Definition at line 103 of file client-test-app.cpp.

References m_source.

const char* TestEvolutionSyncSource::getName (  )  throw () [inline]

Disambiguate getName(): we have inherited it from both SyncSource and AbstractSyncSourceConfig. Both must return the same string.

Reimplemented from EvolutionSyncSource.

Definition at line 94 of file client-test-app.cpp.

References m_source.

virtual SyncItem* TestEvolutionSyncSource::getNextDeletedItem (  )  throw () [inline, virtual]

Return the next SyncItem of updated one. It is used in case of fast sync and retrieve the new data source content.

Reimplemented from EvolutionSyncSource.

Definition at line 86 of file client-test-app.cpp.

References m_source.

virtual SyncItem* TestEvolutionSyncSource::getNextItem (  )  throw () [inline, virtual]

Return the next SyncItem of all. It is used in case of slow sync and retrieve the entire data source content.

Reimplemented from EvolutionSyncSource.

Definition at line 80 of file client-test-app.cpp.

References m_source.

virtual SyncItem* TestEvolutionSyncSource::getNextItemKey (  )  throw () [inline, virtual]

Return the key of the next SyncItem of all. It is used in case of refresh sync and retrieve all the keys of the data source.

Reimplemented from EvolutionSyncSource.

Definition at line 88 of file client-test-app.cpp.

References m_source.

virtual SyncItem* TestEvolutionSyncSource::getNextNewItem (  )  throw () [inline, virtual]

Return the next SyncItem of new one. It is used in case of fast sync and retrieve the new data source content.

Reimplemented from EvolutionSyncSource.

Definition at line 82 of file client-test-app.cpp.

References m_source.

virtual SyncItem* TestEvolutionSyncSource::getNextUpdatedItem (  )  throw () [inline, virtual]

Return the next SyncItem of updated one. It is used in case of fast sync and retrieve the new data source content.

Reimplemented from EvolutionSyncSource.

Definition at line 84 of file client-test-app.cpp.

References m_source.

virtual const char* TestEvolutionSyncSource::getSupportedTypes (  )  const [inline, virtual]

A string representing the source types (with versions) supported by the SyncSource. The string must be formatted as a sequence of "type:version" separated by commas ','. For example: "text/x-vcard:2.1,text/vcard:3.0". The version can be left empty, for example: "text/x-s4j-sifc:". Supported types will be sent as part of the DevInf.

Implements EvolutionSyncSource.

Definition at line 104 of file client-test-app.cpp.

References m_source.

virtual void TestEvolutionSyncSource::logItem ( const SyncItem &  item,
const string &  info,
bool  debug = false 
) [inline, virtual]

Implements EvolutionSyncSource.

Definition at line 113 of file client-test-app.cpp.

References m_source.

virtual void TestEvolutionSyncSource::logItem ( const string &  uid,
const string &  info,
bool  debug = false 
) [inline, virtual]

Implements EvolutionSyncSource.

Definition at line 112 of file client-test-app.cpp.

References m_source.

virtual void TestEvolutionSyncSource::open (  )  [inline, virtual]

Actually opens the data source specified in the constructor, will throw the normal exceptions if that fails. Should not modify the state of the sync source: that can be deferred until the server is also ready and beginSync() is called.

Implements EvolutionSyncSource.

Definition at line 97 of file client-test-app.cpp.

References m_source.

virtual int TestEvolutionSyncSource::removeAllItems (  )  throw () [inline, virtual]

The client library invokes this call to delete all local items. SyncSources derived from EvolutionSyncSource should take care of that when beginSyncThrow() is called with deleteLocal == true and thus do not need to implement this method. If a derived source doesn't do that, then the implementation of this call will simply iterate over all stored LUIDs and remove them.

Returns:
0 for success, non-zero for failure

Reimplemented from EvolutionSyncSource.

Definition at line 93 of file client-test-app.cpp.

References m_source.

virtual void TestEvolutionSyncSource::setItemStatus ( const char *  key,
int  status 
) throw () [inline, virtual]

Reimplemented from EvolutionSyncSource.

Definition at line 89 of file client-test-app.cpp.

References m_source.

virtual int TestEvolutionSyncSource::updateItem ( SyncItem &  item  )  throw () [inline, virtual]

Called by the sync engine to update an item that the source already should have. The item's key is the local key of that item.

Parameters:
item the item as sent by the server
Returns:
SyncML status code

Reimplemented from EvolutionSyncSource.

Definition at line 91 of file client-test-app.cpp.

References m_source.

virtual int TestEvolutionSyncSource::updateItemThrow ( SyncItem &  item  )  [inline, virtual]

Implements EvolutionSyncSource.

Definition at line 110 of file client-test-app.cpp.

References m_source.


Member Data Documentation


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

Generated on Sat Oct 18 17:17:06 2008 for SyncEvolution and Funambol by  doxygen 1.5.7.1