0 Replies Latest reply on Nov 17, 2008 10:26 AM by Ian Springer

    auto-generating the plugin descriptor for the JBossAS 5 plug

    Ian Springer Master

      I have recently started working on the JBossAS 5 plugin. The initial target of this plugin will be Embedded Jopr, but it will eventually get incorporated into Jopr as well. Rather than using JMX as the management interface to the app server as the AS4 plugin does, the AS5 plugin will use the new AS5 Profile Service.

      When writing any RHQ plugin, all of the metadata for each Resource type must be defined in the plugin's descriptor. For the AS5 plugin there are lots of Resource types - several different types of datasources, several different types of connection factories, topics, queues, a bunch of deployment types, etc. Each of these Resource types includes dozens of configuration properties, metrics, traits, and operations, so creating the plugin descriptor definitions for them by hand would be a daunting task.

      So to make things easier, I decided to write some code that would connect to the AS5 Profile Service and for each known management component type that is deployed, generate the corresponding plugin descriptor XML. It actually first converts the managed component objects to ResourceType domain objects, then converts the ResourceType objects to JAXB objects corresponding to the plugin descriptor XSD, then finally marshals the JAXB objects to an XML file.

      The code that converts from ManagedComponents to ResourceTypes is here:
      https://svn.jboss.org/repos/jopr/trunk/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/MetadataConversionUtils.java

      And the coe that converts from ResourceTypes to JAXB objects to XML is here:
      https://svn.jboss.org/repos/jopr/trunk/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/PluginDescriptorGenerator.java

      The entry point to the whole thing is PluginDescriptorGenerator.generatePluginDescriptor(), which I currently call from the AS5 server resource discovery component's discoverResources() method.

      If you want to try it out, download the latest Embedded Jopr source and build it and deploy it to a recent build of AS5. After AS5 has fully started, look for a file similar to the following:

      jboss-5.0.0.GA/server/default/tmp/embjopr/rhq-plugin8989.xml

      This is the generated plugin descriptor.

      Comments are welcome.

      -Ian