|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SyncListener
This class represents a generic Sync Listener, an object that listens to the synchronization of a reporitory. The synchronization is a sequence of events that occour in a certain order. There are three different phases: 1) Connection set up 2) Modification exchange 3) Mapping The phases are encapsulated into a sync session which starts with a startSession and is terminated by an endSession. The phases are described in the SyncML specification and their order is fixed as all of them are mandatory. The Modification exchange phase is the most interesting from the point of view of the SyncListener, because it can be further split into more sub events. The modifications are exchanged with a sequence of send/receive sesssion. Each time modifications are about to be sent to the server a startSending event is generated. Then we can have an arbitrary sequence of itemAddSent, itemReplaceSent and itemDeleteSent. At the end of the sending step a endSending event is generated. Similarly for the receiving phase. The Modification exchange phase can thus be described as: MODIFICATION -> startSyncing (SEND RECEIVE)+ endSyncing SEND -> startSending [itemAddSent | itemReplaceSent | * itemDeleteSent]* endSending RECEIVE -> startReceiving [itemReceived | itemDeleted | itemUpdated | dataReceived]* endReceiving
Field Summary | |
---|---|
static int |
ITEMS_NUMBER_UNKNOWN
Used when the messages to send or received is not know to the mail protocol subsystem |
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(int status)
Invoked at the end of a session, before closing the connection with the remote server. |
void |
endSyncing()
Invoked at the end of the syncing phase |
void |
itemAddSent(java.lang.Object item)
Invoked each time an item added is sent to the server. |
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 |
itemReplaceSent(java.lang.Object item)
Invoked each time an item replaced is sent to the server. |
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 |
void |
startSyncing(int alertCode)
Invoked at the beginning of the syncing phase |
Field Detail |
---|
static final int ITEMS_NUMBER_UNKNOWN
Method Detail |
---|
void startSession()
void endSession(int status)
status
- gives an indication if the session was error free or if
one or more errors were encountered. The value is encoded as a
bit mask according to the value of the STATUS_* constants (see
above). If no error was encountered then status has the value
STATUS_SUCCESS.void startConnecting()
void endConnecting(int action)
action
- describes the action the server requires (this value is
repository dependent)void startSyncing(int alertCode)
alertCode
- is the code returned by the server at the end of the
connection phasevoid endSyncing()
void startMapping()
void endMapping()
void startReceiving(int number)
number
- number of items that will be sent during the
session, if known, or ITEMS_NUMBER_UNKNOWN otherwise.void endReceiving()
void itemReceived(java.lang.Object item)
item
- is the new value receivedvoid itemDeleted(java.lang.Object item)
itemId
- is the id of the value being removedvoid itemUpdated(java.lang.Object item, java.lang.Object update)
item
- is the item that changedupdate
- is an encoding (client depending) of the updatevoid itemUpdated(java.lang.Object item)
item
- is the item that changedvoid dataReceived(java.lang.String date, int size)
date
- is the timestampsize
- is the number of bytes receivedvoid startSending(int numNewItems, int numUpdItems, int numDelItems)
numNewItems
- number of new items to be sentnumUpdItems
- number of updated items to be sentnumDelItems
- number of deleted items to be sentvoid itemAddSent(java.lang.Object item)
void itemReplaceSent(java.lang.Object item)
void itemDeleteSent(java.lang.Object item)
void endSending()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |