Top Description Fields Constructors Methods
org.eclipse.jetty.jmx

public Class ObjectMBean

extends Object
implements DynamicMBean
Class Inheritance
All Implemented Interfaces
javax.management.DynamicMBean
Imports
javax.management.Attribute, .AttributeList, .AttributeNotFoundException, .DynamicMBean, .MBeanException, .MBeanInfo, .ObjectName, .ReflectionException, org.slf4j.Logger, .LoggerFactory

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 Summary

Modifier and TypeField and Description
protected final Object
private MBeanContainer
private MetaData
private static final Logger

Constructor Summary

AccessConstructor and Description
public
ObjectMBean(Object
the object to manage
managedObject
)

Creates a new ObjectMBean wrapping the given managedObject.

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
findBean(ObjectName objectName)

pack-priv ObjectName
public Object
getAttribute(String
The name of the attribute to be retrieved
name
)

Implements javax.management.DynamicMBean.getAttribute.

Obtain the value of a specific attribute of the Dynamic MBean.

public AttributeList
getAttributes(String[]
A list of the attributes to be retrieved.
names
)

Implements javax.management.DynamicMBean.getAttributes.

Get the values of several attributes of the Dynamic MBean.

public Object

Returns:

the managed object
getManagedObject
()

Get the managed object.

public MBeanContainer
public MBeanInfo
getMBeanInfo()

Implements javax.management.DynamicMBean.getMBeanInfo.

Provides the exposed attributes and actions of the Dynamic MBean using an MBeanInfo object.

public String

Returns:

a custom value for the property context
getObjectContextBasis
()

Allows to customize the ObjectName property context.

public ObjectName

Returns:

a custom ObjectName, or null to indicate to MBeanContainer to create a default ObjectName
getObjectName
()

Allows to customize the ObjectName of this MBean.

public String

Returns:

a custom value for the property name
getObjectNameBasis
()

Allows to customize the ObjectName property name.

public Object
invoke(String
The name of the action to be invoked.
name
,
Object[]
An array containing the parameters to be set when the action is invoked.
params
,
String[]
An array containing the signature of the action. The class objects will be loaded through the same class loader as the one used for loading the MBean on which the action is invoked.
signature
)

Implements javax.management.DynamicMBean.invoke.

Allows an action to be invoked on the Dynamic MBean.

pack-priv MetaData
public void
setAttribute(Attribute
The identification of the attribute to be set and the value it is to be set to.
attribute
)

Implements javax.management.DynamicMBean.setAttribute.

Set the value of a specific attribute of the Dynamic MBean.

public AttributeList
setAttributes(AttributeList
A list of attributes: The identification of the attributes to be set and the values they are to be set to.
attributes
)

Implements javax.management.DynamicMBean.setAttributes.

Sets the values of several attributes of the Dynamic MBean.

protected void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_managedback to summary
protected final Object _managed
_mbeanContainerback to summary
private MBeanContainer _mbeanContainer
_metaDataback to summary
private MetaData _metaData
LOGback to summary
private static final Logger LOG

Constructor Detail

ObjectMBeanback to summary
public ObjectMBean(Object managedObject)

Creates a new ObjectMBean wrapping the given managedObject.

Parameters
managedObject:Object

the object to manage

Method Detail

findBeanback to summary
pack-priv Object findBean(ObjectName objectName)
findObjectNameback to summary
pack-priv ObjectName findObjectName(Object bean)
getAttributeback to summary
public Object getAttribute(String name) throws AttributeNotFoundException, ReflectionException, MBeanException

Implements javax.management.DynamicMBean.getAttribute.

Doc from javax.management.DynamicMBean.getAttribute.

Obtain the value of a specific attribute of the Dynamic MBean.

Parameters
name:String

The name of the attribute to be retrieved

Returns:Object

The value of the attribute retrieved.

Annotations
@Override
Exceptions
AttributeNotFoundException:
if specified attribute does not exist or cannot be retrieved
ReflectionException:
Wraps a java.lang.Exception thrown while trying to invoke the getter.
MBeanException:
Wraps a java.lang.Exception thrown by the MBean's getter.
getAttributesback to summary
public AttributeList getAttributes(String[] names)

Implements javax.management.DynamicMBean.getAttributes.

Doc from javax.management.DynamicMBean.getAttributes.

Get the values of several attributes of the Dynamic MBean.

Parameters
names:String[]

A list of the attributes to be retrieved.

Returns:AttributeList

The list of attributes retrieved.

Annotations
@Override
getManagedObjectback to summary
public Object getManagedObject()

Get the managed object.

Returns:Object

the managed object

getMBeanContainerback to summary
public MBeanContainer getMBeanContainer()
getMBeanInfoback to summary
public MBeanInfo getMBeanInfo()

Implements javax.management.DynamicMBean.getMBeanInfo.

Doc from javax.management.DynamicMBean.getMBeanInfo.

Provides the exposed attributes and actions of the Dynamic MBean using an MBeanInfo object.

Returns:MBeanInfo

An instance of MBeanInfo allowing all attributes and actions exposed by this Dynamic MBean to be retrieved.

Annotations
@Override
getObjectContextBasisback to summary
public 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
Returns:String

a custom value for the property context

getObjectNameback to summary
public ObjectName getObjectName()

Allows to customize the ObjectName of this MBean.

Returns:ObjectName

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

getObjectNameBasisback to summary
public 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.

Returns:String

a custom value for the property name

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

Implements javax.management.DynamicMBean.invoke.

Doc from javax.management.DynamicMBean.invoke.

Allows an action to be invoked on the Dynamic MBean.

Parameters
name:String

The name of the action to be invoked.

params:Object[]

An array containing the parameters to be set when the action is invoked.

signature:String[]

An array containing the signature of the action. The class objects will be loaded through the same class loader as the one used for loading the MBean on which the action is invoked.

Returns:Object

The object returned by the action, which represents the result of invoking the action on the MBean specified.

Annotations
@Override
Exceptions
ReflectionException:
Wraps a java.lang.Exception thrown while trying to invoke the method
MBeanException:
Wraps a java.lang.Exception thrown by the MBean's invoked method.
metaDataback to summary
pack-priv MetaData metaData()
setAttributeback to summary
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, ReflectionException, MBeanException

Implements javax.management.DynamicMBean.setAttribute.

Doc from javax.management.DynamicMBean.setAttribute.

Set the value of a specific attribute of the Dynamic MBean.

Parameters
attribute:Attribute

The identification of the attribute to be set and the value it is to be set to.

Annotations
@Override
Exceptions
AttributeNotFoundException:
if specified attribute does not exist or cannot be retrieved
ReflectionException:
Wraps a java.lang.Exception thrown while trying to invoke the MBean's setter.
MBeanException:
Wraps a java.lang.Exception thrown by the MBean's setter.
setAttributesback to summary
public AttributeList setAttributes(AttributeList attributes)

Implements javax.management.DynamicMBean.setAttributes.

Doc from javax.management.DynamicMBean.setAttributes.

Sets the values of several attributes of the Dynamic MBean.

Parameters
attributes:AttributeList

A list of attributes: The identification of the attributes to be set and the values they are to be set to.

Returns:AttributeList

The list of attributes that were set, with their new values.

Annotations
@Override
setMBeanContainerback to summary
protected void setMBeanContainer(MBeanContainer container)