Table of Contents Previous Next PDF


The Wrapper Sample Application

The Wrapper Sample Application
The topic includes the following sections:
Notes:
Technical support for third party CORBA Java ORBs should be provided by their respective vendors. Oracle 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 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 Chapter 3, “The Basic Sample Application.”
Note:
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:
 
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:
Method implementations for the get_balance(), credit(), and debit() operations for the Teller object. The method implementations need to include the code that does the following:
A method implementation for the find_teller() operation of the TellerFactory object.
A Billing server object that creates and registers the TellerFactory object and calls the open_XA_RM and close_XA_RM functions.
During the development process, you would add the following to the University server application:
In the server initialization portion of the code for the University server application, include the Bootstrap object to get a FactoryFinder object for the TellerFactory object. The University server application is using the Bootstrap and FactoryFinder objects like a client application would.
In the code for the University server application, include a reference to the TellerFactory object in the constructor of the servant for the Registrar object. Use the TellerFactory object to create a Teller object.
In the method implementations for the get_student_details() and register_for_courses() operations for the Registrar object, invoke the get_balance() and debit() operations on the Teller object.
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:
Define the following server groups in the GROUPS section of the UBBCONFIG file:
ORA_GRP, which contains the University server application, the Teller application, and the server application for the University database. This server group allows both the University server application and the Teller application to access the University database.
APP_GRP, which contains the Billing server application.
Specify the server applications in the Wrapper sample application in the order in which they should be booted in the SERVERS section of the UBBCONFIG file. Start the server applications in the following order:
a.
b.
c.
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:
The Teller object has an activation policy of process and a transaction policy of optional.
The TellerFactory object has an activation policy of process and a transaction policy of ignore.
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.
2.
3.
4.
5.
Load the UBBCONFIG file.
6.
7.
The following sections describe these steps.
Note:
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.
 
The OMG IDL that declares the Teller and TellerFactory interfaces.
The OMG IDL that declares the CourseSynopsisEnumerator, Registrar, and RegistrarFactory interfaces.
The C++ source code for the method implementations of the CourseSynopsisEnumerator, Registrar, and RegistrarFactory interfaces.
The UBBCONFIG file for the UNIX operating system.
The UBBCONFIG file for the Windows operating system.
The makefile for the Wrapper sample application on the UNIX operating system.
The makefile for the Wrapper sample application on the Windows operating system.
log.cpp, log.h, log_client.cpp, and log_server.cpp
oradbconn.cpp and oranoconn.cpp
samplesdb.cpp and samplesdb.h
unique_id.cpp and unique_id.h
samplesdbsql.h and samplesdbsql.pc
Changing the Protection on the Files for the Wrapper Sample Application
During the installation of the Oracle 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.
tmadmin
2.
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
3.
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.
2.
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:
The Oracle Tuxedo system EventBroker.
The transaction management services, including the NameManager and the FactoryFinder services.
The Interface Repository server process.
The University server process.
The application process for the ATMI application Teller.
The Billing server application process.
The IIOP Listener/Handler process.
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.
prompt>univw_client
2.
At the Enter student id: prompt, enter any number between 100001 and 100010.
3.
4.
At the Enter domain password: prompt, enter the password you defined when you loaded the UBBCONFIG file.
5.
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.

Copyright © 1994, 2017, Oracle and/or its affiliates. All rights reserved.