ManagementComponent mc = (ManagementComponent) moAnns.get(ManagementComponent.class.getName());
if(mc != null)
{
type = new ComponentType(mc.type(), mc.subtype());
}
ManagedComponentImpl comp = new ManagedComponentImpl(type, md, bmdMO);
md.addComponent(bmdMO.getName(), comp);
log.debug("Created ManagedComponent("+comp.getName()+") of type: "
+type
+" for MO: "+bmdMO.getName()
+", componentName: "+bmdMO.getComponentName());
}
if(md != null)
bootstrapMDs.put(kd.getName(), md);
}
// Add other Server managed objects
if(firstDeployment != null)
{
ComponentType type = new ComponentType("MCBean", "MCServer");
ManagedObject serverMO = mof.initManagedObject(mcserver, null);
if (serverMO.getOperations() != null && serverMO.getOperations().size() == 0)
{
ManagedOperationImpl shutdown = new ManagedOperationImpl("Shutdown the server", "shutdown");
if(serverMO instanceof MutableManagedObject)
{
HashSet<ManagedOperation> ops = new HashSet<ManagedOperation>();
ops.add(shutdown);
MutableManagedObject mmo = MutableManagedObject.class.cast(serverMO);
mmo.setOperations(ops);
}
}
ManagedComponentImpl serverComp = new ManagedComponentImpl(type, firstDeployment, serverMO);
firstDeployment.addComponent("MCServer", serverComp);
try
{
BeanInfo mcserverInfo = configurator.getBeanInfo(mcserver.getClass());
BeanKernelRegistryEntry entry = new BeanKernelRegistryEntry(mcserver, mcserverInfo);
bootstrapEntries.put(serverComp.getComponentName(), entry);
}
catch(Throwable t)
{
log.error("Failed to create BeanInfo for: "+serverComp, t);
}
// ServerConfig
type = new ComponentType("MCBean", "ServerConfig");
ServerConfig config = mcserver.getConfig();
ManagedObject mo = mof.initManagedObject(config, null);
ManagedComponentImpl configComp = new ManagedComponentImpl(type, firstDeployment, mo);
firstDeployment.addComponent("ServerConfig", configComp);
log.debug("Created ManagedComponent of type: "+type+" for ServerConfig");
}
}
}