Appendix A. Source code for Trade6 user programs and script files on Windows 275
private void setCommandResult(String ivCommandResult) {
this.ivCommandResult = ivCommandResult;
}
private String getWasScript() {
return ivWasScript;
}
private void setWasScript(String ivWasScript) {
this.ivWasScript = ivWasScript;
}
private String getIhsServerName() {
return ivIhsServerName;
}
private void setIhsServerName(String ivIhsServerName) {
this.ivIhsServerName = ivIhsServerName;
}
private String getServerName() {
return ivServerName;
}
private void setServerName(String ivServerName) {
this.ivServerName = ivServerName;
}
}
The TradeWinPDC.java program
Example A-4 shows the source code for the TradeWinPDC class.
Example: A-4 Source of TradeWinPDC
package com.trade;
/**
* @(#)TradeWinPDC.java
*/
import com.ibm.jsdt.support.SupportWindowsBase;
import com.ibm.jsdt.support.SupportWindowsHelper;
public class TradeWinPDC extends SupportWindowsBase {
private String ivCommandResult = null;
private String ivWASInstallDir = null;
private String ivWASProfileBinDir = null;
private String ivDB2InstallDir = null;
private String ivAppName = null;
private String ivWASServerName = null;
private String ivWasProfileName = null;
private String ivWasVersion = null;
private String ivScriptsDir = null;
private SupportWindowsHelper ivHelper = null;
/**
* Constructor Retrieve input parameter parm#0 = The response file name.
*
*/
public TradeWinPDC(String[] args) {
// The properties file is in the same format as a response file so
// manipulate it in the same way as a response file
276 IBM Express Runtime V2.1
setResponseFileName((1 == args.length) ? args[0] : null);
setMainResources(TradeWinCommon.SAMPLE_MESSAGES);
}
/**
* The Trade application requires WAS and DB2. This PDC will check to see if:
* WAS is installed. (version specified in the properties file)
* DB2 is installed
* If both are installed, it will determine if
* the application is already installed. It will use a jacl script via
* wsadmin, the results being put into a string - ivCommandResult which will
* be searched for errors. - if there is a WAS error returned, it could be
* that WAS is not running, therefore the WAS start command will be run and
* the check to determine if the app is already installed will be run again. -
* There are four possible results in the command result string: -
* APP_EXISTS indicating the application is already installed - return
* PDC_EXISTS - APP_DOES_NOT_EXIST - return PDC_DOES_NOT_EXIST - WASXxxxx
* messages indicating the WAS server is not started - return FAILURE - the
* result file does not exist or some other, unexpected error - return
* FAILURE
*/
private int check() {
int rc = SUCCESS;
int resultrc = FAILURE; // init to return a failure result
boolean startedWAS = false;
ivHelper = (SupportWindowsHelper) getHelper();
setJarFile(ivHelper.getProductInstallingId(this));
// get the values set in the properties file, properties file is
// mandatory
if (getResponseFileName() == null || getResponseFileName().trim().equals("")) {
setMessage(getResourceString(TradeNLSKeys.NO_PROPERTIES_FILE));
ivHelper.log(this);
rc = FAILURE;
} else {
rc = getProperties();
}
// Determine if WAS is installed and get the WAS directories
if (rc == SUCCESS) {
rc = determineWasDir();
}
// Determine if DB2 is installed
if (rc == SUCCESS) {
String db2InstallDir = null;
db2InstallDir = TradeWinCommon.determineDB2Dir(this, ivHelper);
if (db2InstallDir == null || db2InstallDir.trim().equals("")) {
setMessage(getResourceString(TradeNLSKeys.DB2_NOT_INSTALLED));
ivHelper.log(this);
rc = FAILURE;
}
}
if (rc == SUCCESS) {
// Determine if the application is already installed
// Run the WebSphere Admin application (wsadmin), the
// -f option indicates a jacl script is the next arg

Get IBM Express Runtime V2.1 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.