BEA Logo BEA WebLogic Enterprise Release 5.0

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   WLE Doc Home   |   Tuning and Scaling Applications & Related Topics   |   Previous   |   Next   |   Contents   |   Index

Production Sample Application

JUAN: Why do we need this here? Perhaps it should be an appendix to this book.

The topic includes the following sections:

For troubleshooting information and the latest information about using the Production sample application, refer to Readme.txt in the \production directory. For a walkthrough of the scalability tasks in the Production sample application, see Scaling CORBA C++ Server Applications.

Development Process for the Production Sample Application

The topic includes the following sections:

This topic describes the development process required when scaling a WLE application. These steps are in addition to the development process outlined in <HYPERLINK to "The Basic Sample Application">.

Note: The steps in this section have been done for you and are included in the Production sample application.

OMG IDL

During the development process, to support factory-based routing, you make modifications to the Object Management Group (OMG) Interface Definition Language (IDL) definitions for the following operations:

For information about implementing factory-based routing, see <HYPERLINK to Creating C++ Server Applications>.

Client Application

During the development process, you specify a STU_ID value when creating a Registrar object. The STU_ID value defines to which server group the request from the client application is routed.

In the Production sample application, the University server application creates the Teller object the same as a client application. Therefore, an ACT_NUM value needs to be specified when creating a Teller object.

Server Application

During development, you need to modify the invocation to the TP::create_object_reference() operation for the RegistrarFactory and TellerFactory objects to include an NVlist that specifies routing criteria. The criteria parameter of the TP::create_object_reference() operation specifies a list of named values to be used for factory-based routing, as follows:

The value of the criteria parameter must match exactly the routing criteria name, field, and field type specified in the ROUTING section of the UBBCONFIG file.

For information about implementing factory-based routing in a factory, see <HYPERLINK to Creating C++ Server Applications>.

UBBCONFIG File

The UBBCONFIG file in the Production sample application is modified to:

Replicating Server Application Processes and Server Groups

During development, modify the UBBCONFIG file in the following way to configure replicated server application processes and server groups:

  1. In the GROUPS section of the UBBCONFIG file, specify the names of the groups you want to configure. In the Production sample application, there are four server groups: APP_GRP1 , APP_GRP2 , ORA_GRP1 , and ORA_GRP2 .

  2. In the SERVERS section of the UBBCONFIG file, enter the following information for the server application process you want to replicate:

    Table 3-1 Parameters Specified in the SERVERS Section  

    Parameter

    Description

    Server application name

    Specifies the file name of the server executable.

    GROUP

    Specifies the name of the server group to which the server application process belongs. If you are replicating a server process across multiple groups, specify the server process once for each group.

    SRVID

    Specifies a unique administrative ID for the server machine.

    MIN

    Specifies the number of instances of the server application process to start when the WLE application is started. You need to start at least two server application processes.

    MAX

    Specifies the maximum number of server processes that can be running at any one time. You can specify no more than five server application processes.

The MIN and MAX parameters determine the degree to which a given server application can process requests in parallel on a given object. During run time, the system administrator can examine resource bottlenecks and start additional server processes, if necessary. In this sense, the application is scaled by the system administrator.

The following example shows lines from the GROUPS and SERVERS sections of the UBBCONFIG file for the Production sample application.

*GROUPS
APP_GRP1
LMID = SITE1
GRPNO = 2
TMSNAME = TMS
APP_GRP2
LMID = SITE1
GRPNO = 3
TMSNAME = TMS
ORA_GRP1
LMID = SITE1
GRPNO = 4
OPENINFO = "ORACLE_XA:Oracle_XA+Acc=P/scott/tiger+SesTm=100+LogDir
=.+MaxCur=5"
CLOSEINFO = ""
TMSNAME = "TMS_ORA"
ORA_GRP2
LMID = SITE1
GRPNO = 5
OPENINFO = "ORACLE_XA:Oracle_XA+Acc=P/scott/tiger+SesTm=100+LogDir
=.+MaxCur=5"
CLOSEINFO = ""
TMSNAME = "TMS_ORA"

*SERVERS
# By default, activate 2 instances of each server
# and allow the administrator to activate up to 5
# instances of each server
DEFAULT:
MIN = 2
MAX = 5
tellp_server
SRVGRP = ORA_GRP1
SRVID = 10
RESTART = N
tellp_server
SRVGRP = ORA_GRP2
SRVID = 10
RESTART = N
billp_server
SRVGRP = APP_GRP1
SRVID = 10
RESTART = N
billp_server
SRVGRP = APP_GRP2
SRVID = 10
RESTART = N
univp_server
SRVGRP = ORA_GRP1
SRVID = 20
RESTART = N
univp_server
SRVGRP = ORA_GRP2
SRVID = 20
RESTART = N

