站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 jmx API Documentation 英文版文档

StandardMBean (JBoss/JMX API) - JBoss 4.0.1 sp1 jmx API Documentation 英文版文档


javax.management
Class StandardMBean

java.lang.Object
  extended byjavax.management.StandardMBean
All Implemented Interfaces:
DynamicMBean

public class StandardMBean
extends Object
implements DynamicMBean

A helper class to allow standard mbeans greater control over their management interface.

Extending this class actually makes the mbean a dynamic mbean, but with the convenience of a standard mbean.

Version:
$Revision: 1.8 $
Author:
Adrian Brock., Thomas Diesler.

Constructor Summary
protected StandardMBean(Class mbeanInterface)
          Construct a DynamicMBean from this object and the passed management interface class.
  StandardMBean(Object implementation, Class mbeanInterface)
          Construct a DynamicMBean from the given implementation object and the passed management interface class.
 
Method Summary
protected  void cacheMBeanInfo(MBeanInfo info)
          Sets the cached mbean info
 Object getAttribute(String attribute)
          Returns the value of the attribute with the name matching the passed string.
 AttributeList getAttributes(String[] attributes)
          Returns the values of the attributes with names matching the passed string array.
protected  MBeanInfo getCachedMBeanInfo()
          Retrieve the cached mbean info
protected  String getClassName(MBeanInfo info)
          Retrieve the class name of the mbean
protected  MBeanConstructorInfo[] getConstructors(MBeanConstructorInfo[] constructors, Object implementation)
          Retrieve the constructors
protected  String getDescription(MBeanAttributeInfo info)
          Retrieve the description of the mbean attribute
protected  String getDescription(MBeanConstructorInfo info)
          Retrieve the description of the mbean constructor
protected  String getDescription(MBeanConstructorInfo info, MBeanParameterInfo param, int sequence)
          Retrieve the description of the mbean constructor parameter
protected  String getDescription(MBeanFeatureInfo info)
          Retrieve the description of the mbean feature
protected  String getDescription(MBeanInfo info)
          Retrieve the description of the mbean
protected  String getDescription(MBeanOperationInfo info)
          Retrieve the description of the mbean operation
protected  String getDescription(MBeanOperationInfo info, MBeanParameterInfo param, int sequence)
          Retrieve the description of the mbean operation parameter
protected  int getImpact(MBeanOperationInfo info)
          Retrieve the impact of the mbean operation
 Object getImplementation()
          Retrieve the implementation object
 Class getImplementationClass()
          Retrieve the implementation class
 MBeanInfo getMBeanInfo()
          Returns the management interface that describes this dynamic resource.
 Class getMBeanInterface()
          Retrieve the management interface
protected  String getParameterName(MBeanConstructorInfo info, MBeanParameterInfo param, int sequence)
          Retrieve the parameter name for a constructor
protected  String getParameterName(MBeanOperationInfo info, MBeanParameterInfo param, int sequence)
          Retrieve the parameter name for an operation
 Object invoke(String actionName, Object[] params, String[] signature)
          Invokes a resource operation.
 void setAttribute(Attribute attribute)
          Sets the value of an attribute.
 AttributeList setAttributes(AttributeList attributes)
          Sets the values of the attributes passed as an AttributeList of name and new value pairs.
 void setImplementation(Object implementation)
          Replace the implementation object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardMBean

public StandardMBean(Object implementation,
                     Class mbeanInterface)
              throws NotCompliantMBeanException
Construct a DynamicMBean from the given implementation object and the passed management interface class.

Parameters:
implementation - the object implementing the mbean
mbeanInterface - the management interface of the mbean
Throws:
IllegalArgumentException - for a null implementation
NotCompliantMBeanException - if the management interface does not follow the JMX design patterns or the implementation does not implement the interface

StandardMBean

protected StandardMBean(Class mbeanInterface)
                 throws NotCompliantMBeanException
Construct a DynamicMBean from this object and the passed management interface class.

Used in subclassing

Parameters:
mbeanInterface - the management interface of the mbean
Throws:
NotCompliantMBeanException - if the management interface does not follow the JMX design patterns or this does not implement the interface
Method Detail

getImplementation

public Object getImplementation()
Retrieve the implementation object

Returns:
the implementation

setImplementation

public void setImplementation(Object implementation)
                       throws NotCompliantMBeanException
Replace the implementation object

Parameters:
implementation - the new implementation
Throws:
IllegalArgumentException - for a null parameter
NotCompliantMBeanException - if the new implementation does not implement the interface supplied at construction

getImplementationClass

public Class getImplementationClass()
Retrieve the implementation class

Returns:
the class of the implementation

getMBeanInterface

public final Class getMBeanInterface()
Retrieve the management interface

Returns:
the management interface

getAttribute

public Object getAttribute(String attribute)
                    throws AttributeNotFoundException,
                           MBeanException,
                           ReflectionException
Description copied from interface: DynamicMBean
Returns the value of the attribute with the name matching the passed string.

Specified by:
getAttribute in interface DynamicMBean
Parameters:
attribute - the name of the attribute.
Returns:
the value of the attribute.
Throws:
ReflectionException - wraps any error invoking the resource.
MBeanException - wraps any error thrown by the resource when getting the attribute.
AttributeNotFoundException - when there is no such attribute.

setAttribute

