com.ibm.jsdt.support.deploymenthelper
Class OS400DeploymentHelper

java.lang.Object
  extended by com.ibm.jsdt.common.Base
      extended by com.ibm.jsdt.support.deploymenthelper.DeploymentHelper
          extended by com.ibm.jsdt.support.deploymenthelper.OS400DeploymentHelper

public class OS400DeploymentHelper
extends DeploymentHelper

OS400 specific helper functionality.


Field Summary
 
Fields inherited from class com.ibm.jsdt.support.deploymenthelper.DeploymentHelper
DEPLOYER_SPECIFICATION_VERSION_KEY, ENTRY_STAGE, EXIT_STAGE, FAILURE, ISMP_GLOBAL_PROPERTY, ISMP_PRODUCT_PROPERTY, ISMP_WIZARD_PROPERTY, MAIN_STAGE, PDC_CANCEL_INSTALL, PDC_DO_NOT_INSTALL, PDC_DOES_NOT_EXIST, PDC_EXISTS, resourceBundle, SELECTED_TASK_NAMES_KEY, sNEWLN, SUCCESS, VERSIONCHECKER_STAGE, VPD_INSTALL_LOCATION_PIPE, VPD_VERSION_PIPE
 
Fields inherited from class com.ibm.jsdt.common.Base
NEW_LINE, OS_NAME, SLASH
 
Constructor Summary
OS400DeploymentHelper()
          Sole constructor.
 
Method Summary
static boolean arePtfsApplied(java.util.Iterator ptfList)
          Checks to see if each PTF in a specified list has been applied(PERM or TEMP) to the system.
static void chmodDirPermissions(java.lang.String path, java.lang.String chmodValue)
          Changes the permissions on a directory.
static void chmodFilePermissions(java.lang.String fileName, java.lang.String chmodValue)
          Changes the permissions on a file.
static boolean createSecOfrUser(java.lang.String userName, java.lang.String password)
          Creates an administrative user on the i5/OS machine.
static boolean createUser(java.lang.String userName, java.lang.String password)
          Creates a user on the i5/OS machine.
static boolean deleteUser(java.lang.String userName)
          Deletes a user on the i5/OS machine.
static boolean doesHaveSecOfrAuthority(java.lang.String userName)
          Determines whether or not the given user has "secofr" administrative authority.
static boolean doesUserExist(java.lang.String userName)
          Determines whether or not the specified user exists on the system.
static ProgramOutput executeCommandAndConvertToASCII(java.lang.String command, java.lang.String logCommand, boolean convertFromEBCDIC, java.lang.String workingDir)
          Run a QSH command with convertFromEBCDIC option.
static ProgramOutput executeCommandNoConvertToASCII(java.lang.String command, java.lang.String commandToLog)
          Run a QSH command.
static com.ibm.as400.access.AS400Message[] getArePtfsAppliedMessageList()
          Retrieves an array of messages that are associated with a failed program call in the arePtfsApplied method.
static com.ibm.as400.access.AS400 getAS400()
          Retrieves the AS400 system object.
static java.lang.String getCLCommandOutput()
          Retrieves the output of the last invoked CL command.
static java.lang.String getOSLevel()
          Returns the current level of the i5 operating system in the form of "version.release.modification".
static int getOSRelease()
          Obtains the current i5/OS release.
static int getOSVersion()
          Obtains the current i5/OS version.
static boolean isCurrentReleaseEqualOrGreater(java.lang.String os400Release)
          Indicates whether or not the version and release of the current OS/400 computer is greater than or equal to a specified expected value.
static boolean isProductInstalled(java.lang.String os400ProductId, java.lang.String os400ProductOption)
          Checks the system to see if a product and option are installed on the machine.
static boolean isProductInstalled(java.lang.String os400ProductId, java.lang.String os400Release, java.lang.String os400ProductOption)
          Checks the system to see if a product, option, and release are installed on the machine for a specific OS version.
