List<BeanMetaData> beans = bmdf.getBeans();
if(beans != null)
{
for(BeanMetaData bmd : beans)
{
DeploymentUnit compUnit = unit.getComponent(bmd.getName());
if(compUnit == null)
{
log.debug("Failed to find component for bean: "+bmd.getName());
continue;
}
MetaData compMetaData = compUnit.getMetaData();
GenericValue gv = getManagedObjectValue(bmd, compMetaData, bmdfMO);
if(gv != null)
{
// The component managed objects need to be in the root map
ManagedObject compMO = (ManagedObject) gv.getValue();
// Use the ManagedObject name if it's not the same as the attachmentName
String managedObjectName = compUnit.getName();
if(compMO != null && compMO.getAttachmentName() != null)
{
managedObjectName = compMO.getAttachmentName().equals(compMO.getName()) ?
compUnit.getName() : compMO.getName();
}
// Add the managed object
managedObjects.put(managedObjectName, compMO);
// Add the bean MO to the beans list
tmpBeans.add(gv);