org.openmobileis.modules.common.database.jdbc
Class JDBCTerminalUserFODBSyncTarget

java.lang.Object
  extended byorg.openmobileis.modules.common.database.jdbc.JDBCTerminalUserFODBSyncTarget
All Implemented Interfaces:
FODBSyncTarget

public class JDBCTerminalUserFODBSyncTarget
extends java.lang.Object
implements FODBSyncTarget

Title: OpenMobileIS Project Description:

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

Field Summary
protected  TerminalUserJDBCQuery query
           
 
Constructor Summary
JDBCTerminalUserFODBSyncTarget(TerminalUserJDBCQuery q)
          Constructor for TerminalUserManager.
 
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 date)
          Return all atomic object uid modified since specified syncnumber.
 java.lang.String getCollectionName()
           
 java.lang.String getCollectionObjectId(java.lang.Object obj)
           
 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 notifyTerminalUserdelete(java.lang.String repId)
           
 void notifyTerminalUserUpdate(TerminalUser rep)
           
 void setSendSynchroMetaData(java.lang.Object metadata)
          Synchro meta data added to the synchro on the terminal side are given be the synchro process.
 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
 

Field Detail

query

protected TerminalUserJDBCQuery query
Constructor Detail

JDBCTerminalUserFODBSyncTarget

public JDBCTerminalUserFODBSyncTarget(TerminalUserJDBCQuery q)
Constructor for TerminalUserManager.

Method Detail

getCollectionName

public java.lang.String getCollectionName()
Specified by:
getCollectionName in interface FODBSyncTarget
Returns:
the name to the terminal FODB collection.

setSendSynchroMetaData

public void setSendSynchroMetaData(java.lang.Object metadata)
                            throws OpenMSPException
Synchro meta data added to the synchro on the terminal side are given be the synchro process. This method is call before all other synchro method.

Specified by:
setSendSynchroMetaData in interface FODBSyncTarget
Parameters:
metadata -
Throws:
OpenMSPException

getCollectionObjectWithId

public java.lang.Object getCollectionObjectWithId(java.lang.String id)
                                           throws OpenMSPException
Description copied from interface: FODBSyncTarget
It is use by the synchro service to get an object from the database when it has to be updated on the terminal.

Specified by:
getCollectionObjectWithId in interface FODBSyncTarget
Returns:
the collection object with the specified ID.
Throws:
OpenMSPException

updateCollectionObject

public void updateCollectionObject(java.lang.Object obj)
                            throws OpenMSPException
Description copied from interface: FODBSyncTarget
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.

Specified by:
updateCollectionObject in interface FODBSyncTarget
Parameters:
obj - is the instance of the modified object.
Throws:
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.

deleteCollectionObject

public void deleteCollectionObject(java.lang.String id)
                            throws OpenMSPException
Description copied from interface: FODBSyncTarget
Implement the delete part of the database. Call by the synchro service when a object has been deleted on the terminal.

Specified by:
deleteCollectionObject in interface FODBSyncTarget
Parameters:
id - is the identifiant of the deleted object.
Throws:
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.

getConflicResolver

public SynchroConflicResolver getConflicResolver()
Description copied from interface: FODBSyncTarget
When a conflic is detected, the synchro service use this conflic resolver to determine the action to do. We provide default conflic resolver behaviours.

Specified by:
getConflicResolver in interface FODBSyncTarget
Returns:
Return the conflic resolver use to manage synchro conflic.
See Also:
AlwaysUpdateClientSynchroConflicResolver, AlwaysUpdateServerSynchroConflicResolver

getAllCollectionObject

public Array getAllCollectionObject()
                             throws OpenMSPException
Description copied from interface: FODBSyncTarget
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.

Specified by:
getAllCollectionObject in interface FODBSyncTarget
Returns:
Return all the object of the collection for the user that initiate the collection.
Throws:
OpenMSPException - : throws when there is a problem to invalidate the synchronisation. The synchro collection will be in error in the terminal synchro journal.

getCollectionObjectId

public java.lang.String getCollectionObjectId(java.lang.Object obj)

getAllModifiedAtomicObjectSince

public SynchroAtomicObject[] getAllModifiedAtomicObjectSince(long date)
                                                      throws OpenMSPException
Description copied from interface: FODBSyncTarget
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.

Specified by:
getAllModifiedAtomicObjectSince in interface FODBSyncTarget
Throws:
OpenMSPException

getUpdateMaxNbRow

public int getUpdateMaxNbRow()
Description copied from interface: FODBSyncTarget
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)

Specified by:
getUpdateMaxNbRow in interface FODBSyncTarget

updateSynchroDB

public void updateSynchroDB(FastObjectDB db)
                     throws OpenMSPException
Description copied from interface: FODBSyncTarget
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.

Specified by:
updateSynchroDB in interface FODBSyncTarget
Parameters:
db - the database collection (thedb contains only the synchronized collection).
Throws:
OpenMSPException

connect

public void connect(Credential cred)
             throws UserNotFoundException,
                    ServiceException
Description copied from interface: FODBSyncTarget
call at the beginning of the collection synchronisation.

Specified by:
connect in interface FODBSyncTarget
Parameters:
cred - : synchronisation credential
Throws:
UserNotFoundException
ServiceException

disconnect

public void disconnect()
Description copied from interface: FODBSyncTarget
call at the end of the collection synchronisation.

Specified by:
disconnect in interface FODBSyncTarget

notifyTerminalUserUpdate

public void notifyTerminalUserUpdate(TerminalUser rep)
                              throws SynchroException
Throws:
SynchroException

notifyTerminalUserdelete

public void notifyTerminalUserdelete(java.lang.String repId)
                              throws SynchroException
Throws:
SynchroException


Copyright 2006 OpenMobileIS. All Rights Reserved.