{
typeClass = cl.loadClass(typeName);
}
catch (ClassNotFoundException e)
{
throw new JBossNotCompliantMBeanException
("Class not found '" + typeName + "'", e);
}
}
/* Attributes of type Element are passed as is after optionally
performing system property replacement
*/
if (typeClass.equals(org.w3c.dom.Element.class))
{
// Use the first child Element of this element as the value
NodeList nl = element.getChildNodes();
for (int j=0; j < nl.getLength(); j++)
{
Node n = nl.item(j);
if (n.getNodeType() == Node.ELEMENT_NODE)
{
value = n;
break;
}
}
// Replace any ${x} references in the element text
if( replace )
{
PropertyEditor editor = PropertyEditorManager.findEditor(typeClass);
if( editor == null )
{
log.warn("Cannot perform property replace on Element");
}
else
{
editor.setValue(value);
String text = editor.getAsText();
text = StringPropertyReplacer.replaceProperties(text);
editor.setAsText(text);
value = editor.getValue();
}
}
}
if (value == null)
{
PropertyEditor editor = PropertyEditorManager.findEditor(typeClass);
if (editor == null)
{
throw new JBossNotCompliantMBeanException
("No property editor for type '" + typeName + "'");
}
// Get the attribute value
String attributeText = getElementContent(element, trim, replace);
editor.setAsText(attributeText);
value = editor.getValue();
}
}
catch (org.dom4j.DocumentException e)
{
throw new JBossNotCompliantMBeanException(
"cannot convert '" + which + "' descriptor to org.w3c.dom.Element", e);
}
// stop processing
break;