if (wlpHome != null) {
File wlpHomeDir = new File(wlpHome);
File bsAgentJar = new File(wlpHome + "/lib/bootstrap-agent.jar");
File wsLaunchJar = new File(wlpHome + "/lib/ws-launch.jar");
if (!(wlpHomeDir.isDirectory() && bsAgentJar.isFile() && wsLaunchJar.isFile()))
throw new ConfigurationException("wlpHome provided is not valid: " + wlpHome);
} else {
// If wlpHome is null, throw exception
throw new ConfigurationException("wlpHome is required for initialization");
}
// Validate serverName
if (!serverName.matches("^[A-Za-z][A-Za-z0-9]*$"))
throw new ConfigurationException("serverName provided is not valid: '" + serverName + "'");
// Validate httpPort
if (httpPort > 65535 || httpPort <= 0)
throw new ConfigurationException("httpPort provided is not valid: " + httpPort);
// Validate deployType
if (!deployType.equalsIgnoreCase("xml") && !deployType.equalsIgnoreCase("dropins"))
throw new ConfigurationException("deployType provided is not valid: " + deployType + ". deployType should be xml or dropins.");
//Validate sharedLib
if (sharedLib != null) {
if (!sharedLib.isEmpty()) {
if (!deployType.equalsIgnoreCase("xml"))
throw new ConfigurationException("deployType must be set to xml when sharedLib is not empty");
}
}
}