public void setAttribute(Attribute attribute)
                  throws AttributeNotFoundException,
                         InvalidAttributeValueException,
                         MBeanException,
                         ReflectionException
Description copied from interface: DynamicMBean
Sets the value of an attribute. The attribute and new value are passed in the name value pair Attribute.

Specified by:
setAttribute in interface DynamicMBean
Parameters:
attribute - the name and new value of the attribute.
Throws:
MBeanException - wraps any error thrown by the resource when setting the new value.
ReflectionException - wraps any error invoking the resource.
InvalidAttributeValueException - when the new value cannot be converted to the type of the attribute.
AttributeNotFoundException - when there is no such attribute.
See Also:
Attribute

getAttributes

public AttributeList getAttributes(String[] attributes)
Description copied from interface: DynamicMBean
Returns the values of the attributes with names matching the passed string array.

Specified by:
getAttributes in interface DynamicMBean
Parameters:
attributes - the names of the attribute.
Returns:
an AttributeList of name and value pairs.

setAttributes

public AttributeList setAttributes(AttributeList attributes)
Description copied from interface: DynamicMBean
Sets the values of the attributes passed as an AttributeList of name and new value pairs.

Specified by:
setAttributes in interface DynamicMBean
Parameters:
attributes - the name an new value pairs.
Returns:
an AttributeList of name and value pairs that were actually set.

invoke

public Object invoke(String actionName,
                     Object[] params,
                     String[] signature)
              throws MBeanException,
                     ReflectionException
Description copied from interface: DynamicMBean
Invokes a resource operation.

Specified by:
invoke in interface DynamicMBean
Parameters:
actionName - the name of the operation to perform.
params - the parameters to pass to the operation.
signature - the signartures of the parameters.
Returns:
the result of the operation.
Throws:
ReflectionException - wraps any error invoking the resource.
MBeanException - wraps any error thrown by the resource when performing the operation.

getMBeanInfo

public MBeanInfo getMBeanInfo()
Description copied from interface: DynamicMBean
Returns the management interface that describes this dynamic resource. It is the responsibility of the implementation to make sure the description is accurate.

Specified by:
getMBeanInfo in interface DynamicMBean
Returns:
the management interface.

getClassName

protected String getClassName(MBeanInfo info)
Retrieve the class name of the mbean

Parameters:
info - the default mbeaninfo derived by reflection
Returns:
the class name

getDescription

protected String getDescription(MBeanInfo info)
Retrieve the description of the mbean

Parameters:
info - the default mbeaninfo derived by reflection
Returns:
the description

getDescription

protected String getDescription(MBeanFeatureInfo info)
Retrieve the description of the mbean feature

Parameters:
info - the default mbeanfeatureinfo derived by reflection
Returns:
the description

getDescription

protected String getDescription(MBeanAttributeInfo info)
Retrieve the description of the mbean attribute

Parameters:
info - the default mbeanattributeinfo derived by reflection
Returns:
the description

getDescription

protected String getDescription(MBeanConstructorInfo info)
Retrieve the description of the mbean constructor

Parameters:
info - the default mbeanconstructorinfo derived by reflection
Returns:
the description

getDescription

protected String getDescription(MBeanOperationInfo info)
Retrieve the description of the mbean operation

Parameters:
info - the default mbeanoperationinfo derived by reflection
Returns:
the description

getDescription

protected String getDescription(MBeanConstructorInfo info,
                                MBeanParameterInfo param,
                                int sequence)
Retrieve the description of the mbean constructor parameter

Parameters:
info - the default mbeanconstructorinfo derived by reflection
param - the parameter information
sequence - the parameter index, starting with zero
Returns:
the description

getDescription

protected String getDescription(MBeanOperationInfo info,
                                MBeanParameterInfo param,
                                int sequence)
Retrieve the description of the mbean operation parameter

Parameters:
info - the default mbeanoperationinfo derived by reflection
param - the parameter information
sequence - the parameter index, starting with zero
Returns:
the description

getParameterName

protected String getParameterName(MBeanConstructorInfo info,
                                  MBeanParameterInfo param,
                                  int sequence)
Retrieve the parameter name for a constructor

Parameters:
info - the default mbeanconstructorinfo derived by reflection
param - the parameter information
sequence - the parameter index, starting with zero
Returns:
the parameter name

getParameterName

protected String getParameterName(MBeanOperationInfo info,
                                  MBeanParameterInfo param,
                                  int sequence)
Retrieve the parameter name for an operation

Parameters:
info - the default mbeanoperationinfo derived by reflection
param - the parameter information
sequence - the parameter index, starting with zero
Returns:
the parameter name

getImpact

protected int getImpact(MBeanOperationInfo info)
Retrieve the impact of the mbean operation

Parameters:
info - the default mbeanoperationinfo derived by reflection
Returns:
the impact

getConstructors

protected MBeanConstructorInfo[] getConstructors(MBeanConstructorInfo[] constructors,
                                                 Object implementation)
Retrieve the constructors

Parameters:
constructors - the default constructors derived by reflection
implementation - the implementation
Returns:
the constructors if the implementation is this, otherwise null

getCachedMBeanInfo

protected MBeanInfo getCachedMBeanInfo()
Retrieve the cached mbean info

Returns:
the cached mbean info

cacheMBeanInfo

protected void cacheMBeanInfo(MBeanInfo info)
Sets the cached mbean info

Parameters:
info - the mbeaninfo to cache, can be null to erase the cache


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.