public ProcessingNode buildNode(Configuration config) throws Exception {
resourceName = config.getAttribute("resource", null);
functionName = config.getAttribute("function", null);
continuationId = config.getAttribute("continuation", null);
if (resourceName == null) {
// Building a CallFunction node
if (functionName == null && continuationId == null) {
throw new ConfigurationException(
"< map:call > must have either a 'resource', 'function' or 'continuation' attribute, at " +
config.getLocation());
}
node = new CallFunctionNode(
VariableResolverFactory.getResolver(functionName, this.manager),
VariableResolverFactory.getResolver(continuationId, this.manager)
);
} else {
// Building a Call(Resource)Node
if (functionName != null || continuationId != null) {
throw new ConfigurationException(
"< map:call > cannot have both a 'resource' and a 'function' or 'continuation' attribute, at "
+ config.getLocation()
);
}
node = new CallNode();
}
this.treeBuilder.setupNode(this.node, config);
if (node instanceof Configurable) {
((Configurable)this.node).configure(config);
}
return this.node;
}
|