Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget Class Reference

Inheritance diagram for org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget:

org.openmobileis.database.fastobjectdb.synchro.server.FODBSyncTarget List of all members.

Detailed Description

Title: OpenMobileIS project source
Description: Example of a FODBSyncTarget.

FODB synchronisation is done per collection. Each collection is synchronized independently. FODBSyncTarget is the server side collection synchro connector to the server database. In the example the server database is a HSQL db with one table. We use a JDBCBaseDataFactory that make SQL query and the mapping beween BaseData object and SQL in made by BaseDataFODBSyncTarget method. There is two type of synchronisation : * incrementale synchronisation: Terminal modification is updated server side and if everything is ok, server side modifications are send to the terminal and updated in the terminal. * full or complete synchronisation : Terminal modification is updated server side and if everything is ok, the terminal collection file is generated server side and send to the terminal and updated in one file copy. This mode is done for the terminal init database (first synchro) or when there is too much server side object getUpdateMaxNbRow(). When there is too much object it's more efficient to generate the object collection on the server side and to copy the collection file on the terminal than to update each object one at a time. getUpdateMaxNbRow() return the threshold. When there is more object to update, the synchronization is forced to be full for the collection.

Author:
Philippe Delrieu
Since:
JDK 1.1
Version:
1.0.

Definition at line 67 of file BaseDataFODBSyncTarget.java.

Public Member Functions

 BaseDataFODBSyncTarget ()
String getCollectionName ()
Object getCollectionObjectWithId (String id) throws OpenMSPException
 It is use by the synchro service to get an object from the database when it has to be updated on the terminal.
void updateCollectionObject (Object obj) throws OpenMSPException
 Implement the update part of the database.
void deleteCollectionObject (String id) throws OpenMSPException
 Implement the delete part of the database.
SynchroConflicResolver getConflicResolver ()
 When a conflic is detected, the synchro service use this conflic resolver to determine the action to do.
Array getAllCollectionObject () throws OpenMSPException
 It's call when a complete synchronisation is done to fill the terminal database with all object.
SynchroAtomicObject[] getAllModifiedAtomicObjectSince (long syncnumber) throws OpenMSPException
 Return all atomic object uid modified since specified syncnumber.
int getUpdateMaxNbRow ()
 Return the max number of row that update file can contains If more than max row must be updated on the PDA, a complete synchronisation will be started, the database file will be send.
void updateSynchroDB (FastObjectDB db) throws OpenMSPException
 call by synchronisation service during complete synchronisation to update the generated db collection.
void connect (Credential cred) throws UserNotFoundException, ServiceException
 call at the beginning of the collection synchronisation.
void disconnect ()
 call at the end of the collection synchronisation.


Member Function Documentation

void org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.connect Credential  cred  )  throws UserNotFoundException, ServiceException
 

call at the beginning of the collection synchronisation.

Parameters:
cred : synchronisation credential
Exceptions:
UserNotFoundException 
ServiceException 

Implements org.openmobileis.database.fastobjectdb.synchro.server.FODBSyncTarget.

Definition at line 215 of file BaseDataFODBSyncTarget.java.

void org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.deleteCollectionObject String  id  )  throws OpenMSPException
 

Implement the delete part of the database.

Call by the synchro service when a object has been deleted on the terminal.

Parameters:
id is the identifiant of the deleted object.
Exceptions:
OpenMSPException :throws when there is a database delete problem. The synchro collection will be in error in the terminal synchro journal. The id will come back in the next synchronisation.

Implements org.openmobileis.database.fastobjectdb.synchro.server.FODBSyncTarget.

Definition at line 148 of file BaseDataFODBSyncTarget.java.

References org.openmobileis.examples.server.database.JDBCBaseDataFactory.delete().

void org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.disconnect  ) 
 

call at the end of the collection synchronisation.

Parameters:
cred : synchronisation credential
Exceptions:
UserNotFoundException 
ServiceException 

Implements org.openmobileis.database.fastobjectdb.synchro.server.FODBSyncTarget.

Definition at line 221 of file BaseDataFODBSyncTarget.java.

Array org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.getAllCollectionObject  )  throws OpenMSPException
 

It's call when a complete synchronisation is done to fill the terminal database with all object.

If no complete synchronisation can occurs (getUpdateMaxNbRow() always return -1), the method is never call. So no implementation is needed. Complete synchronisation is a convenient way to optimize the terminal synchronisation. some time it's make less time to generate the Terminal complete collection on the server side than to synchronize all modifications.

Returns:
Return all the object of the collection for the user that initiate the collection.
Exceptions:
OpenMSPException : throws when there is a problem to invalidate the synchronisation. The synchro collection will be in error in the terminal synchro journal.

Implements org.openmobileis.database.fastobjectdb.synchro.server.FODBSyncTarget.

Definition at line 169 of file BaseDataFODBSyncTarget.java.

References org.openmobileis.common.util.collection.Array.add(), org.openmobileis.examples.server.database.JDBCBaseDataFactory.getAllBaseData(), and org.openmobileis.examples.simpleappli.data.BaseData.setData().

SynchroAtomicObject [] org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.getAllModifiedAtomicObjectSince long  syncnumber  )  throws OpenMSPException
 

Return all atomic object uid modified since specified syncnumber.

Syncnumber is a number incremented for each synchro request. It can be converted to a timestamp with the SyncNumberManager. It's preferable to use number increment for synchronisation than timestamp to avoid desynchronized clock problem. Terminal and server can be desynchronized at the system cloc level of a few second. A synchronisation can elapse less than a few second. This can leads to synchronisation problem that can be difficult to track.

Implements org.openmobileis.database.fastobjectdb.synchro.server.FODBSyncTarget.

Definition at line 190 of file BaseDataFODBSyncTarget.java.

References org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.getCollectionName().

String org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.getCollectionName  ) 
 

Returns:
the name to the terminal FODB collection.

Implements org.openmobileis.database.fastobjectdb.synchro.server.FODBSyncTarget.

Definition at line 85 of file BaseDataFODBSyncTarget.java.

Referenced by org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.getAllModifiedAtomicObjectSince().

Object org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.getCollectionObjectWithId String  id  )  throws OpenMSPException
 

It is use by the synchro service to get an object from the database when it has to be updated on the terminal.

Returns:
the collection object with the specified ID.

Implements org.openmobileis.database.fastobjectdb.synchro.server.FODBSyncTarget.

Definition at line 93 of file BaseDataFODBSyncTarget.java.

References org.openmobileis.examples.server.database.JDBCBaseDataFactory.getBaseData(), and org.openmobileis.examples.simpleappli.data.BaseData.setData().

SynchroConflicResolver org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.getConflicResolver  ) 
 

When a conflic is detected, the synchro service use this conflic resolver to determine the action to do.

We provide default conflic resolver behaviours.

See also:
org.openmobileis.synchro.algo.replication.AlwaysUpdateClientSynchroConflicResolver

org.openmobileis.synchro.algo.replication.AlwaysUpdateServerSynchroConflicResolver

Returns:
Return the conflic resolver use to manage synchro conflic.

Implements org.openmobileis.database.fastobjectdb.synchro.server.FODBSyncTarget.

Definition at line 161 of file BaseDataFODBSyncTarget.java.

int org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.getUpdateMaxNbRow  ) 
 

Return the max number of row that update file can contains If more than max row must be updated on the PDA, a complete synchronisation will be started, the database file will be send.

If return -1 (default implementation) max row in not taken into account (ie always update file)

Implements org.openmobileis.database.fastobjectdb.synchro.server.FODBSyncTarget.

Definition at line 201 of file BaseDataFODBSyncTarget.java.

void org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.updateCollectionObject Object  obj  )  throws OpenMSPException
 

Implement the update part of the database.

Call by the synchro service when a object has been modified on the terminal. There's only an update method, no insert because on the server side we can't know if it's an update on an insert. Because of synchronisation problems, a created object on the terminal can be synchronized two time. So for each modified object on the terminal you have to validate if it's already exist.

Parameters:
obj is the instance of the modified object.
Exceptions:
OpenMSPException : throws when there is a database update problem. The synchro collection will be in error in the terminal synchro journal. The object will come back in the next synchronisation.

Implements org.openmobileis.database.fastobjectdb.synchro.server.FODBSyncTarget.

Definition at line 114 of file BaseDataFODBSyncTarget.java.

References org.openmobileis.examples.server.database.JDBCBaseDataFactory.create(), org.openmobileis.common.util.database.ManagerDB.getConnection(), org.openmobileis.examples.simpleappli.data.BaseData.getData(), org.openmobileis.common.util.database.AbstractQueryManager.getDbManager(), org.openmobileis.examples.simpleappli.data.BaseData.getId(), and org.openmobileis.examples.server.database.JDBCBaseDataFactory.update().

void org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.updateSynchroDB FastObjectDB  db  )  throws OpenMSPException
 

call by synchronisation service during complete synchronisation to update the generated db collection.

Use to modifiy db objects before the db files are send to the Terminal. Empty is nothing has to ne done.

Parameters:
db the database collection (thedb contains only the synchronized collection).

Implements org.openmobileis.database.fastobjectdb.synchro.server.FODBSyncTarget.

Definition at line 208 of file BaseDataFODBSyncTarget.java.


The documentation for this class was generated from the following file:
Generated on Mon Jul 10 10:29:37 2006 for OpenMobileIS by  doxygen 1.4.4