public ProcessingNode buildNode(Configuration config) throws Exception {
String actionSetName = config.getAttribute("name");
Configuration[] childrenConfig = config.getChildren();
// Inform other builders that we're in an action-set
this.treeBuilder.setAttribute(IN_ACTION_SET, Boolean.TRUE);
// Get the child actions
ProcessingNode[] nodes = this.buildChildNodes(config);
// And get their names
String[] actions = new String[nodes.length];
for (int i = 0; i < childrenConfig.length; i++) {
Configuration childConfig = childrenConfig[i];
String name = childConfig.getName();
if ("act".equals(name)) {
actions[i] = childConfig.getAttribute("action", null);
} else {
// Unknown element
String msg = "Unknown element " + name + " in action-set at " + childConfig.getLocation();
throw new ConfigurationException(msg);
}
}
ActionSetNode node = new ActionSetNode(actionSetName, nodes, actions);
this.treeBuilder.setupNode(node, config);
// Inform other builders that we're no more in an action-set
this.treeBuilder.setAttribute(IN_ACTION_SET, null);
return node;
}
|