Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5108792

Add abstract base class to make coding DynamicMBeans easier

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 6
    • core-svc

      Coding a DynamicMBean is harder than it needs to be. Constructing the MBeanInfo completely by hand is tedious and error-prone. The getAttributes and setAttributes methods have to be written explicitly, even if each of them just consists of calling getAttribute or setAttribute n times. The getAttribute and setAttribute methods frequently consist of a set of lines like this:

        if (attrName.equals("foo"))
          return getFoo();
        else if (attrName.equals("bar"))
          return getBar();
        ...
        else
          throw new AttributeNotFoundException(attrName);

      There should be an easier way.

      The AbstractDynamicMBean class defined by the MX4J project would be a good starting point.
      http://cvs.sourceforge.net/viewcvs.py/mx4j/mx4j/src/core/mx4j/AbstractDynamicMBean.java?view=markup

            emcmanus Eamonn McManus
            emcmanus Eamonn McManus
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: