org.jSyncManager.Conduit.NetInstaller

Class NetInstaller

Implemented Interfaces:
ActionListener, Serializable

public class NetInstaller
extends AbstractInstaller
implements ActionListener

This jConduit allows for the installation of PRC and PDB files from URLs described by a text file at the specified URL. This jConduit works by reading a text file as retrieved from a URL, which is a simple list of URLs pointing to PRC and/or PDB files. Each file is downloaded and installed to the handheld if the handheld doesn't already have the database, or only has an older version of the database available.

Field Summary

static String
PROPERTY_FILENAME

Fields inherited from class org.jSyncManager.API.Conduit.AbstractConduit

CANCEL_BUTTON_PRESSED, HELP_BUTTON_PRESSED, HIGH_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY, OK_BUTTON_PRESSED, configurationPanel, resources

Constructor Summary

NetInstaller()
Net Installer Constructor.

Method Summary

void
actionPerformed(ActionEvent ae)
This method handles events generated when the "Set" button is pressed in the GUI dialog.
protected void
clearDatabaseList()
A method to clear the database list.
protected JPanel
constructConfigPanel()
Constructs a configuration panel for this jConduit.
protected void
exceptionInstallingDatabase(DLPDatabase db, ConduitHandler handler, ConduitHandlerException e)
A method to handle when an exception is encountered while trying to install a database.
protected DLPDatabase[]
getDatabaseList(ConduitHandler handler, DLPUserInfo userInfo)
Returns a list of databases to be installed to the handheld at sync time.
protected URL
getDatabaseListURL()
Get the URL containing the location of the database list file.
byte
getPriority()
This method returns the jConduits priority byte.
protected String
getResourceBundleName()
Retrieves the name of the class to use as the Conduits Resource Bundle.
protected void
installingDatabase(DLPDatabase db, ConduitHandler handler)
A method to handle when a database is to be installed.
protected boolean
isDatabaseInstallAllowed(DLPDatabase db, ConduitHandler handler, DLPUserInfo user)
Determines whether or not this database should be installed.
protected void
skippingDatabase(DLPDatabase db, ConduitHandler handler)
A method to handle when a database is to be skipped (ie: not installed).

Methods inherited from class org.jSyncManager.API.Conduit.AbstractInstaller

clearDatabaseList, exceptionInstallingDatabase, getDatabaseList, installingDatabase, isDatabaseInstallAllowed, skippingDatabase, startSync

Methods inherited from class org.jSyncManager.API.Conduit.AbstractConduit

constructConfigPanel, doInitialization, getConduitDescription, getConduitName, getConduitResourceBundle, getConfigurationPanel, getPriority, getResourceBundleName, initialize, jConduitDialogActionPerformed, startSync, toString

Field Details

PROPERTY_FILENAME

public static final String PROPERTY_FILENAME

Constructor Details

NetInstaller

public NetInstaller()
Net Installer Constructor.

Method Details

actionPerformed

public void actionPerformed(ActionEvent ae)
This method handles events generated when the "Set" button is pressed in the GUI dialog.
Parameters:
ae - the ActionEvent that triggered this method call.

clearDatabaseList

protected void clearDatabaseList()
A method to clear the database list. This class doesn't clear the list, as it may live on a non-writable network, and other users may need it. Besides which, this implementation skips databases which are already installed, so it's unnecessary. Calling this method is a no-op.
Overrides:
clearDatabaseList in interface AbstractInstaller

constructConfigPanel

protected JPanel constructConfigPanel()
Constructs a configuration panel for this jConduit.
Overrides:
constructConfigPanel in interface AbstractConduit
Returns:
a JPanel containing the configuration widgets this jConduit requires.

exceptionInstallingDatabase

protected void exceptionInstallingDatabase(DLPDatabase db,
                                           ConduitHandler handler,
                                           ConduitHandlerException e)
            throws NotConnectedException
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.
Overrides:
exceptionInstallingDatabase in interface AbstractInstaller
Parameters:
db - the database that was being installed when the exception occurred.

getDatabaseList

protected DLPDatabase[] getDatabaseList(ConduitHandler handler,
                                        DLPUserInfo userInfo)
Returns a list of databases to be installed to the handheld at sync time. This method will try to load the file "netinstaller.properties" in order to get the URL of the database list, and then attempt to read each line from the database list and pass them into the DLPDatabase URL loader to create the list of dataase to be installed.
Overrides:
getDatabaseList in interface AbstractInstaller
Parameters:
handler - the ConduitHandler object for this sync (so you can check handheld data if necessary)
userInfo - the DLPUserInfo object for the currently synchronizing user.
Returns:
an array of DLPDatabase objects.
See Also:
DLPDatabase

getDatabaseListURL

protected URL getDatabaseListURL()
Get the URL containing the location of the database list file. This method returns a URL object containing the URL of the file containing the database URL list.
Returns:
the URL containing the database list file.

getPriority

public byte getPriority()
This method returns the jConduits priority byte. This jConduit requires a very low priority in order to ensure the install is done towards the end.
Overrides:
getPriority in interface AbstractConduit
Returns:
the jConduits priority ordering byte.

getResourceBundleName

protected String getResourceBundleName()
Retrieves the name of the class to use as the Conduits Resource Bundle.
Overrides:
getResourceBundleName in interface AbstractConduit
Returns:
the fully-qualified classname of the class to use as this jConduits resource bundle.

installingDatabase

protected void installingDatabase(DLPDatabase db,
                                  ConduitHandler handler)
            throws NotConnectedException
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.
Overrides:
installingDatabase in interface AbstractInstaller
Parameters:
db - the database that is about to be installed.

isDatabaseInstallAllowed

protected boolean isDatabaseInstallAllowed(DLPDatabase db,
                                           ConduitHandler handler,
                                           DLPUserInfo user)
            throws NotConnectedException
Determines whether or not this database should be installed. This method will check to see if the database is already installed, and if so, wether or not the database the be installed is newer than that present on the handheld. If it's newer (or not present), we install it, otherwise we skip it.
Overrides:
isDatabaseInstallAllowed in interface AbstractInstaller
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.

skippingDatabase

protected void skippingDatabase(DLPDatabase db,
                                ConduitHandler handler)
            throws NotConnectedException
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.
Overrides:
skippingDatabase in interface AbstractInstaller
Parameters:
db - the database that is about to be skipped.