jSyncManager

org.jSyncManager.API.Conduit
Class AbstractInstaller

java.lang.Object
  |
  +--org.jSyncManager.API.Conduit.AbstractConduit
        |
        +--org.jSyncManager.API.Conduit.AbstractInstaller
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Installer

public abstract class AbstractInstaller
extends AbstractConduit

An Abstract jConduit used to install whole databases to the handheld. This jConduit allows you to create your own jConduit to install whole databases, simply by providing an array of databases to be installed, and a bit of decision making logic.

Version:
$Revision: 1.4 $
Author:
Brad BARCLAY <bbarclay@jsyncmanager.org>, Last modified by: $Author: yaztromo $.
See Also:
Serialized Form

Fields inherited from class org.jSyncManager.API.Conduit.AbstractConduit
configurationPanel, HIGH_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY, resources
 
Constructor Summary
AbstractInstaller()
          Abstract Installer Constructor.
 
Method Summary
protected abstract  void clearDatabaseList()
          A method to clear the database list supplied by your AbstractInstaller implementation.
protected abstract  void exceptionInstallingDatabase(DLPDatabase db, ConduitHandler handler, ConduitHandlerException e)
          A method to handle when an exception is encountered while trying to install a database.
protected abstract  DLPDatabase[] getDatabaseList()
          Returns a list of databases to be installed to the handheld at sync time.
protected abstract  void installingDatabase(DLPDatabase db, ConduitHandler handler)
          A method to handle when a database is to be installed.
protected abstract  boolean isDatabaseInstallAllowed(DLPDatabase db, ConduitHandler handler, DLPUserInfo user)
          Determines wether or not this database should be installed.
protected abstract  void skippingDatabase(DLPDatabase db, ConduitHandler handler)
          A method to handle when a database is to be skipped (ie: not installed).
 void startSync(ConduitHandler cHandler, DLPUserInfo user)
          This method is called when this jConduit is given the opportunity to synchronize.
 
Methods inherited from class org.jSyncManager.API.Conduit.AbstractConduit
constructConfigPanel, getConduitDescription, getConduitName, getConduitResourceBundle, getConfigurationPanel, getHandler, getPriority, getResourceBundleName, setHandler, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractInstaller

public AbstractInstaller()
Abstract Installer Constructor.
Method Detail

getDatabaseList

protected abstract DLPDatabase[] getDatabaseList()
Returns a list of databases to be installed to the handheld at sync time. Your implementation should provide an array of DLPDatabase objects when this method is called. It will be used by this classes startSync method to install databases to the handheld.
Returns:
an array of DLPDatabas objects.
See Also:
DLPDatabase

isDatabaseInstallAllowed

protected abstract boolean isDatabaseInstallAllowed(DLPDatabase db,
                                                    ConduitHandler handler,
                                                    DLPUserInfo user)
Determines wether or not this database should be installed. This method will be called at sync time by the startSync method to give your Installer jConduit implemenattion the ability to decide wether or not the database should be installed. Reasons why you may not want to allow the database to be installed include if the database already exists on the handheld at a newer revision, or if the specified user shouldn't be permitted access to this database.
Parameters:
db - the database object to be installed.
handler - the ConduitHandler object for this sync (so you can check handheld data if necessary)
user - the DLPUserInfo object for the currently syncing user.
Returns:
true if this database can be installed, false otherwise.

clearDatabaseList

protected abstract void clearDatabaseList()
A method to clear the database list supplied by your AbstractInstaller implementation. This method is called at the end of the startSync method to give your implementation an opportunity to clear the installed database list. You may wish to do this if the install is intended to be a one-time installation. Note that if the connection is lost during sync, this method will not be called, and you'll have no way of knowing what databases were installed, and which ones were not.

installingDatabase

protected abstract void installingDatabase(DLPDatabase db,
                                           ConduitHandler handler)
A method to handle when a database is to be installed. You may use this method to provide an alert to the user when a database is about to be installed.
Parameters:
db - the database that is about to be installed.

skippingDatabase

protected abstract void skippingDatabase(DLPDatabase db,
                                         ConduitHandler handler)
A method to handle when a database is to be skipped (ie: not installed). You may use this method to provide an alert to the user when a database is about to be skipped.
Parameters:
db - the database that is about to be skipped.

exceptionInstallingDatabase

protected abstract void exceptionInstallingDatabase(DLPDatabase db,
                                                    ConduitHandler handler,
                                                    ConduitHandlerException e)
A method to handle when an exception is encountered while trying to install a database. You may use this method to provide an alert to the user when the installation of a database is aborted due to a ConduitHandlerException. You may refer to the exception to determine why the exception occurred, and to then display a message to the user.
Parameters:
db - the database that was being installed when the exception occurred.

startSync

public final void startSync(ConduitHandler cHandler,
                            DLPUserInfo user)
                     throws NotConnectedException
This method is called when this jConduit is given the opportunity to synchronize.
Overrides:
startSync in class AbstractConduit
Parameters:
conduithandler - he handle to the active ConduitHandler to use for synchronization.
Throws:
NotConnectedException - thrown if the connection to the Palm is lost.

jSyncManager

Copyright (c) 1999 - 2003 Brad BARCLAY and others. All Rights Reserved.