Class ObjectMBean
- All Implemented Interfaces:
DynamicMBean
- Direct Known Subclasses:
AbstractConnectorMBean
,AbstractHandlerMBean
,ConnectionStatisticsMBean
,DeploymentManagerMBean
,FilterMappingMBean
,HolderMBean
,HttpClientMBean
,ServerMBean
,ServletMappingMBean
,WebAppProviderMBean
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
-
Constructor Summary
ConstructorDescriptionObjectMBean
(Object managedObject) Creates a new ObjectMBean wrapping the givenmanagedObject
. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(String name) getAttributes
(String[] names) Allows to customize the ObjectName propertycontext
.Allows to customize the ObjectName of this MBean.Allows to customize the ObjectName propertyname
.void
setAttribute
(Attribute attribute) setAttributes
(AttributeList attributes) protected void
setMBeanContainer
(MBeanContainer container)
-
Field Details
-
_managed
-
-
Constructor Details
-
ObjectMBean
Creates a new ObjectMBean wrapping the givenmanagedObject
.- Parameters:
managedObject
- the object to manage
-
-
Method Details
-
getManagedObject
- Returns:
- the managed object
-
getObjectName
Allows to customize the ObjectName of this MBean.
- Returns:
- a custom ObjectName, or null to indicate to
MBeanContainer
to create a default ObjectName
-
getObjectContextBasis
Allows to customize the ObjectName property
context
.When
MBeanContainer
creates default ObjectNames, thecontext
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:
- a custom value for the property
context
-
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:
- a custom value for the property
name
-
setMBeanContainer
-
getMBeanContainer
-
getMBeanInfo
- Specified by:
getMBeanInfo
in interfaceDynamicMBean
-
getAttribute
public Object getAttribute(String name) throws AttributeNotFoundException, ReflectionException, MBeanException - Specified by:
getAttribute
in interfaceDynamicMBean
- Throws:
AttributeNotFoundException
ReflectionException
MBeanException
-
getAttributes
- Specified by:
getAttributes
in interfaceDynamicMBean
-
setAttribute
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, ReflectionException, MBeanException - Specified by:
setAttribute
in interfaceDynamicMBean
- Throws:
AttributeNotFoundException
ReflectionException
MBeanException
-
setAttributes
- Specified by:
setAttributes
in interfaceDynamicMBean
-
invoke
public Object invoke(String name, Object[] params, String[] signature) throws ReflectionException, MBeanException - Specified by:
invoke
in interfaceDynamicMBean
- Throws:
ReflectionException
MBeanException
-