Contents Index Monitoring and canceling synchronization Using the progress viewer

UltraLite Static Java User's Guide
  Adding Non Data Access Features to UltraLite Applications
    Adding synchronization to your application
      Monitoring and canceling synchronization

Handling synchronization status information

The class that implements UlSynchObserver, the UlSynchStatus object holds synchronization status information. This object is filled by UltraLite with synchronization status information each time your updateSynchronizationStatus method is called.

The UlSynchStatus object has the following methods:

int getState()
int getTableCount()
int getTableIndex()
Object getUserData()
UlSynchOptions getSynchOptions()
UlSqlStmt getStatement()
int getErrorCode()
boolean isOKToContinue()
void cancelSynchronization()
Example 

The following code illustrates a very simple observer function:

void updateSynchronizationStatus( UlSynchStatus status )
{
    int state = status.getState();
    System.out.println( "Sync status: " + state );
    if( state == UlSynchStatus.SENDING_TABLE ||
       state == UlSynchStatus.RECEIVING_TABLE ){
          System.out.println( "send/receive table " +
          ( status.getTableIndex() + 1 ) +
            " of " + status.getTableCount() );
    }
}
CustDB example 

An example of an observer function is included in the CustDB sample application. The implementation in CustDB provides a dialog that displays synchronization progress and allows the user to cancel synchronization. The user-interface component makes the observer function platform specific.

The CustDB sample code is in the Samples\UltraLite\CustDB subdirectory of your SQL Anywhere directory. The observer function is contained in the platform-specific subdirectories of the CustDB directory.


Contents Index Monitoring and canceling synchronization Using the progress viewer