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
protected static java.lang.String ADD_ERROR_MESSAGE
           
protected static java.lang.String DELETE_ERROR_MESSAGE
           
protected static java.lang.String ITEM_ERROR_MESSAGE
           
protected static java.lang.String SYNC_ERROR_MESSAGE
           
protected static java.lang.String SYNC_UNAUTHORIZED_MESSAGE
           
protected static java.lang.String UPDATE_ERROR_MESSAGE
           
 
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()
           
 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
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.
 void receiveGetCommand(Credential cred, ContainerMessage replaceContainer, long newSyncNumber)
          Call when the server answer SYNC command container contains a GET item.
 void receiveMapCommand(ContainerMessage mapContainer)
          Event sent when the sync manager receives MAP command openML messages from the server
protected  void receiveReplaceCommand(Credential cred, ContainerMessage replaceContainer, long newSyncNumber)
          Call when the server answer SYNC command container contains a REPLACE item.
 void receiveResultCommand(ContainerMessage resultContainer, ContainerMessage initialCommand)
          Event sent when the sync manager receives RESULT 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
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, receiveStatusCommand, sendData
 

Field Detail

ADD_ERROR_MESSAGE

protected static java.lang.String ADD_ERROR_MESSAGE

UPDATE_ERROR_MESSAGE

protected static java.lang.String UPDATE_ERROR_MESSAGE

DELETE_ERROR_MESSAGE

protected static java.lang.String DELETE_ERROR_MESSAGE

ITEM_ERROR_MESSAGE

protected static java.lang.String ITEM_ERROR_MESSAGE

SYNC_ERROR_MESSAGE

protected static java.lang.String SYNC_ERROR_MESSAGE

SYNC_UNAUTHORIZED_MESSAGE

protected static java.lang.String SYNC_UNAUTHORIZED_MESSAGE
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

initListener

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

Specified by:
initListener in interface OpenMSPSyncListener
Throws:
OpenMSPException

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

public 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.

Specified by:
receiveGetCommand in interface OpenMSPSyncListener
Throws:
OpenMSPException

receiveMapCommand

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

Specified by:
receiveMapCommand in interface OpenMSPSyncListener
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

Specified by:
receiveResultCommand in interface OpenMSPSyncListener
Throws:
OpenMSPException


Copyright 2006 OpenMobileIS. All Rights Reserved.