static boolean isUserPasswordValid(java.lang.String userName, java.lang.String password)
          Determines the validity of the given user and password combination.
static void reboot()
          Reboots the i5/OS machine.
static boolean runCLCommand(java.lang.String command)
          Runs a CL command.
 
Methods inherited from class com.ibm.jsdt.support.deploymenthelper.DeploymentHelper
arraySearch, checkFreeSpaceAvailable, checkTargetDirectory, compareVersions, copyAndRenameFile, copyDirectory, copyFile, deleteFile, determineLogFileName, directorySearch, endOfFileScan, executeCommand, fileExists, fileGrep, fileLength, fileScan, fileSearchAndReplace, fileSearchAndReplaceLine, fileSearchAndReturnLinesWithSearch, getAgentRelease, getBackLevelDeployerMessage, getBackLevelJsdtMessage, getDeployerLocale, getDeploymentPackageJarName, getDeploymentWizardSpecificationVersion, getDomain, getEntryResponseFilePath, getEntryResponseFilePath, getExitResponseFilePath, getExitResponseFilePath, getGroupLocale, getHostName, getIbmNsiISMPPropValue, getIbmNsiProperties, getIbmnsiPropertyKeyPrefix, getIbmNsiPropValue, getIbmNsiPropValueByKey, getIimInstallLocationArray, getIimVersionArray, getKeyValue, getLogFileName, getLogger, getLogsDir, getMainResponseFilePath, getMainResponseFilePath, getOSType, getPartitionCapacity, getPartitionFileSystemType, getPartitionVolumeLabel, getPasswordValue, getPasswordValueByKey, getPreDeploymentCheckerResponseFilePath, getPreDeploymentCheckerResponseFilePath, getProductInstallingBundleProperties, getProductInstallingId, getProductInstallingVersion, getPropertyLogFileName, getQualifiedHostName, getQualifiedTiedPasswordValue, getQualifiedTiedVariableValue, getResourceString, getResponseFilePath, getResponseFilePath, getResponseFileProperties, getResponseFileProperty, getResponseFileValue, getSelectedTaskList, getSetupFileRemovalSetting, getStringFromCommandArray, getSystemEnvVar, getTaskApplicationList, getTaskHostnameList, getTempDir, getTiedPasswordValue, getTiedPasswordValueForKey, getTiedVariableValue, getTiedVariableValueForKey, getTranslatedMessage, getUnpackedDir, getVariableValueForTaskApplication, getVpdInstallLocationArray, getVpdPropertyList, getVpdVersionArray, isAix, isAixOSType, isApplicationVersionEqual, isEnoughTargetDirSpaceAvailable, isHPUX, isHPUXOSType, isIpv6Address, isLinux, isLinuxOSType, isLinuxX86_32, isLinuxX86_64, isOS400, isOS400OSType, isPortOpen, isPortRegistered, isPowerLinuxOSType, isSameDirectoryName, isSunOS, isSunOSType, isVersionSupported, isWindows, isWindowsOSType, log, log, logAppendFile, logAppendFile, logNewLine, logStatus, modifyResponseFile, postCompletionMessageToDeployerUI, postErrorMessageToDeployerMainUI, postErrorMessageToDeployerUI, postInformationMessageToDeployerMainUI, postInformationMessageToDeployerUI, postSuccessMessageToDeployerMainUI, postSuccessMessageToDeployerUI, postWarningMessageToDeployerMainUI, postWarningMessageToDeployerUI, readFile, removeAlphaCharsFromString, replaceSubstring, runAs, runAs, setIbmNsiProperty, setKeyValue, setLogFileName, setMainResources, setResponseFileProperty, setResponseFileValue, trace, trace, trace, trimDoubleQuotes, unPackJar, valueExists, waitForFile, writeFile
 
