|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget
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.
Constructor Summary | |
BaseDataFODBSyncTarget()
|
Method Summary | |
void |
connect(Credential cred)
call at the beginning of the collection synchronisation. |
void |
deleteCollectionObject(java.lang.String id)
Implement the delete part of the database. |
void |
disconnect()
call at the end of the collection synchronisation. |
Array |
getAllCollectionObject()
It's call when a complete synchronisation is done to fill the terminal database with all object. |
SynchroAtomicObject[] |
getAllModifiedAtomicObjectSince(long syncnumber)
Return all atomic object uid modified since specified syncnumber. |
java.lang.String |
getCollectionName()
|
java.lang.Object |
getCollectionObjectWithId(java.lang.String id)
It is use by the synchro service to get an object from the database when it has to be updated on the terminal. |
SynchroConflicResolver |
getConflicResolver()
When a conflic is detected, the synchro service use this conflic resolver to determine the action to do. |
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 |
updateCollectionObject(java.lang.Object obj)
Implement the update part of the database. |
void |
updateSynchroDB(FastObjectDB db)
call by synchronisation service during complete synchronisation to update the generated db collection. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BaseDataFODBSyncTarget()
Method Detail |
public java.lang.String getCollectionName()
getCollectionName
in interface FODBSyncTarget
public java.lang.Object getCollectionObjectWithId(java.lang.String id) throws OpenMSPException
FODBSyncTarget
getCollectionObjectWithId
in interface FODBSyncTarget
OpenMSPException
public void updateCollectionObject(java.lang.Object obj) throws OpenMSPException
FODBSyncTarget
updateCollectionObject
in interface FODBSyncTarget
obj
- is the instance of the modified object.
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.public void deleteCollectionObject(java.lang.String id) throws OpenMSPException
FODBSyncTarget
deleteCollectionObject
in interface FODBSyncTarget
id
- is the identifiant of the deleted object.
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.public SynchroConflicResolver getConflicResolver()
FODBSyncTarget
getConflicResolver
in interface FODBSyncTarget
AlwaysUpdateClientSynchroConflicResolver
,
AlwaysUpdateServerSynchroConflicResolver
public Array getAllCollectionObject() throws OpenMSPException
FODBSyncTarget
getAllCollectionObject
in interface FODBSyncTarget
OpenMSPException
- : throws when there is a problem to invalidate the synchronisation. The synchro collection will be in error in the terminal synchro journal.public SynchroAtomicObject[] getAllModifiedAtomicObjectSince(long syncnumber) throws OpenMSPException
FODBSyncTarget
getAllModifiedAtomicObjectSince
in interface FODBSyncTarget
OpenMSPException
public int getUpdateMaxNbRow()
FODBSyncTarget
getUpdateMaxNbRow
in interface FODBSyncTarget
public void updateSynchroDB(FastObjectDB db) throws OpenMSPException
FODBSyncTarget
updateSynchroDB
in interface FODBSyncTarget
db
- the database collection (thedb contains only the synchronized collection).
OpenMSPException
public void connect(Credential cred) throws UserNotFoundException, ServiceException
FODBSyncTarget
connect
in interface FODBSyncTarget
cred
- : synchronisation credential
ServiceException
UserNotFoundException
public void disconnect()
FODBSyncTarget
disconnect
in interface FODBSyncTarget
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |