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:Figure 6‑1 illustrates how the Wrapper sample application works.Figure 6‑1 The Wrapper Sample ApplicationThis 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: 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.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.
• 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 Billing server object that creates and registers the TellerFactory object and calls the open_XA_RM and close_XA_RM functions.
• 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.
•
• 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: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.
5. Load the UBBCONFIG file.
Note: 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 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. oradbconn.cpp and oranoconn.cpp samplesdb.cpp and samplesdb.h unique_id.cpp and unique_id.h samplesdbsql.h and samplesdbsql.pc The SQL for the University database. This file is located in the \utils directory.Use the following command to load the UBBCONFIG file: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 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.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: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.
•
•
•
•
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. The following sections explain how to use the client applications in the Wrapper sample application.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.