// host desc
String hostDesc = registryService.getHostDesc(hostName);
HostDescriptionType hostDescType = HostDescriptionDocument.Factory.parse(hostDesc).getHostDescription();
// application deployment
DeploymentDescriptionType deploymentDesc = appDescType.getDeploymentDescription();
String tmpDir = deploymentDesc.getTmpDir();
if (tmpDir == null && hostDescType != null) {
tmpDir = hostDescType.getHostConfiguration().getTmpDir();
}
if (tmpDir == null) {
tmpDir = "/tmp";
}
String date = new Date().toString();
date = date.replaceAll(" ", "_");
date = date.replaceAll(":", "_");
tmpDir = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + "_" + date + "_" + UUID.randomUUID();
String workingDir = deploymentDesc.getWorkDir();
if (workingDir == null || workingDir.trim().length() == 0) {
workingDir = tmpDir;
}
String stdOut = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + ".stdout";
String stderr = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + ".stderr";
String executable = deploymentDesc.getExecutable();
String host = deploymentDesc.getHostName();
NameValuePairType[] env = deploymentDesc.getApplicationEnvArray();
Map<String, String> envMap = new HashMap<String, String>();
if (env != null) {
for (int i = 0; i < env.length; i++) {
envMap.put(env[i].getName(), env[i].getValue());
}