org.apache.hivemind.management.impl
Class MBeanRegistryImpl

java.lang.Object
  extended by org.apache.hivemind.management.impl.MBeanRegistryImpl
All Implemented Interfaces:
java.util.EventListener, org.apache.hivemind.events.RegistryShutdownListener, MBeanRegistry

public class MBeanRegistryImpl
extends java.lang.Object
implements MBeanRegistry, org.apache.hivemind.events.RegistryShutdownListener

Implementation of MBeanRegistry. Registers MBeans in an standard JMX MBeanServer Supports calling start methods, after the registration. MBeans can be provided as service references in a configuration. Standard MBeans must use the primitive service model. Any interceptor destroys JMX compliance due to naming conventions. Implements shutdown listener to unregisters all MBeans when the registry is shutdown

Since:
1.1
Author:
Achim Huegen

Constructor Summary
MBeanRegistryImpl(org.apache.hivemind.ErrorHandler errorHandler, org.apache.commons.logging.Log log, javax.management.MBeanServer beanServer, ObjectNameBuilder objectNameBuilder, java.util.List beans)
          Creates new instance Registers all MBeans as defined in beans
 
Method Summary
 javax.management.ObjectInstance registerMBean(java.lang.Object obj, java.lang.Class managementInterface, javax.management.ObjectName objectName)
          Registers a MBean in the MBeanServer
 void registryDidShutdown()
          Unregisters all registered MBeans
 void unregisterMBean(javax.management.ObjectName objectName)
          Unregisters a MBean from the MBeanServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBeanRegistryImpl

public MBeanRegistryImpl(org.apache.hivemind.ErrorHandler errorHandler,
                         org.apache.commons.logging.Log log,
                         javax.management.MBeanServer beanServer,
                         ObjectNameBuilder objectNameBuilder,
                         java.util.List beans)
Creates new instance Registers all MBeans as defined in beans

Parameters:
objectNameBuilder - Service responsible for naming MBeans
beans - List with instances of MBeanRegistrationContribution. The specified services get registered as MBeans
Method Detail

registerMBean

public javax.management.ObjectInstance registerMBean(java.lang.Object obj,
                                                     java.lang.Class managementInterface,
                                                     javax.management.ObjectName objectName)
                                              throws javax.management.InstanceAlreadyExistsException,
                                                     javax.management.MBeanRegistrationException,
                                                     javax.management.NotCompliantMBeanException
Description copied from interface: MBeanRegistry
Registers a MBean in the MBeanServer

Specified by:
registerMBean in interface MBeanRegistry
Parameters:
obj - the MBean
managementInterface - The ManagementInterface if obj is a Standard MBean Can be null, if obj implements DynamicMBean
objectName - ObjectName of the MBean
Throws:
javax.management.InstanceAlreadyExistsException
javax.management.MBeanRegistrationException
javax.management.NotCompliantMBeanException
See Also:
MBeanRegistry.registerMBean(Object, Class, ObjectName)

unregisterMBean

public void unregisterMBean(javax.management.ObjectName objectName)
                     throws javax.management.InstanceNotFoundException,
                            javax.management.MBeanRegistrationException
Description copied from interface: MBeanRegistry
Unregisters a MBean from the MBeanServer

Specified by:
unregisterMBean in interface MBeanRegistry
Parameters:
objectName - ObjectName of the MBean
Throws:
javax.management.InstanceNotFoundException
javax.management.MBeanRegistrationException
See Also:
MBeanRegistry.unregisterMBean(javax.management.ObjectName)

registryDidShutdown

public void registryDidShutdown()
Unregisters all registered MBeans

Specified by:
registryDidShutdown in interface org.apache.hivemind.events.RegistryShutdownListener