in taverna-external-tool-activity/src/main/java/org/apache/taverna/activities/externaltool/manager/impl/InvocationGroupManagerImpl.java [260:314]
private void readConfiguration() {
File f = new File(getInvocationManagerDirectory(), "invocationManager.xml");
if (!f.exists()) {
return;
}
try {
Document document = null;
synchronized (builder) {
document = builder.build(f);
}
Element topElement = document.getRootElement();
Element mechanismsElement = topElement.getChild("invocationMechanisms");
for (Object mechanismObject : mechanismsElement.getChildren("invocationMechanism")) {
Element mechanismElement = (Element) mechanismObject;
Element mechanismNameElement = mechanismElement.getChild("invocationMechanismName");
String mechanismName = mechanismNameElement.getText();
Element mechanismTypeElement = mechanismElement.getChild("invocationMechanismType");
String mechanismType = mechanismTypeElement.getText();
Element mechanismDetailsElement = mechanismElement.getChild("mechanismDetails");
Element detailsElement = (Element) mechanismDetailsElement.getChildren().get(0);
InvocationMechanism mechanism = null;
for (MechanismCreator mc : mechanismCreators) {
if (mc.canHandle(mechanismType)) {
mechanism = mc.convert(detailsElement, mechanismName);
}
}
if (mechanism != null) {
this.addMechanism(mechanism);
}
}
Element groupsElement = topElement.getChild("invocationGroups");
for (Object groupObject : groupsElement.getChildren("invocationGroup")) {
Element groupElement = (Element) groupObject;
Element groupNameElement = groupElement.getChild("invocationGroupName");
String groupName = groupNameElement.getText();
Element mechanismNameElement = groupElement.getChild("mechanismName");
String mechanismName = mechanismNameElement.getText();
InvocationMechanism mechanism = getInvocationMechanism(mechanismName);
if (mechanism == null) {
logger.warn("Could not find mechanism " + mechanismName);
mechanism = getDefaultMechanism();
}
InvocationGroup group = new InvocationGroup(mechanismCreators);
group.setName(groupName);
group.setMechanism(mechanism);
group.convertMechanismToDetails();
this.addInvocationGroup(group);
}
} catch (JDOMException e) {
logger.error("XML parsing problem", e);
} catch (IOException e) {
logger.error("Unable to read invocation manager", e);
}
}