
public abstract class SimpleMBean extends Object implements 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 MBeanInfo |
m_beanInfo |
| Modifier | Constructor and Description |
|---|---|
protected |
SimpleMBean()
Create a new SimpleMBean
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getAttribute(String name)
Gets an attribute using reflection from the MBean.
|
abstract String[] |
getAttributeNames()
This method must return a list of attributes which are
exposed by the SimpleMBean.
|
AttributeList |
getAttributes(String[] arg0)
Gets multiple attributes at the same time.
|
protected String |
getDescription()
Customization hook: Override this to get a description for your MBean.
|
MBeanInfo |
getMBeanInfo()
Return the MBeanInfo structure.
|
abstract String[] |
getMethodNames()
This method must return a list of operations which
are to be exposed by the SimpleMBean.
|
Object |
invoke(String arg0,
Object[] arg1,
String[] arg2)
Invokes a particular method.
|
void |
setAttribute(Attribute attr) |
AttributeList |
setAttributes(AttributeList arg0) |
protected MBeanInfo m_beanInfo
protected SimpleMBean() throws NotCompliantMBeanException
NotCompliantMBeanException - if an error occurs registering the MBean.protected String getDescription()
public Object getAttribute(String name) throws AttributeNotFoundException, MBeanException, ReflectionException
getAttribute in interface DynamicMBeanname - Name of the attribute to find.AttributeNotFoundException - If there is not such attributeMBeanExceptionReflectionExceptionpublic AttributeList getAttributes(String[] arg0)
getAttributes in interface DynamicMBeanarg0 - The attribute names to getpublic MBeanInfo getMBeanInfo()
getMBeanInfo in interface DynamicMBeanpublic Object invoke(String arg0, Object[] arg1, String[] arg2) throws MBeanException, ReflectionException
invoke in interface DynamicMBeanarg0 - Method namearg1 - A list of arguments for the invocationMBeanExceptionReflectionExceptionpublic void setAttribute(Attribute attr) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
setAttribute in interface DynamicMBeanAttributeNotFoundExceptionInvalidAttributeValueExceptionMBeanExceptionReflectionExceptionpublic AttributeList setAttributes(AttributeList arg0)
setAttributes in interface DynamicMBeanpublic abstract 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 String[] getMethodNames()
Copyright © 2001-2018 The Apache Software Foundation. All rights reserved.