far in this chapter, you have seen the JAXR registry information
model, which is mapped to the
javax.xml.registry.infomodel package. This section
looks at the API that allows you to search or update a registry,
which is defined in the package
javax.xml.registry. The examples shown in this
section assume that you have installed the sample registry data in
either a UDDI or ebXML registry, as described in Section 7.3, earlier in this chapter.
Connecting to the Registry
In order to use a registry, you first have to create a connection to it. This process requires two steps:
ConnectionFactoryobject and optionally set properties that determine how it will behave.
ConnectionFactoryobject to obtain a
FederatedConnectionto the target registry.
There are two ways to get a
object. In a J2EE environment, the preferred way is to use the JNDI
API to look up a preconfigured
InitialContext ctx = new InitialContext( ); ConnectionFactory factory = (ConnectionFactory)ctx.lookup("pathToFactory");
J2SE-based registry clients that do not have a preconfigured JNDI
environment can instead use the static
newInstance( ) method:
ConnectionFactory factory = ConnectionFactory.newInstance( );
ConnectionFactory is an abstract class. The actual
class of the object returned by the
method is determined by the property
javax.xml.registry.ConnectionFactoryClass, which can be set in either of the following locations (in ...