org.openmobileis.synchro.openmsp.client
Interface OpenMSPSyncListener

All Known Implementing Classes:
DefaultOpenMSPSyncListener, EmptyOpenMSPSyncListener, LogsSynchroListener

public interface OpenMSPSyncListener

Title: OpenMobileIS project source
Description: Base classe that all processus involved in the synchronisation must implement. Synchro listener are managed by the SynchroManager. The sendData method is call for sending synchronisation data and receiveData is call if there is an answer to send data. Synchronisation end when no data is added to the send data container For each listener, the synchronisation protocol manage an unique id that identity the synchronisation session; see OpenMobile Synchronisation Protocol.

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

Field Summary
static int SYNCHRO_FAILLED
           
static int SYNCHRO_OK
           
 
Method Summary
 void endSync()
          Fire this event once the current synchro is ended
 int getSynchroStatus()
          Return the synchro status of the listener.
 java.lang.String getSyncName()
          Return the name used to identiy the of the listener in the synchro processus.
 void initListener()
          Call during listener registering.
 boolean isSyncOK()
          return true if the synchronisation is OK for the listener.
 void notifySynchroFailure()
          The listener is called if the syncML command processing failed
 void receiveGetCommand(Credential cred, ContainerMessage replaceContainer, long newSyncNumber)
          Call when the server answer container contains a GET command.
 void receiveMapCommand(ContainerMessage mapContainer)
          Event sent when the sync manager receives MAP command openML messages from the server
 void receiveResultCommand(ContainerMessage resultContainer, ContainerMessage initialCommand)
          Event sent when the sync manager receives RESULT openML messages from the server
 void receiveStatusCommand(Status statusCommande, ContainerMessage initialCommand)
          Event sent when the sync manager receives STATUS openML messages from the server
 void receiveSyncCommand(ContainerMessage syncContainer, long newSyncNumber)
          Event sent when the sync manager receives Sync command openML messages from the server
 void sendData(Message message)
          Event sent when the sync manager sends a openML message to the server The specified message is the message use to construct the synchro message This method fill the message with listener commande container.
 void startSync(Credential cred, SynchroDescriptor synchrodescriptor)
          Fire this event once a synchro is starting
 

Field Detail

SYNCHRO_OK

public static final int SYNCHRO_OK
See Also:
Constant Field Values

SYNCHRO_FAILLED

public static final int SYNCHRO_FAILLED
See Also:
Constant Field Values
Method Detail

sendData

public void sendData(Message message)
              throws OpenMSPException
Event sent when the sync manager sends a openML message to the server The specified message is the message use to construct the synchro message This method fill the message with listener commande container.

Throws:
OpenMSPException

getSyncName

public java.lang.String getSyncName()
Return the name used to identiy the of the listener in the synchro processus. This name correspond to the source in the OpenMS protocol.


notifySynchroFailure

public void notifySynchroFailure()
The listener is called if the syncML command processing failed


getSynchroStatus

public int getSynchroStatus()
Return the synchro status of the listener. The return value is defined by the OpenMSP Status class.

See Also:
Status

isSyncOK

public boolean isSyncOK()
return true if the synchronisation is OK for the listener.


startSync

public void startSync(Credential cred,
                      SynchroDescriptor synchrodescriptor)
               throws OpenMSPException
Fire this event once a synchro is starting

Throws:
OpenMSPException

endSync

public void endSync()
             throws OpenMSPException
Fire this event once the current synchro is ended

Throws:
OpenMSPException

receiveSyncCommand

public void receiveSyncCommand(ContainerMessage syncContainer,
                               long newSyncNumber)
                        throws OpenMSPException
Event sent when the sync manager receives Sync command openML messages from the server

Throws:
OpenMSPException

receiveMapCommand

public void receiveMapCommand(ContainerMessage mapContainer)
                       throws OpenMSPException
Event sent when the sync manager receives MAP command openML messages from the server

Throws:
OpenMSPException

receiveResultCommand

public void receiveResultCommand(ContainerMessage resultContainer,
                                 ContainerMessage initialCommand)
                          throws OpenMSPException
Event sent when the sync manager receives RESULT openML messages from the server

Throws:
OpenMSPException

receiveStatusCommand

public void receiveStatusCommand(Status statusCommande,
                                 ContainerMessage initialCommand)
                          throws OpenMSPException
Event sent when the sync manager receives STATUS openML messages from the server

Throws:
OpenMSPException

receiveGetCommand

public void receiveGetCommand(Credential cred,
                              ContainerMessage replaceContainer,
                              long newSyncNumber)
                       throws OpenMSPException
Call when the server answer container contains a GET command. Extends this method to process GET command.

Throws:
OpenMSPException

initListener

public void initListener()
                  throws OpenMSPException
Call during listener registering. The init occurs before the synchronisation. If an exception is throws the listener is not registered.

Throws:
ServiceException
OpenMSPException


Copyright 2006 OpenMobileIS. All Rights Reserved.