Java Reference
In-Depth Information
The Descriptor objects help the metadata classes provide the additional con-
figuration needed for the Model MBean's additional functionality. The Descrip-
torSupport class implements the methods of the Descriptor interface to create a
class that can contain a number of field name-field value pairs. Each field name is
represented by a String object, and each field value is represented by an Object
instance. The methods defined in a Descriptor object deal with getting, setting,
and removing these name-value pairs.
Each metadata object uses the descriptor to contain predefined fields that
describe a particular piece of functionality. As you will see, each metadata class
expects its Descriptor object to contain a field named descriptorType that indi-
cates what the descriptor is being used to describe. The descriptorType field is
expected to have the value MBean , attribute , operation , or notification . There
are many more predefined fields for each metadata class, and we will discuss
each as we go along.
In addition to containing a Descriptor object, each metadata class imple-
ments the DescriptorAccess interface, which provides the classes with the setDe-
scriptor() and getDescriptor() methods. These metadata classes are treated
exactly like the classes they extend, except for their inclusion of Descriptor
objects. Therefore, the following sections will concentrate on their internal
Descriptor —its features, configuration, and uses. For more information about
their super classes, read the metadata section from chapter 5 (section 5.3).
7.4.2
Constructing a ModelMBeanInfoSupport object
As you already know, the ModelMBeanInfoSupport class extends the MBeanInfo
class and therefore provides all the functionality described in chapter 5. How-
ever, this subclass provides the behavioral configuration of a Model MBean by
use of its Descriptor object.
Table 7.2 displays the predefined attributes of the Descriptor object at the
MBean level.
Table 7.2
The MBean-level descriptor attributes
Descriptor attribute
Possible values
Default value
Description
User-defined
mbeanName
The name of the MBean
name
mbean , attribute ,
operation ,
notification
mbean
The type of descriptor
descriptorType
User-defined
Classname
A name for this MBean to be
used in the user display
displayName
Search WWH ::




Custom Search