HQU Deployment and Creating Attachments

HQU plugins can be deployed into HQ, simply by executing:

ant hqu-redeploy-plugin -Dplugin=pinger

Where pinger is the name of the plugin. Internally, all this does is copy ui_plugins/pinger to {JBOSS_HOME}/server/default/deploy/hq.ear/hq.war/hqu

Once a plugin is copied, HQ will attempt to load and deploy it. The plugin deployment process invokes a well-known class within the plugin (Plugin.groovy), which is generally used to create view definitions and participate with the rest of the HQ backend.

Required Plugin Files

An HQU plugin can be as simple as 3 files in a directory. These are the minimum files that must exist for HQU to use it:

/ui_plugins/myplugin
/Plugin.groovy
/plugin.properties
/etc/myplugin_i18n.properties

Plugin.groovy

Plugin.groovy sits in the root of the plugin directory:

/ui_plugins/pinger/Plugin.groovy

Every plugin must have this file, as it is the primary source of interaction between HQ and the plugin. A basic class might look like this:

/ui_plugins/myplugin/Plugin.groovy (attach to masthead)
import org.hyperic.hq.hqu.rendit.HQUPlugin

class Plugin extends HQUPlugin {
    Plugin() {
        addView(description:  'MegaBox Freezer View',
                attachType:   'masthead',
                controller:   FreezerController,
                action:       'index',
                category:     'tracker')
    }
}

When this plugin is copied into HQ and deployed, HQ will automatically create a menu item in the 'Tracker' menu, and when it is selected will internally render the FreezerController.index() controller action.

To add an item to the 'Views' tab of a resource, and gain access to resource context, you can attach a view to resource types:

/ui_plugins/myplugin/Plugin.groovy (attach to resource)
import org.hyperic.hq.hqu.rendit.HQUPlugin

class Plugin extends HQUPlugin {
    Plugin() {
        addView(description:  'Linux CronRebooter',
                attachType:   'resource',
                resourceType: ['Linux'],
                controller:   FreezerController,
                action:       'index']
    }
}

The IHQUPlugin interface documenation has the full list of methods which can be overriden in Plugin.groovy. HQUPlugin is a common superclass to use which provides utility methods for creating views.

plugin.properties

plugin.properties is used by HQ to determine some basic information without being required to run any actual Groovy code. The following properties are recognized:

/ui_plugins/myplugin/plugin.properties
plugin.name= pinger The short name used to refer to the plugin. Choose something fairly universally unique.
plugin.helpTag= Pinger.Broadcast An additional tag of text to tack on to URLs to the HQ documentation.
plugin.version= 0.1 The version of the plugin
plugin.apiMajor= 0 The version of the HQU API that the plugin is known to work with
plugin.apiMinor= 1

etc/myplugin_i18n.properties

While not strictly required, many parts of the framework use it frequently. It is used by Controllers and Views to display localized text and also provides the localized name of the plugin to be displayed at attach points.


Browse Space

- Pages
- News
- Labels
- Attachments
- Bookmarks
- Mail
- Advanced

Explore Confluence

- Popular Labels
- Notation Guide

Your Account

Log In

or Sign Up  

Other Features

Add Content


System Monitoring Software
SourceForge.net Logo