org.openmobileis.synchro.openmsp.client
Class DefaultOpenMSPSyncListener

java.lang.Object
  extended byorg.openmobileis.synchro.openmsp.client.DefaultOpenMSPSyncListener
All Implemented Interfaces:
OpenMSPSyncListener
Direct Known Subclasses:
OpenMSPDBSyncListener, TestOpenMSSyncListener, TestSynchroListener

public abstract class DefaultOpenMSPSyncListener
extends java.lang.Object
implements OpenMSPSyncListener

Title: OpenMobileIS project source
Description: Default Synchro listener that handle OpenMS protocol for synchronisation. Provide helper classes to facilitate the use of OpenMS protocol. The synchroStatus is made persistent by using the ServicePropertiesManager.

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

Field Summary
 
Fields inherited from interface org.openmobileis.synchro.openmsp.client.OpenMSPSyncListener
SYNCHRO_FAILLED, SYNCHRO_OK
 
Constructor Summary
DefaultOpenMSPSyncListener()
           
 
Method Summary
protected static void addCredentialToCommand(Credential cred, RequestCommand command)
          Utility method that add the synchro credential to a RequestCommand.
 void endSync()
          Fire this event once the current synchro is ended
 boolean equals(java.lang.Object obj)
           
protected  JournalLogRenderer getJournalLogRenderer()
           
 int getSynchroStatus()
          Return the synchro status of the listener.
 int hashCode()
           
 boolean isSyncOK()
          return true if the synchronisation is OK for the listener.
 void notifySynchroFailure()
          The listener is called if the syncML command processing failed
protected  void receiveAddCommand(Credential cred, ContainerMessage addContainer, long newSyncNumber)
          Call when the server answer SYNC command container contains a ADD item.
protected  void receiveDeleteCommand(Credential cred, ContainerMessage deleteContainer, long newSyncNumber)
          Call when the server answer SYNC command container contains a DELETE item.
protected  void receiveGetCommand(Credential cred, ContainerMessage replaceContainer, long newSyncNumber)
          Call when the server answer SYNC command container contains a GET item.
protected  void receiveReplaceCommand(Credential cred, ContainerMessage replaceContainer, long newSyncNumber)
          Call when the server answer SYNC command container contains a REPLACE item.
 void receiveSyncCommand(ContainerMessage syncContainer, long newSyncNumber)
          Event sent when the sync manager receives Sync command openML messages from the server
protected  void receiveSyncItem(Credential cred, Item item, long newSyncNumber)
          Call when the server answer SYNC command container contains a SYNC item.
protected  void setSynchroStatus(int status)
          update the synchro status if the specified status is less than current synchro status (more serious status)
 void startSync(Credential cred, SynchroDescriptor synchrodescriptor)
          Fire this event once a synchro is starting
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openmobileis.synchro.openmsp.client.OpenMSPSyncListener
getSyncName, receiveMapCommand, receiveResultCommand, receiveStatusCommand, sendData
 

Constructor Detail

DefaultOpenMSPSyncListener

public DefaultOpenMSPSyncListener()
Method Detail

isSyncOK

public boolean isSyncOK()
Description copied from interface: OpenMSPSyncListener
return true if the synchronisation is OK for the listener.

Specified by:
isSyncOK in interface OpenMSPSyncListener

startSync

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

Specified by:
startSync in interface OpenMSPSyncListener
Throws:
OpenMSPException

endSync

public void endSync()
             throws OpenMSPException
Description copied from interface: OpenMSPSyncListener
Fire this event once the current synchro is ended

Specified by:
endSync in interface OpenMSPSyncListener
Throws:
OpenMSPException

getSynchroStatus

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

Specified by:
getSynchroStatus in interface OpenMSPSyncListener
See Also:
Status

notifySynchroFailure

public void notifySynchroFailure()
Description copied from interface: OpenMSPSyncListener
The listener is called if the syncML command processing failed

Specified by:
notifySynchroFailure in interface OpenMSPSyncListener

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

receiveSyncCommand

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

Specified by:
receiveSyncCommand in interface OpenMSPSyncListener
Throws:
OpenMSPException

addCredentialToCommand

protected static void addCredentialToCommand(Credential cred,
                                             RequestCommand command)
Utility method that add the synchro credential to a RequestCommand.


setSynchroStatus

protected void setSynchroStatus(int status)
update the synchro status if the specified status is less than current synchro status (more serious status)


getJournalLogRenderer

protected JournalLogRenderer getJournalLogRenderer()

receiveAddCommand

protected void receiveAddCommand(Credential cred,
                                 ContainerMessage addContainer,
                                 long newSyncNumber)
                          throws OpenMSPException
Call when the server answer SYNC command container contains a ADD item. Extends this method to process ADD item.

Throws:
OpenMSPException

receiveSyncItem

protected void receiveSyncItem(Credential cred,
                               Item item,
                               long newSyncNumber)
                        throws OpenMSPException
Call when the server answer SYNC command container contains a SYNC item. Extends this method to process SYNC item.

Throws:
OpenMSPException

receiveDeleteCommand

protected void receiveDeleteCommand(Credential cred,
                                    ContainerMessage deleteContainer,
                                    long newSyncNumber)
                             throws OpenMSPException
Call when the server answer SYNC command container contains a DELETE item. Extends this method to process DELETE item.

Throws:
OpenMSPException

receiveReplaceCommand

protected void receiveReplaceCommand(Credential cred,
                                     ContainerMessage replaceContainer,
                                     long newSyncNumber)
                              throws OpenMSPException
Call when the server answer SYNC command container contains a REPLACE item. Extends this method to process REPLACE item.

Throws:
OpenMSPException

receiveGetCommand

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

Throws:
OpenMSPException


Copyright 2005 e-Care. All Rights Reserved.