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 DynamicMBean
name
- Name of the attribute to find.AttributeNotFoundException
- If there is not such attributeMBeanException
ReflectionException
public AttributeList getAttributes(String[] arg0)
getAttributes
in interface DynamicMBean
arg0
- The attribute names to getpublic MBeanInfo getMBeanInfo()
getMBeanInfo
in interface DynamicMBean
public Object invoke(String arg0, Object[] arg1, String[] arg2) throws MBeanException, ReflectionException
invoke
in interface DynamicMBean
arg0
- Method namearg1
- A list of arguments for the invocationMBeanException
ReflectionException
public void setAttribute(Attribute attr) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
setAttribute
in interface DynamicMBean
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException
public AttributeList setAttributes(AttributeList arg0)
setAttributes
in interface DynamicMBean
public 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-2019 The Apache Software Foundation. All rights reserved.