org.eclipse.jetty.jmx

## Class ObjectMBean

- java.lang.Object
- - org.eclipse.jetty.jmx.ObjectMBean

- All Implemented Interfaces:
    DynamicMBean
  Direct Known Subclasses:
    AbstractHandlerMBean, DeploymentManagerMBean, FilterMappingMBean, HolderMBean, LogMBean, ServerMBean, ServletMappingMBean

      public class ObjectMBean
      extends Object
      implements 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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Object` | `_managed`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ObjectMBean(Object managedObject)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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()`
    `String` | `getObjectContextBasis()`
    `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:
      - com.acme.jmx.MyClassMBean
      - com.acme.util.jmx.BaseClassMBean
      - org.eclipse.jetty.jmx.ObjectMBean
      Parameters:
        `o` - The object
      Returns:
        A new instance of an MBean for the object or null.

    - #### getManagedObject

          public Object getManagedObject()

    - #### getObjectName

          public ObjectName getObjectName()

    - #### getObjectContextBasis

          public String getObjectContextBasis()

    - #### getObjectNameBasis

          public String getObjectNameBasis()

    - #### setMBeanContainer

          protected void setMBeanContainer(MBeanContainer container)

    - #### getMBeanContainer

          public MBeanContainer getMBeanContainer()

    - #### getMBeanInfo

          public MBeanInfo getMBeanInfo()

      Specified by:
        `getMBeanInfo` in interface `DynamicMBean`

    - #### getAttribute

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

      Specified by:
        `getAttribute` in interface `DynamicMBean`
      Throws:
        `AttributeNotFoundException`
        `MBeanException`
        `ReflectionException`

    - #### getAttributes

          public AttributeList getAttributes(String[] names)

      Specified by:
        `getAttributes` in interface `DynamicMBean`

    - #### setAttribute

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

      Specified by:
        `setAttribute` in interface `DynamicMBean`
      Throws:
        `AttributeNotFoundException`
        `InvalidAttributeValueException`
        `MBeanException`
        `ReflectionException`

    - #### setAttributes

          public AttributeList setAttributes(AttributeList attrs)

      Specified by:
        `setAttributes` in interface `DynamicMBean`

    - #### invoke

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

      Specified by:
        `invoke` in interface `DynamicMBean`
      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 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-2016 Mort Bay Consulting. All Rights Reserved.