org.jSyncManager.API.Conduit
Class AbstractConduit
java.lang.Object
|
+--org.jSyncManager.API.Conduit.AbstractConduit
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- AbstractInstaller, Alerter, DefaultConduit, Deleter, Email, NotepadViewer, TextDump
- public abstract class AbstractConduit
- extends java.lang.Object
- implements java.io.Serializable
The abstract class representing a jConduit. All jConduits are derived from this class.
- Version:
- $Revision: 1.6 $
- Author:
- Brad BARCLAY <bbarclay@jsyncmanager.org>
Last modified by: $Author: dingodave $ on $Date: 2003/07/09 02:25:14 $.
- See Also:
- Serialized Form
Field Summary |
protected javax.swing.JPanel |
configurationPanel
Used to hold a local handle to a conduit configuration panel. |
static byte |
HIGH_PRIORITY
A useful constant denoting high jConduit priority. |
static byte |
LOW_PRIORITY
A useful constant denoting low jConduit priority. |
static byte |
NORMAL_PRIORITY
A useful constant denoting normal jConduit priority. |
protected java.util.ResourceBundle |
resources
A field to hold a resource bundle for this conduit, if available. |
Constructor Summary |
AbstractConduit()
The constructor used to initialize new jConduits. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
resources
protected transient java.util.ResourceBundle resources
- A field to hold a resource bundle for this conduit, if available.
HIGH_PRIORITY
public static final byte HIGH_PRIORITY
- A useful constant denoting high jConduit priority.
NORMAL_PRIORITY
public static final byte NORMAL_PRIORITY
- A useful constant denoting normal jConduit priority.
LOW_PRIORITY
public static final byte LOW_PRIORITY
- A useful constant denoting low jConduit priority.
configurationPanel
protected transient javax.swing.JPanel configurationPanel
- Used to hold a local handle to a conduit configuration panel.
AbstractConduit
public AbstractConduit()
- The constructor used to initialize new jConduits.
The default implementation does nothing. You should ensure that if your jConduit
requires initialization when it is first installed, that this constructor is overridden.
Note that the default implementation of the jConduit loader will only call the no-parameter
constructor. if you provide constructors that take parameters, they will not be called by
the jConduit initializer.
getConduitName
public final java.lang.String getConduitName()
throws java.util.MissingResourceException
- Returns the name of this jConduit for display.
The name should be a single line of text, with no breaks.
The text will be used by GUI applications for menus, tab labels, etc.
Hence, it should be short but descriptive. For a longer description, use
getConduitDescription(). Note that this method will use the
provided resource class to retreive the name, using the "conduit.name" key.
- Returns:
- the name of this jConduit.
- Throws:
java.util.MissingResourceException
- if the resource bundle can't be loaded.- See Also:
getConduitDescription()
getConduitDescription
public final java.lang.String getConduitDescription()
throws java.util.MissingResourceException
- Returns the description of this jConduit for display.
The description should be a single line of text, with no breaks.
It is up to the displaying application to provide proper word-wrapping.
- Returns:
- the description of this jConduit. Note that this method will use the
jConduit provided resource class to retreive the description, using the "conduit.description" key.
- Throws:
java.util.MissingResourceException
- if the resource bundle can't be loaded.
getResourceBundleName
protected abstract java.lang.String getResourceBundleName()
- Retrieves the name of the class to use as the Conduits Resource Bundle.
This method should return a String containing the fully-qualified classname
of the class to use for this jConduits textual resources.
You may return null from this method, however if you do so you're expected to
override the getConduitName and getConduitDescription methods to return suitable data.
We suggest using Resource Bundles to ensure that your jConduits can be translated to other
languages.
- Returns:
- the fully-qualified classname of the class to use as this jConduits resource bundle.
getConduitResourceBundle
protected final java.util.ResourceBundle getConduitResourceBundle()
throws java.util.MissingResourceException
- Loads the resource bundle named by the getResourceBundleName method.
If the getResourceBundleName method returns null, or if it can't be loaded,
this method will throw a MissingResourceException.
- Returns:
- the ResourceBundle object for this conduits resources.
- Throws:
java.util.MissingResourceException
- thown if the ResourceBundle can't be loaded.
getPriority
public byte getPriority()
- This method returns the jConduits priority byte.
The priority byte is used to determine when a jConduit should be run during synchronization.
The value is a signed byte, with 127 being highest priority, and -128 the lowest.
jConduits with a higher priority will be run first. jConduits with the same priority are run in
an undefined order. By default, jConduits will have priority 0.
Conduits that are a part of a suite of conduits should implement descending priority values to ensure
they are run in a predetermined ordes.
Please resist the temptation to use priority 127 and -128. These should be reserved for
core jSyncManager conduits which do maintenence tasks (such as Installer and Deleter).
Using the maximum and minimum priorities may interfere with correct operation of these tools.
For convienence, AbstractConduit defines constants HIGH_PRIORITY, NORMAL_PRIORITY, and LOW_PRIORITY.
- Returns:
- the jConduits priority ordering byte.
startSync
public abstract void startSync(ConduitHandler conduitHandler,
DLPUserInfo user)
throws NotConnectedException
- This method is called when this jConduit is given the opportunity to synchronize.
The contents of this method should use the provided ConduitHandler object to perform
any necessary data IO between the host and the handheld. If necessary, you may use the passed
DLPUserInfo object to distinguish between users.
- Parameters:
conduitHandler
- the handle to the active ConduitHandler to use for synchronization.user
- the user information object for the handhelds owner.- Throws:
NotConnectedException
- thrown if the connection to the Palm is lost during sync.
toString
public java.lang.String toString()
- Returns the name of this jConduit.
- Overrides:
toString
in class java.lang.Object
- Parameters:
the
- name of this jConduit.- See Also:
getConduitName()
getConfigurationPanel
public final javax.swing.JPanel getConfigurationPanel()
- Retrieves the configuration panel for this jConduit.
This configuration panel should be constructed by the constructConfigPanel method.
This method will call constructConfigPanel if the configurationPanel field is null.
This is done as configurationPanel is a transient field, so as to prevent it from being
serialized. This will cause the constructConfigPanel method to be called
every time this method is called if constructConfigPanel returns null, however
this behaviour won't impact performance due to the very few instructions added to accomplish
this. We'll save instructions in the long run for jConduits that do provide a configuration panel.
- Returns:
- a JPanel containing whatever configuration widgets your jConduit requires.
constructConfigPanel
protected abstract javax.swing.JPanel constructConfigPanel()
- Constructs a configuration panel for this jConduit.
If your jConduit requires user supplied configuration information, you may
construct a JPanel here to be associated with your jConduit, which GUI applications can use
to display to the user prior to synchronization. How this panel is accessed will be
application specific. You may return null here to signify that no setting panel is required.
- Returns:
- a JPanel containing whatever configuration widgets your jConduit requires.
getHandler
public ConduitHandler getHandler()
- Getter for property handler.
- Returns:
- Value of property handler.
setHandler
public void setHandler(ConduitHandler handler)
- Setter for property handler.
- Parameters:
handler
- New value of property handler.
Copyright (c) 1999 - 2003 Brad BARCLAY and others. All Rights Reserved.