Service Registry 3.1 Developer's Guide

Establishing a Connection to the Registry

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

Obtaining a Connection Factory

A client creates a connection from a connection factory. To obtain an instance of the abstract class ConnectionFactory, the client calls 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 to be 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.

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

The client then obtains the connection factory as described in Obtaining 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 2–1 lists and describes the two properties that you can set on a connection. These properties are defined in the JAXR specification.

Table 2–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