CORBA/JAVA Home Page Link
 
Visgenics ORB Icon

Middleware: Visigenic CORBA/JAVA

CORBA provides a distributed, object-oriented, client-server infrastructure while JAVA provides a platform-neutral and objected-oriented programming language, development and deployment environment. The Trade Order Management System was designed from the ground-up  to showcase these features.    

After analyzing the trade order business logic, we identified the objects that make up the system. These are the order object and the customer object. In CORBA terminology,  our clients are the customer log-in and order entry prompts. They were written as as applets so that they can be downloadable to the Web browser. 
 
1.  Business Logic - Customer Order Flow 
 

  • The customer using his favorite Web browser connects to the trading system web site.  A welcome screen will be presented where the user can log on. The user logs on the system. 
     
  • The system validates and authenticates the user. If the customer name or the password was invalid it returns an error message; otherwise,  the user can proceed.

  •  
  • The user enters the trade order information. He or she can buy or sell  a whole number of   shares of securities. The client sends the order by hitting the submit button. 
  • The trade order system validates the order. If everything is OK, it stores the order to the database where an executing broker can read and fill the order at a later time. 
  • A confirmation is sent back to the client. The confirmation includes the trade instruction, an order number, and timestamp of the receipt of order. 
  • The client may enter another  order, check the status of any outstanding order or log off. 
2.  Client Applet  

The Order Entry applet is a CORBA client. It invokes the Corba init() method to initialize the Object Request Broker (ORB).  It then binds to the ORB to locate the server that will service its requests. It creates an instance of Order Manager class by invoking the ORB's bind method.  

An Order Manager object is basically a software factory for creating Order objects. There can be several of these Order Manager objects running at the same time and at different remote sites. They are given names to allow a client to choose a particular instance of the object.  

When the ORB finds the server that implements the Order Manager object, a "session" is established. When the client applet sends an order,  the Order Manager creates an order object.  An order number, timestamp and confirmation are generated and sent back to the client.  

The order is persisted by writing to a relational file using Java Database Connectivity (JDBC) interface. It can then be retrieved by the client to check  the order's status or for the broker to fill.  
  

3. IDL Generated 

An Interface Definition Language (IDL) is a software specification that facilitates the development of object interfaces in CORBA. Sun Microsystems provides a program called idl2java which maps IDL definitions to Java language definitions.   

For this project, we created a file called Order.idl that contains the trade order system's interfaces. They are described in later sections.  The idl2java compiler creates the following files:  

For the  Order and OrderManager class declarations: 
 
Order.java  
OrderManager.java  

For the Order and OrderManager type holders:  
OrderHolder.java  
OrderManagerHolder.java  

For the Order and OrderManager helper classes:  
OrderManagerHelper.java  
OrderHelper.java  

For the Order and OrderManager implementation abstract classes:  
_OrderImplBase.java  
_OrderManagerImplBase.java  

We had to write codes for the Order and OrderManager implementation.   
OrderImpl.java  
OrderManagerImpl.java  

Finally, codes are needed to be written for the client and server applets and applications.  
Client.java  
ClientApplet.java  
Server.java  

For the CustomerAccount interface, the following are generated and written similar to the Order and OrderManager interfaces:  
CustomerAccountImpl.java  
CustomerAccount.java  
CustomerAccountHolder.java  
CustomerAccountHelper.java  
_CustomerAccountImplBase.java  
  
Note: there are other files that are generated by the idl2java compiler which serve as examples for its implementations. Also, skeletons and stubs used for marshalling and unmarshalling are generated but no longer being used since they are replaced by _<class>ImplBase and <class>Helper files.  
  
4. IDL Detailed 

The following describes the interfaces using CORBA IDL.  

Order Interface  

Order.idl contains the IDL for the Order interface. The following is the listing for the Order interface.  
  
interface Order  
 
  attribute long orderNo;  
  attribute string orderTimestampReceived;  
  attribute string orderTimestampFilled;  
  readonly attribute  
           long customerAccountNo;  
  readonly attribute char buySellCode;  
  readonly attribute long orderQuantity;  
  readonly attribute string tickerSymbol;  
  void showOrder();  
};  

Order Interface Members and Methods Descriptions  

  • buySellCode  

  • This represents the order instruction where the valid values are 'B'  for buy and 'S'  for sell.  
     
  • orderQuantity  

  • This represents the number of shares of securities to buy or sell. 
     
  • TickerSymbol 

  • This represents the security symbol to buy or sell.  
     
  • orderTimestampReceived  

  • This represents the timestamp generated by the Server as soon as it receives a valid order.  
  • orderNo  

  • This represents the order serial number generated by the Server as it receives a valid order.   
  • customerAccountNumber  

  • This represents a customer account number.   
  • orderTimestampFilled  

  • This represents the timestamp generated by the Server as soon as the executing broker fills the order.  
  • showOrder()  

  • This method will display the Order information.  
OrderManager Interface  

The Order.idl also contains the IDL for the OrderManager interface. The OrderManager as the name implies manages the messages intended for the Order object.  

When the OrderManager receives a request to send an order or list an order, it creates an Order object by passing the necessary information retrieved from the user interface or the data store.  

The following is the listing for the OrderManager interface.  
 

interface OrderManager   
{   
  void sendOrder(   
    in long customerAccountNo,    
    in char orderCode,   
    in short orderQuantity,   
    in string orderTicker,    
    out string orderTimeStamp,   
    out string confirmation,    
    out long orderNo   
  );   

  void listOrder(in long customerAccountNo);   
};   
  

The OrderManager interface has two methods: sendOrder() and listOrder(). Conceptually,  
the sendOrder() gets information from the client and an Order object is created and persisted.  

The listOrder() method, on the other hand, retrieves  the persisted Order object whose  
reference is returned to the client. The OrderManager object serves a software factory for Order objects.  

  • sendOrder()  

  • This method takes as input the customer account number (customerAccountNo), buy/sell instruction (OrderCode), quantity (orderQuantity), and security symbol (orderTicker). If there are no errors, it then instantiates the Order class while supplying these fields. In addition, the OrderManager generates an order number (orderNo), a timestamp (orderTimeStamp), and an order confirmation (confirmation).  
  • listOrder()  

  • This method takes as input the customer account number (customerAccountNo), retrieves the information from the data store and use them to create an Order object.  
Customer Account Interface  

The Order.idl also contains the IDL for the CustomerAccount interface. The CustomerAccount object handles user authentication.  

The client enters name and the CustomerAccount  implementation  invokes its method to check if the user is a valid user and the password entered is correct. 

The following is the listing for the CustomerAccount interface.  
  

interface CustomerAccount   
{   
  attribute long customerAccountNo;   
  void getAccount(in string name,  
       in string password);   
};   
  

CustomerAccount Interface Members and Methods Descriptions  

  • customerAccountNo  

  • This represents the account number of  the client. For each name in the client database there is an associated password.   
  • getAccount()  

  • This method accepts the client name and password, and checks the database if the client is a valid user of the system. This is used during logon.