The Java Binding

12th February 2002

1. Java Binding Specification
2. Canonical Sample Program
3. Java Binding Implementations
4. Commentary

1. Java Binding Specification

The Java binding is maintained by Matthew Dovey <matthew.dovey@oucs.ox.ac.uk>

You probably want the current version.

The Java binding is largely specified: it's complete enough that it's possible to build working implementations (I have done so), but it should not be considered stable. It is liable to change: in particular, towards being more idiomatic Java.

The following version of the interface specification are available:

2. Canonical Sample Program

To give a flavour of the Java binding, here is ZOOM's equivalent of the ``Hello World'' program: a tiny Z39.50 client that fetches and displays the MARC record for Farlow & Brett Surman's The Complete Dinosaur from the Library of Congress.

import uk.org.miketaylor.zoom.*;

class Canonical {
    public static void main (String[] args) throws Exception {
	Connection conn = new Connection("z3950.loc.gov", 7090);
	conn.option("databaseName", "Voyager");
	conn.option("preferredRecordSyntax", "USMARC");
	Query q = new PrefixQuery("@attr 1=7 0253333490");
	ResultSet rs = conn.search(q);
	System.out.println(rs.getRecord(0).render());
    }
}

3. Java Binding Implementations

At least three streams of work have begun on Java bindings, though none has yet reached a releasable level of maturity:

OCLC's work predates the publishing of the Java binding's specification. We hope that their work and mine can all be brought to a single harmonised API which can be considered the standard Java binding for ZOOM.

4. Commentary

As I was writing the binding specification, I ran into a surprising number of issues which may be of interest to others. Some of them are no doubt just down to my lack of familiarity with Java; others seem to highlight real deficiencies in the language[1]. Here they are, for anyone who wants to understand more of the reasoning behind the decisions made in this binding.

 


Notes

[1]
When that sad day comes that I lie on my death-bed, and heartbroken throngs surround my frail and aged form, looking to glean what wisdom they may from my last words; and when one particularly attractive young acoloyte leans across and asks, ``O exalted master, what one thing remaineth a mystery to thee after these many years?'', twelve gets you seven[2] that I'll reply with my dying breath, ``Why in the name of all that is holy doesn't Java have enum?'' [back]
[2]
``Call it hell, call it heaven / But it's a probable twelve to seven / That the guy's only trying to figure why Java doesn't support enumerated types.'' - Frank Loesser, Guys and Dolls. [back]

Feedback to <mike@indexdata.com> is welcome!