org.mortbay.management
Class ObjectMBean

java.lang.Object
  extended byorg.mortbay.management.ObjectMBean
Direct Known Subclasses:
ContextHandlerMBean, HolderMBean, ServerMBean

public class ObjectMBean
extends Object

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  Object _managed
           
 
Constructor Summary
ObjectMBean(Object managedObject)
           
 
Method Summary
 MBeanAttributeInfo defineAttribute(String name, String metaData)
          Define an attribute on the managed object.
 Object getAttribute(String name)
           
 AttributeList getAttributes(String[] names)
           
 Object getManagedObject()
           
 MBeanContainer getMBeanContainer()
           
 MBeanInfo getMBeanInfo()
           
 ObjectName getObjectName()
           
 String getObjectNameBasis()
           
 Object invoke(String name, Object[] params, String[] signature)
           
static Object mbeanFor(Object o)
          Create MBean for Object.
 void setAttribute(Attribute attr)
           
 AttributeList setAttributes(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 Object _managed
Constructor Detail

ObjectMBean

public ObjectMBean(Object managedObject)
Method Detail

mbeanFor

public static Object mbeanFor(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 Object getManagedObject()

getObjectName

public ObjectName getObjectName()

getObjectNameBasis

public String getObjectNameBasis()

setMBeanContainer

protected void setMBeanContainer(MBeanContainer container)

getMBeanContainer

public MBeanContainer getMBeanContainer()

getMBeanInfo

public MBeanInfo getMBeanInfo()

getAttribute

public Object getAttribute(String name)
                    throws AttributeNotFoundException,
                           MBeanException,
                           ReflectionException
Throws:
AttributeNotFoundException
MBeanException
ReflectionException

getAttributes

public AttributeList getAttributes(String[] names)

setAttribute

public void setAttribute(Attribute attr)
                  throws AttributeNotFoundException,
                         InvalidAttributeValueException,
                         MBeanException,
                         ReflectionException
Throws:
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException

setAttributes

public AttributeList setAttributes(AttributeList attrs)

invoke

public Object invoke(String name,
                     Object[] params,
                     String[] signature)
              throws MBeanException,
                     ReflectionException
Throws:
MBeanException
ReflectionException

defineAttribute

public MBeanAttributeInfo defineAttribute(String name,
                                          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 the "Object","MBean" or "MObject" to indicate the method is on the object, the MBean or on the object but converted to an MBean, access is either "RW" or "RO".


Copyright © {inceptionYear}-2007 Mort Bay Consulting. All Rights Reserved.