All Packages Class Hierarchy This Package Previous Next Index
Class semper.util.install.Installer
java.lang.Object
|
+----semper.util.install.Installer
- public class Installer
- extends Object
- implements MenuLaunchable
This class implements the module installer. It provides services
for installing and uninstalling third-party modules into SEMPER. It
also provides a menu-launchable Installer application that makes
use of these services.
The "distribution" of the module must be available in a
separate directory. The directory should contain:
- A Java Properties file which defines all mandatory
properties. Currently the standard mandatory properties are:
-
name
- name of the module (e.g. SET
)
-
block
- SEMPER block to which the module
belongs (e.g. payment
)
-
author
- identification tag for the author of
the module (e.g. ZRL; there is no standard name space for
this yet)
There may be additional block-specific mandatory properties (e.g. a
payment module must define purseClassName
). In
addition, a number of optional properties are supported by the
standard Installer:
-
dlls
- primary names of dynamically linkable
libraries installed by the module; e.g. CRM
is
the primary name for the Cryptomathic crypto library.
-
packages
top-level package names for package
sub-trees installed by the module;
e.g. semper.payment.SET
. A module is allowed to
claim package names either within its own space in the
SEMPER package hierarchy (e.g. SET
adapter for
the payment
block can install any package
prefixed with semper.payment.SET
or any name
outside the SEMPER hierarchy.
- If the
packages
property was set, then there
must be one
directory for each package sub-tree specified, containing the classes
for the package subtree (there can be sub-packages in the package).
E.g. if packages
was set to <Digicash
semper.payment.ecash
> then there must be two
sub-directories by the same names in the
distribution. The Digicash
directory will be moved to
lib/java/classes/Digicash
directory and the
semper.payment.ecash
directory will be moved to
lib/java/classes/semper/payment/ecash
. Missing
directories is considered a critical failure.
- If the
dlls
property was set, then there
can be
various versions of the each dll specified (one for each
platform). The files are named:
lib<BASENAME>.so.<OS> in the case of Unix
(e.g. libCRMlib.so.aix) and <BASENAME>.windows.dll in
the case of Windows (e.g. CRMlib.windows.dll). The correct
file will be moved to lib/java/dll/<OS>
directory. Missing dlls is not considered a critical failure
(since some dlls seem to be available/necessary only for some
platforms) .
For interactive installation, the properties file must be named
props.txt
.
The installation process consists of the following steps:
- sanity check of the Properties file
- ownership check: the first author to claim a name in a given
name space (e.g. dll name space, package name space), retains that
ownership until it is explicitly relinquished. Only the owner of a
name can make changes to a file corresponding to that name.
- copying of packages into place
- pre-installation method execution from the
Install
class in the module (if available)
- copying of dlls into place
- installation hook execution from the block into which the
module is being installed (if available)
- post-installation method execution from the
Install
class in the module (if available)
The uninstallation process takes similar but opposite steps.
- Version:
- $Revision: 1.9 $ $Date: 1998/08/20 17:44:08 $
- Author:
- N. Asokan ([email protected])
- See Also:
- ModuleInstallerHook, BlockInstallerHook
-
Installer()
-
-
checkProperties(Properties)
- Sanity check a properties file in a distribution
-
getCanonOSName()
- Get the canonical name of the OS.
-
getClassRoot()
- Get the root of the SEMPER classes.
-
getDLLDir()
- Get the pathname of the SEMPER dll directory
This pathname is derived from the root of the SEMPER installation
-
getSEMPERRoot()
- Get the root of the SEMPER installation.
-
init()
- Initialise the Installer
-
install(String, Properties)
- Install a module.
-
isInitialised()
- Is the installer already initialised?
-
launch()
- Implementing the MenuLaunchable interface
-
readProperties(String)
- Read the props.txt file from the specified path_name, do the checks for
mandatory properties and return the Properties object.
-
uninstall(Properties)
- Uninstall a module specified by the properties object
Installer
public Installer()
init
public static void init() throws InstallerException
- Initialise the Installer
- Throws: InstallerException
- if initialisation failed
isInitialised
public static boolean isInitialised()
- Is the installer already initialised?
- Returns:
- true/false
launch
public void launch()
- Implementing the MenuLaunchable interface
- See Also:
- MenuLaunchable
install
public static void install(String path_name,
Properties props) throws InstallerException
- Install a module.
- Pre-condition: the properties file must have been sanity checked
already
- Not done:
- If the installation breaks, no attempt is made to roll-back to the
previous state. It is not clear if that is worth the trouble since it is
always possible to ask the user to re-install the previous version of the
module. Sigh.
- Parameters:
- path_name - where the distribution is to be found
- props - the properties file read from the above directory
- Throws: InstallerException
- when installation fails
uninstall
public static void uninstall(Properties props) throws InstallerException
- Uninstall a module specified by the properties object
- Parameters:
- properties - object that was used during the installation of
the module.
- Uninstall does not remove class directories!
- Throws: InstallerException
- when uninstallation fails
readProperties
public static Properties readProperties(String path_name) throws InstallerException
- Read the props.txt file from the specified path_name, do the checks for
mandatory properties and return the Properties object.
- Parameters:
- path_name - path name of the distribution directory
- Returns:
- properties object initialised from the distribution properties
file
- Throws: InstallerException
- when the properties file cannot be read.
checkProperties
public static boolean checkProperties(Properties props) throws InstallerException
- Sanity check a properties file in a distribution
- Parameters:
- props - Properties object initialised from a properties file in a
module distribution
- Returns:
- true/false
- Throws: InstallerException
- when the check cannot be performed
getSEMPERRoot
public static String getSEMPERRoot()
- Get the root of the SEMPER installation.
The current implementation is only a guess, assuming that the
SEMPER classes are in the first directory in the CLASSPATH whose
pathname ends with "lib/java/classes". It also assumes that the
SEMPER classes are not in a zip file. An alternative
implementation may assume that SEMPERPATH is set in the
environment by the startup script.
- Returns:
- string pathname of the SEMPER root
- See Also:
- getClassRoot, getDLLDir
getClassRoot
public static String getClassRoot()
- Get the root of the SEMPER classes.
This pathname is derived from the root of the SEMPER
installation. This also assumes that SEMPER classes are not in
the form of a zip file. Sigh.
- Returns:
- string pathname of the SEMPER classes directory
- See Also:
- getSEMPERRoot
getDLLDir
public static String getDLLDir()
- Get the pathname of the SEMPER dll directory
This pathname is derived from the root of the SEMPER installation
- Returns:
- string pathname of the SEMPER dll directory
- See Also:
- getSEMPERRoot
getCanonOSName
public static String getCanonOSName()
- Get the canonical name of the OS.
SEMPER has its own ideas of how to name operating systems. This
method returns the name of the OS according to SEMPER's
whims. You are probably better off using the os.name property
- Returns:
- SEMPER's idea of what the name of the OS is
All Packages Class Hierarchy This Package Previous Next Index