Previous section   Next section
ConnectionFactory javax.xml.registry

JAXR 1.0; JWSDP 1.0, J2EE 1.4
public abstract class ConnectionFactory {
// Public Constructors
    public ConnectionFactory(  ); 
// Public Class Methods
    public static ConnectionFactory newInstance(  ) throws JAXRException; 
// Public Instance Methods
    public abstract javax.xml.registry.Connection createConnection(  ) 
        throws JAXRException;               // L0
    public abstract FederatedConnection createFederatedConnection(Collection connections) 
        throws JAXRException;               // L0 (optional)
    public abstract Properties getProperties(  ) 
        throws JAXRException;               // L0
    public abstract void setProperties(Properties properties) 
        throws JAXRException;               // L0
}

The abstract ConnectionFactory class can be used to connect to JAXR registry providers. An instance of ConnectionFactory may be obtained by calling newInstance( ) method, which uses a four-step process to locate a suitable concrete implementation class, as follows:

  1. Looks in the system properties for a property called javax.xml.registry.ConnectionFactoryClass. If this property is defined, its value is assumed to be the class name of a concrete implementation of ConnectionFactory.

  2. Looks for the same property in a file called ${JAVA_HOME}/lib/jaxr.properties. If the property is found, its value is assumed to be the required class name.

  3. Looks for a resource called META-INF/services/javax.xml.registry.ConnectionFactoryClass in the classpath. If such a resource exists, it is opened and a single line is read from it. If the line is not empty, it is used as the required class name.

  4. Finally, an implementation-dependent default class is used. In the case of the reference implementation, this class is called com.sun.xml.registry.common.ConnectionFactoryImpl.

A container-resident client may also be able to obtain a ConnectionFactory instance from its JNDI environment.

A ConnectionFactory supports only one type of registry � at the present time, there are providers available for both UDDI and ebXML registries. In order to ensure you create an instance of the appropriate ConnectionFactory, set the system property javax.xml.registry.ConnectionFactoryClass to the appropriate value, or make sure that the ConnectionFactory class for the registry implementation that you need appears on your classpath before any other implementations and that none of the first three steps in the previous list locates another implementation.

Once you have a ConnectionFactory, use the setProperties( ) method to set property values and then call either the createConnection( ) method or the createFederatedConnection( ) method to get a connection to a JAXR provider. The following properties must be supported by all JAXR providers:

javax.xml.registry.queryManagerURL

The URL required to connect to the query service provided by a registry. The query service is usually an open, insecure service accessed over HTTP.

javax.xml.registry.lifeCycleManagerURL

The URL required to connect to the registry update service. The registry update service typically requires a user to obtain a user ID and to authenticate when connecting. Registries may require the use of a secure transport, such as HTTPS, to perform registry updates. If this property is not specified, it defaults to the value of the javax.xml.registry.queryManagerURL property.

javax.xml.registry.semanticEquivalences

Allows pairs of Concepts to be made equivalent in the view of the registry provider. This facility is used in the handling of postal addresses, as described in Chapter 7.

javax.xml.registry.security.authenticationMethod

Specifies the authentication mechanism that the client would like to use when connecting to the registry. Not all registries insist on authentication for queries, but most do so before allowing registry updates. The JAXR specification defines property values for several possible authentication schemes. JAXR providers and registries are not expected to support all of these schemes, which are UDDI_GET_AUTHTOKEN, HTTP_BASIC, CLIENT_CERTIFICATE, and MS_PASSPORT. You'll find a description of each of these schemes in Chapter 7.

javax.xml.registry.uddi.maxRows

As its name suggests, this property is specific to UDDI registry providers and specifies the maximum number of rows that should be returned in the result of a query operation.

javax.xml.registry.postalAddressScheme

Different registry types use different representations of postal addresses. The JAXR API, on the other hand, provides an abstract view of a postal address that allows application code to be independent of any specific registry. This property provides the identifier of a ClassificationScheme that specifies the mapping between the fields of the postal address scheme used by the registry and the virtual scheme provided by JAXR.

The createConnection( ) method creates a Connection object that can be used to communicate with a single registry via a JAXR provider. The provider uses the values of the javax.xml.registry.queryManagerURL and javax.xml.registry.lifeCycleManagerURL properties to access the target registry when the JAXR client makes requests that require communication with the registry itself. The createFederatedConnection( ) method returns a FederatedConnection object that can be used to send the same query to more than one registry at the same time and combine the responses that are received into a single result set. The createFederatedConnection( ) method requires a Collection containing one or more Connection objects that correspond to the registries to which the queries should be sent. Support for FederatedConnections is optional despite the fact that it is a level 0 feature, although this may change in a future revision of the JAXR specification. A provider that does not support this feature throws an UnsupportedCapabilityException from its createFederatedConnection( ) method.

Returned By

ConnectionFactory.newInstance( )


  Previous section   Next section