com.ibm.mobileservices.isync
Class ISyncManager

java.lang.Object
  |
  +--com.ibm.mobileservices.isync.ISyncManager

public class ISyncManager
extends java.lang.Object

Manages different client implementations of ISyncProvider and ISyncService, allowing applications to not compile in a specific client and allow access to all clients. Implementation similar to JDBC's DriverManager.

Sample Code

import com.ibm.mobileservices.isync.ISyncManager;

Class.forName("com.ibm.mobileservices.isync.db2j.DB2jISyncProvider");
provider = ISyncManager.getISyncProvider("isync:db2j:");
ISyncService service = provider.createSyncService("http://localhost:80", userProps);
ISyncConfig config = service.getConfigStore("");
ISyncDriver syncer = config.getSyncDriver();
syncer.sync();
syncer.close();
config.close();
service.close();


Field Summary
static java.lang.String ISYNC_DB2E_PROTOCOL
          Protocol for DB2e provider.
static java.lang.String ISYNC_DB2J_PROTOCOL
          Protocol for DB2j provider.
static java.lang.String ISYNC_DB2PE_PROTOCOL
          Protocol for DB2 PE provider.
 
Method Summary
static void deregisterProvider(ISyncProvider isyncP)
          Internal un-register provider with the manager.
static ISyncProvider getISyncProvider(java.lang.String uri)
          Returns an instance of ISyncProvider.
static java.util.Enumeration getISyncProviders()
          Gets a list of registered providers.
static ISyncService getISyncService(java.lang.String uri, java.lang.Object prop)
          Gets a synchronization service instance.
static void registerProvider(ISyncProvider isyncP)
          Internal register provider with the manager.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ISYNC_DB2E_PROTOCOL

public static final java.lang.String ISYNC_DB2E_PROTOCOL
Protocol for DB2e provider.

See Also:
Constant Field Values

ISYNC_DB2J_PROTOCOL

public static final java.lang.String ISYNC_DB2J_PROTOCOL
Protocol for DB2j provider.

See Also:
Constant Field Values

ISYNC_DB2PE_PROTOCOL

public static final java.lang.String ISYNC_DB2PE_PROTOCOL
Protocol for DB2 PE provider.

See Also:
Constant Field Values
Method Detail

registerProvider

public static void registerProvider(ISyncProvider isyncP)
Internal register provider with the manager.

Parameters:
isyncP - an instance of ISyncProvider.

deregisterProvider

public static void deregisterProvider(ISyncProvider isyncP)
Internal un-register provider with the manager.

Parameters:
isyncP - an instance of ISyncProvider.

getISyncProviders

public static java.util.Enumeration getISyncProviders()
Gets a list of registered providers.

Returns:
Enumeration of ISyncProvider instances.

getISyncProvider

public static ISyncProvider getISyncProvider(java.lang.String uri)
                                      throws ISyncException
Returns an instance of ISyncProvider.

Parameters:
uri - a String uri
Returns:
an ISyncProvider instance
Throws:
ISyncException - with code:
  • EXC_ILLEGAL_ARG

getISyncService

public static ISyncService getISyncService(java.lang.String uri,
                                           java.lang.Object prop)
                                    throws ISyncException
Gets a synchronization service instance. When the sync driver's sync method is invoked, it will establish a connection to uri, authenticating with user, and password obtained from the prop parameter. For uri, the maximum length is 48 characters for the server name/IP address and 5 characters for port number. Supported properties (with their maximum length):

Parameters:
uri - [protocol]+[url]
prop - Object which is an instance of Properties, user and password are used for the DB2 Everyplace Sync Server authentication. See specific implementations for what properties may be set. MIDP accepts a Hashtable since there are no Properties.
Returns:
a new ISyncService instance for use with ISyncConfigStore
Throws:
ISyncException - with code:
  • EXC_ILLEGAL_ARG
  • EXC_ILLEGAL_STATE
  • EXC_UNSUPPORTED_ENCODING

An example of how to use the propObj parameter:

Properties prop = new Properties():
prop.put("isync.user", "nurse1");
prop.put("isync.password", "nurse1");
prop.put("isync.encoding", "Cp1252");
prop.put("isync.trace", "detailed");
prop.put("isync.messagesize", "64000");
ISyncManager.getISyncService("jdbc:db2e:http://localhost:80", prop);
See Also:
ISyncConfigStore, ISync


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