loom
  1. loom
  2. LOOM-71

MBeanInfoBuilder does not process superinterfaces

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.0-rc2
    • Fix Version/s: None
    • Component/s: Engine
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The metaclass MBeanInfoBuilder does not process the superinterfaces of a management interface. This behaviour is not consistent with the jmx spec.

      Following patch corrects this:

      — MBeanInfoBuilder.java Wed Oct 6 19:06:52 2004
      +++ MBeanInfoBuilder.java.patch Wed Oct 6 19:34:52 2004
      @@ -161,6 +161,45 @@
      helper.setClassname( type.getName() );
      helper.setDescription( description );

      + introspectAndExtract( type, helper );
      +
      + if( type.isInterface() )

      { + introspectSuperinterfaces( api, helper ); + }

      +
      + return helper.toModelMBeanInfo();
      + }
      +
      + /**
      + * Introspects superinterfaces.
      + * This method uses recursion to iterate through all higher superinterfaces.
      + * (Warning: possible stack overflow)
      + *
      + * @param type the class
      + * @param helper the helper
      + * @throws Exception if unable to introspect class
      + */
      + private void introspectSuperinterfaces( final Class type, final ModelInfoCreationHelper helper )
      + throws Exception
      + {
      + Class[] apis = cls.getInterfaces();
      + for( int i = 0; i < apis.length; i++ )

      { + Class api = apis[i]; + introspectAndExtract( api, helper ); + introspectSuperinterfaces( api, helper ); + }

      + }
      +
      + /**
      + * Introspects a class and extracts MBean constructors/properties/operations.
      + *
      + * @param type the class
      + * @param helper the helper
      + * @throws Exception if unable to introspect class
      + */
      + private void introspectAndExtract( final Class type, final ModelInfoCreationHelper helper )
      + throws Exception
      +

      { final BeanInfo beanInfo = Introspector.getBeanInfo( type ); final Constructor[] constructors = type.getConstructors(); @@ -170,8 +209,6 @@ extractConstructors( constructors, helper ); extractAttributes( propertys, helper ); extractOperations( methods, helper ); - - return helper.toModelMBeanInfo(); }

      /**

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Mark Hale
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: