public class ObjectMBean
extends java.lang.Object
implements javax.management.DynamicMBean
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.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Object |
_managed |
| Constructor and Description |
|---|
ObjectMBean(java.lang.Object managedObject)
Creates a new ObjectMBean wrapping the given
managedObject. |
| Modifier and Type | Method and Description |
|---|---|
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() |
java.lang.String |
getObjectContextBasis()
Allows to customize the ObjectName property
context. |
javax.management.ObjectName |
getObjectName()
Allows to customize the ObjectName of this MBean.
|
java.lang.String |
getObjectNameBasis()
Allows to customize the ObjectName property
name. |
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)
Deprecated.
Use
MBeanContainer.mbeanFor(Object) instead |
void |
setAttribute(javax.management.Attribute attribute) |
javax.management.AttributeList |
setAttributes(javax.management.AttributeList attributes) |
protected void |
setMBeanContainer(MBeanContainer container) |
public ObjectMBean(java.lang.Object managedObject)
managedObject.managedObject - the object to managepublic java.lang.Object getManagedObject()
public javax.management.ObjectName getObjectName()
Allows to customize the ObjectName of this MBean.
MBeanContainer to create a default ObjectNamepublic 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:
contextpublic 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.
nameprotected void setMBeanContainer(MBeanContainer container)
public MBeanContainer getMBeanContainer()
@Deprecated public static java.lang.Object mbeanFor(java.lang.Object o)
MBeanContainer.mbeanFor(Object) insteado - the object to wrap as MBeanpublic javax.management.MBeanInfo getMBeanInfo()
getMBeanInfo in interface javax.management.DynamicMBeanpublic java.lang.Object getAttribute(java.lang.String name)
throws javax.management.AttributeNotFoundException,
javax.management.ReflectionException,
javax.management.MBeanException
getAttribute in interface javax.management.DynamicMBeanjavax.management.AttributeNotFoundExceptionjavax.management.ReflectionExceptionjavax.management.MBeanExceptionpublic javax.management.AttributeList getAttributes(java.lang.String[] names)
getAttributes in interface javax.management.DynamicMBeanpublic void setAttribute(javax.management.Attribute attribute)
throws javax.management.AttributeNotFoundException,
javax.management.ReflectionException,
javax.management.MBeanException
setAttribute in interface javax.management.DynamicMBeanjavax.management.AttributeNotFoundExceptionjavax.management.ReflectionExceptionjavax.management.MBeanExceptionpublic javax.management.AttributeList setAttributes(javax.management.AttributeList attributes)
setAttributes in interface javax.management.DynamicMBeanpublic java.lang.Object invoke(java.lang.String name,
java.lang.Object[] params,
java.lang.String[] signature)
throws javax.management.ReflectionException,
javax.management.MBeanException
invoke in interface javax.management.DynamicMBeanjavax.management.ReflectionExceptionjavax.management.MBeanExceptionCopyright © 1995–2023 Webtide. All rights reserved.