com.funambol.syncml.spds
Class BasicSyncListener

java.lang.Object
  extended by com.funambol.syncml.spds.BasicSyncListener
All Implemented Interfaces:
SyncListener

public class BasicSyncListener
extends java.lang.Object
implements SyncListener

This class provides a basic implementation for a SyncListener. All methods are empty and users can easily extend this class to provide their own callbacks.


Field Summary
 
Fields inherited from interface com.funambol.syncml.spds.SyncListener
ACCESS_ERROR, BACKEND_AUTH_ERROR, BACKEND_ERROR, CANCELLED, CLIENT_ERROR, COMPRESSED_RESPONSE_ERROR, CONN_NOT_FOUND, CONNECTION_BLOCKED_BY_USER, DATA_NULL, DEVICE_FULL_ERROR, ERROR_RECEIVING_ITEMS, ERROR_SENDING_ITEMS, FORBIDDEN_ERROR, GENERIC_ERROR, ILLEGAL_ARGUMENT, INVALID_CREDENTIALS, ITEMS_NUMBER_UNKNOWN, READ_SERVER_RESPONSE_ERROR, SERVER_BUSY, SERVER_CONNECTION_REQUEST_ERROR, SERVER_ERROR, SERVER_READ_ERROR, SERVER_WRITE_ERROR, SMART_SLOW_SYNC_UNSUPPORTED, SUCCESS, URI_NOT_FOUND_ERROR, WRITE_SERVER_REQUEST_ERROR
 
Constructor Summary
BasicSyncListener()
           
 
Method Summary
 void dataReceived(java.lang.String date, int size)
          Invoked each time data is received from the server, with the timestamp and the size in bytes of the receive data.
 void endConnecting(int action)
          Invoked at the end of the login phase.
 void endMapping()
          Invoked at the end of the mapping phase.
 void endReceiving()
          Invoked at the end of the receiving phase
 void endSending()
          Invoked when the mail protocol subsystem has finished to send message.
 void endSession(SyncReport report)
          Invoked at the end of a session after the last message was exchanged (or an error occurred).
 void endSyncing()
          Invoked at the end of the syncing phase
 void itemAddChunkSent(java.lang.String key, java.lang.String parent, int size)
          Invoked when a chunk of a new item was sent
 void itemAddSendingEnded(java.lang.String key, java.lang.String parent, int size)
          Invoked when the sending of a new item has terminated
 void itemAddSendingStarted(java.lang.String key, java.lang.String parent, int size)
          Invoked when the sending of a new item has started
 void itemDeleted(java.lang.Object item)
          Invoked each time a message is deleted
 void itemDeleteSent(java.lang.Object item)
          Invoked each time an item deleted is sent to the server.
 void itemReceived(java.lang.Object item)
          Invoked each time a message is received and stored successfully in the client.
 void itemReplaceChunkSent(java.lang.String key, java.lang.String parent, int size)
          Invoked when a chunk of a replaced item was sent
 void itemReplaceSendingEnded(java.lang.String key, java.lang.String parent, int size)
          Invoked when the sending of a replaced item has terminated
 void itemReplaceSendingStarted(java.lang.String key, java.lang.String parent, int size)
          Invoked when the sending of a replaced item has started
 void itemUpdated(java.lang.Object item)
          Invoked when an item changes on the other side.
 void itemUpdated(java.lang.Object item, java.lang.Object update)
          Invoked when an item changes on the other side.
 void startConnecting()
          Invoked at the beginning of the login phase.
 void startMapping()
          Invoked at the beginning of the mapping phase.
 void startReceiving(int number)
          Invoked when items are ready to be received from the server.
 void startSending(int numNewItems, int numUpdItems, int numDelItems)
          Invoked before beginning to send items to the server.
 void startSession()
          Invoked at the beginning of the session, before opening the connection with the server
 boolean startSyncing(int alertCode, DevInf devInf)
          Invoked at the beginning of the syncing phase
 void syncStarted(int alertCode)
          Invoked at the beginning of the syncing phase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicSyncListener

public BasicSyncListener()
Method Detail

startSession

public void startSession()
Invoked at the beginning of the session, before opening the connection with the server

Specified by:
startSession in interface SyncListener

endSession

public void endSession(SyncReport report)
Invoked at the end of a session after the last message was exchanged (or an error occurred).

Specified by:
endSession in interface SyncListener
Parameters:
report - this is a summary of what happened during the sync, including the overall status.

startConnecting

public void startConnecting()
Invoked at the beginning of the login phase.

Specified by:
startConnecting in interface SyncListener

endConnecting

public void endConnecting(int action)
Invoked at the end of the login phase.

Specified by:
endConnecting in interface SyncListener
Parameters:
action - describes the action the server requires (this value is repository dependent)

syncStarted

public void syncStarted(int alertCode)
Invoked at the beginning of the syncing phase

Specified by:
syncStarted in interface SyncListener
Parameters:
alertCode - is the code returned by the server at the end of the connection phase

endSyncing

public void endSyncing()
Invoked at the end of the syncing phase

Specified by:
endSyncing in interface SyncListener

startReceiving

public void startReceiving(int number)
Invoked when items are ready to be received from the server.

