Red Hat Training
A Red Hat training course is available for Red Hat JBoss Operations Network
3.2. Writing Server-Side Plug-ins
Server-side plug-ins are flexible and while there are some categories that structure the behavior of server-side plug-ins (alerts, content, GUI), generic plug-ins can cover almost any server function.
The outline of writing server-side plug-ins is:
- Optional. Manually download example plug-ins to use as a template from The RHQ Project GitHub Page.
- Identify the type of plug-in. Each server-side plug-in is managed by a higher level plug-in container, which correlates to the type or function of the plug-in.
- Optional. Write custom schema for the plug-in configuration.
- Create the directory for the custom plugin in the sourceRoot
/modules/enterprise/server/plugins
directory. For example:mkdir myPlugin cd myPlugin/ mkdir -p src/main/java/org/rhq/enterprise/server/plugins/myPlugin mkdir -p src/main/resources/META-INF
- Copy the
pom.xml
file from a similar existing plug-in to use for the Maven builds to package your new plug-in. For example:cp ../alert-email/pom.xml .
- Edit the
pom.xml
file so that its properties reflect the new plug-in.NOTEBe sure to include the location of the parent repositories used by server-side plug-ins, which are inhttps://repository.jboss.org/nexus/content/groups/public/org/rhq/rhq-enterprise-server-plugins-parent/
. For example:<repositories> <repository> <snapshots> <enabled>true</enabled> </snapshots> <id>jboss</id> <name>JBoss Repository</name> <url>https://repository.jboss.org/nexus/content/groups/public/org/rhq/rhq-enterprise-server-plugins-parent/</url> </repository> ... </repositories>
- Write the plug-in descriptor that defines that specific plug-in instance. The plug-in descriptor defines everything from the plug-in classes to scheduled jobs. Plug-in descriptor elements are covered in Section 2.2.1.4, “Plug-in Configuration (Both Global and Local)”.
- Implement the Java classes for the plug-in.
- Build the plug-in. During the Maven build process, the plug-in files can be validated.
mvn install
- Deploy the plug-in, as in Section 3.4, “Deploying Server-Side Plug-ins”. When a server-side plug-in is deployed on one server, it is automatically propagated to all of the other JBoss ON servers in the cloud.