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:
  1. Optional. Manually download example plug-ins to use as a template from The RHQ Project GitHub Page.
  2. 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.
  3. Optional. Write custom schema for the plug-in configuration.
  4. 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
  5. 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 .
  6. Edit the pom.xml file so that its properties reflect the new plug-in.
    NOTE
    Be sure to include the location of the parent repositories used by server-side plug-ins, which are in https://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>
  7. 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)”.
  8. Implement the Java classes for the plug-in.
  9. Build the plug-in. During the Maven build process, the plug-in files can be validated.
    mvn install
    
  10. 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.