javax.management
public class StandardMBean extends Object implements DynamicMBean
Since: 1.5
Constructor Summary | |
---|---|
protected | StandardMBean(Class<?> iface)
Constructs a new {@link StandardMBean} using the specified
interface and this as the instance. |
<T> | StandardMBean(T impl, Class<T> iface)
Constructs a new {@link StandardMBean} using the specified
interface and the supplied instance as the implementation.
|
Method Summary | |
---|---|
protected void | cacheMBeanInfo(MBeanInfo info)
Caches the {@link MBeanInfo} instance for this object. |
Object | getAttribute(String name)
Obtains the value of the specified attribute of the
management bean. |
AttributeList | getAttributes(String[] names)
Obtains the values of each of the specified attributes
of the management bean. |
protected MBeanInfo | getCachedMBeanInfo()
Returns the cached {@link MBeanInfo} instance for this object. |
protected String | getClassName(MBeanInfo info)
Returns the class name that will be used in the {@link MBeanInfo}
instance. |
protected MBeanConstructorInfo[] | getConstructors(MBeanConstructorInfo[] constructors, Object impl)
Returns information on the constructors that will be used in
the {@link MBeanInfo} instance. |
protected String | getDescription(MBeanAttributeInfo info)
Returns the description of the attribute that will be used in
the supplied {@link MBeanAttributeInfo} instance. |
protected String | getDescription(MBeanConstructorInfo info)
Returns the description of the constructor that will be used in
the supplied {@link MBeanConstructorInfo} instance. |
protected String | getDescription(MBeanConstructorInfo info, MBeanParameterInfo param, int n)
Returns the description of the nth parameter of the constructor
that will be used in the supplied {@link MBeanParameterInfo}
instance. |
protected String | getDescription(MBeanFeatureInfo info)
Returns the description of the supplied feature that
will be used in the supplied {@link MBeanFeatureInfo}
instance. |
protected String | getDescription(MBeanInfo info)
Returns the description of the bean that will be used in the
supplied {@link MBeanInfo} instance. |
protected String | getDescription(MBeanOperationInfo info)
Returns the description of the operation that will be used in
the supplied {@link MBeanOperationInfo} instance. |
protected String | getDescription(MBeanOperationInfo info, MBeanParameterInfo param, int n)
Returns the description of the nth parameter of the operation
that will be used in the supplied {@link MBeanParameterInfo}
instance. |
protected int | getImpact(MBeanOperationInfo info)
Returns the impact of the operation that will be used in the
supplied {@link MBeanOperationInfo} instance. |
Object | getImplementation()
Returns the instance that implements this bean.
|
Class<?> | getImplementationClass()
Returns the class of the instance that implements this bean.
|
MBeanInfo | getMBeanInfo() Returns an information object which lists the attributes and actions associated with the management bean. |
Class<?> | getMBeanInterface()
Returns the interface for this management bean.
|
protected String | getParameterName(MBeanConstructorInfo info, MBeanParameterInfo param, int n)
Returns the name of the nth parameter of the constructor
that will be used in the supplied {@link MBeanParameterInfo}
instance. |
protected String | getParameterName(MBeanOperationInfo info, MBeanParameterInfo param, int n)
Returns the name of the nth parameter of the operation
that will be used in the supplied {@link MBeanParameterInfo}
instance. |
Object | invoke(String name, Object[] params, String[] signature)
Invokes the specified action on the management bean using
the supplied parameters. |
void | setAttribute(Attribute attribute)
Sets the value of the specified attribute of the
management bean. |
AttributeList | setAttributes(AttributeList attributes)
Sets the value of each of the specified attributes
to that supplied by the {@link Attribute} object.
|
void | setImplementation(Object impl)
Replaces the implementation of the interface used by this
instance with the one specified. |
this
as the instance. This should
be used to create an instance via subclassing.
Parameters: iface the interface this bean implements, or null
if the interface should be determined using the naming
convention (class X has interface XMBean).
Throws: NotCompliantMBeanException if this class doesn't implement the interface or a method appears in the interface that doesn't comply with the naming conventions.
Parameters: impl the implementation. iface the interface the bean implements, or null
if the interface should be determined using the naming
convention (class X has interface XMBean).
Throws: IllegalArgumentException if impl
is null
. NotCompliantMBeanException if impl
doesn't implement
the interface or a method appears
in the interface that doesn't comply
with the naming conventions.
Parameters: info the {@link MBeanInfo} instance to cache, or null
if there is no new value to cache. When the value is not
null
, the cache should replace the current value
with the value supplied here.
See Also: getCachedMBeanInfo
Parameters: name the name of the attribute to retrieve.
Returns: the value of the specified attribute.
Throws: AttributeNotFoundException if the name does not correspond to an attribute of the bean. MBeanException if retrieving the attribute causes the bean to throw an exception (which becomes the cause of this exception). ReflectionException if an exception occurred in trying to use the reflection interface to lookup the attribute. The thrown exception is the cause of this exception.
See Also: StandardMBean
Parameters: names the names of the attributes to retrieve.
Returns: a list of the retrieved attributes.
See Also: setAttributes
Returns: the cached {@link MBeanInfo} instance, or null
if no value is cached.
See Also: cacheMBeanInfo
Parameters: info the {@link MBeanInfo} instance constructed via reflection.
Returns: the class name to use in the instance.
null
unless the implementation supplied
is either null
or this
. This default
implementation prevents the use of
{@link MBeanServer#createMBean} in cases where the bean is
not created as a subclass of {@link StandardMBean}.
Parameters: constructors the constructor information created via
reflection. impl the implementation, or null
if this
should be ignored.
Returns: the constructor information to use.
Parameters: info the {@link MBeanAttributeInfo} instance constructed via reflection.
Returns: the description to use in the instance.
Parameters: info the {@link MBeanConstructorInfo} instance constructed via reflection.
Returns: the description to use in the instance.
param.getDescription()
.
Parameters: info the {@link MBeanConstructorInfo} instance constructed via reflection. param the {@link MBeanParameterInfo} instance constructed via reflection. n the number of the parameter, in order to link it to the information on the constructor.
Returns: the description to use in the instance.
info.getDescription()
. This method is also called
by default for the more specific description methods for attributes,
constructors and operations.
Parameters: info the {@link MBeanFeatureInfo} instance constructed via reflection.
Returns: the description to use in the instance.
info.getDescription()
.
Parameters: info the {@link MBeanInfo} instance constructed via reflection.
Returns: the description to use in the instance.
Parameters: info the {@link MBeanOperationInfo} instance constructed via reflection.
Returns: the description to use in the instance.
param.getDescription()
.
Parameters: info the {@link MBeanOperationInfo} instance constructed via reflection. param the {@link MBeanParameterInfo} instance constructed via reflection. n the number of the parameter, in order to link it to the information on the operation.
Returns: the description to use in the instance.
info.getImpact()
.
Parameters: info the {@link MBeanOperationInfo} instance constructed via reflection.
Returns: the impact flag to use in the instance.
Returns: the implementation.
Returns: the implementation class.
Returns an information object which lists the attributes and actions associated with the management bean. This implementation proceeds as follows:
Returns: a description of the management bean, including all exposed attributes and actions.
Returns: the management interface.
param.getName()
.
Parameters: info the {@link MBeanConstructorInfo} instance constructed via reflection. param the {@link MBeanParameterInfo} instance constructed via reflection. n the number of the parameter, in order to link it to the information on the constructor.
Returns: the name to use in the instance.
param.getName()
.
Parameters: info the {@link MBeanOperationInfo} instance constructed via reflection. param the {@link MBeanParameterInfo} instance constructed via reflection. n the number of the parameter, in order to link it to the information on the operation.
Returns: the name to use in the instance.
Parameters: name the name of the action to invoke. params the parameters used to call the action. signature the signature of the action.
Returns: the return value of the action.
Throws: MBeanException if the action throws an exception. The thrown exception is the cause of this exception. ReflectionException if an exception occurred in trying to use the reflection interface to invoke the action. The thrown exception is the cause of this exception.
Parameters: attribute the attribute to set.
Throws: AttributeNotFoundException if the attribute does not correspond to an attribute of the bean. InvalidAttributeValueException if the value is invalid for this particular attribute of the bean. MBeanException if setting the attribute causes the bean to throw an exception (which becomes the cause of this exception). ReflectionException if an exception occurred in trying to use the reflection interface to lookup the attribute. The thrown exception is the cause of this exception.
See Also: getAttribute
Parameters: attributes the attributes to set.
Returns: a list of the changed attributes.
See Also: StandardMBean
Throws: IllegalArgumentException if impl
is null
. NotCompliantMBeanException if impl
doesn't implement
the interface or a method appears
in the interface that doesn't comply
with the naming conventions.