Java Software

Developers Information


Building the code

Building the Java-OPeNDAP software should be very simple.

  1. Go get and install the current J2SE and ANT (see below)
  2. If you haven't got it already, get the source code distribution from OPeNDAP.
  3. Unpack the source code distribution (tar -xvf DistributionFileName.jar)
  4. Enter the top level directory (Java-OPeNDAP)
  5. Run the command "ant compile"

This will compile all of the distributed software, but nothing more. For more detailed information you should read (and try to understand) the ANT build.xml file. For those of you using an IDE you will have to follow your own "path" to get this going.

If you are trying to fix a parser bug you better read the Parsers section at the bottom of this document.


Dependencies

Java Virtual Machine

Java 2 Standard Edition (J2SE)

Minimum: Java 1.5
Recommended: Java 1.6.x

This software was developed and tested against the 1.6.0 release of the J2SE

3rd Party Libraries Required by the DAP2 Software

The core software depends on several third part libraries. All of these are included with the distribution (in the lib directory). These (should) be the ones that the code was compiled against for development and testing purposes.

It is possibly (in fact likely) that newer versions of these libraries are available from the various development teams that create these products. Replace them at your own risk.

Apache Tomcat

Minimum: 4.1.18
Recommended: 6.0.29

Note: This code has not been tested against version 7 of Tomcat!

The servlets were developed and tested using Tomcat 5.5.20. In particular, the code was linked against the servlet.jar bundled with this particular version of Tomcat. This is not (to the best of my knowledge) a library that is included with the standard Java distributions.

ANT

Minimum: 1.5.2 (Warning!)
Recommended: 1.6 or higher

This software now builds entirely with ANT. If you haven't already got ANT, then go get it. You need it. There is a master build file in the top level directory which contains all of the various production rules for the software.

Compiling the source: This should be straight forward. Just go to the top level directory and type "ant compile". For more detailed instructions you should read the master build file, build.xml.




Parsers (Optional)

Currently the DAP2 parsers are implemented as grammers written in/for YACC, along with some written in/for JavaCC. You don't NEED to be able to compile the parsers in order to build the software. All of the java files that are generated by YACC and JavaCC are checked into the system and unless you have specific needs to alter the parsers (like in order to fix a bug) then I strongly recommend that you just leave them alone. Really.

Compiling the parsers:

Make sure that you have fulfilled the software dependancies listed below. The following sections describe how to

YACC Grammars



Here we will describe how to build the parsers whose grammars are written in YACC.



JavaCC Grammars

The parsers target in the top level build.xml file uses the <javacc> task build the parsers whose grammars are written for JavaCC. The javacc task requires that the local installation of JavaCC be identified as an attribute. In order to build the parser you will need to create a separate properties file (that is not checked into SVN). This file must be called javacc-config and it must live in the top level Java-OPeNDAP directory. The content of the javacc-config file must be the property JavaCC.home and its value should be set to the top level directory of the JavaCC distribution on your development system.

Here is an example of the content of the javacc-config file:

    JavaCC.home=/usr/local/javacc
Once you have created the javacc-config then the parsers target in Java-OPeNDAP/buildfiles/opendap.xml should work, at least within the constraints of the Warning.

Warning: There exists a version conflict between some versions of ANT and some versions of JavaCC. If you have JavaCC 2.1 or 2.0 then the parsers should compile fine, no matter what version of ANT you have. However, if you are using JavaCC 3.0 or newer (released after the JavaCC project migrated from WebGain to Java.Net) older versions of ANT will fail to correctly identify the JavaCC libraries. The mail and bug archives indicate that the problem was fixed as of 5/26/2003, but the patch won't migrate into a release until version 1.6. You can grab a nightly build of Ant release 1.6beta as work around until 1.6 hits the street. Good luck.

Parser Dependencies

JavaCC

Minimum: Optional (Only required if you plan on working on the constraint expression parser.)
Recommended: 2.1 or higher. (Warning!)

Javacc takes a grammar file and produces a Java source code file from it. All of these resulting Java source files are checked into the SVN tree, so unless you anticipate working on the grammar files themselves you will not need to get Javacc. Most of the OPeNDAP parsers rely on the yacc tool to build. The constraint expression parser is built from a grammar file with a .jj extension. The grammar contains the rules for both the scanner and the parser (and thus encapsulate both the functionalities of lex and yacc). If you are going to work on the parsers you should :

  1. Contact us first: Support
  2. Read the ANT section below on how to compile the parsers.