Methods inherited from class com.ibm.jsdt.common.Base
getBuildPropertiesAccessor, getFullVersion, getMainResources, getResourceString, getResourceString, getResourceString, getResourceString, getResourceString, getResourceStringArray, getResourceStringArray, showBuildProperties, showFullVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OS400DeploymentHelper

public OS400DeploymentHelper()
Sole constructor.

Method Detail

chmodDirPermissions

public static void chmodDirPermissions(java.lang.String path,
                                       java.lang.String chmodValue)
Changes the permissions on a directory.

Parameters:
path - - a directory on which to set access permission
chmodValue - - a chmod value indicating the level of permission to set

chmodFilePermissions

public static void chmodFilePermissions(java.lang.String fileName,
                                        java.lang.String chmodValue)
Changes the permissions on a file.

Parameters:
fileName - - a file name on which to set access permission
chmodValue - - a chmod value indicating the level of permission to set

createSecOfrUser

public static boolean createSecOfrUser(java.lang.String userName,
                                       java.lang.String password)
Creates an administrative user on the i5/OS machine. The user will have "secofr" authority.

Parameters:
userName - - a user name
password - - a user password
Returns:
A boolean value of
  • true if the administrative user is successfully created.
  • false otherwise

createUser

public static boolean createUser(java.lang.String userName,
                                 java.lang.String password)
Creates a user on the i5/OS machine.

Parameters:
userName - - a user name
password - - a user password
Returns:
A boolean value of
  • true if the user is successfully created
  • false otherwise

deleteUser

public static boolean deleteUser(java.lang.String userName)
Deletes a user on the i5/OS machine.

Parameters:
userName - - user name to be deleted
Returns:
A boolean value of
  • true if the user is successfully deleted
  • false otherwise

reboot

public static void reboot()
Reboots the i5/OS machine.


doesHaveSecOfrAuthority

public static boolean doesHaveSecOfrAuthority(java.lang.String userName)
Determines whether or not the given user has "secofr" administrative authority.

Parameters:
userName - - a user name to be verified
Returns:
A boolean value of
  • true if the user has administrative authority
  • false otherwise

isUserPasswordValid

public static boolean isUserPasswordValid(java.lang.String userName,
                                          java.lang.String password)
Determines the validity of the given user and password combination.

Parameters:
userName - - a user name
password - - a user password
Returns:
A boolean value of
  • true if the password is valid for the user
  • false otherwise

doesUserExist

public static boolean doesUserExist(java.lang.String userName)
Determines whether or not the specified user exists on the system.

Parameters:
userName - - a user name
Returns:
A boolean value of
  • true if user exists
  • false otherwise

runCLCommand

public static boolean runCLCommand(java.lang.String command)
Runs a CL command. Example of the format of the CL command:

"QSYS/CRTLIB LIB(MYLIB) TEXT('Some text')"

Parameters:
command - - CL command
Returns:
A boolean value of
  • true if the command returns true
  • false otherwise

getCLCommandOutput

public static java.lang.String getCLCommandOutput()
Retrieves the output of the last invoked CL command.

Returns:
The output of the CL command

getOSLevel

public static java.lang.String getOSLevel()
Returns the current level of the i5 operating system in the form of "version.release.modification".

Returns:
The OS level on target computer

getOSVersion

public static int getOSVersion()
Obtains the current i5/OS version.

Returns:
The version of the operating system on the target computer.

getOSRelease

public static int getOSRelease()
Obtains the current i5/OS release.

Returns:
The release number the operating system on the target computer.

isProductInstalled

public static boolean isProductInstalled(java.lang.String os400ProductId,
                                         java.lang.String os400ProductOption)
Checks the system to see if a product and option are installed on the machine. It uses the "Product" class which replaces the RSoftwareResource class in V5R4.

For example os400ProductId = 5722DG1. See Product Javadoc for constant values.