Implementing Factory-based Routing

For each interface for which you want to enable factory-based routing, you need to define the following information in the UBBCONFIG file:

During the development process, make the following changes to the UBBCONFIG file:

  1. The INTERFACES section lists the names of the interfaces for which you want to enable factory-based routing. For each interface, this section specifies the value on which the interface routes. The routing value is specified in the FACTORYROUTING identifier.

    The following example shows the FACTORYROUTING identifier for the Registrar and Teller objects in the Production sample application:

    INTERFACES
    "IDL:beasys.com/UniversityP/Registrar:1.0"
    FACTORYROUTING = STU_ID
    "IDL:beasys.com/BillingP/Teller:1.0"
    FACTORYROUTING = ACT_NUM

  2. The ROUTING section specifies the following data for each routing value:

    Table 3-2 Parameters Specified in the ROUTING Section  

    Parameter

    Description

    TYPE

    Specifies the type of routing. In the Production sample, the type of routing is factory-based routing. Therefore, this parameter is defined to FACTORY .

    FIELD

    Specifies the variable name that the factory inserts in the routing value. In the Production sample, the field parameters are student_id and account_number , respectively.

    FIELDTYPE

    Specifies the data type of the routing value. In the Production sample, the field types for student_id and account_number are long .

    RANGES

    Specifies the values that are routed to each group.

    The following example shows the ROUTING section of the UBBCONFIG file used in the Production sample application:

    *ROUTING
    STU_ID
    FIELD = "student_id"
    TYPE = FACTORY
    FIELDTYPE = LONG
    RANGES = "100001-100005:ORA_GRP1,100006-100010:ORA_GRP2"
    ACT_NUM
    FIELD = "account_number"
    TYPE = FACTORY
    FIELDTYPE = LONG
    RANGES = "200010-200014:APP_GRP1,200015-200019:APP_GRP2"

    The example shows that Registrar objects for students with IDs 100001 through 100005 are instantiated in ORA_GRP1 , and students with IDs 100006 through 100010 are instantiated in ORA_GRP2. Likewise, Teller objects for accounts 200010 through 200014 are instantiated in APP_GRP1, and accounts 200015 through 200019 are instantiated in APP_GRP2 .

  3. The groups specified by the RANGES identifier in the ROUTING section of the UBBCONFIG file need to be identified and configured. For example, the Production sample application specifies four groups: ORA_GRP1 , ORA_GRP2 , APP_GRP1 , and APP_GRP2 . These groups need to be configured, and the machines on which they run need to be identified.

    Note: The names of the server groups in the GROUPS section must exactly match the group names specified in the ROUTING section.

ICF File

During development, you need to change the activation policy of the Registrar , RegistrarFactory , Teller , and TellerFactory objects from process to method. For information about defining activation and transaction policies for CORBA objects, see <HYPERLINK to Creating C++ Server Applications>.

Setting Up the Production Sample Application

To set up the Production sample application, complete the following steps:

The following sections describe these steps.

Note: Before you can build or run the Production sample application, you need to perform the steps in <HYPERLINK to "Setting Up Your Environment">.

Step 1: Copy the Files for the Production Sample Application into a Work Directory

The files for the Production sample application are located in the following directories:

Windows NT

drive :\ WLEdir \samples\corba\university\production

UNIX

/usr/ WLEdir /samples/corba/university/production

In addition, you need to copy the utils directory into your work directory. The utils directory contains files that set up logging, tracing, and access to the University database.

Use the files listed in Table 3-3 to create the Production sample application.

Table 3-3 Files Included in the Production Sample Application  

File

Description

billp.idl

OMG IDL that declares the Teller and TellerFactory interfaces.

univp.idl

OMG IDL that declares the CourseSynopsisEnumerator , Registrar , and RegistrarFactory interfaces.

billps.cpp

C++ source code for the Billing server application in the Production sample application.

univps.cpp

C++ source code for the University server application in the Production sample application.

billp__i.h
billp_i.cpp

C++ source code for the method implementations of the Teller and TellerFactory interfaces.

univp_i.h
univp_i.cpp

C++ source code for method implementations of the CourseSynopsisEnumerator , Registrar , and RegistrarFactory interfaces.

