List<DeployPackageStep> unexecutedSteps = translateSteps(packageDetails);
// Load the JBPM process into the executor
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(process);
ProcessInstance processInstance = new ProcessInstance(processDefinition);
ContextInstance context = processInstance.getContextInstance();
// Populate the variables we'll need in the handlers
context.setVariable(ContextVariables.CONTENT_CONTEXT, contentContext);
context.setVariable(ContextVariables.CONTROL_ACTION_FACADE, controlFacade);
context.setVariable(ContextVariables.PACKAGE_DETAILS_KEY, packageDetails.getKey());
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
Date timestamp = new Date();
String formattedTimestamp = format.format(timestamp);
context.setVariable(ContextVariables.TIMESTAMP, formattedTimestamp);
try {
File downloadDir = createTempDir("jon_download");
if (downloadDir != null) {
context.setVariable(ContextVariables.DOWNLOAD_DIR, downloadDir.getAbsolutePath());
}
File patchDir = createTempDir("jon_patch");
if (patchDir != null) {
context.setVariable(ContextVariables.PATCH_DIR, patchDir.getAbsolutePath());
}
} catch (IOException e) {
// No need to throw this error, a handler will check for these to be valid and fail the step accordingly
log.error("Error creating temporary directories", e);
}
// Populate the variables describing the AS instance
String jbossHomeDir = jbossPaths.getHomeDir();
log.debug("jbossHomeDir: " + (jbossHomeDir == null ? " is NULL" : jbossHomeDir));
jbossHomeDir += File.separator; // Just to make sure it ends with the separator
context.setVariable(ContextVariables.JBOSS_HOME_DIR, jbossHomeDir);
String jbossClientDir = jbossHomeDir + File.separator + "client" + File.separator;
log.debug("jbossClientDir: " + jbossClientDir);
context.setVariable(ContextVariables.JBOSS_CLIENT_DIR, jbossClientDir);
String jbossServerDir = jbossPaths.getServerDir();
log.debug("jbossServerDir: " + (jbossServerDir == null ? " is NULL" : jbossServerDir));
jbossServerDir += File.separator; // Just to make sure
context.setVariable(ContextVariables.JBOSS_SERVER_DIR, jbossServerDir);
// The workflow will reference values inside of this object for substitution
// Ultimately, we should parse out the workflows to use the domain object directly
SoftwareValue softwareValue = resourcePackageDetailsToSoftwareValue(packageDetails);
context.setVariable(ContextVariables.SOFTWARE, softwareValue);
// Perform the workflow
try {
processInstance.signal();
} catch (Exception e) {