com.ibm.manplato.Threads
Class Synchronizer

java.lang.Object
  |
  +--com.ibm.manplato.Threads.Synchronizer
All Implemented Interfaces:
ConduitManager, java.lang.Runnable
Direct Known Subclasses:
NetSynchronizer

public class Synchronizer
extends java.lang.Object
implements java.lang.Runnable, ConduitManager

This class encapsulates the ManplatoSync synchronization engine as a seperate Runnable class, allowing it to be incorporated into multithreaded applications which listen to multiple synchronization ports at once.

Version:
$Rev$-$Date: 2001/07/30 15:03:12 $$State: Exp $
Author:
File Created By: Brad BARCLAY <bbarclay@ca.ibm.com>, Last Modified By: $Author: Yaztromo $

Inner Class Summary
(package private)  class Synchronizer.ConduitList
           
 
Field Summary
static int BACKUP_SYNC
           
 java.io.PrintWriter logStream
           
static int NORMAL_SYNC
           
static int RESTORE_SYNC
           
 boolean running
           
 java.io.PrintWriter statusStream
           
static java.lang.String version
           
 
Constructor Summary
protected Synchronizer()
          Insert the method's description here.
  Synchronizer(SLPTransportInterface transport, int syncSpeed, SynchronizerListener listener)
          Insert the method's description here.
 
Method Summary
 void appendToPalmSyncLog(java.lang.String text)
          Appends a string to the Palm's Sync Log.
protected  void finalize()
          Code to perform when this object is garbage collected.
 java.util.Vector getDBInfo()
          Retrieves the database info vector.
 DLPDatabaseInfo getDBInfo(java.lang.String s)
          Returns a database information object for the specified, named database.
 DLPVersion getDLPVersion()
          Retrieves the DLP version number.
 boolean getPopupState()
          Returns the desired popup state.
 DLPStorageInfo getStorageInfo()
          Retrieves the storage information object from the remote device.
 DLPSystemInfo getSystemInfo()
          Retrieves hardware system information from the remote device.
 DLPUserInfo getUserInfo()
          Retrieves the user info object for the remote device.
 boolean isModemListener()
          This method is used to determine if this ManplatoSync instance is listening to a serial port with a cradle, or a serial port with a modem attached.
 void postToLog(java.lang.String s)
          Posts the desired string to the synchronization log.
 void run()
          run method comment.
 void setLogStream(java.io.PrintStream stream)
          Insert the method's description here.
 void setLogStream(java.io.PrintWriter stream)
          Insert the method's description here.
 void setRestorePath(java.lang.String path)
          Sets the path to use for the Restore sync method.
 void setSpeed(int speed)
          Insert the method's description here.
 void setStatus(java.lang.String s)
          Insert the method's description here.
 void setStatusStream(java.io.PrintStream stream)
          Insert the method's description here.
 void setStatusStream(java.io.PrintWriter stream)
          Insert the method's description here.
 void stopSync()
          Insert the method's description here.
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public static final java.lang.String version

statusStream

public java.io.PrintWriter statusStream

logStream

public java.io.PrintWriter logStream

running

public volatile boolean running

NORMAL_SYNC

public static final int NORMAL_SYNC

BACKUP_SYNC

public static final int BACKUP_SYNC

RESTORE_SYNC

public static final int RESTORE_SYNC
Constructor Detail

Synchronizer

protected Synchronizer()
Insert the method's description here. Creation date: (09/04/00 11:46:48 PM)

Synchronizer

public Synchronizer(SLPTransportInterface transport,
                    int syncSpeed,
                    SynchronizerListener listener)
Insert the method's description here. Creation date: (04/03/00 1:24:35 AM)
Parameters:
transport - com.ibm.manplato.Transport.SLPTransportInterface
conduits - java.util.Vector
synctime - boolean
Method Detail

appendToPalmSyncLog

public void appendToPalmSyncLog(java.lang.String text)
Description copied from interface: ConduitManager
Appends a string to the Palm's Sync Log. To increase speed and reduce packet overhead, ManplatoSync does not write through each and every request to add something to the Palm's sync log. Instead, it collocts this information, and then sends it all at once at the end of sync. Data passed into this method should collect this data, and process it approperiately.
Specified by:
appendToPalmSyncLog in interface ConduitManager
Parameters:
text - java.lang.String

finalize

protected void finalize()
                 throws java.lang.Throwable
Code to perform when this object is garbage collected. Any exception thrown by a finalize method causes the finalization to halt. But otherwise, it is ignored.
Overrides:
finalize in class java.lang.Object

getDBInfo

public java.util.Vector getDBInfo()
Description copied from interface: ConduitManager
Retrieves the database info vector. At the start of synchronization, ManplatoSync queries all of the databases for their information, and stores them in a set of DLPDatabaseInfo blocks inside a Vector. Calls to this method return this vector. Note that the data within this vector may be slightly out of date, as other Conduits may have modified these databases since the database info vector was built.
Specified by:
getDBInfo in interface ConduitManager
Following copied from interface: com.ibm.manplato.ConduitManager
Returns:
a Vector containing DLPDatabaseInfo objects.