univpc.cpp

C++ source code for the CORBA C++ client application in the Production sample application.

frmBrowser.frm

Visual Basic source code for the ActiveX client application in the Production sample application.

university.vbp

Visual Basic project file for the ActiveX client application in the Production sample application.

University.vbw

Visual Basic workspace file for the ActiveX client application in the Production sample application.

modPublicDeclarations.bas

Visual Basic file that contains the declarations for variables used in the sample applications.

frmTracing.frm
frmTracing.frx

Files that provide tracing capabilities to the ActiveX client application.

frmLogon.frm

Visual Basic file that performs the security logon for the ActiveX client application.

univPApplet.java

Java source code for the CORBA Java client application in the Production sample application.

univp_utils.h
univp_utils.cpp

Files that define database access functions for the CORBA C++ client application.

univp.icf

Implementation Configuration File (ICF) for the University server application in the Production sample application.

billp.icf

ICF file for the Billing server application in the Production sample application.

tellw_flds, tellw_u.c, tellw_c.h, tellws.ec

files for the BEA TUXEDO Teller application.

setenvp.sh

UNIX script that sets the environment variables needed to build and run the Production sample application.

setenvp.cmd

MS-DOS command procedure that sets the environment variables needed to build and run the Production sample application.

ubb_p.mk

UBBCONFIG file for the UNIX operating system.

ubb_p.nt

UBBCONFIG file for the Windows NT operating system.

makefilep.mk

makefile for the Production sample application on the UNIX operating system.

makefilep.nt

makefile for the Production sample application on the Windows NT operating system.

log.cpp , log.h , log_client.cpp , and log_server.cpp

Files for the client and server applications that provide logging and tracing functions for the sample applications. These files are located in the \utils directory.

oradbconn.cpp and oranoconn.cpp

Files that provide access to an Oracle SQL database instance.These files are located in the \utils directory.

samplesdb.cpp and samplesdb.h

Files that provide print functions for the database exceptions in the sample applications. These files are located in the \utils directory.

unique_id.cpp and unique_id.h

C++ Unique ID class routines for the sample applications. These files are located in the \utils directory.

samplesdbsql.h and samplesdbsql.pc

C++ class methods that implement access to the SQL database. These files are located in the \utils directory.

university.sql

SQL for the University database. This file is located in the \utils directory.

Step 2: Change the Protection on the Files for the Production Sample Application

During the installation of the WLE software, the sample application files are marked as read-only. Before you can edit the files or build the files in the Production sample application, you need to change the protection of the files you copied into your work directory, as follows:

Windows NT

prompt>attrib -r drive:\ workdirectory \*.*

UNIX

