Java Reference
In-Depth Information
The
setAttribute()
method throws
InstanceNotFoundException
,
MBean-
Exception
,
AttributeNotFoundException
,
ReflectionException
, and
Runtime-
OperationsException.
In addition to these exceptions, the method throws
InvalidAttributeValueException
, indicating that the supplied attribute value
cannot be assigned to the MBean attribute.
The AttributeList setAttributes( ObjectName name, AttributeList list ) method
This method operates like the previous method, but over an
AttributeList
argu-
ment. The
AttributeList
parameter contains
Attribute
objects that contain
names and values for writeable MBean attributes. This method throws the
InstanceNotFoundException
,
ReflectionException
, and
RuntimeOperationsEx-
ception
exceptions.
The Object invoke( ObjectName name, String method,
Object[] params, String[] sig ) method
The
MBeanServer
interface declares the
invoke()
method in order to allow man-
agement applications to invoke the exposed operations of MBeans. To invoke an
MBean operation, you need to pass in its
ObjectName
, the method name, and two
arrays that contain the method's signature and input parameters. The result of
the MBean operation will be returned as an instance of the
Object
class. The
method name supplied by the
String
parameter must be a valid MBean opera-
tion. This method throws
InstanceNotFoundException
,
MBeanException
, and
ReflectionException
.
The MBeanInfo getMBeanInfo( ObjectName name ) method
The
getMBeanInfo()
method will return an instance of the
MBeanInfo
class that
describes the MBean corresponding to the supplied
ObjectName
instance. Man-
agement applications would use this method to discover everything about an
MBean. With all the information from the
MBeanInfo
object, applications can cre-
ate a view of the MBean for user interaction.
For more information about the
MBeanInfo
class and the other metadata
objects, look back at chapter 4. Remember that the MBean server uses the
MBean metadata objects (the
MBeanInfo
descriptions) to internally represent
MBeans. Therefore, every MBean is described in the same manner regardless of
its type.
In addition to the
InstanceNotFoundException
and
ReflectionException
exceptions, this method throws the
IntrospectionException
exception indicat-
ing that an error occurred while the MBean server was using reflection to build
the
MBeanInfo
object for the MBean.