JBoss Community Archive (Read Only)

RHQ 4.9

Plugins - Packaging Structure

Plugin Structure Checklist

images/author/images/icons/emoticons/check.gif Include plugin descriptor with the correct name and location
images/author/images/icons/emoticons/check.gif Include compiled classes for the plugin API interfaces and any supporting classes
images/author/images/icons/emoticons/check.gif Optional: Include any dependency JARs and files in the correct location

Overview

A plugin is packaged up as a JAR file and follows many of the typical JAR file patterns.

The following properties are specific to a packaged RHQ plugin.

Plugin Descriptor

A plugin descriptor must be provided in a plugin. Without this descriptor, the plugin container will be unable to determine the functionality (resource types and their associated metadata) introduced by the plugin. The plugin descriptor must be located at the following location within the JAR:

META-INF/rhq-plugin.xml

For more information on how to write a plugin descriptor, see the plugin descriptor documentation page.

Classes

As mentioned in "What are the pieces that make up a plugin?", a plugin is made up of the descriptor and the code implementations of the plugin API interfaces. These implementations, along with any other classes that are written to support them, are located at the root level of the packaged plugin JAR (obviously keeping the package structure in tact). For instance, the following is a snippet of the files found in the platform plugin:

 19780  05-08-08 10:54   META-INF/rhq-plugin.xml
 5516  05-08-08 10:54   org/rhq/plugins/platform/NetworkAdapterComponent.class
11411  05-08-08 10:54   org/rhq/plugins/platform/PlatformComponent.class
 2895  05-08-08 10:54   org/rhq/plugins/platform/CpuDiscoveryComponent.class

The above snippet shows both the plugin descriptor file as well as a number of component implementations. Each of those classes implements one of the plugin API interfaces, however as previously stated other support classes may be included as well.

Dependencies

Optionally, plugins can include dependency libraries that are not already provided by the RHQ agent. Each plugin is loaded into its own class loader, so there is no risk of a plugin providing a dependency that will conflict with ones from a different plugin.

Dependencies are placed in a lib directory inside of the packaged plugin JAR, located at the root of the file. Any JAR files not placed in this directory will not be loaded into the class loader.

Additionally, resource files may be placed in this directory as well and will be accessible in the plugin's classpath.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 07:57:31 UTC, last content change 2013-09-18 19:42:09 UTC.