|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.funambol.syncml.client.TrackableSyncSource
com.funambol.syncml.client.FileSyncSource
public class FileSyncSource
An implementation of TrackableSyncSource, providing the ability to sync briefcases (files). The source can handle both raw files and OMA files (file objects). By default the source formats items according to the OMA file object spec, but it is capable of receiving also raw files, if their MIME type is not OMA file objects.
Nested Class Summary | |
---|---|
protected class |
FileSyncSource.FileSyncItem
|
Field Summary | |
---|---|
protected java.lang.String |
directory
|
protected java.lang.String[] |
extensions
|
Fields inherited from class com.funambol.syncml.client.TrackableSyncSource |
---|
allItems, config, delItems, filter, globalStatus, newItems, syncMode, tracker, updItems |
Fields inherited from interface com.funambol.syncml.spds.SyncSource |
---|
ENCODING_B64, ENCODING_NONE, STATUS_CONNECTION_ERROR, STATUS_RECV_ERROR, STATUS_SEND_ERROR, STATUS_SERVER_ERROR, STATUS_SUCCESS |
Constructor Summary | |
---|---|
FileSyncSource(SourceConfig config,
ChangesTracker tracker,
java.lang.String directory)
FileSyncSource constructor: initialize source config |
Method Summary | |
---|---|
int |
addItem(SyncItem item)
Add an item to the local store. |
protected void |
applyFileObjectProperties(FileSyncSource.FileSyncItem fsi,
FileObjectOutputStream foos)
|
void |
beginSync(int syncMode)
Called after SyncManager preparation and initialization just before start the synchronization of the SyncSource. |
SyncItem |
createSyncItem(java.lang.String key,
java.lang.String type,
char state,
java.lang.String parent,
long size)
Creates a new SyncItem for the engine to store incoming items |
protected void |
deleteAllItems()
Physically delete all items |
int |
deleteItem(java.lang.String key)
Delete an item from the local store. |
boolean |
filterFile(java.lang.String name)
Return whether a given filename is filtered by the SyncSource. |
protected java.util.Enumeration |
getAllItemsKeys()
|
protected SyncItem |
getItemContent(SyncItem item)
TODO: is this still needed? This is still kind of strange, we don't really need to get the item content any longer but we just need to create a proper item from which the content can be read |
void |
setSupportedExtensions(java.lang.String[] extensions)
|
int |
updateItem(SyncItem item)
Update an item in the local store. |
Methods inherited from class com.funambol.syncml.client.TrackableSyncSource |
---|
dataReceived, endSync, getClientAddNumber, getClientDeleteNumber, getClientItemsNumber, getClientReplaceNumber, getConfig, getEncoding, getFilter, getLastAnchor, getListener, getName, getNextAnchor, getNextDeletedItem, getNextItem, getNextNewItem, getNextUpdatedItem, getServerItemsNumber, getSourceUri, getStatus, getSyncMode, getTracker, getType, setConfig, setFilter, setItemStatus, setLastAnchor, setListener, setNextAnchor, setServerItemsNumber, setTracker |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String directory
protected java.lang.String[] extensions
Constructor Detail |
---|
public FileSyncSource(SourceConfig config, ChangesTracker tracker, java.lang.String directory)
Method Detail |
---|
public void beginSync(int syncMode) throws SyncException
SyncSource
beginSync
in interface SyncSource
beginSync
in class TrackableSyncSource
syncMode
- the synchronization type: one of the values in
sync4j.framework.core.AlertCode
SyncException
- in case of error. This will stop the sync processprotected java.util.Enumeration getAllItemsKeys() throws SyncException
getAllItemsKeys
in class TrackableSyncSource
SyncException
public int addItem(SyncItem item) throws SyncException
addItem
in interface SyncSource
addItem
in class TrackableSyncSource
item
- the received item
SyncException
- if an error occurs while applying the file
attributespublic int updateItem(SyncItem item) throws SyncException
updateItem
in interface SyncSource
updateItem
in class TrackableSyncSource
item
- the received item
SyncException
- if an error occurs while applying the file
attributespublic int deleteItem(java.lang.String key) throws SyncException
deleteItem
in interface SyncSource
deleteItem
in class TrackableSyncSource
key
- the item key
SyncException
- if the operation fails for any reasonprotected SyncItem getItemContent(SyncItem item) throws SyncException
getItemContent
in class TrackableSyncSource
SyncException
public SyncItem createSyncItem(java.lang.String key, java.lang.String type, char state, java.lang.String parent, long size) throws SyncException
TrackableSyncSource
createSyncItem
in interface SyncSource
createSyncItem
in class TrackableSyncSource
key
- is the item keytype
- is the item typestate
- this item's stateparent
- is the item's parentsize
- is the item size
SyncException
protected void applyFileObjectProperties(FileSyncSource.FileSyncItem fsi, FileObjectOutputStream foos) throws java.io.IOException
java.io.IOException
protected void deleteAllItems()
TrackableSyncSource
deleteAllItems
in class TrackableSyncSource
public void setSupportedExtensions(java.lang.String[] extensions)
public boolean filterFile(java.lang.String name)
filename
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |