Working with Bindings

The registry implementation has two separate and distinct uses for accessing XML documents from Java using bindings created by JAXB:

  • Accessing ebXML documents using bindings created from the schemas in the ebXMLrr spec
  • Accessing the client browser configuration document using bindings created from the schema for the configuration file

What is JAXB?

The JAXB page on java.sun.com currently (June 2004) defines JAXB as:

Java Architecture for XML Binding (JAXB) provides a convenient way to bind an XML schema to a representation in Java code. This makes it easy for you to incorporate XML data and processing functions in applications based on Java technology without having to know much about XML itself.

There is an introductory article on JAXB at http://java.sun.com/developer/technicalArticles/WebServices/jaxb/.

Binding for ebXML Schema

Creating the binding code is part of the ebxmlrr-spec project, not the omar project, since:

  • The generated binding code is useful for any ebXML Registry implementation
  • The spec doesn't change very often, so the binding seldom needs to be recreated

The jar files for the binding source code, compiled class files, and documentation are included in the omar distribution.

Generating the Binding

You need the ebxmlrr-spec project to be able to generate the binding.

There are three Ant targets in the ebxmlrr-spec project that are useful:

  • bindingv3 - generates the Java code
  • doc - creates the Javadoc documentation from the generated code
  • dist - creates the separate jar files for the binding's class files and the binding's Javadocs (and the W3C DSIG Javadocs, which are out of scope for this discussion). The class files are in oasis-regrep.jar, and the Javadocs in oasis-regrep-doc.jar.

Using the Binding

oasis-regrep.jar and oasis-regrep-doc.jar are in misc/lib (as is oasis-regrep-src.jar which contains the source code), and all three are copied into build/lib when you build nearly any target.

To give an idea how often the binding is used, at the time of this writing, the binding classes are used by classes in the following packages:

  • org.freebxml.omar.client.ui.swing
  • org.freebxml.omar.client.ui.thin
  • org.freebxml.omar.client.xml.registry
  • org.freebxml.omar.client.xml.registry.infomodel
  • org.freebxml.omar.common
  • org.freebxml.omar.server.common
  • org.freebxml.omar.server.event
  • org.freebxml.omar.server.event.listener.server
  • org.freebxml.omar.server.interfaces
  • org.freebxml.omar.server.interfaces.rest
  • org.freebxml.omar.server.interfaces.soap
  • org.freebxml.omar.server.lcm
  • org.freebxml.omar.server.lcm.quota
  • org.freebxml.omar.server.persistence
  • org.freebxml.omar.server.persistence.rdb
  • org.freebxml.omar.server.query
  • org.freebxml.omar.server.query.filter
  • org.freebxml.omar.server.query.sql
  • org.freebxml.omar.server.security.authentication
  • org.freebxml.omar.server.security.authorization
  • org.freebxml.omar.server.util

Binding for Client Configuration

The jar files for the bindingcompiled binding and its documentation only are included in the omar distribution.

Generating the Binding

The schema for the user interface configuration XML files is at src/java/org/freebxml/omar/client/ui/common/conf/browserConfig.xsd.

There are two Ant targets in the omar project that are useful:

  • check.bindings - checks that the generated code is up to date with respect to the schema
  • bindings - creates the generated code from the schema

Using the Binding

It is not surprising that, at the time of this writing, the binding classes are used only within client packages:

  • org.freebxml.omar.client.ui.common
  • org.freebxml.omar.client.ui.swing
  • org.freebxml.omar.client.ui.thin