Java Reference
In-Depth Information
Table 7.3
Attribute-level descriptor attributes (continued)
Descriptor attribute
Possible values
Description
XML format
Same as the MBean level
presentationString
User-defined
Display name for this attribute
displayName
You'll notice some duplicates from the MBean-level descriptor. As mentioned
earlier, any duplicates override the MBean-level values but apply only to this
particular attribute. The remaining attributes fall into three categories: describ-
ing the attribute, accessing the attribute, and storing the attribute value.
Describing the attribute
The descriptor attributes falling into this category are name , default , protocol-
Map , and iterable . The name value is simply the name of the attribute. The
default attribute provides the MBean attribute with a default value. Remember,
because the Descriptor class allows for name- Object pairs, the default value can
be more than a String representation.
The iterable attribute indicates to a user whether the MBean attribute value
is an iterable collection. This is a quick way to determine if the MBean attribute
value is a list or some other class using the java.util.Iterable interface.
Finally, the protocolMap descriptor attribute is a unique attribute used only
for MBean attributes. It contains an Object value that provides hints to a man-
agement application about how this MBean attribute value might be mapped to
a different protocol. For example, you could use the protocolMap attribute to
translate this value to Simple Network Management Protocol ( SNMP ) or a pro-
prietary protocol.
Accessing the attribute
To describe how the MBean attribute is accessed, you need to use the getMethod
and setMethod descriptor attributes. These two attributes contain the names of
the methods used to get and set the value of the MBean attribute. In contrast to
the other MBean types, these methods do not have to follow the naming scheme
of getName and setName , where Name is the name of the MBean attribute. These
method names can be any methods of the managed resource Object value con-
tained in the Model MBean. Thus you can map an MBean attribute value to any
method available in your object. Operations specified as getters and setter must
also be described with an operation metadata object (shown in a moment).
Search WWH ::




Custom Search