JDK-6196560 : Move Descriptor support from ModelMBean*Info to MBean*Info
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2004-11-17
  • Updated: 2010-07-29
  • Resolved: 2004-12-06
Related Reports
Duplicate :  
Relates :  
Description
One of the key features of Model MBeans is the ability to include
extra metadata in the ModelMBeanInfo and related classes
(ModelMBeanAttributeInfo etc) via a Descriptor parameter to those
classes' constructors.  It was originally envisaged that Descriptors
would be more generally useful than just for Model MBeans, which is
why the Descriptor interface is in javax.management rather than
javax.management.modelmbean.  It would be very useful to allow
Descriptors to be supplied for other types of MBeans, for example:
- to indicate that an attribute or operation is "disabled" (see
  bug 4786777));
- to provide additional information about an attribute that is
  a metric, for example its units, minimum and maximum values, whether
  it is an instantaneous value or is sampled across a period, etc.;
- to specify that the value of an attribute is constant for a given
  MBean instance;
- ...and it is the same as a named property in the MBean's ObjectName
###@###.### 2004-11-17 13:17:01 GMT

Comments
EVALUATION Implies a number of small changes across the API. The various MBean*Info and OpenMBean*InfoSupport classes should implement the existing interface DescriptorAccess, which gives them getDescriptor and setDescriptor methods, or perhaps a new parent interface DescriptorGetter with just the getDescriptor method (most of these classes are currently immutable). With DescriptorGetter, the existing constructors must be augmented with one or more new constructors that have a Descriptor parameter, and even with DescriptorAccess this would probably be preferable. The only concrete implementation of the Descriptor interface is javax.management.modelmbean.DescriptorSupport, and it would be odd to require people using other kinds of MBeans to import this class. So a parent class should be introduced, say javax.management.modelmbean.DescriptorImpl, and most methods moved from DescriptorSupport up to DescriptorImpl. The isValid() method should probably stay in DescriptorSupport, however. DescriptorImpl should probably refuse to set a descriptor value that is not a string, leaving this possible only in DescriptorSupport. Non-string values are asking for trouble, especially with Open MBeans where they can violate the guarantee that a client will be able to receive metadata without ever needing nonstandard classes from its server. The XML string produced by toXMLString() should be standardized and accepted by the DescriptorImpl and DescriptorSupport constructors. It should be possible to specify Descriptor contents in a Standard MBean interface using annotations. ###@###.### 2004-11-17 13:17:01 GMT
17-11-2004