Skip navigation.

Guide to CORBA University Sample Applications

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents Index View as PDF   Get Adobe Reader

The Wrapper Sample Application

The topic includes the following sections:

Note: The BEA Tuxedo CORBA Java client and BEA Tuxedo CORBA Java client ORB were deprecated in Tuxedo 8.1 and are no longer supported in Tuxedo 9.0.

All BEA Tuxedo CORBA Java client and BEA Tuxedo CORBA Java client ORB text references, associated code samples, etc. should only be used:

Technical support for third party CORBA Java ORBs should be provided by their respective vendors. BEA Tuxedo does not provide any technical support or documentation for third party CORBA Java ORBs.

 


How the Wrapper Sample Application Works

In the Wrapper sample application, when a student registers for classes, the student's account is charged for the classes and the balance of the student's account is updated. In addition, students can get information about their account balances.

The Wrapper sample application incorporates a ATMI service. The Billing server application contains a Teller object, which calls the ATMI application Teller. The Teller application performs the following billing operations:

The University database is modified to include account information.

Figure 6-1 illustrates how the Wrapper sample application works.

Figure 6-1 The Wrapper Sample Application


 

The Wrapper Sample Application


 

 


The Development Process for the Wrapper Sample Application

This section describes the development process required when wrapping an ATMI service in a CORBA application. These steps are in addition to the development process outlined in The Basic Sample Application.

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

OMG IDL

When wrapping an ATMI service, you need to define an object that interoperates with the ATMI service and a factory that creates that object. In the Wrapper sample application, the Teller and TellerFactory objects interact with the ATMI service. During the development process, you would define the interfaces of the Teller and the TellerFactory objects in Object Management Group (OMG) Interface Definition Language (IDL), as follows:

Object

Description

Operations

TellerFactory

Returns an object reference to the Teller object

find_teller()

Teller

Interoperates with the ATMI application Teller to perform billing and accounting operations

get_balance()

credit()

debit()


 

You need to add a Balance field to the StudentDetails structure. Client applications use the Balance field to show the student's account balance. A user exception DelinquentAccount is also added.

The Client Application

During the development process, you would add code to the client application to handle the user exception Delinquent Account that the register_for_courses() operation can raise.

The Server Application

During the development process, you would write the following for the Billing server application:

During the development process, you would add the following to the University server application:

For information about writing server applications that wrap ATMI services, see Creating CORBA Server Applications.

The UBBCONFIG File

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

The ICF File

During the development process, you need to define activation and transaction policies for the Teller and TellerFactory objects. The Teller and TellerFactory objects have the following policies:

For information about defining activation and transaction policies for CORBA objects, see Creating CORBA Server Applications.

 


Building the Wrapper Sample Application

To build the Wrapper sample application, complete the following steps:

  1. Copy the files for the Wrapper sample application.
  2. Change the protection on the files for the Wrapper sample application.
  3. Set the environment variables.
  4. Initialize the University database.
  5. Load the UBBCONFIG file.
  6. Create a transaction log.
  7. Build the client and server sample applications.

The following sections describe these steps.

Note: Before you can build or run the Wrapper sample application, you need to complete the steps in Setting Up Your Environment.

Copying the Files for the Wrapper Sample Application into a Work Directory

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

Windows

drive:\TUXDIR\samples\corba\university\wrapper

UNIX

/usr/TUXDIR/samples/corba/university/wrapper

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.

You will use the files listed in Table 6-1 to create the Wrapper sample application.

Table 6-1 Files Included in the Wrapper Sample Application 

File

Description

billw.idl

The OMG IDL that declares the Teller and TellerFactory interfaces.

univw.idl

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

billws.cpp

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

univws.cpp

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

billw__i.h
billw_i.cpp

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

univw_i.h
univw_i.cpp

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

univwc.cpp

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

univw_utils.h
univw_utils.cpp

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

univw.icf

The ICF file for the University server application in the Wrapper sample application.

billw.icf

The ICF file for the Billing server application in the Wrapper sample application.

setenvw.sh

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

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

The files for the ATMI application Teller.

setenvw.cmd

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

ubb_w.mk

The UBBCONFIG file for the UNIX operating system.

ubb_w.nt

The UBBCONFIG file for the Windows operating system.

makefilew.mk

The makefile for the Wrapper sample application on the UNIX operating system.

makefilew.nt

The makefile for the Wrapper sample application on the Windows operating system.

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

The 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

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

samplesdb.cpp and samplesdb.h

The 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

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


 

Changing the Protection on the Files for the Wrapper Sample Application

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

Windows

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

UNIX

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

Setting the Environment Variables

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

Windows

prompt>setenvw

UNIX

prompt>/bin/ksh

prompt>. ./setenvw.sh

Initializing the University Database

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

Windows

prompt>nmake -f makefilew.nt initdb

UNIX

prompt>make -f makefilew.mk initdb

Loading the UBBCONFIG File

Use the following command to load the UBBCONFIG file:

Windows

prompt>tmloadcf -y ubb_w.nt

UNIX

prompt>tmloadcf -y ubb_w.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.

Creating a Transaction Log

The transaction log records the transaction activities in a CORBA 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 Wrapper sample application, the transaction log is placed in your work directory.

To open the transaction log for the Wrapper sample application, complete the following steps:

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

  3. Enter the following command to create a transaction log:
  4. crdl -b blocks -z directorypath
    crlog -m SITE1

    where

    blocks specifies the number of blocks to be allocated for the transaction log, and directorypath indicates the location of the transaction log. The directorypath option needs to match the location specified in the TLOGDEVICE parameter in the UBBCONFIG file. The following is an example of the command on Windows:

    crdl -b 500 -z c:\mysamples\university\wrapper\TLOG

  5. Enter q to quit the Interactive Administrative Interface.

 


Compiling the Wrapper Sample Application

During the development process, you would use the buildobjclient and buildobjserver commands to build the client and server applications. However, for the Wrapper sample application, this step has been done for you. The directory for the Wrapper 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 Wrapper sample application:

Windows

prompt>nmake -f makefilew.nt

UNIX

prompt>make -f makefilew.mk

 


Running the Wrapper Sample Application

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

  1. Start the server application.
  2. Start one or more of the client applications.

These steps are described in the following sections.

Starting the Server Application

Start the system and sample application server processes in the Wrapper sample application by entering the following command:

prompt>tmboot -y

This command starts the following server processes:

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

prompt>tmshutdown

Starting the CORBA C++ Client Application

Start the CORBA C++ client application in the Wrapper sample application by completing the following steps:

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

  3. At the Enter student id: prompt, enter any number between 100001 and 100010.
  4. Press Enter.
  5. At the Enter domain password: prompt, enter the password you defined when you loaded the UBBCONFIG file.
  6. Press Enter.

 


Using the Client Applications in the Wrapper Sample Application

The following sections explain how to use the client applications in the Wrapper sample application.

The CORBA C++ Client Application

The CORBA C++ client application in the Wrapper sample application has the following additional option:

<B>    Display Your Balance

The Display Your Balance option displays the account balance associated with the student ID used to log on to the CORBA C++ client application.

To exit the C++ CORBA client application, enter E at the Options prompt.

 

Skip navigation bar  Back to Top Previous Next