Red Hat Training

A Red Hat training course is available for Red Hat JBoss Operations Network

Chapter 2. Writing Server-Side Plug-ins: Background

All JBoss ON plug-ins have a similar configuration and deployment style, with minor differences in what is required for the plug-ins to access the systems. Server-side plug-ins refer to any plug-in which accesses the core JBoss ON server to perform its actions; essentially, these are global plug-ins used for the central server behavior.

2.1. An Intro to Server-Side Plug-ins

Server-side plug-ins extend the functionality of the JBoss ON server. JBoss ON comes with several categories of server-side plug-ins already:
  • Alert sender plug-ins for methods to send alert notifications for resources
  • Bundle plug-ins for deploying files and application
  • Drift plug-ins for monitoring resource or filesystem configuration and files
  • Content plug-ins for managing resource configurations
  • Generic plug-ins for everything else
Server-side plug-ins are not limited to those three categories; the server-side plug-in framework allows substantial access to the server itself. Server-side plug-ins can be used to run remote scripts in response to monitoring events or to provision systems in a custom work flow — anything that is within the purview of the JBoss ON server.
This is a much more casual approach to implementing plug-ins than the more structured, formal agent plug-in system. This allows much more latitude in what plug-in developers are able to accomplish.
IMPORTANT
All server-side plug-ins have full access to the server's stateless session beans (SLSBs). This allows a lot of latitude and versatility in the functionality of server-side plug-ins and allows access to any server subsystem. However, this also makes server-side plug-ins extremely powerful. Be cautious in writing and deploying server-side plug-ins.
Server-side plug-ins have a different framework for writing and deploying plug-ins than the framework for agent plug-ins. Here are some general bits of information that are useful as you begin writing server-side plug-ins:
  • Once the server-side plug-in is built and deployed, the plug-in is a JAR file with a META-INF/ directory which contains the rhq-serverplugin.xml plug-in descriptor.
  • Each plug-in is independent of every other plug-in. Unlike agent plug-ins, server-side plug-ins do not interact with each other. There are no plug-in dependencies for server-side plug-ins.
Server-side plug-ins are organized according to their type, and the type corresponds to the subsystem or functional area which the plug-in extends. Each type of plug-in is contained within a defined plug-in container.
Server-side plug-ins are managed in the JBoss ON server within a plug-in container that relates to the function of the plug-in, and the plug-in container handles general tasks like starting and stopping plug-ins and providing general configuration settings for that type of plug-in. (All plug-in containers are, themselves, members of a single master plug-in container.)

Figure 2.1. Server-Side Plug-in Containers

Server-Side Plug-in Containers
There is only one plug-in container for each type of plug-in, but there can be an unlimited number of server-side plug-ins within each plug-in container.
NOTE
A plug-in container defines what type a plug-in is. A plug-in, then, can only be in one plug-in container because it can only be of one type.
Table 2.1, “Available Plug-in Containers” summarizes the available plug-in containers with JBoss ON.

Table 2.1. Available Plug-in Containers

Plug-in Type Description Container Name
Generic Catch-all type for any custom plug-ins. This type of plug-in only interacts with the plug-in container for the container to start and stop the plug-in and to initialize and shutdown the plug-in libraries. Generic Plugin
Alert methods Defines an alert notification method, or the way that an alert is sent. AlertHandler
Bundle Defines and processes a type of bundle. This type of plug-in performs tasks that the core server needs to process and manage bundles of specific bundle types, such as Ant recipes or file-based bundles. Each bundle server plug-in knows about and can process a single bundle type. Bundle Plugin
Drift Processes drift operations and configuration. This stores and retrieves content (files) being managed for drift detection and remediation. Drift JPA Plugin
Content Contains metadata for a a repository or a group of repositories. PackageSource
Repository (also Package) Defines a content repository. Plug-ins can define a single repository,which is then used for provisioning, entitlements, and updates for JBoss ON-managed resources. ChannelSource
NOTE
New plug-in containers cannot be created without rebuilding JBoss ON, because the plug-in containers are part of the core JBoss ON code. Rather than defining a new plug-in type, use the generic plug-in container, since this provides full access to the server functionality, anyway.