bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Programming BPM Client Apps

Accessing Process Engine Information

This section describes how to access information about the WebLogic Integration process engine. It includes the following topics:

- Getting the Server Version

- Getting the Package Version

- Getting the Template Definition Version

- Getting Server Properties

- Using the Convenience Methods

- Example of Accessing Information About the Process Engine

For more information about the methods described in this section, see the com.bea.wlpi.server.serverproperties.ServerProperties or com.bea.wlpi.client.common.WLPI Javadoc.

Getting the Server Version

To get the server version, use the following com.bea.wlpi.server.serverproperties.ServerProperties method:

>     public com.bea.wlpi.common.VersionInfo getServerVersion(
>     ) throws java.rmi.RemoteException

This method returns the server version as a VersionInfo object. To access information about the version, use the VersionInfo object methods described in VersionInfo Object.

For example, the following code gets the version and saves it to the version object. In this example, properties represents the EJBObject reference to the ServerProperties EJB.

>     VersionInfo version = properties.getServerVersion();

For more information about the getServerVersion() method, see the com.bea.wlpi.server.serverproperties.ServerProperties Javadoc.

Getting the Package Version

To get the package version that is supported by the server, use the following com.bea.wlpi.server.serverproperties.ServerProperties method:

>     public com.bea.wlpi.common.VersionInfo getPackageVersion(
>     ) throws java.rmi.RemoteException

This method returns the package version as a VersionInfo object. To access information about the version, use the VersionInfo object methods described in VersionInfo Object.

For example, the following code gets the package version and saves it to the version object. In this example, properties represents the EJBObject reference to the ServerProperties EJB.

>     VersionInfo version = properties.getPackageVersion();

For more information about the getPackageVersion() method, see the com.bea.wlpi.server.serverproperties.ServerProperties Javadoc.

Getting the Template Definition Version

To get the template definition version supported by the server, use the following com.bea.wlpi.server.serverproperties.ServerProperties method:

>     public com.bea.wlpi.common.VersionInfo getTemplateDefinitionVersion(
>     ) throws java.rmi.RemoteException

This method returns the template definition version supported by the server as a VersionInfo object. To access information about the version, you can use the VersionInfo object methods described in VersionInfo Object.

For example, the following code gets the template definition version supported by the server and saves it to the version object. In this example, properties represents the EJBObject reference to the ServerProperties EJB.

>     VersionInfo version = properties.getTemplateDefinitionVersion();

For more information about the getTemplateDefinitionVersion() method, see the com.bea.wlpi.server.serverproperties.ServerProperties Javadoc.

Getting Server Properties

To get server properties, use the following com.bea.wlpi.server.serverproperties.ServerProperties method:

>     public java.util.Properties getProperties(
>     ) throws java.rmi.RemoteException

This method returns the server properties, including the Java system properties and any other defined properties.

Note: In a clustered environment, the remote inspection of Java system properties is of limited use, as the method request is directed to a server, based on the configured routing algorithm. The information returned by the method call varies, particularly if the systems in the cluster have unique specifications.

For example, the following code gets the server properties and saves them to the props object. In this example, properties represents the EJBObject reference to the ServerProperties EJB.

>     Properties props = properties.getProperties();

For more information about the getProperties() method, see the com.bea.wlpi.server.serverproperties.ServerProperties Javadoc.

Using the Convenience Methods

The com.bea.wlpi.client.common.WLPI class provides a set of convenience methods for accessing server information. The following table summarizes these methods.

Table 4-1 Convenience Methods for Accessing Server Information

Method | Description
--- | ---
public com.bea.wlpi.common.VersionInfo getServerVersion( ) throws java.lang.IllegalStateException, com.bea.wlpi.common.WorkflowException | Accesses the ServerProperties session EJB and returns the BPM server version. This method returns a com.bea.wlpi.common.VersionInfo object corresponding to the template. To access information about the version, use the VersionInfo object methods described in VersionInfo Object.
public com.bea.wlpi.common.VersionInfo getServerTemplateDefinitionVersion( ) throws java.lang.IllegalStateException, com.bea.wlpi.common.WorkflowException | Accesses the ServerProperties session EJB and returns the template definition version supported by the current version of WebLogic Integration. This method returns a com.bea.wlpi.common.VersionInfo object corresponding to the template. To access information about the version, use the VersionInfo object methods described in VersionInfo Object.

