By convention, all of the files associated with a sensor's HackyInstaller code is placed in a subdirectory called "installer". The first step in creating a new sensor installer is to create this directory. For example, if we are creating an installer for a sensor named FooSensor, then the installer subdirectory might be located in your local workspace as follows:
C:\svn\hackySensor_FooSensor\src\org\hackystat\sensor\foosensor\installer\
A file named <moduleName>.<installerName>.installer.def.xml defines a sensor installer plugin for use by HackyInstaller. This extension point requires a file pattern of "*.installer.def.xml" in order to be recognized by the build system.
Example 21.1, “hackySensor_Eclipse.eclipse.installer.def.xml” illustrates an example Installer definition file for the Eclipse sensor.
Example 21.1. hackySensor_Eclipse.eclipse.installer.def.xml
<sensor> <name value="Eclipse" /><os windows="true" mac="true" linux-unix="true" />
<package value="org.hackystat.sensor.eclipse.installer" />
<class value="EclipseSensorInstaller" /> <description value="The Eclipse sensor collects Activity, UnitTest and Buffer Transition sensor data." />
<!-- Paths needed by this sensor --> <path id="ECLIPSE_HOME" description="Eclipse home directory" example="C:\eclipse (Windows), /Applications/eclipse (Unix)" >
<!-- Checks for the files/directories specified that ensure the path specifed above is valid. --> <check value="/.eclipseproduct" /> </path> <!-- Sensor specfic properties for sensor.properties --> <property name="ENABLE_ECLIPSE_SENSOR"
value="false"
readonly="false" validationclass=""
fieldLength=""
description="Enable Eclipse sensor." />
<property name="ENABLE_ECLIPSE_MONITOR_SENSOR" value="true" readonly="false" validationclass="" description="Enable status line monitoring." /> <property name="ENABLE_ECLIPSE_UPDATE_SENSOR" value="false" readonly="false" validationclass="" description="Enable checking for new Eclipse sensor versions." /> <property name="ENABLE_ECLIPSE_BUFFTRANS_SENSOR" value="false" readonly="false" validationclass="" description="Enable Buffer Transition data collection." /> </sensor>
Please note the following regarding Example 21.1, “hackySensor_Eclipse.eclipse.installer.def.xml”:
Note: an optional 'information' element can be added to the installer definition file. An example of the optional element should look like: Example 21.2, “An example information element”. The additional information will appear in a popup window after a sensor is installed. Figure 21.1, “ The additional information window ” illustrates the window displayed to the user.
Example 21.2. An example information element
<information value="This sensor requires a usermaps.xml file in the USER_HOME/.hackystat directory. Please verify that this file exists./>