ISV Partners' Guide

     Previous  Next    Open TOC in new window  Open Index in new window  View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Using the BEA Registry API

ISV applications that interoperate with WebLogic Server typically need to have specific information about the BEA software, for example, the current software version number or custom startup requirements. As BEA releases new versions and service packs of WebLogic Server, and as customers extend and modify their WebLogic Server installations, ISV software needs to detect changes in a way that results in minimal or no impact on the usage of that software.

The BEA Registry API is a mechanism that provides a uniform access method to information about BEA software installations that is contained in the BEA Registry file, registry.xml. The BEA Registry API gives ISV applications a manageable, predictable means of interoperating with BEA software as customer environments change.

This chapter contains the following topics:

WARNING: Do not modify the contents of the BEA Registry file, registry.xml. Such modification may result in unpredictable system behavior.


About the BEA Registry

A BEA Registry file is created in each BEA Home directory on each machine where a BEA product has been installed, and it stores context data about the software installed on that machine, including:

Using the BEA Registry API to obtain this information is much more reliable and stable than other methods, such as examining the weblogic.Admin file and run-time MBeans. Regardless of how the volume and format of the information kept in the BEA Registry may change across successive releases of BEA software, the BEA Registry API returns data in a standard format.


Using the Registry API

The Registry API package contains the classes and interfaces summarized in Table 5-1. Click the name of a class or interface listed in this table to view the Javadoc for it.

Table 5-1 Registry API Package com.bea.plateng.gpr.registry 
Interface for returning information about the product installed in a BEA Home directory.
Class that implements the ProductInfo interface.
Interface for inspecting the BEA Registry file, registry.xml, in a BEA Home directory for installed products, components, and subcomponents.
Class that implements the RegistryInfo interface.

To create an application that uses the Registry API, complete steps similar to the following:

  1. Add the following JAR file to the system classpath on your machine:
  2. BEA_HOME/utils/bsu/commdev.jar

  3. Create a Java application that includes the following import statements:
  4. import com.bea.plateng.gpr.registry.RegistryInfo;
    import com.bea.plateng.gpr.registry.RegistryInfoImpl;
    import com.bea.plateng.gpr.registry.ProductInfo;

  5. In the Java application, declare the following two variables:
    • A variable of type String, which is set to the absolute path of the BEA Home directory
    • A variable of type RegistryInfo, which is a Java object for storing information obtained from the BEA Registry
    • For example:

      String beaHomeDir = "c:\\bea";
      RegistryInfo regInfo;

      Note that as an alternative to creating a variable in which you set the absolute path of the BEA Home directory, you can invoke the RegistryInfoImpl.getBEAHomes method. This method returns an array of String objects that represent each BEA Home directory detected on the current machine.

  6. Create an instance of a RegistryInfo object, which accepts the BEA Home directory as an input parameter. For example:
  7. try
    regInfo = new RegistryInfoImpl(beaHomeDir);
    catch(Exception e)
    //log exception
    return;//cannot continue if we cannot parse the registry

  8. Invoke methods on the RegistryInfo object to obtain the desired information. For example, you can obtain a list of existing Java home directories, which are returned in an array of String objects. You can also return the names of installed BEA products in an array of ProductInfo objects.
  9. For example:

    //These are all the jdks in the registry.xml
    String jdks[] = regInfo.getJavaHomes();

    //These are all the products found in the registry
    ProductInfo[] infos = regInfo.getProductInfos();

    You can also return a specific product name using the getProductInfo() method. For example:

    ProductInfo info = regInfo.getProductInfo("WebLogic Server", "");

Javadoc for the Registry API is available at the following URL:

  Back to Top       Previous  Next