For more information, see the com.bea.wlpi.client.common.WLPI Javadoc.

Example of Accessing Information About the Process Engine

This section provides an excerpt from the command-line administration client example showing how to access server properties.

An input stream is defined to communicate with the user, and the user is prompted to specify what action to perform. If the user selects the Server Properties option, the system gets the server and template definition versions, and uses the returned VersionInfo objects to obtain other information about the server and template definition, including the name, and major, minor, and build versions. In addition, the server property names and values are displayed.

Important lines of code are highlighted in bold. In this example, the string serverProperties represents the EJBObject reference to the ServerProperties EJB.

>     /* Display Tool Title */
>        System.out.print( "\n---  Command Line Administration v1.1  ---" );

>     /* Display the main menu and interact with user */
>     while( true ) {
>     /* Display the menu */
>        System.out.println( "\n---             Main Menu            ---" );
>        System.out.println( "\nEnter choice:" );
>        System.out.println( "1) Organizations" );
>        System.out.println( "2) Roles" );
>        System.out.println( "3) Users" );
>        System.out.println( "4) Security Realm" );
>        System.out.println( "5) Business Operations" );
>        System.out.println( "6) Event Keys" );
>        System.out.println( "7) Business Calendars" );
>        System.out.println( "8) EJB Catalog" );
>        System.out.println( "9) Server Properties" );
>        System.out.println( "Q) Quit" );
>        System.out.print( ">> " );
>           .
>           .
>           .

>     /**
>      * Method that illustrates the Public API Methods available in the
>      * ServerProperties interface (no user interaction, display mode only).
>      */
>     public static void mngServerProperties( ) {
>        Properties serverSystemProperties;
>        String answer;

>        try {
>           /* Prompt user to select if we need to display the System properties */
>           if( ( answer = askQuestion( "\nList system properties (y/n)?" ) )
>              == null ) {
>              /* User cancelled the operation */
>              System.out.println( "*** Cancelled" );
>              return;
>           }

>           /* Parse the answer */
>           boolean isListSysProperties = ( answer.equals( "y" ) ||
>              answer.equals( "Y" ) );
>           /* Display all the server properties and attributes */
>           System.out.println( "\nServer Version:" );

>           /* WLPI Public API Method */
>           /* Retrieve server attributes */
>           serverVersion = serverProperties.getServerVersion( );

>           /* Display all available attributes in WLPI v1.2.1 */
>           System.out.println( "- Release Name: " + serverVersion.getName( ) );
>           System.out.println( "- Version: " + serverVersion +
>              " (Major=" + serverVersion.getMajorVersion( ) +
>              " Minor=" + serverVersion.getMinorVersion( ) +
>              " Build=" + serverVersion.getBuild( ) + ")" );

>           /* Display all the template definition properties and attributes */
>           System.out.println( "\nTemplate Definition version supported:" );

>           /* WLPI Public API Method */
>           /* Retrieve template definition attributes */
>           serverDTDVersion = serverProperties.getTemplateDefinitionVersion( );

>           /* Display all available attributes */
>           System.out.println( "- Release Name: " + serverDTDVersion.getName( ) );
>           System.out.println( "- Version: " + serverDTDVersion +
>              " (Major=" + serverDTDVersion.getMajorVersion( ) +
>              " Minor=" + serverDTDVersion.getMinorVersion( ) +
>              " Build=" + serverDTDVersion.getBuild( ) + ")" );

>           if( isListSysProperties ) {
>              System.out.println( "\nSystem Properties: " );

>           /* WLPI Public API Method */
>           /* Retrieve server system properties */
>           serverSystemProperties = serverProperties.getProperties( );

>           /* Loop to display all properties */
>           for( Enumeration e = serverSystemProperties.propertyNames( );
>              e.hasMoreElements( ); ) {
>              String propertyName = e.nextElement( ).toString( );
>              System.out.println( "- Name: '" + propertyName + "' Value: '" +
>              serverSystemProperties.getProperty( propertyName ) + "'\n" );
>           }
>        }
>     }
>        catch( Exception e ) {
>           System.out.println( "*** Failed to retrieve properties" );
>           System.err.println( e );
>        }
>        return;
>     }