Today, Model MBeans support "Descriptors" to supply additional metadata about the MBean. A Descriptor is essentially a Map<String,?> that contains metadata items. A Descriptor can be attached to the ModelMBeanInfo to describe the MBean itself, and to the various ModelMBean*Info classes (ModelMBeanAttributeInfo etc) to describe the components of the MBean.
This feature is extremely useful, and in the original JMX API there was plainly some recognition of its usefulness beyond just Model MBeans. The Descriptor interface is in javax.management, not javax.management.modelmbean, although its only standard implementation is javax.management.modelmbean.DescriptorSupport.
In particular, it would be very convenient to be able to extend the metadata of Open MBeans using Descriptors, for example in conjunction with MXBeans.
Model MBeans are somewhat difficult to code because they are Dynamic MBeans. You need to build up a lot of data structures to specify the metadata of the Model MBean. If Descriptors were available to Standard MBeans, and if their contents were specifiable through annotations, this would allow us to specify very common additional semantics for attributes and operations in Standard MBeans. For example, it would allow us to specify, for an attribute that is a metric, whether it is a gauge or a counter, what its units are, what its minimum and maximum values are, and so on. Likewise, it would allow us to plug some holes that prevent the mapping between CIM objects and Standard MBeans from being fully reversible.
The suggested change is as follows:
- for every constructor in the classes MBean*Info (MBeanInfo, MBeanAttributeInfo, etc), add a parallel constructor with the same parameters plus an additional Descriptor parameter;
- likewise for OpenMBean*InfoSupport;
- add a parent interface of DescriptorAccess called DescriptorRead that contains the getDescriptor method but not the setDescriptor method and have the above classes implement it;
- add a parent class of DescriptorSupport called SimpleDescriptor that is a read-only Descriptor and that is in the javax.management package.
The last two changes are intended to preserve the present immutability of metadata for Standard MBeans, Open MBeans, and most user-coded Dynamic MBeans. Model MBean metadata is not immutable since it is based on DescriptorSupport which is mutable.
xxxxx@xxxxx 2004-12-06 14:45:18 GMT