Skip navigation.
Downloads | Product Documentation | Support

ISV Partners' Guide

# 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:

- About the BEA Registry
- Using the Registry API

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:

- BEA product information—The BEA Registry tracks the following information for each BEA product installed:

- Product name, version number, and installation directory
- Service pack and patch level
- BEA program group name
- Start script information. For example, on Windows systems, this information includes the name of the program group under which the Start menu entry for this product is created, and the path to the directory that contains the Start menu entries.
- List of installed subcomponents, for example, WebLogic Server examples

- Node Manager listen port
- Java 2 JDK information—The BEA Registry tracks the following Java 2 JDK information:

- `JAVA_HOME`, `JAVA_VENDOR`, and version of the default Java 2 JDK
- List of host directories for all Java 2 JDK installations
- JVM version and vendor of a given Java home directory

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

ProductInfo`` | Interface for returning information about the product installed in a BEA Home directory.
ProductInfoImpl`` | Class that implements the `ProductInfo` interface.
RegistryInfo`` | Interface for inspecting the BEA Registry file, `registry.xml`, in a BEA Home directory for installed products, components, and subcomponents.
RegistryInfoImpl`` | 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:

`BEA_HOME``/utils/bsu/commdev.jar`

2. Create a Java application that includes the following `import` statements:

`import com.bea.plateng.gpr.registry.RegistryInfo;
import com.bea.plateng.gpr.registry.RegistryInfoImpl;
import com.bea.plateng.gpr.registry.ProductInfo;`

3. 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.

4. Create an instance of a `RegistryInfo` object, which accepts the BEA Home directory as an input parameter. For example:

`try
{
regInfo = new RegistryInfoImpl(beaHomeDir);
}
catch(Exception e)
{
//log exception
return;//cannot continue if we cannot parse the registry
}`

5. 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.

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", "9.1.0.0");`

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

http://e-docs.bea.com/common/docs91/javadoc/index.html