panmx.rmx
Class RMXBeanFactory

java.lang.Object
  extended by panmx.rmx.RMXBeanFactory

public final class RMXBeanFactory
extends java.lang.Object

The RMXBeanFactory consists of static methods to create RMXBeans.

RMXBeans

A RMXBean is a MBean that only uses datatypes that conform to Open MBean types. This means that the JMX Connector Server and Connector Client need not share mBean specific implementation classes. RMXBeans are strongly influenced by the design of Suns MXBeans.

The RMXBean may use the following types;

Field

RMX Beans can have types that are java beans made up of fields that are expected to have both accessor and mutator methods. The accessors are expected to follow the standard Java Bean pattern;

   public [Type] get[name]() { ... }
 

or if the attribute has a boolean type it can also be accessed via;

   public boolean is[name]() { ... }
 

Mutators also follow the standard Java Bean pattern with one modification - mutators do NOT need to be public.

   void set[name]( [Type] t ) { ... }
 

Usage Patterns

There are two techniques for creating RMXBean beans. One is to create a RMXBean from the component and a corresponding MXBean interface that defines the management interface. These RMXBeans are "StandardRMXBean"s and are created using the RMXBeanFactory.createStandardRMXBean(...) methods. If not otherwise specified a RMXBean will have a management interface with a classname the same as it's classname postfixed with "RMXBean".

The other technique is to annotate the MBean using the annotations defined in the annotations package and use the RMXBeanFactory.createAnnotatedRMXBean(...) method.


Constructor Summary
RMXBeanFactory()
           
 
Method Summary
static java.lang.Object createAnnotatedRMXBean(java.lang.Object object)
          Create RMXBean from annotated object.
static java.lang.Object createStandardRMXBean(java.lang.Object object)
          Create StandardRMXBean using "default" management interface.
static java.lang.Object createStandardRMXBean(java.lang.Object object, java.lang.Class mxInterface)
          Create StandardRMXBean with specified management interface.
static java.lang.Object createStandardRMXBean(java.lang.Object object, java.lang.Class[] mxInterfaces)
          Create StandardRMXBean with specified management interfaces.
static java.lang.Object newProxyInstance(javax.management.MBeanServerConnection connection, javax.management.ObjectName objectName, java.lang.Class mxType)
          Create proxy object for interacting with RMXBean.
static java.lang.Object newProxyInstance(javax.management.MBeanServerConnection connection, javax.management.ObjectName objectName, java.lang.ClassLoader classLoader, java.lang.Class<?>[] mxTypes)
          Create proxy object for interacting with RMXBean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RMXBeanFactory

public RMXBeanFactory()
Method Detail

createAnnotatedRMXBean

public static java.lang.Object createAnnotatedRMXBean(java.lang.Object object)
                                               throws javax.management.NotCompliantMBeanException
Create RMXBean from annotated object.

Parameters:
object - the object.
Returns:
the RMXBean.
Throws:
javax.management.NotCompliantMBeanException - if the object does not conform to RMXBean specification.

createStandardRMXBean

public static java.lang.Object createStandardRMXBean(java.lang.Object object)
                                              throws javax.management.NotCompliantMBeanException
Create StandardRMXBean using "default" management interface.

Parameters:
object - the object.
Returns:
the RMXBean.
Throws:
javax.management.NotCompliantMBeanException - if the object does not conform to RMXBean specification.

createStandardRMXBean

public static java.lang.Object createStandardRMXBean(java.lang.Object object,
                                                     java.lang.Class mxInterface)
                                              throws javax.management.NotCompliantMBeanException
Create StandardRMXBean with specified management interface.

Parameters:
object - the object.
mxInterface - the management interface.
Returns:
the RMXBean.
Throws:
javax.management.NotCompliantMBeanException - if the object does not conform to RMXBean specification.

createStandardRMXBean

public static java.lang.Object createStandardRMXBean(java.lang.Object object,
                                                     java.lang.Class[] mxInterfaces)
                                              throws javax.management.NotCompliantMBeanException
Create StandardRMXBean with specified management interfaces.

Parameters:
object - the object.
mxInterfaces - the management interfaces.
Returns:
the RMXBean.
Throws:
javax.management.NotCompliantMBeanException - if the object does not conform to RMXBean specification.

newProxyInstance

public static java.lang.Object newProxyInstance(javax.management.MBeanServerConnection connection,
                                                javax.management.ObjectName objectName,
                                                java.lang.Class mxType)
                                         throws javax.management.NotCompliantMBeanException
Create proxy object for interacting with RMXBean.

Parameters:
connection - the MBeanServerConnection.
objectName - the name of object on server.
mxType - the interface to proxy.
Returns:
the proxy object.
Throws:
javax.management.NotCompliantMBeanException

newProxyInstance

public static java.lang.Object newProxyInstance(javax.management.MBeanServerConnection connection,
                                                javax.management.ObjectName objectName,
                                                java.lang.ClassLoader classLoader,
                                                java.lang.Class<?>[] mxTypes)
                                         throws javax.management.NotCompliantMBeanException
Create proxy object for interacting with RMXBean.

Parameters:
connection - the MBeanServerConnection.
objectName - the name of object on server.
classLoader - the parent classloader of proxy. The mxTypes must be accessible through ClassLoader.
mxTypes - the interfaces to proxy.
Returns:
the proxy object.
Throws:
javax.management.NotCompliantMBeanException


Copyright © 2005-2006 . All Rights Reserved.