com.funambol.syncml.client
Class ConfigSyncSource

java.lang.Object
  extended by com.funambol.syncml.client.TrackableSyncSource
      extended by com.funambol.syncml.client.ConfigSyncSource
All Implemented Interfaces:
SyncSource

public class ConfigSyncSource
extends TrackableSyncSource

An implementation of TrackableSyncSource, providing the ability to sync Funambol's client configuration


Field Summary
 
Fields inherited from class com.funambol.syncml.client.TrackableSyncSource
allItems, config, delItems, filter, globalStatus, newItems, syncMode, tracker, updItems
 
Fields inherited from interface com.funambol.syncml.spds.SyncSource
ENCODING_B64, ENCODING_NONE, STATUS_CONNECTION_ERROR, STATUS_RECV_ERROR, STATUS_SEND_ERROR, STATUS_SERVER_ERROR, STATUS_SUCCESS
 
Constructor Summary
ConfigSyncSource(SourceConfig config, ChangesTracker tracker, StringKeyValueStore store)
          ConfigSyncSource constructor
 
Method Summary
 int addItem(SyncItem item)
          The purpose of this implementation is simply to notify the tracker.
 void beginSync(int syncMode)
          Called after SyncManager preparation and initialization just before start the synchronization of the SyncSource.
protected  void deleteAllItems()
          Physically delete all items
 int deleteItem(java.lang.String key)
          The purpose of this implementation is simply to notify the tracker.
 void endSync()
          Called just before committing the synchronization process by the SyncManager.
protected  java.util.Enumeration getAllItemsKeys()
           
protected  SyncItem getItemContent(SyncItem item)
           
 int updateItem(SyncItem item)
          The purpose of this implementation is simply to notify the tracker.
 
Methods inherited from class com.funambol.syncml.client.TrackableSyncSource
createSyncItem, dataReceived, getClientAddNumber, getClientDeleteNumber, getClientItemsNumber, getClientReplaceNumber, getConfig, getEncoding, getFilter, getLastAnchor, getListener, getName, getNextAnchor, getNextDeletedItem, getNextItem, getNextNewItem, getNextUpdatedItem, getServerItemsNumber, getSourceUri, getStatus, getSyncMode, getTracker, getType, setConfig, setFilter, setItemStatus, setLastAnchor, setListener, setNextAnchor, setServerItemsNumber, setTracker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigSyncSource

public ConfigSyncSource(SourceConfig config,
                        ChangesTracker tracker,
                        StringKeyValueStore store)
ConfigSyncSource constructor

Method Detail

beginSync

public void beginSync(int syncMode)
               throws SyncException
Description copied from interface: SyncSource
Called after SyncManager preparation and initialization just before start the synchronization of the SyncSource. The implementation must reset the all/new/upd/del item lists when this method is called by the sync engine.

Specified by:
beginSync in interface SyncSource
Overrides:
beginSync in class TrackableSyncSource
Parameters:
syncMode - the synchronization type: one of the values in sync4j.framework.core.AlertCode
Throws:
SyncException - in case of error. This will stop the sync process

endSync

public void endSync()
             throws SyncException
Description copied from interface: SyncSource
Called just before committing the synchronization process by the SyncManager. The SyncSource can stop the commit phase raising an exception here.

Specified by:
endSync in interface SyncSource
Overrides:
endSync in class TrackableSyncSource
Throws:
SyncException - in case of error, to stop the commit.

getAllItemsKeys

protected java.util.Enumeration getAllItemsKeys()
                                         throws SyncException
Specified by:
getAllItemsKeys in class TrackableSyncSource
Throws:
SyncException

addItem

public int addItem(SyncItem item)
            throws SyncException
Description copied from class: TrackableSyncSource
The purpose of this implementation is simply to notify the tracker. Classes that extends the TrackableSyncSource should invoke this method at the end of their processing in the addItem so that the tracker is properly updated. Otherwise they are in charge of notifying the tracker.

Specified by:
addItem in interface SyncSource
Overrides:
addItem in class TrackableSyncSource
Parameters:
item - is the item being added
Returns:
SUCCESS if the tracker was successfully updated, GENERIC_ERROR otherwise
Throws:
SyncException - if an unrecoverable error occur, to stop the sync

updateItem

public int updateItem(SyncItem item)
               throws SyncException
Description copied from class: TrackableSyncSource
The purpose of this implementation is simply to notify the tracker. Classes that extends the TrackableSyncSource should invoke this method at the end of their processing in the updateItem so that the tracker is properly updated. Otherwise they are in charge of notifying the tracker.

Specified by:
updateItem in interface SyncSource
Overrides:
updateItem in class TrackableSyncSource
Parameters:
item - is the item being updated
Returns:
SUCCESS if the tracker was successfully updated, GENERIC_ERROR otherwise
Throws:
SyncException - if an unrecoverable error occur, to stop the sync

deleteItem

public int deleteItem(java.lang.String key)
               throws SyncException
Description copied from class: TrackableSyncSource
The purpose of this implementation is simply to notify the tracker. Classes that extends the TrackableSyncSource should invoke this method at the end of their processing in the updateItem so that the tracker is properly updated. Otherwise they are in charge of notifying the tracker.

Specified by:
deleteItem in interface SyncSource
Overrides:
deleteItem in class TrackableSyncSource
Parameters:
key - is the key of the item being deleted
Returns:
SUCCESS if the tracker was successfully updated, GENERIC_ERROR otherwise
Throws:
SyncException - if an unrecoverable error occur, to stop the sync

getItemContent

protected SyncItem getItemContent(SyncItem item)
                           throws SyncException
Specified by:
getItemContent in class TrackableSyncSource
Throws:
SyncException

deleteAllItems

protected void deleteAllItems()
Description copied from class: TrackableSyncSource
Physically delete all items

Specified by:
deleteAllItems in class TrackableSyncSource


Copyright © 2001-2009 Funambol.