FileSyncSource Class Reference
[Sync Client]

This class extends the CacheSyncSource abstract class, implementing a plain file datastore. More...

#include <FileSyncSource.h>

Inheritance diagram for FileSyncSource:

Inheritance graph
[legend]
Collaboration diagram for FileSyncSource:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FileSyncSource (const WCHAR *name, AbstractSyncSourceConfig *sc)
void assign (FileSyncSource &s)
void setDir (const char *p)
 set/get the directory where to sync the files
const StringBuffer & getDir ()
EnumerationgetAllItemList ()
 Get the list of all the keys stored in a StringBuffer.
int removeAllItems ()
 Removes all the item of the sync source.
int insertItem (SyncItem &item)
 Called by the sync engine to add an item that the server has sent.
int modifyItem (SyncItem &item)
 Called by the sync engine to update an item that the source already should have.
int removeItem (SyncItem &item)
 Called by the sync engine to update an item that the source already should have.
void * getItemContent (StringBuffer &key, size_t *size)
 Get the content of an item given the key.

Detailed Description

This class extends the CacheSyncSource abstract class, implementing a plain file datastore.

All the files in a folder are synchronized with the server. Depending on the MIME type defined for the source (see SyncSourceConfig::getType()), this class can work in two ways:

for incoming items, the format of the file is detected by the content.


Member Function Documentation

Enumeration* FileSyncSource::getAllItemList (  )  [virtual]

Get the list of all the keys stored in a StringBuffer.

It reads all the files name in the directory. The directory is set in the sync source.

Implements CacheSyncSource.

int FileSyncSource::removeAllItems (  )  [virtual]

Removes all the item of the sync source.

It is called by the engine in the case of a refresh from server to clean all the client items before receiving the server ones.

Implements SyncSource.

int FileSyncSource::insertItem ( SyncItem &  item  )  [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

Implements CacheSyncSource.

int FileSyncSource::modifyItem ( SyncItem &  item  )  [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

Implements CacheSyncSource.

int FileSyncSource::removeItem ( SyncItem &  item  )  [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

Implements CacheSyncSource.

void* FileSyncSource::getItemContent ( StringBuffer &  key,
size_t *  size 
) [virtual]

Get the content of an item given the key.

It is used to populate the SyncItem before the engine uses it in the usual flow of the sync. It is used also by the itemHandler if needed (i.e. in the cache implementation)

Parameters:
key the local key of the item
size OUT: the size of the content

Implements CacheSyncSource.


The documentation for this class was generated from the following file:
Generated on Wed Jan 14 17:15:46 2009 for Funambol C++ Client Library by  doxygen 1.5.2