Specified by:
startReceiving in interface SyncListener
Parameters:
number - number of items that will be sent during the session, if known, or ITEMS_NUMBER_UNKNOWN otherwise.

endReceiving

public void endReceiving()
Invoked at the end of the receiving phase

Specified by:
endReceiving in interface SyncListener

itemReceived

public void itemReceived(java.lang.Object item)
Invoked each time a message is received and stored successfully in the client.

Specified by:
itemReceived in interface SyncListener
Parameters:
item - is the new value received

itemDeleted

public void itemDeleted(java.lang.Object item)
Invoked each time a message is deleted

Specified by:
itemDeleted in interface SyncListener
Parameters:
itemId - is the id of the value being removed

itemUpdated

public void itemUpdated(java.lang.Object item,
                        java.lang.Object update)
Invoked when an item changes on the other side.

Specified by:
itemUpdated in interface SyncListener
Parameters:
item - is the item that has changed
update - is a description of the update (the semantics of this paramenter is completely SyncSource dependent)

itemUpdated

public void itemUpdated(java.lang.Object item)
Invoked when an item changes on the other side.

Specified by:
itemUpdated in interface SyncListener
Parameters:
item - is the item that changed

dataReceived

public void dataReceived(java.lang.String date,
                         int size)
Invoked each time data is received from the server, with the timestamp and the size in bytes of the receive data.

Specified by:
dataReceived in interface SyncListener
Parameters:
date - is the timestamp
size - is the number of bytes received

startSending

public void startSending(int numNewItems,
                         int numUpdItems,
                         int numDelItems)
Invoked before beginning to send items to the server.

Specified by:
startSending in interface SyncListener
Parameters:
numNewItems - number of new items to be sent
numUpdItems - number of updated items to be sent
numDelItems - number of deleted items to be sent

itemAddSendingStarted

public void itemAddSendingStarted(java.lang.String key,
                                  java.lang.String parent,
                                  int size)
Description copied from interface: SyncListener
Invoked when the sending of a new item has started

Specified by:
itemAddSendingStarted in interface SyncListener
Parameters:
key - is the item key
parent - is the item parent
size - is the item size (total size, regardless of chunking)

itemAddSendingEnded

public void itemAddSendingEnded(java.lang.String key,
                                java.lang.String parent,
                                int size)
Description copied from interface: SyncListener
Invoked when the sending of a new item has terminated

Specified by:
itemAddSendingEnded in interface SyncListener
Parameters:
key - is the item key
parent - is the item parent
size - is the item size (total size, regardless of chunking)

itemAddChunkSent

public void itemAddChunkSent(java.lang.String key,
                             java.lang.String parent,
                             int size)
Description copied from interface: SyncListener
Invoked when a chunk of a new item was sent

Specified by:
itemAddChunkSent in interface SyncListener
Parameters:
key - is the item key
parent - is the item parent
size - is the item size (chunk size)

itemReplaceSendingStarted

public void itemReplaceSendingStarted(java.lang.String key,
                                      java.lang.String parent,
                                      int size)
Description copied from interface: SyncListener
Invoked when the sending of a replaced item has started

Specified by:
itemReplaceSendingStarted in interface SyncListener
Parameters:
key - is the item key
parent - is the item parent
size - is the item size (total size, regardless of chunking)

itemReplaceSendingEnded

public void itemReplaceSendingEnded(java.lang.String key,
                                    java.lang.String parent,
                                    int size)
Description copied from interface: SyncListener
Invoked when the sending of a replaced item has terminated

Specified by:
itemReplaceSendingEnded in interface SyncListener
Parameters:
key - is the item key
parent - is the item parent
size - is the item size (total size, regardless of chunking)

itemReplaceChunkSent

public void itemReplaceChunkSent(java.lang.String key,
                                 java.lang.String parent,
                                 int size)
Description copied from interface: SyncListener
Invoked when a chunk of a replaced item was sent

Specified by:
itemReplaceChunkSent in interface SyncListener
Parameters:
key - is the item key
parent - is the item parent
size - is the item size (chunk size)

itemDeleteSent

public void itemDeleteSent(java.lang.Object item)
Invoked each time an item deleted is sent to the server.

Specified by:
itemDeleteSent in interface SyncListener

endSending

public void endSending()
Invoked when the mail protocol subsystem has finished to send message.

Specified by:
endSending in interface SyncListener

startMapping

public void startMapping()
Invoked at the beginning of the mapping phase.

Specified by:
startMapping in interface SyncListener

endMapping

public void endMapping()
Invoked at the end of the mapping phase.

Specified by:
endMapping in interface SyncListener

startSyncing

public boolean startSyncing(int alertCode,
                            DevInf devInf)
Invoked at the beginning of the syncing phase

Specified by:
startSyncing in interface SyncListener
Parameters:
alertCode - is the code returned by the server at the end of the connection phase
serverDevInf - is the server device info if they are provided by the server. The server can send its dev inf if they changed or if the client requested them (@see SyncManager.sync). This value may be null if the server did not provide its device information.
Returns:
true if the sync can proceed or null if the client wants to interrupt it


Copyright © 2001-2009 Funambol.