public abstract class SimpleMBean extends java.lang.Object implements javax.management.DynamicMBean
This class is similar to the javax.management.StandardMBean, but it does require the API interface to be declared, so it's simpler. It's not as powerful, but it does not require you to declare two classes (and keep them in sync).
| Modifier and Type | Field and Description |
|---|---|
protected javax.management.MBeanInfo |
m_beanInfo |
| Modifier | Constructor and Description |
|---|---|
protected |
SimpleMBean()
Create a new SimpleMBean
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getAttribute(java.lang.String name)
Gets an attribute using reflection from the MBean.
|
abstract java.lang.String[] |
getAttributeNames()
This method must return a list of attributes which are
exposed by the SimpleMBean.
|
javax.management.AttributeList |
getAttributes(java.lang.String[] arg0)
Gets multiple attributes at the same time.
|
protected java.lang.String |
getDescription()
Customization hook: Override this to get a description for your MBean.
|
javax.management.MBeanInfo |
getMBeanInfo()
Return the MBeanInfo structure.
|
abstract java.lang.String[] |
getMethodNames()
This method must return a list of operations which
are to be exposed by the SimpleMBean.
|
java.lang.Object |
invoke(java.lang.String arg0,
java.lang.Object[] arg1,
java.lang.String[] arg2)
Invokes a particular method.
|
void |
setAttribute(javax.management.Attribute attr) |
javax.management.AttributeList |
setAttributes(javax.management.AttributeList arg0) |
protected javax.management.MBeanInfo m_beanInfo
protected SimpleMBean() throws javax.management.NotCompliantMBeanException
javax.management.NotCompliantMBeanException - if an error occurs registering the MBean.protected java.lang.String getDescription()
public java.lang.Object getAttribute(java.lang.String name) throws javax.management.AttributeNotFoundException, javax.management.MBeanException, javax.management.ReflectionException
getAttribute in interface javax.management.DynamicMBeanname - Name of the attribute to find.javax.management.AttributeNotFoundException - If there is not such attributejavax.management.MBeanExceptionjavax.management.ReflectionExceptionpublic javax.management.AttributeList getAttributes(java.lang.String[] arg0)
getAttributes in interface javax.management.DynamicMBeanarg0 - The attribute names to getpublic javax.management.MBeanInfo getMBeanInfo()
getMBeanInfo in interface javax.management.DynamicMBeanpublic java.lang.Object invoke(java.lang.String arg0, java.lang.Object[] arg1, java.lang.String[] arg2) throws javax.management.MBeanException, javax.management.ReflectionException
invoke in interface javax.management.DynamicMBeanarg0 - Method namearg1 - A list of arguments for the invocationjavax.management.MBeanExceptionjavax.management.ReflectionExceptionpublic void setAttribute(javax.management.Attribute attr) throws javax.management.AttributeNotFoundException, javax.management.InvalidAttributeValueException, javax.management.MBeanException, javax.management.ReflectionException
setAttribute in interface javax.management.DynamicMBeanjavax.management.AttributeNotFoundExceptionjavax.management.InvalidAttributeValueExceptionjavax.management.MBeanExceptionjavax.management.ReflectionExceptionpublic javax.management.AttributeList setAttributes(javax.management.AttributeList arg0)
setAttributes in interface javax.management.DynamicMBeanpublic abstract java.lang.String[] getAttributeNames()
public void setFoo( String foo ) ...
public String getFoo() ...
public String[] getAttributeNames()
{
String[] attrs = { "foo" };
return attrs;
}
Also, methods starting with "is" are also recognized as getters
(e.g. public boolean isFoo().)public abstract java.lang.String[] getMethodNames()
Copyright (c) 2001-2022 The Apache Software Foundation. All rights reserved.