5 Synchronization Utilities for Java Sync Client

The following sections provide information on synchronization utilities for java sync client:

5.1 OSync Utility

OSync utility is used to do a synchronization for Java Sync client. The usage is given as follows:

Table 5-1 Usage of OSync Utility

Parameter Description

user, pwd, url

Username, password, server URL

-f

Use files to store temporary sync payload

-r

Enable resume

-ns

Do not save sync metadata files before sync

-sp

Save sync password in encrypted form in sync metadata files

-ssl

Use SSL over HTTP

-nnps

Do not download new publications

-fr

Force complete refresh

-cancel stage percent

Sync and cancel at stage and percent

-param par1=val1 par2=val2

Set parameters in ose.ini before sync, refer to Table 5-2 in Section 5.2, "SetParam Utility" for valid parameters in ose.ini.


OSync utility is supported for both Java SE client and Java ME (OJEC) client. For SE client, by default, OSync would do synchronization with SQLite JDBC Driver if you do not specify which JDBC driver to use. However, you can specify which JDBC drivers to use during synchronization by using OSync command below.

The following command is used to sync with the BDB drivers:

java -Djava.library.path=<path to BDB native and jdbc jni libraries> -cp .:osync_se.jar:jdbc.jar oracle.opensync.tools.OSync <USER_NAME> <PASSWORD> <SERVER_URL: e.g. MobileServerIp:MobileServerPort>  -param OSE.FILES=YES -param SQLITE.JDBC.DRIVER=SQLite.JDBCDriver  -param SQLITE.JDBC.URL_PFX=jdbc:sqlite:/

The following command is used to sync with the SQLite drivers:

java -cp .:osync_se.jar:sqlitejdbc-v053.jar oracle.opensync.tools.OSync <USER_NAME> <PASSWORD> <SERVER_URL: e.g. MobileServerIp:MobileServerPort>  -param OSE.FILES=YES -param SQLITE.JDBC.DRIVER=org.sqlite.JDBC -param SQLITE.JDBC.URL_PFX=jdbc:sqlite:

Another method to specify which JDBC drivers to use during synchronization is that you can creat an ose.ini file manually in the same dir as osync_se.jar and add below parameters to it before you invoke OSync utility. To sync with BDB JDBC driver, the corresponding parameters should be:

  • SQLITE.JDBC.DRIVER=SQLite.JDBCDriver

  • SQLITE.JDBC.URL_PFX=jdbc:sqlite:/

To sync with SQLite JDBC driver, the corresponding parameters should be:

  • SQLITE.JDBC.DRIVER=org.sqlite.JDBC

  • SQLITE.JDBC.URL_PFX=jdbc:sqlite:

For ME client, there is no SQLite option. You can use the above 2 methods to specify BDB JDBC driver only.

Another difference for ME client and SE client is that you must specify OSE.FILES=YES in arguments when you run OSync utility for ME client while it is optional for the SE client.

If your Mobile server URL starts with "https", you must specify NETWORK.DISABLE_SSL_CHECK = YES in the argument.

For more information, refer to javadoc of class oracle.opensync.tools.OSync.

5.2 SetParam Utility

SetParam utility is used to create and edit ose.ini, which is in the same dir as osync_se.jar. The supported parameters in ose.ini are given in the following table:

Table 5-2 Usage of SetParam Utility

Parameter Description

BGSYNC.DISABLE=YES|NO

Enable/Disable Sync Agent

OSE.RESUME=YES|NO

Use resume or not

OSE.FILES=YES|NO

Use file or not to store temporary sync payload

SQLITE.LIMIT_CONNECTIONS=YES|NO

Use limit number of database connections during sync to 2 (queue-based mode) or 1 (state-based mode). Only used for Blackberry client where OS limits number of database connections.

SQLITE.QUEUES=YES|NO

Use queue-based mode (YES) or state-based mode (NO).

SQLITE.DATA_DIRECTORY

Root of the client database directory (for example:/home/user/mobileclient/sqlite_db)

SQLITE.JDBC.DRIVER=org.sqlite.JDBC

Client JDBC Driver name

SQLITE.JDBC.URL_PFX=jdbc:sqlite:

Client JDBC URL prefix

BGSYNC.NET_WAIT_TIMEOUT=600000

Time interval to wait to check network status in syncagent in absence of network notifications. Default is 10000ms (10 seconds).

NETWORK.DISABLE_SSL_CHECK=YES|NO

Disable SSL Certificate check on the client. Needed if server uses self-signed certificates.


Usage:

java -cp .;osync_se.jar oracle.opensync.tools.SetParam parameter1 paramter2 

Example:

java -cp .;osync_se.jar oracle.opensync.tools.SetParam OSE.FILES=NO

You can invoke the utility in command line or call the included class methods in oracle.opensync.tools.SetParam from your own classes to programmatically set the parameters in ose.ini before the call to sync.

For more information, refer to javadoc of class oracle.opensync.tools.SetParam.

5.3 SyncConsole Utility

You can use SyncConsole utility to invoke a synchronization, set parameters in ose.ini and control syncagent for Java Sync client.

Usage:

  • To start it with BDB JDBC Driver:

    java -Djava.library.path=<path to BDB native and jdbc jni libraries> -cp .:osync_se.jar:jdbc.jar oracle.opensync.tools.SyncConsoleva
    
  • To start it with SQLite JDBC Driver:

    java -cp .:osync_se.jar:sqlitejdbc-v053.jar oracle.opensync.tools.SyncConsole
    

You can input commands once you start SyncConsole. The supported commands are as follows:

Table 5-3 Usage of SyncConsole Utility

Command Description

sync

Invokes oracle.opensync.tools.OSync to do a synchronization. You can refer to Section 5.1, "OSync Utility" for valid parameters for OSync.

status

Reports sync agent status.

start

Start Syncagent. The command will wait for syncagent to be started unless -nw or -nowait option is specified.

stop

Stop Syncagent. The command will wait for syncagent to be stopped unless -nw or -nowait option is specified.

pause

Pause Syncagent. The command will wait for syncagent to be paused unless -nw or -nowait option is specified.

resume

Resume Syncagent. The command will wait for syncagent to be resumed unless -nw or -nowait option is specified.

enable

Enables Sync Agent

disable

Disables Sync Agent. It would stop Sync Agent first and then Disable it. If you specify -nw or -nowait, it will disable immediately.

message

Invoking this command first time will add message handler to syncagent to dump syncagent messages into file named "SyncConsoleMsg.txt" in the working directory. Invoking this command second time will remove this message handler so that writing of syncagent messages will be stopped.

msg

The same as command "message".

setparam

Invokes oracle.opensync.tools.SetParam to set parameters in ose.ini. You can refer to Section 5.2, "SetParam Utility" for valid parameters for SetParam.

q

Exit SyncConsole process.

exit

The same as command "q".

quit

The same as command "q".


For example:

Sync Console>sync john john server_url