com.ibm.mobileservices.isync
Interface ISyncDriver

All Known Implementing Classes:
MIDPISyncProvider

public interface ISyncDriver

This interface represents the synchronization driver for performing data synchronization with the DB2 Everyplace Sync Server.


Method Summary
 void cancelSync()
          User callable cancel of synchronization operation.
 void close()
          Close the synchronization driver instance.
 java.lang.String getPref(int prefID)
          Deprecated. Use property version of createSyncService.
 void setPref(int prefID, java.lang.String value)
          Deprecated. Use property version of createSyncService.
 void setSyncListener(com.ibm.mobileservices.isync.event.ISyncListener listener)
          User implemented listener implementation to receive events in eventIssued method
 int sync()
          Synchronize all subscription sets that are enabled in the specified config store.
 int syncConfig()
          Synchronize the configuration to obtain subscription set worklist from the server.
 

Method Detail

syncConfig

public int syncConfig()
               throws ISyncException
Synchronize the configuration to obtain subscription set worklist from the server.

Returns:
  • RTN_SUCCEEDED
  • RTN_CANCELED
  • RTN_FAILED

Return status descriptions:

  • RTN_SUCCEEDED: Configuration synchronized successfully.
  • RTN_CANCELED: The synchronization has been canceled.
  • RTN_FAILED: Configuration sync has failed to synchronize.
Throws:
throws - ISyncException with code:
  • EXC_ILLEGAL_STATE
  • EXC_ILLEGAL_ARG
  • EXC_CONFIG_SYNC
  • EXC_AUTH_FAILED
  • EXC_INCOMP_VERSION
  • EXC_INVALID_SESSION
  • EXC_SYNC_GROUP
  • EXC_REGISTER_DEVICE
  • EXC_SERVER_FORBIDDEN
  • EXC_SERVER_NOT_FOUND
  • EXC_SERVER_ERROR
  • EXC_SERVER_NOT_AVAIL
  • EXC_NET_OPEN_LIB
  • EXC_NET_RESOLVE_HOST
  • EXC_NET_OPEN_CONN
  • EXC_NET_UNKNOWN
ISyncException

sync

public int sync()
         throws ISyncException
Synchronize all subscription sets that are enabled in the specified config store.

The sync method launches a synchronization session based on the given config store object. Initially, a subscription set is said to be in RESET mode, if it has never been synchronized before. When the sync engine performs synchronization on that subscription set, it will fetch a complete replica from the SyncServer, which is called a REFRESH operation.

After the refresh is completed, next time when the subscription set is synchronized again, the sync engine will simply synchronize the changed data, which is called a SYNC operation.

See implementations of ISyncDriver for specific information on details pertaining to this method.

Returns:
  • RTN_SUCCEEDED
  • RTN_CANCELED
  • RTN_FAILED

Return status descriptions:

  • RTN_SUCCEEDED: All subscription sets synchronized successfully.
  • RTN_CANCELED: The synchronization has been canceled.
  • RTN_FAILED: One or more subscription set(s) has failed to sync. If the config (the very first subscription set) fails to sync, the entire synchronization session is aborted. If one of the subscriptions in a subscription set fails to sync (due to conflicting data sent from this client in a previous sync session), the sync engine will skip to the next subscription set.
Throws:
throws - ISyncException with code:
  • EXC_ILLEGAL_STATE
  • EXC_ILLEGAL_ARG
  • EXC_CONFIG_SYNC
  • EXC_AUTH_FAILED
  • EXC_INCOMP_VERSION
  • EXC_INVALID_SESSION
  • EXC_SYNC_GROUP
  • EXC_REGISTER_DEVICE
  • EXC_SERVER_FORBIDDEN
  • EXC_SERVER_NOT_FOUND
  • EXC_SERVER_ERROR
  • EXC_SERVER_NOT_AVAIL
  • EXC_NET_OPEN_LIB
  • EXC_NET_RESOLVE_HOST
  • EXC_NET_OPEN_CONN
  • EXC_NET_UNKNOWN
ISyncException

cancelSync

public void cancelSync()
                throws ISyncException
User callable cancel of synchronization operation. When the cancel is detected the listener.eventIssued() callback is notified of the cancel with a event code of ISync.EVT_INF_SYNC_CANCELED. The sync methods will return ISync.RTN_CANCELED when the cancel is detected.

Throws:
throws - ISyncException with code:
  • EXC_ILLEGAL_STATE
ISyncException

setSyncListener

public void setSyncListener(com.ibm.mobileservices.isync.event.ISyncListener listener)
                     throws ISyncException
User implemented listener implementation to receive events in eventIssued method

Throws:
throws - ISyncException with code:
  • EXC_ILLEGAL_STATE
ISyncException

getPref

public java.lang.String getPref(int prefID)
                         throws ISyncException
Deprecated. Use property version of createSyncService.

Get the default value or user specified value of a preference. See setPref .

See ISync.PREF_* for legal values

Returns null if not found.

Parameters:
prefID - an int specifying the preference ID
Returns:
a String specifying the preference value; returns null if not found.
Throws:
throws - ISyncException with code of:
  • EXC_ILLEGAL_STATE
  • EXC_PREF_UNKNOWN_ID
  • EXC_PREF_LIMIT
  • EXC_PREF_ERROR
  • EXC_NOT_SUPPORTED
ISyncException
See Also:
setPref(int, java.lang.String)

setPref

public void setPref(int prefID,
                    java.lang.String value)
             throws ISyncException
Deprecated. Use property version of createSyncService.

Set a preference for this synchronization operation. Please refer to the driver implementation documentation for more details.

The set of preferences which must be specified is:

Throws:
throws - ISyncException with code of :
  • EXC_ILLEGAL_STATE
  • EXC_ILLEGAL_ARG
  • EXC_PREF_UNKNOWN_ID
  • EXC_PREF_ERROR
  • EXC_NOT_SUPPORTED

See Also Implementation specifiec drivers for more detailed documentation.

ISyncException

close

public void close()
           throws ISyncException
Close the synchronization driver instance.

Throws:
throws - ISyncException with code:
  • EXC_ILLEGAL_STATE
ISyncException


(c) Copyright IBM Corp. 2001, 2002, 2003. All Rights Reserved.