{
add(new OutputMessage((Output) oneElement));
}
else
{
throw new ModelException("Element " + oneElement.getName() + " is of an unknown type: "
+ oneElement.getClass().getName() + "'");
}
}
/* Attributes must be either ResponseElements, or basic Java types */
String oneAttribName = null;
Object oneAttribValue = null;
for (Iterator ia = res.getAttributes().keySet().iterator(); ia.hasNext();)
{
oneAttribName = (String) ia.next();
oneAttribValue = res.getAttribute(oneAttribName);
if (oneAttribValue instanceof Command)
{
setAttribute(oneAttribName, new CommandMessage((Command) oneAttribValue));
}
else if (oneAttribValue instanceof Input)
{
setAttribute(oneAttribName, new InputMessage((Input) oneAttribValue));
}
else if (oneAttribValue instanceof Output)
{
setAttribute(oneAttribName, new OutputMessage((Output) oneAttribValue));
}
else if (oneAttribValue.getClass().getName().startsWith("java.lang"))
{
setAttribute(oneAttribName, oneAttribValue);
}
else if (oneAttribValue.getClass().getName().startsWith("java.util"))
{
setAttribute(oneAttribName, oneAttribValue);
}
else
{
throw new ModelException("Attribute '" + oneAttribName + "' of Class '"
+ oneAttribValue.getClass().getName() + "' is not allowed as a ModelResponse attribute");
}
}
Map errs = res.getErrors();