return new File(FileUtils.getCanonicalPath(homeDir.getPath()));
}
private void setStartScriptPluginConfigProps(ProcessInfo process, AS7CommandLine commandLine,
Configuration pluginConfig, ProcessInfo agentProcess) {
StartScriptConfiguration startScriptConfig = new StartScriptConfiguration(pluginConfig);
ProcessInfo parentProcess = getPotentialStartScriptProcess(process);
File startScript = ServerStartScriptDiscoveryUtility.getStartScript(parentProcess);
if (startScript == null) {
// The parent process is not a script - fallback to the default value (e.g. "bin/standalone.sh").
String startScriptFileName = getMode().getStartScriptFileName();
startScript = new File("bin", startScriptFileName);
}
if (!startScript.exists()) {
if (!startScript.isAbsolute()) {
File homeDir = new File(pluginConfig.getSimpleValue("homeDir"));
File startScriptAbsolute = new File(homeDir, startScript.getPath());
if (!startScriptAbsolute.exists()) {
LOG.warn("Failed to find start script file for AS7 server with command line [" + commandLine
+ "] - defaulting 'startScripFile' plugin config prop to [" + startScript + "].");
}
}
}
startScriptConfig.setStartScript(startScript);
String startScriptPrefix = ServerStartScriptDiscoveryUtility.getStartScriptPrefix(process, agentProcess);
startScriptConfig.setStartScriptPrefix(startScriptPrefix);
Map<String, String> startScriptEnv = ServerStartScriptDiscoveryUtility.getStartScriptEnv(process,
parentProcess, START_SCRIPT_ENV_VAR_NAMES);
startScriptConfig.setStartScriptEnv(startScriptEnv);
List<String> startScriptArgs = ServerStartScriptDiscoveryUtility.getStartScriptArgs(parentProcess,
commandLine.getAppServerArguments(), START_SCRIPT_OPTION_EXCLUDES);
startScriptConfig.setStartScriptArgs(startScriptArgs);
}