Prev Up Next
Go backward to 2.2 The JGOFS server
Go up to Top
Go forward to 4 The DAP Architecture

3 Writing your own OPeNDAP server

If neither of the available user-configurable servers will work with your data, or if you wish to add some features they lack, you may write your own OPeNDAP server.

3.1 Choose a language

It is possible to take the DAP specification and implement a server which DAP-aware clients can use as a data source. That is, it is possible to write a DAP server using just the protocol description. For example, the data server hosted by the IRI/LDEO Climate Data Library at Columbia University is such a server. However, server writers don't have to work from the DAP specification. There are several toolkits available which make this process of writing your own server fairly simple. The DODS/OPeNDAP project has both a C++ and a Java toolkit. COLA provides a toolkit called Anagram that can be used to build servers that support server-side processing operations which can be used to generate temporary data sets.1

The OPeNDAP project provides both a C++ and a Java implementation of the DAP. Each library includes both the classes that implement the various objects which comprise the DAP and support software that handles the mechanics of processing inbound requests and generating the correct responses.

To choose one of the toolkits, several factors should be weighed. First, with which of the two programming languages are you most comfortable? Also to be considered are: What type of computer will the server run on. Java is equally supported on win32 and Unix (and mac, in all probability) while the C++ code for server development is supported only on Unix. If you have an API that can read the data, will it be easier to use it from C++ or Java? Lastly, the Java servers are implemented as servlets and typically spend less time on startup tasks than the C++ servers which use the CGI mechanism. If you anticipate many small requests, then you can expect noticeable performance improvements with the Java code, while larger average requests will mitigate this difference.

NOTE: Developers at UCAR have implemented OPeNDAP servers as Apache httpd

modules; these OPeNDAP servers effectively run as Unix daemons and thus have none of the startup performance issues of CGI programs. These servers are noticeably faster--about one order of magnitude--for very small requests. In the future we plan to incorporate this software in our general distribution, contact technical support or the opendap-tech list for information/help.

3.2 Server architecture

The essence of the OPeNDAP server architecture is that a collection of programs are used to handle various requests made to the servers. In addition to these `handler' and `service' programs there's also a dispatcher that interfaces to an http daemon. The actual requests are made to the web daemon which then passes them along to the dispatcher. The dispatcher examines the request and decides which handler or service program should process it and how that program should be passed parameters extracted from the request.

NOTE: The C++ software works exactly as described above; the Java code is

the same in principle but slightly different in practice, since it's based on servlets.

While the C++ toolkit uses an architecture based on CGI and the Java toolkit uses servlets, both share many characteristics. If you understand how the servers are built, it will be easy to see how your own server can be implemented with minimal effort. The Server Installation Guide's section on Server Architecture provides an excellent description of the CGI-based (C++) servers. The Server Installation Guide contains a short how-to that covers setting up the Java software. It also explains the software needed to run the servlet-based OPeNDAP servers.


James Gallagher <jgallagher@gso.uri.edu>, 2006-08-17, Revision: 14349

Prev Up Next