|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A SyncSource is responsible for storing and retrieving SyncItem objects from/to an external data source. Note that the SyncSource interface makes no assumptions about the underlying data source or about how data are formatted: each concrete implementation will use its specific storage and formae.
A SyncSource is not used directly by the host application, instead its methods are called by the synchronization engine during modifications analysis.
The SyncSource methods are designed to perform an efficient synchronization process, letting the source selecting the changed items instead of doing more complex field by field comparison. It is responsibility of the source developer to make sure that the getNew/Updated/DeletedSyncItems() methods return the correct values.
The configuration information required to set up a SyncSource is stored in the device management store under the context ./syncml/sources with the structure below:
.../{source name} + class + uri + type + ... other properties ...Where other properties are implementation specific and are set by the engine when the source is instantiated.
Method Summary | |
void |
beginSync(int syncMode)
Called after SyncManager preparation and initialization just before start the synchronization of the SyncSource. |
void |
commitSync()
Called just before committing the synchronization process by the SyncManager. |
SyncItem[] |
getAllSyncItems(java.security.Principal principal)
Returns all items in the data store belonging to the given principal. |
SyncItem[] |
getDeletedSyncItems(java.security.Principal principal,
java.util.Date since)
Returns all deleted items belonging to the given principal and deleted after the given point in time. |
java.lang.String |
getName()
Returns the name of the source |
SyncItem[] |
getNewSyncItems(java.security.Principal principal,
java.util.Date since)
Returns all new items belonging to the given principal and created after the given point in time. |
java.lang.String |
getSourceURI()
Returns the source URI |
java.lang.String |
getType()
Returns the type of the source (i.e. text/x-vcard) |
SyncItem[] |
getUpdatedSyncItems(java.security.Principal principal,
java.util.Date since)
Returns all updated items belonging to the given principal and modified after the given point in time. |
void |
removeSyncItem(java.security.Principal principal,
SyncItem syncItem)
Removes a SyncItem given its key. |
SyncItem |
setSyncItem(java.security.Principal principal,
SyncItem syncItem)
Replaces an existing SyncItem or adds a new SyncItem if it does not exist. |
Method Detail |
public java.lang.String getName()
public java.lang.String getSourceURI()
public java.lang.String getType()
public SyncItem[] getAllSyncItems(java.security.Principal principal) throws SyncException
principal
- not used, always null
SyncException
- in case of error (for instance if the
underlying data store runs into problems)public SyncItem[] getDeletedSyncItems(java.security.Principal principal, java.util.Date since) throws SyncException
principal
- the principal for which the data has to be considered
Null means all principalssince
- consider the changes since this point in time. Null means
all items regardless when they were changed.
SyncException
- in case of error (for instance if the
underlying data store runs into problems)public SyncItem[] getNewSyncItems(java.security.Principal principal, java.util.Date since) throws SyncException
principal
- not used, always nullsince
- consider the changes since this point in . Null means
all items regardless when they were changed.
SyncException
- in case of error (for instance if the
underlying data store runs into problems)public SyncItem[] getUpdatedSyncItems(java.security.Principal principal, java.util.Date since) throws SyncException
principal
- not used, always nullsince
- consider the changes since this point in time. Null means
all items regardless when they were changed.
SyncException
public void removeSyncItem(java.security.Principal principal, SyncItem syncItem) throws SyncException
principal
- not used, always nullsyncItem
- the item to remove
SyncException
- in case of error (for instance if the
underlying data store runs into problems)public SyncItem setSyncItem(java.security.Principal principal, SyncItem syncItem) throws SyncException
principal
- not used, always nullsyncItem
- the item to replace/add
SyncException
- in case of error (for instance if the
underlying data store runs into problems)public void beginSync(int syncMode) throws SyncException
syncMode
- the synchronization type: one of the values in
sync4j.framework.core.AlertCode
SyncException
- in case of error. This will stop the sync processpublic void commitSync() throws SyncException
SyncException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |