HQU Plugin Directory Layout
HQU plugins are broken down into the following directories.
| /app | Contains the controllers and Groovy code which respond to web requsts |
| /views | Contains the HTML and templates which will be rendered to browsers |
| /etc | Contains auxiliary files such as localization resources |
| /lib | Contains additional support libraries that the plugin needs (and which HQ doesn't provide) |
| /public | Contains additional HTML, images, and CSS that the plugin depends on |
| ./ | Contains deployment descriptors |
/app - The plugin controllers
Controllers are the C in MVC. Web requests are routed to the controllers, which execute and render a view to the client. This directory contains all the .groovy code and classes.
/views - The HTML and templates
Views are chunks of HTML which controllers can render to clients. These special groovy-based views (GSPs, or Groovy Server Pages), can contain a mixture of markup as well as special control sequences to execute code and use variables passed from controllers. Views are formatted as .gsp (Groovy Server Pages). Since Views and the Controllers in /app are usually tied to each other, views are organized by controller:
| /app | /FreezerController.groovy | ||
| /views | /freezer | /resetTemp.gsp |
/etc - Localization and auxiliary files
| plugin_name_i18n.properties | localization definition |
Localization files are stored in /etc. If your plugin is named cool, there is a file named /etc/cool_i18n.properties which contains all the localization strings.
/lib - Plugin Libraries
Sometimes plugins need additional Java libraries to perform their function. JAR files placed in this directory will automatically be added to the plugin's classpath.
/public
If a plugin needs images, its own CSS, or additional HTML, this directory can contain those files.
./plugin.properties
The root directory of the plugin contains a deployment descriptor , plugin.properties, which is a general descriptor that HQ uses to identify the plugin.
plugin.name=cool plugin.helpTag=cool.MegaBoxes plugin.version=0.1 plugin.apiMajor=0 plugin.apiMinor=1
Where cool is the name of your plugin, and cool.MegaBoxes is the tag used to identify it to the help system. plugin.version defines the version number of the plugin, and the API versions are the versions of the HQU api that they expect to be using.
./Plugin.groovy
This is the main class that HQ uses to interact with the plugin. It handles deployment messages, declares and attaches views, and provides more advanced HQU features.