|
|
The Wrapper Sample Application
The topic includes the following sections:
Refer to Readme.txt in the \wrapper directory for troubleshooting information and the latest information about using the Wrapper sample application.
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 The Basic Sample Application section.
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:
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:
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 2000
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.
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 2000
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 2000
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 2000
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 2000
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:
tmadmin
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 2000:
crdl -b 500 -z c:\mysamples\university\wrapper\TLOG
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 2000
prompt>nmake -f makefilew.nt
UNIX
prompt>make -f makefilew.mk
To build the CORBA Java client application:
Windows 2000
prompt>nmake -f makefilew.nt javaclient
UNIX
prompt>make -f makefilew.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 BEA Tuxedo Command Reference.
Running the Wrapper Sample Application
To run the Wrapper sample application, complete the following steps:
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 BEA Tuxedo system EventBroker.
The transaction management services, including the NameManager and the FactoryFinder services.
The Interface Repository server process. This server process is used only by ActiveX client applications.
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:
prompt>univw_client
Starting the CORBA Java Client Application
To run the CORBA Java client application in the Wrapper sample application, complete the following steps:
code="UnivWApplet.class"
codebase=.
to read as follows:
code="UnivWApplet"
archive="UnivWApplet.jar,m3envobj.jar"
Copy the class files in the Wrapper sample application directory that were generated by the makefile into the tmp directory, set the directory (cd) to the tmp directory, and issue one of the following commands to create a .JAR file that contains all the Wrapper sample application classes:
jar -cf ..\UnivWApplet.jar *.* (Microsoft Windows 2000 systems)
jar -cf ../UnivPWpplet.jar * (UNIX systems)
Note: On Microsoft Windows 2000 systems, the node name needs to be in all uppercase characters. For example, if the node is specified as SERVER in the UBBCONFIG file and in the UnivWApplet.html file, set your browser to http://SERVER/UnivWApplet.html.
Exceptions appear in the status bar of the Appletviewer window or in the MS-DOS window in which the CORBA Java client application was started.
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, complete the following steps:
The IIOP Listener window appears.
The Logon window appears.
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:
The type library file is named DImodulename_interfacename.tlb.
To run the ActiveX client application, complete the following steps:
The IIOP Listener window appears.
The Logon window appears.
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.
The CORBA Java Client Application
The CORBA Java client application in the Wrapper sample application allows you to display an account balance.
When you log on to the CORBA Java client application, a Student Account Summary window appears. The Student Account Summary window displays the account balance associated with the student ID used to log on to the CORBA Java client application. When you register for additional courses, the amount in the Balance text box in the Student Account Summary window increases.
To exit the CORBA Java client application, click the Logoff button in the Student Account Summary window, or choose Quit from the File menu.
The ActiveX Client Application
The ActiveX client application in the Wrapper sample application allows you to display an account balance.
When you log on to the ActiveX client application, a Course Browser window appears. The Course Browser window displays the registered courses and account balance for the student ID used to log on to the ActiveX client application. When you register for additional courses, the amount in the Balance text box in the Course Browser window increases.
To exit the ActiveX client application, choose Exit from the File menu.
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|