Project Notes


Project: CORBA Reference Application

Author: Kevin Minard

Description:
This sample provides an example of a credit approval/credit card issuing system for a fictitious company selling outdoor adventure gear. The company, Cliffhanger Adventure Gear, requires an automated system for processing the credit history of an applicant to determine if a credit card should be issued.  If a credit card is issued, the system calculates the credit limit and expiration date for the account.

The sample consists of two JBuilder projects, a Credit Approval Server application and a Credit Approval Client applet. The Credit Approval Server and Credit Approval Applet communicate by means of a set of CORBA objects, illustrating how to create and use CORBA objects in JBuilder. Generation of Java code from IDL source, a server application, a client applet, and a callback are demonstrated. For simplicity, the client and server are set up to run on the same machine. This sample also provides an example of using JBuilder's DataExpress database components to enforce a set of business rules.

Setup
To run this sample, you must

Executing the Sample
To execute the CORBA sample, follow this order of events:

  1. Start the VisiBroker OSAGENT.EXE executable, which is located in JBuilder\bin. On Windows NT, use the -C command line parameter. "VisiBroker Smart Agent" appears on the Windows Taskbar.
  2. Execute the Server portion of this sample: CreditApprovalServer.jpr. The server runs and displays messages in a console window. You should see the message "Awaiting client requests".
  3. Execute the Client applet portion of this sample: CreditApprovalClient.jpr. Enter the data required to apply for a credit card and click the Submit button. The request is sent to the server, which processes it and sends a response back to the client applet.

Other documentation and data files
One other document included in this sample, Reusable Code, highlights some of the reusable code snippets from this sample project that might be useful for your own JBuilder projects.

In addition to the InterBase database ACMECreditBureau.GDB, this application's Db directory contains text files that can be used to generate clean copies of the CLIFFHANGER.GDB and ACMECreditBureau.GDB databases. To use them:



Cliffhanger Adventure Gear Credit Approval Server

Description:
The Approval Server is responsible for reviewing an applicants credit history and to make a determination as to whether the applicant should or should not be approved for a Cliffhanger Credit Card.  The server also issues credit cards to approved applicants consisting of a credit card number, an expiration date and a credit limit.

The server uses two databases:

  1. The Cliffhanger Database: This database contains Cliffhanger Credit Card account information such as card holder information, credit card number, expiration date, balance, credit limit and account status.  Records are created in this database when an applicant is issued a credit card.
  2. The ACME Credit Bureau Database: This database contains account history for all active/inactive accounts of people tracked by the ACME Credit Bureau.  This database is used in the Credit Card Approval process. Since using real credit history information is not feasible, this database is populated using randomly generated, fictional sample data.


The Credit Approval Server notes are divided into discussions of demonstrated features as follows:

Using IDL to Generate Java Classes
The first step in creating CORBA objects is defining their interfaces using IDL. The IDL defined interfaces for this project are located in CreditApproval.idl.  Interfaces only need to be created for objects that are going to be distributed using CORBA.
Once these interfaces have been defined, use JBuilder's CORBA Settings Wizard (from Tools | CORBA Settings) to create Java helper interfaces and classes.  For this project, these generated classes are located in the CreditApprovalCORBAInterface package.  Files generated with the _example_  prefix demonstrate how to use the Java classes and interfaces generated by the wizard.

The CreditApprobal.idl interface file demonstrates the following:

ORB Usage
CORBA Class implementation, initialization, registration and usage are demonstrated by the following classes:

CreditApprovalServer Class demonstrates the following:

CreditApprovalDispenserImpl Class demonstrates the following: CreditApprovalImpl Class demonstrates the following:

Data Module
Three data module classes are used in this sample.  These classes contain Database components, QueryDataSet components, and all the business rules logic. Data modules simplify reuse and multiple use of collections of dataset components.

One of these data modules, the CreditHsitoryReviewer class, demonstrates the following:

 


Cliffhanger Adventure Gear Credit Approval Applet
 

Description:
The Credit Approval Applet is used to collect information from the user to be processed by the Credit Approval Server.

The Credit Approval Applet notes are divided into discussions of demonstrated features as follows:

ORB Usage
This Applet uses CORBA to communicate with the server.  To receive status information, the applet creates a callback CORBA object that is passed to the server.  The following classes demonstrate ORB usage:

The CallbackThread class demonstrates the following:

The ClientCallbackImpl class demonstrates the following: The CreditApprovalApplet class demonstrates the following:

Required Field Processing
Required field processing is an important part of data entry.  A form cannot be submitted for processing until all required fields are complete. The applet uses a couple of techniques to notify the user of missing required fields.

  1. The applet displays the name of the next required column that does not contain a value in the status line.
  2. When the user attempts to submit an incomplete form, the applet displays a message to the user indicating the missing required field and then sets focus to that field.
The ApplicationFormPanel class demonstrates the following: The FindMissingRequired class demonstrates the following: