Hyrax - Example BES Modules

From OPeNDAP Documentation
Revision as of 04:54, 28 January 2009 by PatrickWest (talk | contribs)

We have provided you with two example BES modules. These modules are the Hello World module and the CSV data handler module.

Both of these modules are available from the SVN source code repository and are not included in the source tar ball or the binary distributions. To get them you will need to 'check out' the bes source code for this module.

1 Hello World

The Hello World module, the SampleModule class, adds a new command to the BES, the SampleSayXMLCommand. Using the BES command line client you would have an input file with the following:

  <?xml version="1.0" encoding="UTF-8"?>
  <request reqID="some_unique_value" >
      <say what="hello" to="world" />

The XML response document would look like the following:

  <?xml version="1.0" encoding="ISO-8859-1"?>
  <say><response><text>hello world</text></response></say>

It also adds the SampleRequestHandler class, which handles help and version requests, the SampleSayResponseHandler class, which handles building AND populating the informational response, and the SayReporter, which reports on what is being said to who in a log file configured in the BES configuration file. You can see the sample input and output in the bes-testsuite directory under bes/hello_world. Adding this sample module to your BES configuration file is also easy. It uses the same mechanism that data handlers use, providing a shell script, bes-sample-data.sh, to add information to the configuration file.

2 CSV Data Handler Module

The CSV Data Handler Module handles requests for data in the CSV format (comma separated). Here is an example file:


The types of data allowed are:

  • String
  • Byte
  • Int16
  • Int32
  • Float32
  • Float64

The CSV Data Handler Module class CSVModule adds a request handler (CSVRequestHandler) to handle populating DAP2 response objects (DAS, DDS, DataDDS) as well as the standard response for help and version. The Module also tells the BES that it can handle THREDDS catalog requests.