OTN Financial Brokerage Service Application

Date : 01-SEP-2003


Table of Contents

Introduction
Application Overview
Application Design
Sample Application Files
Setting Up the Sample Application

Introduction

  • Prerequisite

  • Technical Overview

Prerequisite

To understand more about the design and working of the Financial Brokerage Service(FBS) sample application, and the EJB 2.1 features that we have targeted to highlight, we expect you to have basic EJB knowledge along with an understanding of Web Services. You can always read the extensive information (in the form of tutorials,articles or HowTo's) available on OTN or the EJB specification to get up to speed with the technology prerequisites for this sample application.

Technical Overview

Developed by Sun Microsystems, Oracle and other vendors, the EJB (Enterprise JavaBean) specification defines an architecture for building applications from server-side components called enterprise beans or EJBs.

Simply put, a software component is a reusable object or group of objects (more precisely, an object graph) not bound to a particular program or application. Any number of applications or processes can use a given component, and multiple instances can be in use at the same time. As such, components offer developers numerous benefits. By building applications with components, you can:

  • Improve design by modeling real-world entities.
  • Improve developer productivity. Each piece of an application (for example, data model, business logic, and user interface) can be built by a specialist.
  • Reuse business logic. Write once, deploy anywhere.
  • Simplify deployment.
  • Distribute logic and functionality.

Server-side components are deployed to and execute on a server. Compared to thick-client applications, applications built using server-side components offer the following additional benefits:

  • Reduced client-side processing load.
  • Fewer network round-trips.
  • Clean separation of business logic and presentation logic, interfaces and implementation.
  • Easy maintenance: when you deploy an updated component to a server, clients everywhere gain immediate access.

Enterprise JavaBeans (EJB) 2.0 was significantly upgraded in J2EE 1.3, with performance enhancements such as local interfaces, productivity enhancements such as relationship management for entity beans with Container Managed Relationships, and improved usability with the built-in object query language EJB QL. Given these and other changes, the adoption of EJB-based architectures has grown significantly over the last year.

In J2EE 1.4, the EJB 2.1 specification tackles two widely anticipated enhancements to EJB QL. These include a new ORDER BY clause enabling sorting capabilities that previously were either hand-coded by developers or offered through proprietary extensions and new aggregate functions such as AVG, MIN, MAX, and COUNT. Because EJB QL naturally maps to SQL, these set-based manipulation additions were seen as critical by many developers and are now required by the specification.

Other additions in the EJB 2.1 specification include a timer specification that enables developers to build business processes that support the concept of notifications or alerts. And for developers using Message Driven Beans (MDB), the type support for messages has been extended to support more than JMS messages. This increased type support is the first step in enabling MDBs to support Web service message types and will likely be an area of further work in future releases of J2EE.

FBS demonstrates the following features

  • Web service endpoints implemented by Stateless Session Beans
  • EJB Timer Service
  • Message Driven Beans
  • Toplink Persistence Framework

Application Overview

Financial Brokerage Service (FBS) application allows various Financial Institutions (FIs) to offer their clients an online channel for managing their portfolios. In other words, this application is an end-to-end application which provides the user with the functionality to take part in trading of equities, managing portfolio and accessing real time data. The important functionality's provided by the Financial Brokerage Service are :

  • Setup, Access and Manage accounts
  • Trade (Buy / Sell) Stocks
  • Access Real time quotes
  • Access Financial News Data
  • Expose its stock quotes repository as a service

The application identifies three types of users - FBS Administrator, Corporate User and Individual User, each with different privileges.

FBS Administrator

The FBS Administrator is responsible for Daily Uploading of Financial Market News and Stock Data to the FBS Database. The FBS Administrator can also add few symbols which can be traded from this particular FBS. The FBS Administrator need not upload the market data manually, instead a job timer can be setup to upload the same at a particular frequency. The FBS Administrator can monitor trade activity by setting the report interval. At the specified interval (for example, every 15 minutes), the system creates an email message listing the trades executed in that interval and sends it to the administrator.

Corporate User

Corporate Users can use their account on this system and set up various ESOP (Employee Stock Option Plan) accounts for its employees. After setting up Employee Accounts, the details of their accounts are conveyed to the employees through the email address specified in the XML during upload. Henceforth, employees can use the created accounts to manage their assets. For setting up ESOP accounts, Corporate User need to upload Grants Information as an XML file pertaining to a particular schema which can be viewed.

Individual User

The Individual User represents the end user of this Financial Brokerage Service Application. After registering with this system, user can login and view the personalized Home Page featuring Financial News and Current Stock Rates according to the preference of Stock Symbols and News. The User can set his/her preferences and alerts as required. A particular alert on a Symbol, reminds the User about certain critical information such as Stock price has gone above some value or fallen below some value and so on. User can also edit his/her profile information. User can view the current portfolio (Stocks held) and trade stocks online. When user buys/sells a particular Stock, the associated information is sent to the Stock Exchange as a simplified message. Transaction History can also be viewed to review the past transactions.

To have a sneak preview of the application, refer UsingFBS.html.

Application Design

The FBS sample application uses the MVC architecture to handle and process customer requests. The requests are generated from the user interface(View) (generated by Java Sever Pages) which are intercepted by a servlet filter. This filter provides authorization and authentication service for the FBS application. It authenticates the user session to check if its a valid user of the system, once authenticated the filter authorizes the user session based on a pre-configured control file. This control file has the event-role mapping, i.e which roles can execute/perform which events. If the user session has the necessary authorization to perform the requested event, the control is forwarded to the Controller (ControllerServlet). The controller invokes the necessary helper classes to process the request. Request processing will either be handled by the Enterprise JavaBeans layer or by the helper classes themselves. If the request pertains to access of information related to stock quotes or news, the helper classes use the Toplink persistence framework to fetch them. If the request is to perform a trading operation or manipulating user preference, the Enterprise JavaBeans layer handles it, the EJB layer might use the Toplink framework to access the stock information (such as stock rates). Once the request has been processed successfully, the user is notified of the status of the operation.

Sample Application Files

This section will provide a tabular listing of the sample application files, along with their respective directory locations and a description of what they do in the overall scheme of the application:

Documentation

Directory File Description
Readme.html This file.
Install.html This file has instructions required to deploy and run FBS sample application.
UsingFBS.html This file has instruction on how to use the FBS sample application.

Java Server Pages

Directory File Description
*.jsp This directory holds all JSP files for this entire application for browser client. These JSP files form the view layer for browser client.
*.jsp This directory holds all JSP files for this entire application for hand-held device client. These JSP files for the view layer for hand-held device client.
web.xml The deployment descriptor for the FBS Web application.
Control.xml This file holds the event-helper-view mapping for the FBS application. This files is also used by the servlet filter to authorize user session.
Exception.xml This file holds the exception-errorpage mapping.
corporateorder.xsd This XML schema defines the structure of a corporate order posted by Corporate users.

Enterprise JavaBeans

Directory File Description
*.java This directory has Java files that implement the Administration services of this application. These files form the Model for Administration Functionality.
*.java This directory has Java files that implement the Trade Management services of this application. These files form the Model for TradeManagement Functionality.
*.java This directory has Java files that implement the User Management services of this application. These files form the Model for UserManagement Functionality.

Web Service Files

Directory File Description
StockQuoteService.java Service interface for StockQuote JAX-RPC Web Service.
StockQuoteBean.java Bean implementation for StockQuote Service.

Helper Files (Web application)

Directory File Description
*.java This directory has Java files that form the Administrator helper files.
*.java This directory has the JAX-RPC Client Stub files for the StockQuote JAX-RPC Web Service.
*.java This directory has Java files that form the Trade helper files.
*.java This directory has Java files that form the User helper files.
*.java This directory has Java files that implement the controller part of the Model View Controller(MVC) architecture.
*.java This directory has utility files like float to string formatting, parsing control xml file, parsing exception xml file etc.

Toplink Managed Files

Directory File Description
*.java Java source files of domain objects that are managed by Toplink.

Configuration and Deployment Descriptor Files

Directory File Description
build.xml ANT configuration file to build and deploy this application.
Connection.properties Property file that hold the configuration information required by FBS application.
project.xml Toplink Project file that contains the descriptor and mapping configuration for FBS application.
session.xml Toplink Session configuration file.
application.xml Deployment descriptor file used to define the FBS EAR, which contains the details of the EJB module and Web module.
orion-application.xml This file is used to configure the application server to use the data-source.xml that is part of the ear file.
data-sources.xml This file is used to define the datasource to which the application connects to.
ejb-jar.xml The deployment descriptor for EJBs in FBS application.
orion-ejb-jar.xml The container specific deployment descriptor for EJBs in FBS application. It contains the data-source details for Entity Beans and JMS mappings for MessageDriven Beans.
webservices.xml The deployment descriptor for Web Service endpoint.
mapping.xml The mappings file for Web Service endpoint.
FBSStockQuoteService.wsdl The WSDL file for the JAX-RPC StockQuote Web Service.
ejb-jar.xml The deployment descriptor for StockQuote EJB.

Setting Up the Application

Refer the Install.html for step-by-step instructions on extracting files, installing and configuring the FBS sample application.


Post your comments/feedback on this application on OTN Sample Code Discussion Forum.

 

E-mail this page
Printer View Printer View