Class ObjectMBean

  • All Implemented Interfaces:
    Direct Known Subclasses:
    AbstractConnectorMBean, AbstractHandlerMBean, ConnectionStatisticsMBean, DeploymentManagerMBean, FilterMappingMBean, HolderMBean, HttpClientMBean, LogMBean, ServerMBean, ServletMappingMBean

    public class ObjectMBean
    extends java.lang.Object

    A dynamic MBean that can wrap an arbitrary Object instance.

    The attributes and operations exposed by this bean are controlled by the merge of annotations discovered in all superclasses and all superinterfaces.

    Given class com.acme.Foo, then com.acme.jmx.FooMBean is searched; if found, it is instantiated with the com.acme.Foo instance passed to the constructor.

    Class com.acme.jmx.FooMBean can then override the default behavior of ObjectMBean and provide a custom ObjectName, or custom ObjectName properties name and context, etc.

    • Field Detail

      • _managed

        protected final java.lang.Object _managed
    • Constructor Detail

      • ObjectMBean

        public ObjectMBean​(java.lang.Object managedObject)
        Creates a new ObjectMBean wrapping the given managedObject.
        managedObject - the object to manage
    • Method Detail

      • getManagedObject

        public java.lang.Object getManagedObject()
        the managed object
      • getObjectName

        public getObjectName()

        Allows to customize the ObjectName of this MBean.

        a custom ObjectName, or null to indicate to MBeanContainer to create a default ObjectName
      • getObjectContextBasis

        public java.lang.String getObjectContextBasis()

        Allows to customize the ObjectName property context.

        When MBeanContainer creates default ObjectNames, the context property is "inherited" recursively by MBeans that are children of this MBean; this allows to "group" descendant MBeans so that it is clear who is the ancestor they belong to.

        For example, if object A has a child component B which has children components C, then AMBean can override this method to return "alpha", and then the ObjectNames will be:

        • domain:type=a,context=alpha,id=0
        • domain:type=b,context=alpha,id=0
        • domain:type=c,context=alpha,id=0
        • domain:type=c,context=alpha,id=1
        a custom value for the property context
      • getObjectNameBasis

        public java.lang.String getObjectNameBasis()

        Allows to customize the ObjectName property name.

        Certain components have a natural name and returning it from this method allows it to be part of the ObjectName.

        a custom value for the property name
      • setMBeanContainer

        protected void setMBeanContainer​(MBeanContainer container)
      • mbeanFor

        public static java.lang.Object mbeanFor​(java.lang.Object o)
        o - the object to wrap as MBean
        a new instance of an MBean for the object or null if the MBean cannot be created
      • getMBeanInfo

        public getMBeanInfo()
        Specified by:
        getMBeanInfo in interface
      • getAttribute

        public java.lang.Object getAttribute​(java.lang.String name)
        Specified by:
        getAttribute in interface
      • getAttributes

        public getAttributes​(java.lang.String[] names)
        Specified by:
        getAttributes in interface
      • setAttribute

        public void setAttribute​( attribute)
        Specified by:
        setAttribute in interface
      • setAttributes

        public setAttributes​( attributes)
        Specified by:
        setAttributes in interface
      • invoke

        public java.lang.Object invoke​(java.lang.String name,
                                       java.lang.Object[] params,
                                       java.lang.String[] signature)
        Specified by:
        invoke in interface