|
SmartSync 1.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--li.netcat.smartsync.SmartSyncClient
This is the main entry point to SmartSync from the clients point of view. To start a synchronization,
construct a new instance of a SmartSyncClient
, modify it's properties and call the synchronize(...)
method. Example:
SmartSyncClient client = new SmartSyncClient(); client.setCompressionFlag(false); if (client.synchronize(new URL("http://localhost:8080/smartsync/SmartSyncServer"), new File("c:\\temp\\smartsync\\client"))) { System.out.printLn("update done"); } else { System.out.printLn("no new update available"); }
Field Summary | |
static int |
MODE_ARCHIVE
The archive mode causes the client to create a temporary directory for the update, and then rename the target directory to *_old and rename the temporary directory to the target. |
static int |
MODE_DIRECT
The direct mode causes the client to operate directly on the target directory |
static int |
MODE_EXTERNAL
This mode is used when the whole java virtual machine is also part of the target directory. |
Constructor Summary | |
SmartSyncClient()
Constructs a new instance of a SmartSyncClient and sets all properties to it's initial default. |
Method Summary | |
void |
addEventMonitor(EventMonitor monitor)
Adds an event monitor to the list of monitors. |
boolean |
getCompressionFlag()
Returns the compression flag. |
int |
getMode()
Returns the operation mode of the client. |
boolean |
getTaskSummaryFlag()
Returns the task summary flag. |
void |
removeEventMonitor(EventMonitor monitor)
Removes an event monitor from the list of monitors. |
void |
setCompressionFlag(boolean flag)
Sets the compression flag. |
void |
setMode(int mode)
Sets the operation mode of the client. |
void |
setTaskSummaryFlag(boolean flag)
Sets the task summary flag. |
boolean |
synchronize(java.net.URL remoteDirectory,
java.io.File localDirectory)
Synchronizes the given local directory with the given remote resource. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MODE_DIRECT
public static final int MODE_ARCHIVE
public static final int MODE_EXTERNAL
Constructor Detail |
public SmartSyncClient()
SmartSyncClient
and sets all properties to it's initial default.Method Detail |
public void addEventMonitor(EventMonitor monitor)
monitor
- The monitor to be added, not null
.public void removeEventMonitor(EventMonitor monitor)
monitor
- The monitor to be deleted.java.lang.IllegalArgumentException
- If the monitor is not in the list of monitors.public boolean getTaskSummaryFlag()
public void setTaskSummaryFlag(boolean flag)
flag
- The new value of the task summary flag. Specify false
to omit the task summary.public boolean getCompressionFlag()
public void setCompressionFlag(boolean flag)
flag
- The new value of the compression flag. Specify false
to turn off compression.public int getMode()
public void setMode(int mode)
mode
- One of the values MODE_*. The default is set to MODE_DIRECT.public boolean synchronize(java.net.URL remoteDirectory, java.io.File localDirectory) throws java.io.IOException
SmartSyncServer
(a servlet) that
represents a directory structure.This method does not create an own thread for communication.
remoteDirectory
- A URL that points to the remote resource.localDirectory
- The local directory that gets updated.true
, if an update occured, false otherwise.java.io.IOException
- If an input/output problem occured.
|
SmartSync 1.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |