public JDBCEntityCommandMetaData(Element element,
JDBCEntityCommandMetaData defaultValues) throws DeploymentException {
// command name
commandName = defaultValues.getCommandName();
String commandClassStr = element.getAttribute( "class" );
if( (commandClassStr != null)
&& (commandClassStr.trim().length() > 0) )
{
try
{
commandClass = GetTCLAction.
getContextClassLoader().loadClass( commandClassStr );
} catch (ClassNotFoundException e) {
throw new DeploymentException( "Could not load class: "
+ commandClassStr);
}
}
else
{
commandClass = defaultValues.getCommandClass();
}
// attributes
attributes.putAll( defaultValues.attributes );
for( Iterator iter = MetaData.getChildrenByTagName( element, "attribute" );
iter.hasNext(); )
{
Element attrEl = (Element) iter.next();
// attribute name
String attrName = attrEl.getAttribute( "name" );
if( attrName == null )
{
throw new DeploymentException( "entity-command " + commandName
+ " has an attribute with no name" );
}
// attribute value
String attrValue = MetaData.getElementContent( attrEl );
attributes.put( attrName, attrValue );
}
}
Constructs a JDBCEntityCommandMetaData from entity-command xml element
and default values Parameters:
element - entity-command element
|