prompt>chmod u+rw / workdirectory /*.*

Step 3: Set the Environment Variables

Use the following command to set the environment variables used to build the client and server applications in the Production sample application:

Windows NT

prompt>setenvp

UNIX

prompt>/bin/ksh

prompt>. ./setenvp.sh

Step 4: Initialize the University Database

Use the following command to initialize the University database used with the Production sample application:

Windows NT

prompt>nmake -f makefilep.nt initdb

UNIX

prompt>make -f makefilep.mk initdb

Step 5: Load the UBBCONFIG File

Use the following command to load the UBBCONFIG file:

Windows NT

prompt>tmloadcf -y ubb_p.nt

UNIX

prompt>tmloadcf -y ubb_p.mk

The build process for the UBBCONFIG file prompts you for an application password. This password will be used to log on to the client applications. Enter the password and press Enter. You are then prompted to verify the password by entering it again.

Step 6: Create a Transaction Log

The transaction log records the transaction activities in a WLE application. During the development process you need to define the location of the transaction log (specified by the TLOGDEVICE parameter) in the UBBCONFIG file. For the Production sample application, the transaction log is placed in your work directory.

You need to perform the following steps to open the transaction log for the Production sample application:

  1. Enter the following command to start the Interactive Administrative Interface:

    tmadmin

  2. Enter the following command to create a transaction log:

    crdl -b blocks -z directorypath
    crlog -m SITE1

    where

  3. Enter q to quit the Interactive Administrative Interface.

Compiling the Production Sample Application

During the development process, you would use the buildobjclient and buildobjserver commands to build the client and server applications. However, for the Production sample application, this step has been done for you. The directory for the Production sample application contains a makefile that builds the client and server sample applications.

Use the following commands to build the CORBA C++ client and server application in the Production sample application:

Windows NT

prompt>nmake -f makefilep.nt

UNIX

prompt>make -f makefilep.mk

To build the CORBA Java client application:

Windows NT

prompt>nmake -f makefilep.nt javaclient

UNIX

prompt>make -f makefilep.mk javaclient

For information about starting the ActiveX client application, see Starting the ActiveX Client Application.

For more information about the buildobjclient and buildobjserver commands, see the <HYPERLINK to C++ Programming Reference>.

Running the Production Sample Application

To run the Production sample application, complete the following steps:

The following sections described these steps in detail.

Step 1: Start the Server Application

Start the system and sample application server applications in the Production sample application by entering the following command:

prompt>tmboot -y

This command starts the server processes described in Table 3-4:

Table 3-4 Server Processes Started by Invoking tmboot -y

Process

Description

TMSYSEVT

BEA TUXEDO system event broker.

TMFFNAME

Transaction management services, including the NameManager and the FactoryFinder services.

TMIFSRVR

Interface Repository server process. This server process is used only by ActiveX client applications.

univp_server

Four processes of the University server application.

tellp_server

Four processes of the BEA TUXEDO Teller application.

billp_server

Four processes of the Billing server application.

ISL

IIOP Listener/Handler process.

Before using another sample application, enter the following command to stop the system and sample application server processes:

prompt>tmshutdown

Step 2: Start the Client Application

This topic includes the following sections:

Starting the CORBA C++ Client Application

Start the CORBA C++ client application in the Production sample application by perform the following steps:

  1. At the MS-DOS prompt, enter the following command:

    prompt>univp_client

  2. At the Enter student id: prompt, enter any number between 100001 and 100010 , and then press Enter.

  3. At the Enter domain password: prompt, enter the password you defined when you loaded the UBBCONFIG file, and then press Enter.

    Note: The CORBA C++ client application in the Production sample application works in the same manner as the CORBA C++ client application in the Wrapper sample application.

Starting the CORBA Java Client Application

Before you can start the CORBA Java client application, you need to change the value of the Port and Host parameters in UnivPApplet.html to match the host name and port number specified in the ISL parameter in the UBBCONFIG file. For example:

<param name=port value=2500>
<param name=host value=BEANIE>

Start the CORBA Java client application in the Production sample application by performing the following steps:

  1. At the MS-DOS prompt, enter the following command:

    prompt>appletviewer UnivPApplet.html

    A logon window appears.

  2. Enter a number between 100001 and 100010 in the student ID field.

  3. In the Domain Password field, enter the password you defined when you loaded the UBBCONFIG file.

  4. Double-click the Logon button.

    Note: The CORBA Java client application in the Production sample application works in the same manner as the CORBA Java client application in the Wrapper sample application.

Starting the ActiveX Client Application

Note: For the University sample applications, the task of loading the OMG IDL for the CORBA interfaces into the Interface Repository is automated by the makefile .

Before you can start the ActiveX client application, you must use the Application Builder to create ActiveX bindings for the CORBA interfaces.

To create an ActiveX binding for a CORBA interface:

  1. Click the BEA Application Builder icon in the WLE program group.

    The IIOP Listener window appears.

  2. In the IIOP Listener window, enter the host name and port number that you specified in the ISL parameter in the UBBCONFIG file. You must match exactly the capitalization used in the UBBCONFIG file.

    The Logon window appears.

  3. In the Logon window, enter a student ID between 100001 and 100010 for the user name and the password you defined when you loaded the UBBCONFIG file.

    The Application Builder window appears. All the CORBA interfaces loaded in the Interface Repository appear in the Services window of the Application Builder.

  4. Highlight the UniversityP folder in the Services window and drag it to the Workstation Views window, or copy the UniversityP folder from the Services window and paste it into the Workstation Views window.

    A confirmation window appears.

  5. Click Create to create the ActiveX bindings for the CORBA interfaces in the Production sample application.

    The Application Builder creates the following:

Perform the following steps to run the ActiveX client application:

  1. Open the University.vbw file in Visual Basic.

  2. From the Run menu, click Start.

    The IIOP Listener window appears.

  3. In the IIOP Listener window, enter the host name and port number that you specified in the ISL parameter in the UBBCONFIG file. You must match exactly the capitalization used in the UBBCONFIG file.

    The Logon window appears.

  4. In the Logon window, enter a student ID between 100001 and 100010 for the user name and the password you defined when you loaded the UBBCONFIG file.

    Note: The ActiveX client application in the Production sample application works in the same manner as the ActiveX client application in the Wrapper sample application.