if(m_baseConfigBean==null)
return null;
String xpath = MBeanHelper.getXPathPattern( (ModelMBeanInfo)m_mbeanInfo) +
ServerXPathHelper.XPATH_SEPARATOR + childName;
Class cl = ConfigMBeanHelper.getConfigBeanClass(xpath);
ConfigBean bean = (ConfigBean)cl.newInstance();
MBeanRegistryEntry regEntry = m_registry.findMBeanRegistryEntryByXPathPattern(xpath);
if(childValues!=null)
for(int i=0; i<childValues.size(); i++)
{
Attribute attr = (Attribute)childValues.get(i);
if( (attr.getValue()==null || attr.getValue().equals("")))
{
//empty value set bypass if not allowed in the registry
boolean bEmptyValueAllowed = false;
try {
// analyze registry_Entry emptyValueAllowed (if mentioned)
bEmptyValueAllowed = regEntry.isAttributeEmptyValueAllowed(attr.getName());
} catch (MBeanMetaException mme)
{
//field not found in registry
}
if(!bEmptyValueAllowed)
continue; //skip set of empty value
}
if(attr.getValue()==null)
bean.setAttributeValue(MBeanMetaHelper.mapToConfigBeanAttributeName(attr.getName()), (String)attr.getValue());
else
bean.setAttributeValue(MBeanMetaHelper.mapToConfigBeanAttributeName(attr.getName()), ""+attr.getValue());
}
if(props!=null && props.size()>0)
{
final Enumeration e = props.propertyNames();
ArrayList propsList = new ArrayList();
while (e.hasMoreElements())
{
ElementProperty ep = new ElementProperty();
String key = (String)e.nextElement();
ep.setName(key);
ep.setValue(props.getProperty(key));
propsList.add(ep);
}
if(propsList.size()>0)
{
ElementProperty eps[] = (ElementProperty[])propsList.toArray(
new ElementProperty[propsList.size()]);
bean.setValue("ElementProperty", eps);
}
}
return bean;
}