Red Hat Training

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

4.3. Extended Example: Content Types for Resources

All of the behavior for how a resource is managed in JBoss ON depends on how it is described in its resource plug-in for the agent. This includes all of the monitoring metrics that can be collected, any configuration that can be set, and any operations that can be performed. This also includes any content that can be deployed for that resource and what kind of content is expected.
A package refers to any piece of content. A package is usually a file of some kind, like a JBoss AS JAR file. However, since the package type for a resource is defined in the resource plug-in, a package can be anything, so long as the resource plug-in is configured to use it.
As with other elements related to the resource, the package type is defined in the plug-in descriptor for the resource type. Each package type can define certain attributes (listed in Package Attributes), but every package must define its name and its type (of four given categories).
In the plug-in descriptor, package types are identified by <content> elements. The required properties are set as flags on the main <content> element; any configurable properties, which are set by the user when new packages are uploaded to the resource, are given in <c:simple-property> child elements. For example, this content element in the Platform Resource Plug-in identifies deployable (category) package types for Windows platforms:
      <content name="InstalledSoftware" displayName="Installed Software" category="deployable" description="Installed Windows Software">
           <configuration>
               <c:simple-property name="Publisher"/>
               <c:simple-property name="Comments"/>
               <c:simple-property name="Contact"/>
               <c:simple-property name="HelpLink"/>
               <c:simple-property name="HelpTelephone"/>
               <c:simple-property name="InstallLocation"/>
               <c:simple-property name="InstallSource"/>
               <c:simple-property name="EstimatedSize" units="kilobytes"/>
          </configuration>
       </content>
While packages can be manually added to a resource, an agent can also actively check for new content and add any discovered content to its inventory. A package is inventoried in JBoss ON through a recurring package discovery scan. The interval at which this discovery occurs can be explicitly set in the package's definition in the plug-in's descriptor or it can use the default value given in the plug-in schema file.

Package Attributes

Display Name (Optional)
A user interface friendly name of the package type.
Description (Optional)
Describes the type of content found in packages of this type.
Category (Required)
One of four enumerated options:
  • Executable Script (which is potentially editable)
  • Executable Binary
  • Configuration (a configuration file for the resource)
  • Deployable
Discovery Interval (Optional)
Defines the time between package discovery scans for this type; different package types can be configured with intervals to represent the likelihood of the package inventory changing.
Creation Type Flag (Optional)
If set to true, a package of this type is used when creating resources of the enclosing resource type. An example of this situation is a Java EAR file. There is an EAR resource type that represents the enterprise application in JBoss ON. Under that resource type, there is a package type defined to represent the EAR file itself. This package type is flagged as a creation type; when creating a new EAR resource, the EAR file must be created at the same time. The default for this attribute is false, as packages will typically not represent the creation of a new resource.
Configuration (Optional)
The configuration element allows the plug-in to define an open-ended set of attributes about the package type. These values will be populated during package discovery, and if not marked as read only, can be specified by the user at artifact creation time. An example of a property in this configuration element is a Boolean that describes if an EAR file is deployed as exploded or zipped. When EAR files are discovered, this flag will be populated and carry package type specified information. Additionally, when deploying a new EAR file through JBoss ON, this flag can be set to indicate how the package should be deployed on the AS instance.