if (refAttribute != null) {
String ref = refAttribute.getValue();
if (globalOutputs == null)
throw new InvalidModuleException("Reference to output '" + ref + "' was made, but no output map was supplied");
Output output = (Output)globalOutputs.get(ref);
if (output == null)
throw new InvalidModuleException("Reference to output '" + ref + "' was made, but output was not found in supplied output list");
else
return (Output)output.clone();
}
//parse regular:
String paramName = element.getAttributeValue("name");
if (paramName == null)
throw new InvalidModuleException("Output parameter missing required 'name' attribute");
Output output = new Output(paramName);
String type = element.getAttributeValue("type");
if (type == null)
type = Types.FILE; //or is FILE_LIST better because it's safer?
output.setType(type);
List children = element.getChildren();
Element child;
for (int i=0; i<children.size(); i++) {
child = (Element)children.get(i);
String name = child.getName().toLowerCase();
if (name.equals("title"))
output.setTitle(child.getText());
else if (name.equals("help"))
output.setHelp(child.getText());
else if (name.equals("pattern"))
output.setPattern(child.getText());
}
//validate:
if (output.getPattern() == null)
throw new InvalidModuleException("Output parameter missing required 'pattern' element");
return output;
}