Setting Up a JAXR Client

This section describes the first steps to follow to implement a JAXR client that can perform queries and updates to the Service Registry. A JAXR client is a client program that can access registries using the JAXR API. This section covers the following topics:

Starting the Registry

To start the Registry, you start the container into which you installed the Registry: Tomcat or the Sun Java System Application Server.

Getting Access to the Registry

Any user of a JAXR client can perform queries on the Registry for objects that are not restricted by an access control policy. To perform queries for restricted objects, to add data to the Registry, or to update Registry data, however, a user must obtain permission from the Registry to access it. The Registry uses client-certificate authentication for user access.

To create a user that can submit data to the Registry, use the User Registration Wizard of the Web Console that is part of the Registry software. You can also use an existing certificate obtained from a certificate authority.

You will specify your user name and password for some of the JAXR client example programs, along with information about the location of your certificate.

Establishing a Connection to the Registry

The first task a JAXR client must complete is to establish a connection to a registry. Establishing a connection involves the following tasks:

Creating a Connection Factory

A client creates a connection from a connection factory.

To use JAXR in a stand-alone client program, you must obtainan instance of the abstract class ConnectionFactory. To do so, call the getConnectionFactory method in the JAXR provider's JAXRUtility class.

import org.freebxml.omar.client.xml.registry.util.JAXRUtility;
...
ConnectionFactory factory = JAXRUtility.getConnectionFactory(); 

Creating a Connection

To create a connection, a client first creates a set of properties that specify the URL or URLs of the registry or registries being accessed. The following code provides the URLs of the query service and publishing service for the Registry if the Registry is deployed on the local system. (There should be no line break in the strings.)

Properties props = new Properties();
props.setProperty("javax.xml.registry.queryManagerURL",
  "http://localhost:8080/omar/registry/soap");
props.setProperty("javax.xml.registry.lifeCycleManagerURL",
  "http://localhost:8080/omar/registry/soap"); 

The client then obtains the connection factory as described in Creating a Connection Factory, sets its properties, and creates the connection. The following code fragment performs these tasks:

ConnectionFactory factory = 
  JAXRUtility.getConnectionFactory();
factory.setProperties(props);
Connection connection = factory.createConnection(); 

The makeConnection method in the sample programs shows the steps used to create a JAXR connection.

Table 8-1 lists and describes the two properties you can set on a connection. These properties are defined in the JAXR specification.

Table 8-1 Standard JAXR Connection Properties 
Property Name and Description
Data Type
Default Value
javax.xml.registry.queryManagerURL
 
Specifies the URL of the query manager service within the target registry provider.
String
None
javax.xml.registry.lifeCycleManagerURL
 
Specifies the URL of the life-cycle manager service within the target registry provider (for registry updates).
String
Same as the specified queryManagerURL value

Obtaining and Using a RegistryService Object

After creating the connection, the client uses the connection to obtain a RegistryService object and then the interface or interfaces it will use:

RegistryService rs = connection.getRegistryService();
BusinessQueryManager bqm = rs.getBusinessQueryManager();
BusinessLifeCycleManager blcm = 
  rs.getBusinessLifeCycleManager(); 

Typically, a client obtains a BusinessQueryManager object and either a LifeCycleManager or a BusinessLifeCycleManager object from the RegistryService object. If it is using the Registry for simple queries only, it may need to obtain only a BusinessQueryManager object.