org.eclipse.jetty.jmx
Class ObjectMBean

java.lang.Object
  extended by org.eclipse.jetty.jmx.ObjectMBean
All Implemented Interfaces:
javax.management.DynamicMBean
Direct Known Subclasses:
ContextHandlerMBean, HolderMBean, ServerMBean

public class ObjectMBean
extends java.lang.Object
implements javax.management.DynamicMBean

ObjectMBean. A dynamic MBean that can wrap an arbitary Object instance. the attributes and methods exposed by this bean are controlled by the merge of property bundles discovered by names related to all superclasses and all superinterfaces. Attributes and methods exported may be "Object" and must exist on the wrapped object, or "MBean" and must exist on a subclass of OBjectMBean or "MObject" which exists on the wrapped object, but whose values are converted to MBean object names.


Field Summary
protected  java.lang.Object _managed
           
 
Constructor Summary
ObjectMBean(java.lang.Object managedObject)
           
 
Method Summary
 javax.management.MBeanAttributeInfo defineAttribute(java.lang.String name, java.lang.String metaData)
          Define an attribute on the managed object.
 java.lang.Object getAttribute(java.lang.String name)
           
 javax.management.AttributeList getAttributes(java.lang.String[] names)
           
 java.lang.Object getManagedObject()
           
 MBeanContainer getMBeanContainer()
           
 javax.management.MBeanInfo getMBeanInfo()
           
 javax.management.ObjectName getObjectName()
           
 java.lang.String getObjectNameBasis()
           
 java.lang.Object invoke(java.lang.String name, java.lang.Object[] params, java.lang.String[] signature)
           
static java.lang.Object mbeanFor(java.lang.Object o)
          Create MBean for Object.
 void setAttribute(javax.management.Attribute attr)
           
 javax.management.AttributeList setAttributes(javax.management.AttributeList attrs)
           
protected  void setMBeanContainer(MBeanContainer container)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_managed

protected java.lang.Object _managed
Constructor Detail

ObjectMBean

public ObjectMBean(java.lang.Object managedObject)
Method Detail

mbeanFor

public static java.lang.Object mbeanFor(java.lang.Object o)
Create MBean for Object. Attempts to create an MBean for the object by searching the package and class name space. For example an object of the type
 class com.acme.MyClass extends com.acme.util.BaseClass implements com.acme.Iface
 
Then this method would look for the following classes:

Parameters:
o - The object
Returns:
A new instance of an MBean for the object or null.

getManagedObject

public java.lang.Object getManagedObject()

getObjectName

public javax.management.ObjectName getObjectName()

getObjectNameBasis

public java.lang.String getObjectNameBasis()

setMBeanContainer

protected void setMBeanContainer(MBeanContainer container)

getMBeanContainer

public MBeanContainer getMBeanContainer()

getMBeanInfo

public javax.management.MBeanInfo getMBeanInfo()
Specified by:
getMBeanInfo in interface javax.management.DynamicMBean

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
                              throws javax.management.AttributeNotFoundException,
                                     javax.management.MBeanException,
                                     javax.management.ReflectionException
Specified by:
getAttribute in interface javax.management.DynamicMBean
Throws:
javax.management.AttributeNotFoundException
javax.management.MBeanException
javax.management.ReflectionException

getAttributes

public javax.management.AttributeList getAttributes(java.lang.String[] names)
Specified by:
getAttributes in interface javax.management.DynamicMBean

setAttribute

public void setAttribute(javax.management.Attribute attr)
                  throws javax.management.AttributeNotFoundException,
                         javax.management.InvalidAttributeValueException,
                         javax.management.MBeanException,
                         javax.management.ReflectionException
Specified by:
setAttribute in interface javax.management.DynamicMBean
Throws:
javax.management.AttributeNotFoundException
javax.management.InvalidAttributeValueException
javax.management.MBeanException
javax.management.ReflectionException

setAttributes

public javax.management.AttributeList setAttributes(javax.management.AttributeList attrs)
Specified by:
setAttributes in interface javax.management.DynamicMBean

invoke

public java.lang.Object invoke(java.lang.String name,
                               java.lang.Object[] params,
                               java.lang.String[] signature)
                        throws javax.management.MBeanException,
                               javax.management.ReflectionException
Specified by:
invoke in interface javax.management.DynamicMBean
Throws:
javax.management.MBeanException
javax.management.ReflectionException

defineAttribute

public javax.management.MBeanAttributeInfo defineAttribute(java.lang.String name,
                                                           java.lang.String metaData)
Define an attribute on the managed object. The meta data is defined by looking for standard getter and setter methods. Descriptions are obtained with a call to findDescription with the attribute name.

Parameters:
name -
metaData - "description" or "access:description" or "type:access:description" where type is one of:
  • "Object" The field/method is on the managed object.
  • "MBean" The field/method is on the mbean proxy object
  • "MObject" The field/method is on the managed object and value should be converted to MBean reference
  • "MMBean" The field/method is on the mbean proxy object and value should be converted to MBean reference
the access is either "RW" or "RO".


Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.