JAXR Programming
So
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:
Obtain a
ConnectionFactoryobject and optionally set properties that determine how it will behave.Use the
ConnectionFactoryobject to obtain aConnectionorFederatedConnectionto the target registry.
There are two ways to get a
ConnectionFactory
object. In a J2EE environment, the preferred way is to use the JNDI
API to look up a preconfigured ConnectionFactory:
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 newInstance( )
method is determined by the property
javax.xml.registry.ConnectionFactoryClass, which can be set in either of the following locations (in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access