Version 9.6
 —  CentraSite API for JAXR  —

Creating and Closing a JAXR-based Connection

The following topics are discussed in this document:


Creating a JAXR-based Connection

Start of instruction setTo create a JAXR-based connection

  1. Ensure that the CLASSPATH includes directories that contain the following files:

    activation.jar
    CentraSiteCommons.jar
    CentraSiteDynLoader.jar
    CentraSiteJAXR-API.jar
    CentraSiteLCM.jar
    CentraSiteLCM-api.jar
    CentraSiteLCM-L10N.jar
    CentraSitePolicy-API.jar
    CentraSiteResourceAccess-API.jar
    CentraSiteUtils.jar
    CentraSiteUtils-L10N.jar
    CentraSiteVMS.jar
    CentraSiteVMS-L10N.jar
    commons-codec.jar
    commons-httpclient.jar
    commons-lang.jar
    commons-logging.jar
    cstUtils.jar
    groovy-all*.jar
    inmUtil.jar
    inmUtilConf.jar
    jaxen.jar
    jaxr-api.jar
    jaxrpc.jar
    jdom.jar
    log4j.jar
    PolicyLogBindings.jar
    saaj.jar
    saxpath.jar
    script-api.jar
    sin-common.jar
    sin-misc.jar
    sin-ssx.jar
    sin-xmlserver.jar
    stax-api.jar
    TaminoAPI4J.jar
    TaminoAPI4J-l10n.jar
    uddiKeyConverter.jar
    wstx-asl.jar
    wvcm.jar
    xmlbeans.jar
    xqjapi.jar
    xqj-ino-api.jar

    Note:
    You can find these files in the CentraSite redist folder.

    Note:
    If you have activated an e-mail policy, the CLASSPATH must additionally include the file mail.jar, which you can find in the rts/bin folder.

  2. Start your client program with the following parameter:

    -Djavax.xml.registry.ConnectionFactoryClass=com.centrasite.jaxr.ConnectionFactoryImpl

    Or:
    Set this property during program startup:

    System.setProperty("javax.xml.registry.ConnectionFactoryClass",
                                             "com.centrasite.jaxr.ConnectionFactoryImpl");
    
  3. Create a factory:

    ConnectionFactory connFactory = ConnectionFactory.newInstance();
  4. Supply the queryManagerURL to the connection:

    Properties p = new Properties();
    p.setProperty("javax.xml.registry.queryManagerURL",
                                                "http://localhost:53307/CentraSite/CentraSite");
    

    Note:
    In CentraSite, the lifeCycleManagerURL is always the same as the queryManagerURL, hence it need not be specified.

    Note:
    The port number, in the example above specified as 53307, may need to be changed to suit your local configuration.

  5. Set the BrowserBehaviour option:

    p.setProperty("com.centrasite.jaxr.BrowserBehaviour", "yes"); 
    connFactory.setProperties(p); 
    

    Enabling BrowserBehaviour mode is the preferred way of creating a JAXR-based connection. This is beneficial for several reasons. The BrowserBehaviour mode uses a less strict locking pattern, and this can result in an increased number of parallel read and update operations. For example in the CentraSite Control UI, while one user is looking at some asset, another user can update the same asset in parallel. In the same scenario without BrowserBehaviour, the update would fail as the necessary lock cannot not be granted.

    Moreover, with BrowserBehaviour mode, the assets cached on the client side are refreshed more often. After an asset is read, it will be refreshed in the cache if it is returned as the result of a subsequent query with a newer timestamp.

  6. Create the connection and set the user credentials. The setCredentials() method expects a Set containing a java.net.PasswordAuthentication object.

    Connection connection = connFactory.createConnection();
    
    HashSet credentials = new HashSet(1);
    credentials.add(new PasswordAuthentication("userid", "password".toCharArray()));
    		
    connection.setCredentials(credentials);
    
  7. With the connection given, the other environment objects can easily be constructed:

    RegistryService regService = connection.getRegistryService();
    BusinessLifeCycleManager lcManager = regService.getBusinessLifeCycleManager();
    BusinessQueryManager     bqManager = regService.getBusinessQueryManager();
    

Top of page

Closing a JAXR-based Connection

A JAXR-based connection uses some resources in the CentraSite XML Server. We therefore strongly recommend making sure that a connection is closed in case of a JAXR-based client failure. Otherwise the resources are released only after a non-activity timeout; this might hinder parallel users.

Start of instruction setTo close a JAXR-based connection

Top of page