Parameters:
os400ProductId - - OS400 product id
os400ProductOption - - OS400 product option
Returns:
A boolean value of
  • true if the product and option are correctly installed.
  • false if the product is not installed, or if it is on the system, but not in a fully installed state.

isProductInstalled

public static boolean isProductInstalled(java.lang.String os400ProductId,
                                         java.lang.String os400Release,
                                         java.lang.String os400ProductOption)
Checks the system to see if a product, option, and release are installed on the machine for a specific OS version. It uses the "Product" class which replaces the RSoftwareResource class in V5R4.

For example os400ProductId = "5722DG1", os400ProductOption = "*BASE" or "0001" or "0002" etc, os400ProductRelease = "V6R1M0" See Product Javadoc for constant values.

Parameters:
os400ProductId - - OS400 product id
os400ProductOption - - OS400 product option
os400ProductRelease - - OS400 product release
Returns:
A boolean value of
  • true if the product and option and release are correctly installed.
  • false if the product or option or release are not installed, or if it is on the system but not in a fully installed state.

arePtfsApplied

public static boolean arePtfsApplied(java.util.Iterator ptfList)
Checks to see if each PTF in a specified list has been applied(PERM or TEMP) to the system.

Applied is defined as temporarily applied, permanently applied, or superseded. If a PTF is loaded or has a SAVF it is not considered applied.

The ptfList must contain String[3] arrays for each entry. Each entry(String[3]) must contain {, , }. For example one entry would be an String[]{"5722DG1", "V5R2M0", "SI13933"}.

Parameters:
ptfList - - an iterator of ptfList
Returns:
A boolean value of
  • true if every PTF in the list has been applied.
  • false if one or more PTFs in the list is not applied.

getAS400

public static com.ibm.as400.access.AS400 getAS400()
Retrieves the AS400 system object.

Returns:
AS400

getArePtfsAppliedMessageList

public static com.ibm.as400.access.AS400Message[] getArePtfsAppliedMessageList()
Retrieves an array of messages that are associated with a failed program call in the arePtfsApplied method.

The arePtfsApplied method must be called prior to calling this method.

Returns:
AS400Message[]

isCurrentReleaseEqualOrGreater

public static boolean isCurrentReleaseEqualOrGreater(java.lang.String os400Release)
Indicates whether or not the version and release of the current OS/400 computer is greater than or equal to a specified expected value.

For example, if a release of V5R2M0 was passed, and the current target computer is V5R1M0, then the value of false would be returned. If the release of the current computer is V5R2M0 or later, a value of true is returned.

Parameters:
os400Release - - OS400 release
Returns:
A boolean value of
  • true if the current release on the computer is the same or higher than the specified release,
  • false otherwise.

executeCommandAndConvertToASCII

public static ProgramOutput executeCommandAndConvertToASCII(java.lang.String command,
                                                            java.lang.String logCommand,
                                                            boolean convertFromEBCDIC,
                                                            java.lang.String workingDir)
Run a QSH command with convertFromEBCDIC option. To run a CL command use the runCLCommand() method. The command and a success or failure message are logged. The output can also be written to the log file.

Parameters:
command - - the command to run.
logCommand - - logCommand to write to the log file. Can be used if the original contains secure information such as user ID and/or password.
convertFromEBCDIC - - a boolean if the output needs to be converted from EBCDIC to ASCII.
workingDir - - A String indicate the working directory from which the command should be run from. If null is specified, the current working directory is used.
Returns:
ProgramOutput The program output. It contains information about the command's stderr, stdout, return code, and exception thrown (if any).

executeCommandNoConvertToASCII

public static ProgramOutput executeCommandNoConvertToASCII(java.lang.String command,
                                                           java.lang.String commandToLog)
Run a QSH command. To run a CL command use the invokeCLCommand() method. The command and output are logged.

Parameters:
command - - the command to run.
commandToLog - - the command to log. If null or empty string is specified, a command will be logged.
Returns:
The command output if the command completed successfully. Null otherwise