utilities
Class AS400ToolboxInstaller

java.lang.Object
  |
  +--utilities.AS400ToolboxInstaller

public class AS400ToolboxInstaller
extends java.lang.Object

The AS400ToolboxInstaller class is used to install, update, compare, and uninstall the AS/400 Toolbox for Java packages. Note that this class writes to the local file system, so it may fail if used in an applet.

The AS400ToolboxInstaller class can be included in the user's program, or it can be run as a command line program, as follows:

 java utilities.AS400ToolboxInstaller [ options ]
 

Options

-install
Indicates that the specified packages are to be installed. If the -package option is not specified, all packages will be installed. The source and target options must be specified when using this option. The -install option may be abbreviated to -i.
-uninstall
Indicates that the specified packages are to be removed. The package and target options must be specified when using this option. The -uninstall option may be abbreviated to -u.
-compare
Indicates that the source package with be compared with the target package to determine if an update is needed. The package, source, and target options must be specified when using this option. The -compare option may be abbreviated to -c.
-package package1[,package2[, ...]]
Specifies the package to install, compare, or uninstall. If -package is specified, at least one package name must be specified. The -package option may be abbreviated to -p.
-source sourceURL
Specifies the location of the source files. The HTTP server is used to access the files. The system name or the fully-qualified URL may be specified. If the system name is specified, it will automatically be converted to the URL where the licensed program installed the files. For example, if mySystem is specified, http://mySystem/QIBM/ProdData/HTTP/Public/jt400/ will be used. The -source option may be abbreviated to -s.
-target targetDirectory
Specifies the fully-qualified path name of where to store the files. The -target option may be abbreviated to -t.
-prompt
Specifies that the user will be prompted before updating the packages on the workstation. If not specified, the packages will be updated. The -prompt option may be abbreviated to -pr.
-?
Displays the help text.
-help
Displays the help text. The -help parameter may be abbreviated to -h.

Install Example

The following example will install all packages.

The following examples will install the access package.

Uninstall Example

This example will remove the access package.

Compare Example

This example will compare the current level of the OPNAV package.

Help Example

The following will display help information:


Method Summary
static java.util.Vector getClasspathAdditions()
          Returns the set of paths that should be added to the CLASSPATH as a result of the latest install or uninstall operation.
static java.util.Vector getClasspathRemovals()
          Returns the set of paths that should be removed from the CLASSPATH as a result of the latest install or uninstall operation.
static java.util.Vector getUnexpandedFiles()
          Returns the set of files that should be expanded as a result of the latest install or uninstall operation.
static boolean install(java.lang.String packageName, java.lang.String targetPath, java.net.URL source)
          Installs/updates an AS/400 Toolbox for Java package.
static boolean isInstalled(java.lang.String packageName, java.lang.String targetPath)
          Indicates if the package is installed.
static boolean isUpdateNeeded(java.lang.String packageName, java.lang.String targetPath, java.net.URL source)
          Returns whether the package is downlevel.
static void main(java.lang.String[] args)
          Performs the actions specified in the invocation arguments.
static java.util.Vector unInstall(java.lang.String packageName, java.lang.String targetPath)
          Removes a package from the target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getClasspathAdditions

public static java.util.Vector getClasspathAdditions()
Returns the set of paths that should be added to the CLASSPATH as a result of the latest install or uninstall operation. The returned vector will always be empty after an uninstall.

Returns:
The vector of Strings which contain the paths that should be added to the CLASSPATH as a result of the latest install or uninstall operation.

getClasspathRemovals

public static java.util.Vector getClasspathRemovals()
Returns the set of paths that should be removed from the CLASSPATH as a result of the latest install or uninstall operation.
Note: Removing directories from the classpath may cause Java programs to fail if the directory contains code required by the Java program. Extraneous directories in the CLASSPATH do no harm. Therefore, you may not wish to remove any CLASSPATH entries, or remove only directories which do not contain any Java code.

Returns:
The vector of Strings which contain the paths that should be removed from the CLASSPATH as a result of the latest install or uninstall operation.

getUnexpandedFiles

public static java.util.Vector getUnexpandedFiles()
Returns the set of files that should be expanded as a result of the latest install or uninstall operation. Note that not all *.zip files will be in this list. Only those files designated to be expanded by the package will be included. The returned vector will always be empty after an uninstall.

Returns:
The vector of Strings which contain the files that should be expanded as a result of the latest install or uninstall operation.

install

public static boolean install(java.lang.String packageName,
                              java.lang.String targetPath,
                              java.net.URL source)
                       throws java.io.IOException
Installs/updates an AS/400 Toolbox for Java package. If the package is already installed, it will be updated if needed. This method just copies files, it will not modify the CLASSPATH, or expand any 'zipped' files.
URL sourceURL = new URL("http://myAS400/QIBM/ProdData/HTTP/Public/jt400/");
AS400ToolboxInstaller.install("ACCESS", "C:\\java\\", sourceURL);

Parameters:
packageName - The package which to install. "*ALL" can be used to install all the AS/400 Toolbox for Java packages.
targetPath - The path in which to install. The directory will be created if it does not exist.
source - The URL which contains the location which contains the current package. File names will be appended to this location, so a trailing path separator is required.
Returns:
true if an install/update occurred, false if no updates were needed.
Throws:
java.io.IOException - If an error occurs while communicating with the server.

isInstalled

public static boolean isInstalled(java.lang.String packageName,
                                  java.lang.String targetPath)
Indicates if the package is installed. Installation is determined by examining the target directory for the *.LVL file. This method does not check for a partial installation, if installation is incomplete, this method may return true or false.
AS400ToolboxInstaller.isInstalled("ACCESS", "C:\\java\\");

Parameters:
packageName - The package which will be checked. Note that *ALL is not supported.
targetPath - The path in which the package is installed.
Returns:
true if the package has been installed, false if the package has not been installed.

isUpdateNeeded

public static boolean isUpdateNeeded(java.lang.String packageName,
                                     java.lang.String targetPath,
                                     java.net.URL source)
                              throws java.io.IOException
Returns whether the package is downlevel. This method will return true if the package is not installed.
URL sourceURL = new URL("http://myAS400/QIBM/ProdData/HTTP/Public/jt400/");
AS400ToolboxInstaller.isUpdateNeeded("ACCESS", "C:\\java\\", sourceURL);

Parameters:
packageName - The package which will be checked. "*ALL" can be used to check all the AS/400 Toolbox for Java packages.
targetPath - The path in which the package is installed.
source - The URL which contains the location which contains the current package. File names will be appended to this location, so a trailing path separator is required.
Returns:
true if an update is needed, false if no updates are needed.
Throws:
java.io.IOException - If an error occurs while communicating with the server.

main

public static void main(java.lang.String[] args)
Performs the actions specified in the invocation arguments. See the class description for information on the command line parameters.

Parameters:
args - The command line arguments.

unInstall

public static java.util.Vector unInstall(java.lang.String packageName,
                                         java.lang.String targetPath)
                                  throws java.io.IOException
Removes a package from the target. This method deletes all the files in the package, and deletes directories if they are empty. It does not modify the CLASSPATH.
AS400ToolboxInstaller.unInstall("ACCESS", "C:\\java\\");

Parameters:
packageName - The package to remove. "*ALL" can be used to remove all the AS/400 Toolbox for Java packages.
targetPath - The path from which to remove the package.
Returns:
The vector of Strings which contain the names (including path) of files and directories which exist but could not be deleted.
Throws:
java.io.IOException - If the package is not installed.