org.picocontainer.gems.jmx
Class StandardMBeanFactory

java.lang.Object
  extended by org.picocontainer.gems.jmx.StandardMBeanFactory
All Implemented Interfaces:
DynamicMBeanFactory
Direct Known Subclasses:
MX4JDynamicMBeanFactory

public class StandardMBeanFactory
extends Object
implements DynamicMBeanFactory

A factory for DynamicMBeans, that creates MBean instances using the classes StandardMBean and ModelMBean provided by the JMX specification. The implementation offers special support for StandardMBeans following the naming convention for their management interface using the class name of the component with an appended MBean.

Author:
Michael Ward, Jörg Schaible

Constructor Summary
StandardMBeanFactory()
           
 
Method Summary
 DynamicMBean create(Object componentInstance, Class management, MBeanInfo mBeanInfo)
          Create a StandardMBean for the component.
 Class getDefaultManagementInterface(Class type, MBeanInfo mBeanInfo)
          Determin the management interface for the given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardMBeanFactory

public StandardMBeanFactory()
Method Detail

create

public DynamicMBean create(Object componentInstance,
                           Class management,
                           MBeanInfo mBeanInfo)
Create a StandardMBean for the component.

Specified by:
create in interface DynamicMBeanFactory
Parameters:
componentInstance - the instance of the Object being exposed for management.
management - The management interface. If null the implementation will use the interface complying with the naming convention for management interfaces.
mBeanInfo - The MBeanInfo to use. If null the StandardMBean will use an automatically generated one.
Returns:
Returns a StandardMBean. If the mBeanInfo was not null, it is an instance of a StandardNanoMBean.
See Also:
DynamicMBeanFactory.create(java.lang.Object, java.lang.Class, javax.management.MBeanInfo)

getDefaultManagementInterface

public Class getDefaultManagementInterface(Class type,
                                           MBeanInfo mBeanInfo)
                                    throws ClassNotFoundException
Determin the management interface for the given type. The class name of the given type is used as class name of the mBean unless the caller has provided a MBeanInfo, the class name of the MBean is retrieved a MBeanInfo that defines this name. Following the naming conventions is the name of the management interface the same as the class name of the MBean with an appended MBean. The ClassLoader of the type is used to load the interface type.

Parameters:
type - The class of the MBean.
mBeanInfo - The MBeanInfo for the MBean. May be null.
Returns:
Returns the default management interface.
Throws:
ClassNotFoundException - If the management interface cannot be found.


Copyright © 2003-2010 Codehaus. All Rights Reserved.