com.funambol.client.engine
Class SyncEngine

java.lang.Object
  extended by com.funambol.client.engine.SyncEngine

public class SyncEngine
extends java.lang.Object

This class represents an engine for synchronizations. It wraps the APIs and in particular it is built on top of the SyncScheduler. This class has the following main goals: 1) Perform some basic checks before firing a sync. For example it checks if radio signal is good. These checks are platform dependent and not performed by the APIs 2) Incapsulate error handling and sync threading. When a sync is requested it is run in a separate thread, and this thread is monitored by the SyncEngine which intercepts exceptions and handle them 3) Support compression error recovering. If a sync throws an error because compression is not supported, then the sync is resumed without compression 4) Add a listener for the entire sync. Each sync source has its own listener for source specific events, but the SyncEngine has a different listener that generats events global to the entire synchronization.


Field Summary
protected  AppSyncSourceManager appSyncSourceManager
           
protected  Configuration configuration
           
protected  Customization customization
           
 
Constructor Summary
SyncEngine(Customization customization, Configuration configuration, AppSyncSourceManager appSyncSourceManager, NetworkStatus networkStatus)
           
 
Method Summary
 void cancelSync()
           
protected  SyncManager createManager(AppSyncSource source, SyncConfig config)
           
protected  void fireSync(SyncManager manager, SyncSource source, int syncMode, boolean askServerCaps)
           
 AppSyncSource getCurrentSource()
          Returns the source which is currently being synchronized.
 SyncEngineListener getListener()
          Gets the current listener.
 boolean isSynchronizing()
          Returns true iff a sync is in progress
 void setListener(SyncEngineListener listener)
           
 void setNetworkStatus(NetworkStatus networkStatus)
           
 void setSpawnThread(boolean value)
           
 void setTransportAgent(TransportAgent ta)
           
 void sync(java.lang.Object[] requestContent)
          SyncSchedulerListener callback.
 boolean synchronize(java.util.Vector sources)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

customization

protected Customization customization

appSyncSourceManager

protected AppSyncSourceManager appSyncSourceManager

configuration

protected Configuration configuration
Constructor Detail

SyncEngine

public SyncEngine(Customization customization,
                  Configuration configuration,
                  AppSyncSourceManager appSyncSourceManager,
                  NetworkStatus networkStatus)
Method Detail

setListener

public void setListener(SyncEngineListener listener)

getListener

public SyncEngineListener getListener()
Gets the current listener.


setSpawnThread

public void setSpawnThread(boolean value)

setNetworkStatus

public void setNetworkStatus(NetworkStatus networkStatus)

cancelSync

public void cancelSync()

setTransportAgent

public void setTransportAgent(TransportAgent ta)

sync

public void sync(java.lang.Object[] requestContent)
SyncSchedulerListener callback. This method is invoked when a sync programmed in the SyncScheduler shall be fired.


isSynchronizing

public boolean isSynchronizing()
Returns true iff a sync is in progress


getCurrentSource

public AppSyncSource getCurrentSource()
Returns the source which is currently being synchronized. This method returns a non null value only if isSynchronizing returns true. The method may return null even during a synchronization. In particular a synchronization is requested and this immediately triggers the "isSynchronizing" but the currentSource is not set until the source really starts synchronizing. Users must be ready to handle null return values.


synchronize

public boolean synchronize(java.util.Vector sources)

createManager

protected SyncManager createManager(AppSyncSource source,
                                    SyncConfig config)

fireSync

protected void fireSync(SyncManager manager,
                        SyncSource source,
                        int syncMode,
                        boolean askServerCaps)


Copyright © 2001-2009 Funambol.