getDBInfo

public DLPDatabaseInfo getDBInfo(java.lang.String s)
                          throws DatabaseNotFoundException
Description copied from interface: ConduitManager
Returns a database information object for the specified, named database. This method will return the DLPDatabaseInfo object corresponding the the specified named database, if it exists. Note that in the typical ManplatoSync implementation, this data is retrieved from the database info Vector, as opposed to directly from the Palm, meaning the info can be slightly out of date. Conduits that need up-to-date info should query the database info directly.
Specified by:
getDBInfo in interface ConduitManager
Following copied from interface: com.ibm.manplato.ConduitManager
Parameters:
s - the database name to retrieve info for.
Returns:
the requested database info object.
Throws:
DatabaseNotFoundException - if the named database does not exist on this device.

getDLPVersion

public DLPVersion getDLPVersion()
Description copied from interface: ConduitManager
Retrieves the DLP version number. Some jCondiuts may want to call methods which are only available on specific versions of the DLP protocol. At the start of sync, ManplatoSync reads the DLP version number, and stores it for later use. This method will return this value.
Specified by:
getDLPVersion in interface ConduitManager
Returns:
com.ibm.manplato.Protocol.Util.DLPVersion

getPopupState

public boolean getPopupState()
Description copied from interface: ConduitManager
Returns the desired popup state. Some Conduits may want to display their own GUI progress panels. However, the user may find this visually distracting. This option should be queried by all Conduits that wish to popup a panel during sync to determine wether or not to display their panels. GUI synchronizers should set this to the value specified by the user. Note that non-GUI synchronizers should set this to false.
Specified by:
getPopupState in interface ConduitManager
Returns:
boolean

getStorageInfo

public DLPStorageInfo getStorageInfo()
Description copied from interface: ConduitManager
Retrieves the storage information object from the remote device. Typically, this data is read at the start of sync by the synchronization application. This method exposes this information for Conduits to read.
Specified by:
getStorageInfo in interface ConduitManager
Returns:
com.ibm.manplato.Protocol.Util.DLPStorageInfo

getSystemInfo

public DLPSystemInfo getSystemInfo()
Description copied from interface: ConduitManager
Retrieves hardware system information from the remote device.
Specified by:
getSystemInfo in interface ConduitManager
Returns:
com.ibm.manplato.Protocol.Util.DLPSystemInfo

getUserInfo

public DLPUserInfo getUserInfo()
Description copied from interface: ConduitManager
Retrieves the user info object for the remote device. User information is read and stored at the start of sync. This method allows Conduits to query this information.
Specified by:
getUserInfo in interface ConduitManager
Following copied from interface: com.ibm.manplato.ConduitManager
Returns:
the DLPUserInfo object associated with the user info on the remote device.

isModemListener

public boolean isModemListener()
This method is used to determine if this ManplatoSync instance is listening to a serial port with a cradle, or a serial port with a modem attached.
Specified by:
isModemListener in interface ConduitManager
Returns:
true if the attached serial device is a modem, false otherwise.

postToLog

public void postToLog(java.lang.String s)
Description copied from interface: ConduitManager
Posts the desired string to the synchronization log. Calls to this method add the specified string to the host-side synchronization log.
Specified by:
postToLog in interface ConduitManager
Parameters:
s - java.lang.String

run

public void run()
run method comment.
Specified by:
run in interface java.lang.Runnable

setLogStream

public void setLogStream(java.io.PrintStream stream)
Insert the method's description here. Creation date: (04/03/00 3:00:10 AM)
Parameters:
stream - java.io.PrintStream

setLogStream

public void setLogStream(java.io.PrintWriter stream)
Insert the method's description here. Creation date: (04/03/00 3:00:10 AM)
Parameters:
stream - java.io.PrintStream

setRestorePath

public void setRestorePath(java.lang.String path)
Sets the path to use for the Restore sync method.
Parameters:
path - the path to use for the restore method.

setSpeed

public void setSpeed(int speed)
Insert the method's description here. Creation date: (04/03/00 2:26:31 AM)
Parameters:
speed - int

setStatus

public void setStatus(java.lang.String s)
Insert the method's description here. Creation date: (04/03/00 12:57:46 AM)
Specified by:
setStatus in interface ConduitManager
Parameters:
s - java.lang.String

setStatusStream

public void setStatusStream(java.io.PrintStream stream)
Insert the method's description here. Creation date: (04/03/00 12:56:43 AM)
Parameters:
stream - java.io.PrintStream

setStatusStream

public void setStatusStream(java.io.PrintWriter stream)
Insert the method's description here. Creation date: (04/03/00 12:56:43 AM)
Parameters:
stream - java.io.PrintStream

stopSync

public void stopSync()
Insert the method's description here. Creation date: (04/03/00 2:32:34 AM)