com.funambol.syncml.client
Interface ChangesTracker
- All Known Implementing Classes:
- CacheTracker
public interface ChangesTracker
This interface can be used by TrackableSyncSource to detect changes occourred
since the last synchronization. The API provides a basic implementation
in CacheTracker which detects changes comparing fingerprints.
Client can implement this interface and use it in the TrackableSyncSource if more
efficient methods are available.
Method Summary |
void |
begin(int syncMode)
This method allows implementations to get ready to return list of
changes. |
void |
empty()
Empty the tracker status. |
void |
end()
This method allows implementations to clean data. |
java.util.Enumeration |
getDeletedItems()
Returns the list of deleted items. |
int |
getDeletedItemsCount()
Returns the number of deleted items that will be returned by the getDeletedItems
method |
java.util.Enumeration |
getNewItems()
Returns the list of new items. |
int |
getNewItemsCount()
Returns the number of new items that will be returned by the getNewItems
method |
java.util.Enumeration |
getUpdatedItems()
Returns the list of updated items. |
int |
getUpdatedItemsCount()
Returns the number of updated items that will be returned by the getUpdatedItems
method |
boolean |
removeItem(SyncItem item)
Remove the given item from the list of changes |
void |
reset()
This method resets the list of changes. |
void |
setItemStatus(java.lang.String key,
int status)
Set an item status returned by the server as result of the
synchronization. |
void |
setSyncSource(TrackableSyncSource ss)
This method associates this tracker to the given Sync Source. |
setSyncSource
void setSyncSource(TrackableSyncSource ss)
- This method associates this tracker to the given Sync Source. This method
must be called once before using the tracker. The tracker is invalid
until this method is invoked.
begin
void begin(int syncMode)
throws TrackerException
- This method allows implementations to get ready to return list of
changes. An implementation may decide to detect all changes at this point
or not, the interface does not enforce any semantics on this.
The only requirement is that any change made before this method is
invoked must be part of the lists returned by other methods.
- Parameters:
syncMode
- The sync mode
- Throws:
TrackerException
end
void end()
throws TrackerException
- This method allows implementations to clean data. After this method is
invoked it is illegal to fetch list of changes. A new call to "begin" is
required first.
- Throws:
TrackerException
getNewItems
java.util.Enumeration getNewItems()
throws TrackerException
- Returns the list of new items. The list of new items is frozen when the
method is invoked, after this method returns any change is not part of
the list of new items returned. Changes that happen after this method
returns will be part of the next changes set.
There is no guarantee that the list will contain all the changes that
happened after the begin method was invoked. This is an implementation
choice, it is only guaranteed that the list includes all the changes at
the time "begin" was invoked.
- Returns:
- the list of new items as an Enumeration
of SyncItem
- Throws:
TrackerException
getNewItemsCount
int getNewItemsCount()
throws TrackerException
- Returns the number of new items that will be returned by the getNewItems
method
- Returns:
- the number of items
- Throws:
TrackerException
getUpdatedItems
java.util.Enumeration getUpdatedItems()
throws TrackerException
- Returns the list of updated items. The list of updated items is frozen when the
method is invoked, after this method returns any change is not part of
the list of new items returned. Changes that happen after this method
returns will be part of the next changes set.
There is no guarantee that the list will contain all the changes that
happened after the begin method was invoked. This is an implementation
choice, it is only guaranteed that the list includes all the changes at
the time "begin" was invoked.
- Returns:
- the list of updated items as an Enumeration
of SyncItem
- Throws:
TrackerException
getUpdatedItemsCount
int getUpdatedItemsCount()
throws TrackerException
- Returns the number of updated items that will be returned by the getUpdatedItems
method
- Returns:
- the number of items
- Throws:
TrackerException
getDeletedItems
java.util.Enumeration getDeletedItems()
throws TrackerException
- Returns the list of deleted items. The list of deleted items is frozen when the
method is invoked, after this method returns any change is not part of
the list of new items returned. Changes that happen after this method
returns will be part of the next changes set.
There is no guarantee that the list will contain all the changes that
happened after the begin method was invoked. This is an implementation
choice, it is only guaranteed that the list includes all the changes at
the time "begin" was invoked.
- Returns:
- the list of updated items as an Enumeration
of strings (SyncItem's keys)
- Throws:
TrackerException
getDeletedItemsCount
int getDeletedItemsCount()
throws TrackerException
- Returns the number of deleted items that will be returned by the getDeletedItems
method
- Returns:
- the number of items
- Throws:
TrackerException
setItemStatus
void setItemStatus(java.lang.String key,
int status)
throws TrackerException
- Set an item status returned by the server as result of the
synchronization. This method is needed by the tracker to decide
if an item can be removed from the list of changes or it has to be kept
for the next run
- Parameters:
key
- the item key (cannot be null)status
- the syncml status for this item
- Throws:
TrackerException
reset
void reset()
throws TrackerException
- This method resets the list of changes. The lists (new, upd, del) will be empty
immediately after this call is invoked.
- Throws:
TrackerException
removeItem
boolean removeItem(SyncItem item)
throws TrackerException
- Remove the given item from the list of changes
- Parameters:
item
- is the item to be removed
- Returns:
- true if an item was found and deleted
- Throws:
TrackerException
empty
void empty()
throws TrackerException
- Empty the tracker status. After this method is invoked all the items
currently present will be reported as new items.
- Throws:
TrackerException
Copyright © 2001-2009 Funambol.