Saturday, July 26, 2008

RHQ plugin descriptor development - and validation in your IDE

When writing a plugin for RHQ, one has to write the plugin descriptor. While this is not complicated, it still leaves some room for errors.
The good thing (but you will hate it, when you run into it) is that when deploying the plugin, its descriptor will be validated against the defining XML Schema - and errors will reported.

Of course, you could just have a look at the structural diagram of the second part of my plugin development postings, but this doesn't really make the task of writing XML easier.

The elements of the plugin descriptor are encoded in two XML Schema files in the source code:

  • urn:xmlns:rhq-plugin : rhq/modules/core/client-api/src/main/resources/rhq-plugin.xsd
  • urn:xmlns:rhq-configuration : rhq/modules/core/client-api/src/main/resources/rhq-configuration.xsd



Which means for you, that you can use the Schema files too for validation in your IDE. The following sections show how this is done; as my base install path of the RHQ project is in /jon/jonHEAD, this path will be prepended in the examples.

Eclipse 3.3



Go to Preferences->Web and XML->XML Catalog.



IntelliJ 7



Go to Setup->Resources and enter the urn and the path. So it might look like this:



NetBeans 6.1



Go to Tools->DTDs and XML Schemas. Then select the User Catalog and click on Add Local DTD or Schema. This might look as follows:


No comments: