After downloading and installing hackyDoc_SimpleSdt, it is useful to take a few minutes to look around the module directory, which illustrates the directory structure and minimal set of files for SDT definition. Example 15.1, “Directory layout and selected files in the hackyDoc_SimpleSdt module” illustrates this layout.
Example 15.1. Directory layout and selected files in the hackyDoc_SimpleSdt module
hackyDoc_SimpleSdt/
local.build.xml
src/
org/hackystat/doc/simplesdt/
sdt/
hackyDoc_SimpleSdt.simplesdt.sdt.def.xml
SimpleSdt.java
SimpleSdtShellCommand.java
TestSimpleSdt.java
package.html
docbook/
hackyDoc_SimpleSdt.simplesdt.sdt.docbook.def.xml
hackyDoc_SimpleSdt.simplesdt.sdt.docbook.xml
testdataset/data/SimpleSdt/
2001-01-02.xml
This example shows that the SimpleSdt sensor data type is declared within a module called "hackyDoc_SimpleSdt". The use of the "hackyDoc" prefix is one way in which this template differs from production code: you will in general want to prefix all of your SDT modules with "hackySdt", not "hackyDoc".
The most important contents of the top-level directory are: (1) the local.build.xml file, which provides the Ant declarations necessary to integrate this sensor data type into the Hackystat system, and (2) a directory called "src", which contains the actual SDT definitions.
The src directory contains a subdirectory tree "org/hackystat/doc/simplesdt/", which corresponds to the Java package hierarchy for this sensor data type. For the SimpleSdt SDT, this package hierarchy contains only a single subpackage called "sdt". However, more sophisticated SDT definitions will include other subpackages, such as "dailyanalysis", "dailyproject", and "reducer". The "sdt" subpackage contains the core definitions of the sensor data type, and is the focus of this chapter. Sensor data type enhancements such as daily analysis, daily project, and reduction functions will be covered in other chapters of this developer guide.
The "sdt" subpackage contains four top-level files (hackyDoc_SimpleSdt.simplesdt.sdt.def.xml, SimpleSdt.java, SimpleSdtShellCommand.java, and TestSimpleSdt.java), and two subdirectories: "docbook" and "testdataset". Let's now look at each of these components in detail.