![]() |
![]() |
BEA WebLogic Enterprise 4.2 Developer Center |
![]() HOME | SITE MAP | SEARCH | CONTACT | GLOSSARY | PDF FILES | WHAT'S NEW |
||
![]() GETTING STARTED | TABLE OF CONTENTS | PREVIOUS TOPIC | NEXT TOPIC | INDEX |
This chapter discusses the following topics:
Refer to In the Transactions sample application, students can register for classes. The operation of registering for courses is executed within the scope of a transaction. The Transactions sample application works in the following way:
Readme.txt
in the \transactions
directory for troubleshooting information and the latest information about using the Transactions sample application.
How the Transactions Sample Application Works
Figure 5-1 illustrates how the Transactions sample application works.
Figure 5-1 The Transactions Sample Application
This section describes the steps used to add transactions to the Transactions sample application. These steps are in addition to the development process outlined in Chapter 3, "The Basic Sample Application."
Note: The steps in this section have been done for you and are included in the Transactions sample application.
During the development process, you would define in Object Management Group (OMG) Interface Definition Language (IDL) the register_for_courses()
operation for the Registrar
. The register_for_courses()
operation has a parameter, NotRegisteredList,
which returns to the client application the list of courses for which registration failed. If the value of NotRegisteredList
is empty, the client application commits the transaction.
You also need to define the TooManyCredits
user exception.
During the development process, you would add the following to your client application:
register_for_courses()
operation so that students can register for courses.
For information about using Transactions in client applications, see Getting Started.
During the development process, you would add the following to the University server application:
The University Server Application
TP::open_xa_rm()
and TP::close_xa_rm()
operations in the Server::initialize()
and Server::release()
operations of the Server object
register_for_courses()
operation
For information about these tasks, see Creating C++ Server Applications.
During the development process, you need the following in the The UBBCONFIG File
UBBCONFIG
file:
Note:
If you use a database other than Oracle, refer to the product documentation for information about defining the XA parameter.
TLOG
) in the TLOGDEVICE
parameter.
For information about the transaction log and defining parameters in the During the development process, change the Transaction policy of the Perform the following steps to build the Transactions sample application:
UBBCONFIG
file, see Administration Guide.
The ICF File
Registrar
object from optional
to always
. The always
Transaction policy indicates that this object must be part of a transaction. For information about defining Transaction policies for CORBA objects, see Creating C++ Server Applications.
Building the Transactions Sample Application
The following sections describe these steps.
Note: Before you can build or run the Transactions sample application, you need to perform the steps in Chapter 2, "Setting Up Your Environment."
The files for the Transactions sample application are located in the following directories:
Windows NT
drive
:\
WLEdir
\samples\corba\university
\transaction
UNIX
/usr/
WLEdir
/samples/corba/university
/transaction
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 5-1 to create the Transactions sample application.
During the installation of the WLE software, the sample application files are marked read-only. Before you can edit the files or build the files in the Transactions 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
/*.*
Use the following command to set the environment variables used to build the client and server applications in the Transactions sample application:
Windows NT
prompt>setenvt
UNIX
prompt>/bin/ksh
prompt>. ./setenvt.sh
Use the following command to initialize the University database used with the Transactions sample application:
Windows NT
prompt>nmake -f makefilet.nt initdb
UNIX
prompt>make -f makefilet.mk initdb
Use the following command to load the UBBCONFIG
file:
Windows NT
prompt>tmloadcf -y ubb_t.nt
UNIX
prompt>tmloadcf -y ubb_t.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.
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 Transactions 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 Transactions sample application:
tmadmin
where
crdl -b
blocks
-z
directorypath
clog -m SITE1
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 NT:
crdl -b 500 -z c:\mysamples\university\Transaction\TLOG
q t
o exit the Interactive Administrative Interface.
During the development process, you would use the buildobjclient
and buildobjserver
commands to build the client and server applications. You would also build a database-specific transaction manager to coordinate the transactional events in the client/server application. However, for the Transactions sample application, this step has been done for you. The directory for the Transactions sample application contains a makefile
that builds the client and server sample applications and creates a transaction manager called TMS_ORA.
Note:
In the makefile
, the following parameter is hard coded to build a transaction manager for the Oracle database:
RM=Oracle_XA
If you use a database other than Oracle, you need to change this parameter.
Use the following commands to build the CORBA C++ client and server applications in the Transactions sample application:
Windows NT
prompt>nmake -f makefilet.nt
UNIX
prompt>make -f makefilet.mk
To build the CORBA Java client application:
Windows NT
prompt>nmake -f makefilet.nt javaclient
UNIX
prompt>make -f makefilet.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 C++ Programming Reference.
Perform the following steps to run the Transactions sample application:
These steps are described in the following sections.
Start the system and sample application server applications in the Transactions sample application by entering the following command:
prompt>tmboot -y
This command starts the following server processes:
TMSYSEVT
The BEA TUXEDO system event broker.
TMFFNAME
The transaction management services, including the NameManager and the FactoryFinder services.
TMIFSRVR
The Interface Repository server process. This server process is used only by ActiveX client applications.
univt_server
Before using another sample application, enter the following command to stop the system and sample application server processes:
Start the CORBA C++ client application in the Transactions sample application by performing the following steps:
prompt>tmshutdown
Starting the CORBA C++ Client Application
prompt>univt_client
Enter student id:
prompt, enter any number between 100001 and
100010.
Before you can start the CORBA Java client application, you need to change the value of the Port
and Host
parameters in UnivSApplet.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 Transactions sample application by performing the following steps:
A logon window appears.
prompt>appletviewer UnivTApplet.html
UBBCONFIG
file.
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:
The IIOP Listener window appears.
ISL
parameter in the UBBCONFIG
file . You must match exactly
the capitalization used in the UBBCONFIG
file.
The Logon window appears.
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.
A confirmation window appears.
The Application Builder creates the following:
DI
modulename_interfacename
. For example, the binding for the Registrar
interface is named DIUniversityT_Registrar
.
\
WLEdir
\TypeLibraries.
The type library file is named DI
modulename_interfacename
.tlb.
Perform the following steps to run the ActiveX client application:
The IIOP Listener window appears.
ISL
parameter in the UBBCONFIG
file. You must match exactly
the capitalization used in the UBBCONFIG
file.
The Logon window appears.
UBBCONFIG
file.
The following sections briefly explain how to use the client applications in the Transactions sample application.
The CORBA C++ client application in the Transactions sample application has the following additional option:
<R> Register for Courses
Perform the following steps to register for a course:
R
.
Course Number
prompt, enter a course number followed by -1 . For
example:
L
to view a list of courses for which the student ID
is registered.
To exit the C++ CORBA client application, enter E
at the Options prompt.
When you log on to the CORBA Java client application, a Student Account Summary window appears. Use the Student Account Summary window to register for courses.
Perform the following steps to register for a class:
computer
.
A list of courses matching the search string appears in the window.
If you are already registered for a course, Yes
appears in the Registered field on the Student Account Summary window.
To view a list of courses for which the student ID is registered, double click the Show Registration button.
To exit the CORBA Java client application, click the Logoff button in the Student Account Summary window, or choose Quit from the Applet menu.
When you log on to the ActiveX client application, the Course Browser window appears. Use the Course Browser window to register for courses.
Perform the following steps to register for a class:
computer
.
A list of all the courses that match that search string appears.
The details for the selected course appear.
To remove a course from the schedule, double click the course in the schedule.
To view a list of courses for which the student ID is registered, click the Get Registered Courses button.
To complete information about a course, click the Get Details button.
To exit the ActiveX client application, choose Exit from the File menu.