try {
workflowProperties = XmlUtils.parseXml(actionXml);
}
catch (JDOMException e1) {
log.warn("Configuration parse error in:" + actionXml);
throw new CommandException(ErrorCode.E1005, e1.getMessage(), e1);
}
// generate the 'runConf' for this action
// Step 1: runConf = createdConf
Configuration runConf = null;
try {
runConf = new XConfiguration(new StringReader(createdConf));
}
catch (IOException e1) {
log.warn("Configuration parse error in:" + createdConf);
throw new CommandException(ErrorCode.E1005, e1.getMessage(), e1);
}
// Step 2: Merge local properties into runConf
// extract 'property' tags under 'configuration' block in the
// coordinator.xml (saved in actionxml column)
// convert Element to XConfiguration
Element configElement = (Element) workflowProperties.getChild("action", workflowProperties.getNamespace())
.getChild("workflow", workflowProperties.getNamespace()).getChild("configuration",
workflowProperties.getNamespace());
if (configElement != null) {
String strConfig = XmlUtils.prettyPrint(configElement).toString();
Configuration localConf;
try {
localConf = new XConfiguration(new StringReader(strConfig));
}
catch (IOException e1) {
log.warn("Configuration parse error in:" + strConfig);
throw new CommandException(ErrorCode.E1005, e1.getMessage(), e1);
}
// copy configuration properties in coordinator.xml to the runConf
XConfiguration.copy(localConf, runConf);
}