0% found this document useful (0 votes)
127 views85 pages

Real-Time Finance Management System

The document describes a real-time finance management system (RFMS) developed by Abdul Muqtadir that allows users to manage their stock portfolio, personal finances, debts, and accounts in one online system with tools to help with various financial tasks like portfolio management, reminders, debt reduction, and expenditure analysis. RFMS fetches real-time market data from stock exchanges in XML format that is displayed to users through a Java/XML based approach using Java Server Pages.

Uploaded by

Shreyas Deshmukh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views85 pages

Real-Time Finance Management System

The document describes a real-time finance management system (RFMS) developed by Abdul Muqtadir that allows users to manage their stock portfolio, personal finances, debts, and accounts in one online system with tools to help with various financial tasks like portfolio management, reminders, debt reduction, and expenditure analysis. RFMS fetches real-time market data from stock exchanges in XML format that is displayed to users through a Java/XML based approach using Java Server Pages.

Uploaded by

Shreyas Deshmukh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 85

California State University, San Bernardino

CSUSB ScholarWorks

Theses Digitization Project John M. Pfau Library

2006

Real-time finance management system


Abdul Muqtadir

Follow this and additional works at: https://scholarworks.lib.csusb.edu/etd-project

Recommended Citation
Muqtadir, Abdul, "Real-time finance management system" (2006). Theses Digitization Project. 2992.
https://scholarworks.lib.csusb.edu/etd-project/2992

This Project is brought to you for free and open access by the John M. Pfau Library at CSUSB ScholarWorks. It has
been accepted for inclusion in Theses Digitization Project by an authorized administrator of CSUSB ScholarWorks.
For more information, please contact scholarworks@csusb.edu.
REAL-TIME FINANCE MANAGEMENT SYSTEM

A Project

Presented to the

Faculty of

California State University,

San Bernardino

In Partial Fulfillment

of the Requirements for the Degree

Master of Science

in

Computer Science

by

Abdul Muqtadir.

March 2006
REAL-TIME FINANCE MANAGEMENT SYSTEM

A Project

Presented to the

Faculty of

California State University,

San Bernardino

by

Abdul Muqtadir

March 2006

date

Dr. Richard Botting

Dr. Keith Schubert


© 2006 Abdul Muqtadir
ABSTRACT

Almost everybody earns money in this world, but very

few of them actually spend it in a wise way. There is no

doubt that managing finances will help anybody to have a

secure and safe financial future. I have attempted to-

solve this problem by creating a Real-Time Finance

Management System (RFMS) wherein users can easily manage

their finances.

RFMS will also help users to learn more about stocks.

They can create a sample portfolio of stocks and monitor

them closely to see which direction their picked stocks

are headed. Graphs have been provided in the system for

them to easily visualize and see the numbers in a clear

perspective.

Apart from stocks RFMS helps the users to manage

their finances using the different finance management

tools and calculators provided.

This is a Java/XML based approach where-in real-time

market data from different stock exchanges is fetched and

displayed for the user. This is done internally using a

data access layer. The information we get is in an XML

format, which is taken by the Java program and displayed,

using Java Server Pages.

iii
ACKNOWLEDGMENTS

First and foremost I would like to thank my parents

for putting in me the desire and the importance of

education. I also thank them for giving me the strength

and confidence that I can achieve anything in life.

During the course of my project and writing the ■

thesis there have been people who gave support both

academically and professionally. I would like to thank my

advisor Dr. Ernesto Gomez and my committee members Dr.

Botting and Dr. Schubert for giving me the education and

encouragement for my project. I would also like to thank

my friends and family for the confidence that they have

given me.

iv
TABLE OF CONTENTS

ABSTRACT .................. iii

ACKNOWLEDGMENTS ................................ iv

LIST OF FIGURES ...................... viii

CHAPTER ONE: SOFTWARE REQUIREMENTS SPECIFICATION

1.1 Introduction ............................ 1

1.2 Purpose of the Project .................. 2

1.3 Context of the Problem .................. 2

1.4 Related Work ............................ 2

1.5 Significance of the Project ............. 3

1.6 Assumptions and Limitations ............. 3

1.7 Definition of Terms ....... 4

CHAPTER TWO: SOFTWARE DESIGN

2.1 Introduction ......................... 9

2.2 Preliminary Design ....................... 9

2.3 Detailed Design ........................ 13

2.4 System Setup ............................ 17

2.5 Summary .......... 19

CHAPTER THREE: SYSTEM VALIDATION

3.1 Introduction ...... 20

3.2 Unit Test Plan .......................... 20

3.3 Integration TestPlan .................... 21

3.4 System Test Plan ............. 24

CHAPTER FOUR: MAINTENANCE

4.1 Introduction ............... . ............ 25

vi
4.2 Maintenance Guidelines ............. 25

4.2.1 Interfaces Management ............ 25

4.2.2 Administration ................... 26

4.3 Tools Utilized .......... 26

4.4 Directory Structure ..................... 26

CHAPTER FIVE: PROJECT IMPLEMENTATION

5.1 Introduction ............................ 28

5.2 System Interfaces ....................... 29

5.2.1 Login ............................ 29

5.2.2 Portfolio Management ............. 29

5.2.3 Reminder Setup ................... 33

5.2.4 Debt Reduction Planning .......... 34

5.2.5 Expenditure Analysis ............. 35

5.2.6 Account Information .............. 36

CHAPTER SIX: CONCLUSIONS AND FUTURE DIRECTIONS

6.1 Conclusions ............................. 39

6.2 Future Directions ............ ........... 40

APPENDIX: SOURCE CODE OFJAVA CLASSES ............ 42

REFERENCES ....................................... 78

vii
LIST OF FIGURES

Figure 1. AdministratorUse Case Diagram............... 11

Figure 2 . User Use Case Diagram........................ 11

Figure 3. 3-Tier Architecture Diagram ................ 13

Figure 4. Model 1 Architecture Diagram .............. 15

Figure 5 . Login Page........................... 29

Figure 6. Portfolio Management Page .................. 30

Figure 7. Get Stock Quote Page...... 31

Figure 8. Get Top Trading StockList................... 32

Figure 9. Time and Sales Report...................... 33

Figure 10. Reminder Setup Page........................34

Figure 11. Debt Reduction PlanningPage................ 35

Figure 12. Expenditure Analysis Page ....... .......... 36

Figure 13. Account Information Page.................. 37

Figure 14. Balance Check Book Page................... 3 8

viii
CHAPTER ONE

SOFTWARE REQUIREMENTS SPECIFICATION

1.1 Introduction

Almost everybody earns money in this world, but very

few of them actually spend it in a wise way. There is no

doubt that managing finances will help anybody to have a

secure and safe financial future. I have attempted to

solve this problem by creating a Real-Time finance

management system - RFMS, wherein users can easily manage

their finances.

RFMS will also help users to learn more about stocks.

They can create a sample portfolio of stocks and monitor

them closely to see which direction are their picked

stocks headed. Graphs have been provided in the system for

them to easily visualize and help them see the numbers in

a clear perspective.

Apart from stocks RFMS helps the users to manage

their finances using the different finance management

tools and calculators provided.

This is a Java/XML based approach, where real-time

market data from different stock exchanges is fetched and

displayed for the user. This is done internally using a

data access layer. The information we get is in an XML

1
format which is taken by the Java program and displayed

using Java Server Pages.

The project divides finance management into 4 general

categories. These include Portfolio Management, Reminders,

Debt Management, and Account Management. Each of these

categories has different tools to help users with their

finances.

1.2 Purpose of the Project

The purpose of the project was to develop an online

finance management system where the users can learn and

manage their stock portfolio and personal finances which

would help them have control over their investments,

personal finances or debts.

1.3 Context of the Problem

The context of the problem was to address issues of

personal finance management and problems of having to do

so from one place. Also proprietary software had to be

installed on every computer the users want to use for

managing their finances.

1.4 Related Work

There has been lot of work done in the field of

personal finance management software, but most of the work

2
is done for stand-alone systems where■the users usually

have to buy and install proprietary software on their

computer.

1.5 Significance of the Project

RFMS was developed for providing a one stop place for

dealing with.most of the problems in personal finance

management. The users.are under no obligation to use this

tool a set number of times. Based on their present

situation the users can use the different tools provided

in the system.

1.6 Assumptions and Limitations

The following assumptions and limitations were made

regarding the project:

1. To manage accounts using RFMS users need to enter

their daily transactions into the system.

2. Users have all the required data for Credit Card

Pay-Down such as Beginning Balance, Annual

Percentage Rate and the Minimum Payment amounts.

3. User should have at least a very basic knowledge

about stocks and managing portfolios.

4. The interest calculations used in the system are

either Simple Interest or I Compound Interest

Calculations.

3
*

5. J2EE - Java 2 Platform, Enterprise Edition.

Sun's Java platform for multi-tier server

oriented enterprise applications.

6. JDK - Java Development Kit, A free Sun

Microsystems product which provides the

environment required for programming in Java.

The JDK is available for variety of platforms,

such as Sun Solaris, Microsoft Windows and Linux.

7. JVM - Java Virtual Machine. It is a software

that interprets and executes the byte code in

Java class files.

8. JDBC - Java DataBase Connectivity. A programming

interface that lets Java applications access a

database via the SQl Language.

9. JSP - JavaServer Page, an extension to the Java

servlet technology from Sun Microsystems that

provides a simple programming vehicle for

displaying dynamic content on a web page.

10. JavaBean - A component architecture for the Java

programming language, developed initially by Sun,

but now available from several other vendors.

JavaBeans components are called "Beans".

11. JavaScript - A Scripting Language that is widely

supported in the web browsers and other web

5
' tools. It adds interactive functions to HTML

pages which are otherwise static.

12. XML - The Extensible Markup Language (XML) is a

W3C-recommended general-purpose markup language

for creating special-purpose markup languages. It

is a simplified subset of SGML, capable of

describing many different kinds of data. Its

primary purpose is to facilitate the sharing of

data across different systems, particularly

systems connected via.the Internet. Languages

based on XML (for example, RDF, RSS, MathML,

XHTML, SVG, and cXML) are defined in a formal

way, allowing programs to modify and validate

documents in these languages without prior

knowledge of their form.

13. JAXP - JAXP or Java API for XML Parsing is an

optional API provided by JavaSoft. It provides

basic functionality for reading, manipulating,

and generating XML documents through pure Java

APIs. It is a thin and lightweight API that

provides a standard way to seamlessly integrate

any XML-compliant parser, with a Java application.

14. JDOM - JDOM is a Java-based document object model

for XML that integrates with Document Object

6
Model (DOM) and Simple API for XML (SAX) and uses

parsers to build the document.

15.XERCES - Xerces is a set of parsers compatible

with Extensible Markup Language (XML). Xerces

parsers are available for Java and C++,

implementing World Wide Web Consortium (W3C) XML,

Document Object Model (DOM), and Simple API for

XML (SAX) standards.

16.SAX - SAX or Simple API for XML is an event-

driven, serial-access mechanism for accessing XML

documents. Provides a standardized interface for

the interaction of applications with many XML

tools. SAX uses two basic types of objects,

Parser and Document Handlers.

17.SOAP - Simple Object Access Protocol SOAP is a

lightweight protocol for exchange of information

in a decentralized, distributed environment. It

is an XML based protocol that consists of three

parts: an envelope, a set of encoding rules, and

a convention for representing remote procedure

calls and responses.

18.DOM - Document Object Model (DOM) is a form of

representation of structured documents as an

object-oriented model. DOM is the official World

7
Wide Web Consortium (W3C) standard for

representing structured documents in a platform-

and language-neutral manner. The DOM is also the

basis for a wide range of application programming

interfaces, some of which are standardized by the

W3C.

19. REST - Representational State Transfer is a model

for web services based solely on HTTP. REST takes

the view that the Web already has everything

necessary for web services, without having to add

extra specifications like SOAP and UDDI. Any item

can be made available (i.e. represented) at a

URI, and, subject to the necessary permissions,

it can be manipulated using one of the simple

operations defined within HTTP (GET to retrieve

information, PUT and POST to modify it, DELETE to

remove it).

20. RFMS - Real-Time Finance Management System. This

is the name of the directories where the .jsp

files of RFMS are stored in tomcat. The same

name has been used for the database of RFMS as

well.

8
CHAPTER TWO

SOFTWARE DESIGN

2.1 Introduction

Chapter Two consists of a discussion of the software

design. Specifically, RFMS is a JSP based system that

resides on three-tier architecture. The front-end was

based on JSP, and the back-end was a MySQL database. The

connections to the database are made through the Java

Beans with a JDBC connection.

2.2 Preliminary Design

RFMS is a system designed for users to manage their

finances using the tools provided in the system. It was

developed to overcome the following issues:

1. Getting the price for one stock at a time and

basically managing your own portfolio of stocks.

2. Using actual money to learn and play around with

stocks. This is an expensive mistake; users should have a

lot of knowledge before they get into the stock market.

3. Using different reminders systems and still

forgetting to pay bills on time.

4. Paying more interest than required in loans such

as Student Loans, Car Loans, and Mortgages.

9
5. Difficulty in analyzing information from budget

creation and maintenance.

6. Overdrawing and ruining your credit by simple

mistakes of not balancing your check book as it requires

too many calculations.

A robust, flexible and user-friendly system was

needed and RFMS was an implementation that solved most of

the issues.

Choosing the architecture was an important part.

RFMS uses the 3 tier architecture that provides the user

interfaces through the web browser. All the user

interfaces are divided based on user type. The users are

of 2 types:

• System Administrator

• User

The use case diagrams showing the individual

functions of all the users are given in the following

figures:

10
Administrator

Figure 1. Administrator Use Case Diagram

$Expenditure Analysis

lorT)
Account Information

Figure 2. User Use Case Diagram


i

i-

11
2.3 Detailed Design

Architecture: RFMS has a 3-tier architecture. A 3-

tier architecture was considered since the 2-tier

architecture combines both the presentation logic with the

business logic in one tier called the client side. The

other tier called the server provides the database.

The 3-tier architecture separates the business logic

from the presentation logic and has the database in the

third tier. This architecture is very flexible and has

high scalability.

Figure 3. 3-Tier Architecture Diagram

13
A. Client Tier: The Java enabled web browsers are

used as client tier. The user sends requests via the

browser. The browser then sends the request to the Java

Beans residing at the application server that process the

request and send it back to the browser which in turn

interprets the information it receives from the server and

displays graphically for the client.

B. Middle Tier: The middle tier is also known as the

application server. RFMS was designed to run in Jakarta

Tomcat-5.0.30 web server. Tomcat supports JSP and

JavaBeans which are the programming techniques used in the

system.

C. Database Server Tier: The database tier is the

back end application server where the data is stored.

RFMS uses MySQL version 4.0.23-nt. MySQL provides very

fast joins using an optimized one-sweep multi-join. You

can connect MySQL to Tomcat using a MySQL driver.

Programming Technique and Language: The programming

language used by RFMS was Java and its JSP technology. JSP

standard was developed by Sun Microsystems as an

alternative to Microsoft's active server, page (ASP)

technology. JSP pages are similar to ASP pages in the fact

that they are compiled on the server, rather than in a

user's Web browser.

14
However, JSP is Java-based, whereas ASP is Visual

Basic-based. JSP pages are useful for building dynamic Web

sites and accessing database information on a Web server.

Though JSP pages may have Java interspersed with HTML, all

the Java code is parsed on the server. Therefore, once the

page gets to the browser, it is only HTML. JavaScript, on

the other hand, is usually parsed by the Web browser, not

the Web server.

The other benefits of JSP that made it a choice over

other technologies are:

1. JSP separates program logic from the

presentation.

2. JSP pages have the "Write Once, Run Anywhere"

property. By virtue of their ultimate translation

to Java byte code, JSP pages are platform

15
independent. This means that JSP pages can be

, developed on any platform and deployed on any

server.

3. JSP pages also make it easy to embed reusable

components like JavaBeans that perform

specialized tasks. JavaBeans are developed once

and can be used in any number of Java Server

Pages.

4. JSP technology has become a part of the J2EE

which brings Java technology to enterprise

computing. Using JSP pages for constructing a

website, we can create a front-end component of

the type of.powerful N-tier applications made

possible by J2EE.

5. JSP has custom tag libraries that make it highly

extensible.

These numerous characteristics of JSP made it a good

choice for RFMS.

The JavaBeans used in RFMS are:

1. Stocklnfo

2 . Users

3 . UsersAdmin

4. TimeAndSales

5 . TopList

16
6. DateBean

7 . Reminder

8. DebtPlanner

9 . Expenditure

10. Accountlnfo.

2.4 System Setup

RFMS's development system involved the following

steps:

1. Installation of J2SDK 1.4.2_06. The Java 2 SDK is

a development environment for building

applications, applets, and components using the

Java programming language. The Java 2 SDK

includes tools useful for developing and testing

programs written in the Java programming language

and running on the Java platform. These tools are

designed to be used from the command line. Except

for the appletviewer, these tools do not provide

a graphical user interface.

2. Install Tomcat - Servlet/JSP container. RFMS uses

Tomcat version 5.0.30 which implements the

Servlet 2.4 and JavaServer Pages 2.0

specifications from the Java Community Process,

and includes many additional features that make

17
it a useful platform for developing and deploying

web applications and web services.

3. Install the MySQL database server: RFMS uses

MySQL version 4.0.23-nt. The MySQL (R) software

delivers a very fast, multi-threaded, multi-user,

and robust SQL (Structured Query Language)

database server. MySQL Server is intended for

mission-critical, heavy-load production systems

as well as for embedding into mass-deployed

software.

4. Install a JDBC Driver: RFMS uses MySQL

Connector/J which is a native Java driver that

converts JDBC (Java Database Connectivity) calls

into the network protocol used by the MySQL

database. It lets developers working with the

Java programming language easily build programs

and applets that interact with MySQL and connect

all corporate data, even in a heterogeneous

environment. MySQL Connector/J is a Type IV JDBC

driver and has a complete JDBC feature set that

supports the capabilities of MySQL.

5. Make changes in the server.xml and web.xml files

in the application server to establish

connectivity between tomcat and MySQL.

18
6. Test your web application.

The client can have any operating system such as

Windows 95/98/NT/2000/XP workstation, Mac OS, OS/2, UNIX,

Linux etc. The browsers that the client can use for

viewing HTML documents and using RFMS are Netscape

Navigator 3.0 or higher or Microsoft's Internet Explorer

3.x or higher.

2.5 Summary

The software design of the project was presented in

Chapter Two and it the underlying structure of the

application developed. RFMS was a 3-tier architecture

based web application that provides interfaces in HTML for

the clients. The data is retrieved from a MySQL database

through JavaBeans and sent to the browsers by JSP pages.

19
CHAPTER THREE

SYSTEM VALIDATION

3.1 Introduction

This chapter provides the procedures in which RFMS -

Real-Time Finance Management System was tested and the

results gathered from it. It was tested on Microsoft's

Internet Explorer Browser.

3.2 Unit Test Plan

RFMS - A Real-Time Finance Management System was a

web-based application that helps users manage their

finances by using the tools provided in the system. The

users can input their financial information online and

analyze it irrespective of where they are.

As part of the Unit Test Plan, RFMS was tested based

on the user types since each user has its own set of

interfaces. All the interfaces are web based and

available through the browser.

As part of the unit test plan these steps were taken

and results found:

1. All the hyperlinks available in each set of

interfaces of RFMS were checked, irrespective of

the content that they provide. It was found that

all of them do work.

20
2. User data input was given to check if the

presentation logic worked. The presentation

logic was implemented in JavaScript, which checks

if the input taken from the users was valid. The

display was in HTML. The Interfaces of RFSM that

required user input successfully validated it.

3. There are error pages that display the errors

based on the functionality.

4. JavaScript displays the errors in the input of

entries in alert boxes.

5. The basic rules of web based applications of

readability and presentation for each set of

Interfaces was verified. The data and content was

readable and displayed in a user-friendly manner.

3.3 Integration Test Plan

As part of the Integration Test Plan, RFMS was tested

for functionality based on its user-type. The users have

their own interfaces and after being tested as single

units and their presentation they were tested based on

functionality.

The functions of each user are as follows:

A. Systems Administrator:

• Create user account

21
• Edit user account

• Delete user account

• View User Information

B. User

• Manage Portfolio

• Setup Reminders

• Debt Reduction Planning

• Account Information

Every set of functions is available on the left hand

side of the browser as a menu.

The following tests were performed and results

obtained:

1. RFMS's user interfaces were tested now for

content across each page depending on the

functionality.

2. Every function of each user was tested.

3. A user was created as part of the administrator

pages. After the information was entered the

functions of edition, deleting and final viewing

of all information was done. ■ RFMS's Systems

Administrator pages tests passed successfully.

22
4. The user functionality was tested for bugs and

limitations. Each function was checked for

content and right response.

5. Certain limitations were found which have been

documented and the bugs were fixed.

6. The portfolio management section was checked if

it was able to get data over the internet from

the inetat website. This passed successful.

7. The Reminder section was thoroughly tested to see

if it was able to send outgoing email at the

exact specified time, it was able to do it

without any problem.

8. The different tools in the debt reduction

planning were checked to see if all the formulas

used in there were correct. The system was able

to perform these tasks even with wrong input

values.

9. The account information page was checked to see

if the balance check book tool matches a real

balance book.

23
3.4 System Test Plan

As part of the System Test Plan, the following tests

were performed:

1. The JSP server and the MySQL server were started

and the system start page was opened in the

browser successfully.

2. Tested to see that unauthorized users cannot view

pages. They cannot get past the login page.

3. Tested to see if XML queries are being processed

properly, they were being processed as expected.

4. Tested to see if reminder email system was able

to send out emails and found that it doing it

without any problems.

5. The graphs for the expenditure analysis page

needs data for two months to be able to display

the comparison, it gives an error message if data

for at least two months is not available.

6. Balance check book sections was tested to see if

users modified an earlier entry then the system

should be able to recalculate all the entries

again. The test was passed.

24
CHAPTER FOUR

MAINTENANCE

4.1 Introduction

This chapter provides the measures that need to be

taken to maintain RFMS - A Real-Time Finance Management

System. Maintenance needs to be done if:

1. Issues arise on the front-end of the application

or the back-end programming.

2. Issues with the tools utilized for development.

3. Issues with the directory structure of the

application.

4.2 Maintenance Guidelines

These guidelines aim at providing the information for

maintenance issues that might arise depending on the user-

type and the front end of the application as well as

depending on the programming and servers at the backend of

the application.

4.2.1 Interfaces Management

The programming has been done in JSP and Java and

RFMS has been tested for all the functionality. But if

issues arise then the Webmaster will have to know Java,

JSP, JavaScript, XML and MySql to troubleshoot problems in

the business logic of the application.

25
4.2.2 Administration

A Systems Administrator/webmaster is needed to

create, edit or delete accounts.

4.3 Tools Utilized

RFMS was developed using the following tools:

1. Tomcat Web Server

2. MySql Database Server

3. Java 2 Standard Development Kit

4. JDBC Driver

5. Macromedia Dreamweaver

4.4 Directory Structure

RFMS used Apache's Jakarta Tomcat server as the

JSP/Servlet container. The web application was developed

in the "webapps" sub-directory of the Jakarta Tomcat main

directory. It was stored in a directory under "webapps"

called "rfms".

The files present at each directory level:

rfms directory

All the . jsp and .html files are saved here. The

naming convention followed can be explained by an example

of a create user admin page:

1. Presentation page: createUser.jsp.

26
2. JavaScript Code for user-input validation:

createUserCheck.jsp.

3 . JSP servlet page for communication with the

JavaBeans that insert the data:

createUserInsert.jsp.

The common files used by all the users are placed directly

under "rfms", but all the other pages are placed in sub­

directories based on their user-type first and then their

functionality. The sub-directories under "rfms" are:

1. admin - The administrator pages.

2. portfolio - The stock management pages.

3. reminder - The email reminder pages.

4. debt - The debt reduction planning pages.

5. expenditure - The expenditure analysis pages.

6. accountlnfo - The account information pages.

4. web-inf - This directory has the .java files

stored in it and the respective .class files are

stored in another sub-directory package in it

called rfms_modules.

27
CHAPTER FIVE

PROJECT IMPLEMENTATION

5.1 Introduction

This chapter provides details about the

implementation of the project by describing some of the

interfaces used in the project. The RFMS's front-end was

tried to be made as user-friendly as possible. JavaScript

was used on the client side to check for the validity of

user's input. Error messages were reported appropriately

wherever it was needed.

The Real-Time Finance Management System - RFMS was

developed to help users control and plan their finances.

Various aspects of finance are considered in the project.

These include:

1. Portfolio Management

2. Reminder Setup

3. Debt Reduction Planning

4. Expenditure Analysis

5. Account Information

Apart from these pages there was a system login process

which was required to authenticate users.

28
5.2 System Interfaces

5.2.1 Login

The login process authenticates users based on the

username and password provided by them.

s LgBal ^ime Hhahce.MahageniEnl System.-Mk:rpsDtrih1er;net-,Exp!orer $ •* & % » **

■File Edit View Favorites Tools Help. _ i _■ v

©Back ’ © ’ @ @ $*1 ^Sear* Favorite! G '

Address |^~http://localhost:8080/rfms/lndax.jsp ' gr|‘S%60 ;


Real-'Rme Finance ’Management System

Please Login to view your account

Figure 5. Login Page

5.2.2 Portfolio Management

This section had three tools present in it:

1. Get Quote

2 . Get Top Trading List

3 . Get Time and Sales Report for a Stock

29
t.?»Regl-Tirne4FinBhceiManagernenl.System -Microsoft Interjie^Expbreri . j,
L®'
File Edit View . Favorftes Tools Help - ", _ ...

©Bad, - © ’ 0 [g (gj ! /^Search ^Favorites 0’ f§i’ ’

; Address ktp://localhost:8080/rfms/portfolio/index.Kml “BJ-Sgo-


• .................. :.......................................................................................... s

I
Real-Time Finance Management System

'Portfolio
\ Management s
Get Quote
Reminders

Debt Planning

Expenditures Top Trading Shares List


* Account . No. ofRecords.
, Information

Time and Sales


Enter Symbol:

Choose # ofRecords:

(4£)Done -X ■ i- i ii-1 D^locailntranet a.


a

Figure 6. Portfolio Management Page

The three tools provided in this section gets updated

Real-Time Market information when the markets are open.

30
^ReabTiipe Fmance.ManagEnientSystem • Portfolio Manage(Ticnl- Microsoft Ihternet Explore# as

File Edit View Favorites Tools Help SS


•W® I P^ ®
Addrew kg] tttp://bcahost:6080/ffms/portfo&o/getQiJote.js

Real-Time Finance Management System

Portfolio Get Quote: ■■■■Eg


Management
Hero is the quote that you requested for: GOOG
Reminders

Figure 7. Get Stock Quote Page

The get quote section retrieves a quote and market

information based on the symbol provided by the user.

31
siSReaJ-Time Finance Manaecmenl Systenv-.Rqrlfolio Management - Microsoft Internet Explores a

Hie:-Edit View Favorftes Tods Help

I Back - © - 3 gj £$| yO Search '^FavcltM 0 ®-

Addross j^J http://locaIhost:6080/rfms/portfolto/getTopLi$t.jsp

Get Quote: |

Top 20 List
RANK SYMBOL MARKET TIME “ MATCHED SHARES

1 QQQQ Nlvl 39.2240 14,58.22.784-05:00 33836924


Home ‘ 28370925
2 3UNYV NM 3;6910 14*5828:377-05:00

Portfolio 3 SYMC NM 19J500 14.5828,819-05:00 24254904


Management SPY AM' 12J.2400 14:5824533-05:00 22177769
4

5 MSFT NM 264000 1458.28:222-05:00 20502333


Reminders
6 S1RI NM 6,8760 14 5829.185-05:00 19976370
Debt Planning 7 JDSU .............. NM 22010 14.5829320-05:00 16289272

Expenditures
5 8 csco NM ' 17J800 14-58-25.27S-05-O0 15000740 ................. *

9 INTO NM 23 1300 145821.872-05:00 14174479

1 io ORCL NM 12.5000 1458-18.488-05:00 • . . 10592451

11' AMAT NM 16.3300 14:58:11270-05:00 8391704

t 12 DELL NM 29,0300 ~ ~~ 14-58:25,67.05X10 8069563

13 AAPL NM 59,7000 14.58:29.681-05:00 * 7985171


e
:14 MERQE. 245000 14:58:26.926-05:00 6894778

j 15 IWM AM 650400 14*58:22.888-05:00 61602171


| 16 10.4300 145823.733-05:00 4999812 ' - - '
SEBL NM
! 17 QCOM NM' 40.1700 1458.23567-05:00 4863533
j :18 * 1458:.15J6..0500 ’ 4765056
GNxrr NM 2.1200
1 1? CMCSA NM 28.5100 1458:27,944-0500 “ ~ 4734616:

} 20 „ SMH AM 34,1300 1458,20.648.0500 4631600

Si] Done - ’ , , . ’ - - I' ’ll C ] I! *y local intranet

Figure 8. Get Top Trading Stock List

This page gets the top 20 trading list by default. If

needed, we can ask the system to get up to 500 top trading

stocks at that time.

32
MReal-Time Finance, Wanagemenl System r Portfolio'Management- Microsoft InlernetExplor.cr,
Fite Edit View Favorites Tools Help , - J
©8«ck -©'00 /Jsearch "^Favorites ^3)1 fg- & w -

Ha
Address litSl htto://kxabost:80e0/rfm5/DortfoEo/oetTimeAndSales.lsp Go

■X
■“
Get Quale: HH|H jjgj!
i » ■

Time and Sales


H>etet25 Sales tor GOOG

ft
MATCHED
PRICE ,
f TTKTr
-miE . u
MATCH
nTE
*
I
REFERENCE
NUMBER
1
|
1
SHARES

14:59:56398-05:00 ■ B J 2121616
t. .100 378.2500

2. -308 378,1300 14:59:55359-0^00 . S i 2121521

3, .34 378 1300 ‘ i4.59t55.l85-05fl0 ' S , 2121512


Hothc
4, 66 378.1300 14 59-55,143-05:00 S 2121511
Portfolio 1 2120705
■5. 100 378.1600 14'59:524 53-05X0 S
Management ■ i439t5j.7i^bj:KI ’ B
' '378.24150 ' } ' " ’ 2120668
100

Reminders 7. 350 ' 378.1200 1459:50,?69-05;0Q ’ S » 2120599


H. 50 378 1200 1459^0,439x05X0 ’ ’ S I 2120351
8,
Debt Plannina
100 373.1900 1*439:49353-05^0 ‘ 3 '[ 2120162
‘ 9,
10, ' 378.2900 } j 14’59‘49 332-05-00 S. } 2120082 . i
Expenditures s400

11. 198 378.3100 14:59:48.753-05X0 S I 2120021


”Account"
Information 12. 100 ■378,3400 14,59:46;507-05XO S t 2119776
F
Fxnen'sfi Planner
13.' ' Jtti 3783500 1459:46,478-05X0 S
i -
2119772
'' 21

14,. 2 3783500 14,59:46.475-05X0 * S

ii ' ' >50 1459;46.^9.65:CO ' B f 2119764


Dills & Dues 3783600

10' 378.2500 1459i45,£33-05;00 S 1 2119716


16.
1459144,724-05:00 S I ' - ^119525 |
17. 100 ■3783300

t i ( f i CJ Local Intranet
Dons ■'

Figure 9. Time and Sales Report

This page gets the last 25 matched deals for a

particular stock. Again, 25 is just the default the

maximum number of matched deals it can retrieve in one

call is 100.

5.2.3 Reminder Setup

This section consists of setting up reminders for

oneself. The system sends out an email at the particular

day the reminder is set up to.

33
/iRcahTimft Finance Managemenl'f yslem * yicrp.soft‘Inicrnel Explorer ’ -7— —.... ggg
£
File ' Edit Wew •Favorites Tools Help - c-
©^ ' © 0 ® © :9SM'ch dd0™*'5 ® j I1 ’ ■

•Addrtts4^Ihttp://loca!hosti8080/rfms/reminders/index.htfri : Kl'S 50

Real-Time Finance Management System

’ REMINDERS
Portfolio « . .. ..
Management Setup Wew Reminders

Figure 10. Reminder Setup Page

Here the users were able to set reminders for

themselves. The system used to allow them to set up to two

reminders for each event.

5.2.4 Debt Reduction Planning

This sections a loan calculator to figure out the

details of any loan. You could get information like how

much interest will you pay over the term of the loan or

how much will your loan payments per month will be.

34
70®)®
, ReaUTime Finance Manafiemen^S>5lemi+Micrgsofl Irilernct Explorer

F8e Edit View Favorkes Tools Help - 1 SB

@ Back - © - 0 g] 'JDseatch -^Favorites @ | fg- U ’

; Address http://localhost:&]80/rfms/debt/index.btm ]

Real-Time Finance Management System

- DEBT REDUCTION PLANNING


Porifblib 5 There are different tools provided in this section for you to Calculate and see if-you can reduce the interest you pay on your loans
Management, °

Loan Calculator
Reminders'

Figure 11. Debt Reduction Planning Page

Just by entering a few details such as loan amount,

the term and the interest rate users could get valuable

information such as the monthly payments and the total

interest they will be paying over the life of the loan.

5.2.5 Expenditure Analysis

This is the section where the users enter their

monthly expenses every month and then they can use this

information to see graphs and charts on their expenses so

that they can better analyze their budget for the upcoming

months.

35
s RcahTime Finance Management System - Microsoft Internet Explorer

F3o EdS View Favorites Tods Hefc SB


C^8ack
' © ' 0 @ Ui j ,Ps”’th Favorites 0'0’ L'1 '
Addresshttp;/J]ocalhort;8080ytfms/expen(]itures/lndax.html ]0e>
IS
Real-Time Finance Management System

EXPENDITURE ANALYSIS
Portfolio
Management Entering budget informationTor each month Will help you analyze yoiir spending

Enter your Expenditures

1. Housing (Mortgage/Reht)

2. Utilities (7/ater, Gas, Electric, etc.

4, Auto Insurance.

5. Credit Gard Payments

6, Miscellaneous

Enter your total monthly income from all sources

Figure 12. Expenditure Analysis Page

Here the users enter their monthly expenses based on

the categories provided. The users also had the ability to

add new categories that are specific to them.

5.2.6 Account Information

This section has a balance check book tool. This

facilitates the users to balance their check book from

anywhere. Calculations are done for the user by the

system. All the user has to do is to enter the

transactions.

36
^iRcal-^irnc:Finahco.ManagemcnTSystem - Microsoft Internet Explorer I “

Fite
©esck ’
Edit View
© ’
Favorites
hl
Tools
1*3 © j
Help..- ? j,
'h*’’""*”
, ®
■© i IV ’
«.
• i .®L

Address t4tp://localhost:80eo/rftns/account/ridex.htmi Ba«

Real-Time Finance Management System

Home
ACCOUNT INFORMATION
Portfolio
Management „ Here you can find the: tool to balance your check book,,

Reminders BALANCE CHECK BOOK

Debt Planning
Enter your beginning balance,
Expenditures
|| , EHTfiR TRANSACTION ||
Account
Information Descnphon oEtheTransactiori:

Transaction Type:
Transaction D ate: 1

Amount: IjHHHHHBB
Y... :... —-am.-. ........... 11

® ■ , ! ' I -Y local intranet a-, ,.o-


3HS8IP81Finance Ma f'Ife”’jS0Cf

Figure 13. Account Information Page

This is the page where the users enter their

transactions. Based on the transaction type the system

determines if it was a debit/credit transaction and

calculations are done on that basis.

37
'.i Real-'flnic^hanco ManagcniBnUSysteniLMicrosofJ'Internet Explorer-

File Edit View Favorites Tools’ Help ■ < • •


.-.3F
©Bock - @ ' 00 tJlJ | 9a“‘h 'i^’ra™rte! I Si

Address http://tocahost:0Oao/rfms/account/vtew8abnceBook.Jsp

Real-Time Finance Management System.

ACCOUNT INFORMATION
Portfolio
Management Balance Check Book Details

Account
Information

■4Bcg»-. Local intranet /

sSJIN J’PWItasFiniTOMi..'.' fjl

Figure 14. Balance Check Book Page

This page displays the users balance book. It also

gives the ability to edit a previous transaction or to

enter new transactions.

38
CHAPTER SIX

CONCLUSIONS AND FUTURE DIRECTIONS

6.1 Conclusions

RFMS - A Real-Time Finance Management System was a

personal finance management system which provides real­

time market data from stock exchanges. When the stock

exchange is open the data is delayed by less than 15

minutes. Users can use RFMS to learn more about stocks in

general and learn to trade by using virtual money.

RFMS also provides users with other tools such as

reminder system which sends email to remind you about

events, a few loan calculators, a budgeting system that

graphs the user's expenses and a balance check book tool.

Passing XML data over HTTP is the latest in EDI

(Electronic Data Interchange) standards. Java Combined

with XML provides developers with powerful tools to

develop internet based applications.

The real-time stock data is retrieved using REST

architecture. REST - Representational State Transfer is a

model for web services based solely on HTTP. REST takes

the view that the Web already has everything necessary for

web services, without having to add extra specifications

like SOAP and UDDI. RFMS used Java and XML to get this

39
data using REST architecture. Part of this data was stored

in a database. MySql database was used to store

information on user's calculations so that they don't have

to enter it the next time they use the system.

6.2 Future Directions

Personal Software Management Software is used by

almost everyone these days to keep track of their

finances. A typical person could have multiple bank

accounts, multiple credit cards, a few investment

accounts, and lots of bills. So this field is here to stay

and many more tools will be required by people in the

future.

In future not only stock information but also bank,

credit card and bills information can be transferred over

the internet using the REST architecture. This will help

users to transport their data from one system to another

without any problems.

Technology usage wise, Servlets or Java Struts were

not used in RFMS, but if the application is expanded to

include more tools then using those would benefit a lot.

Also trying to utilize XML to the fullest will make

development and/or maintenance easy to manage.

40
Tools: the more the better. There is no limit on the

number of different tools that could be provided for the

users. Dealing with variable loans, mortgages and creating

amortization tables for those will help users see what

part of their money is actually going towards the

principal.

Taxes: One more limitless field. Tools could be

provided which keeps track of user's expenses and at the

end of the year prepares a statement for the user which

would help the users file their taxes.

Finally and once again, use XML to send data back and

forth between applications. Using XML cannot be stressed

enough; XML makes the task of transferring data from one

application to another a breeze.

41
APPENDIX

SOURCE CODE OF JAVA CLASSES

42
Here is the source code from some of the files used in Real-Time Finance
Management System.

database.java

//java document
package rfms_modules;
import j ava. sql. *;
public class database
{
private static String url="jdbc:mysql://localhost/rfms";
private static String driver="com.mysql.jdbc.Driver";
private static String user="mac";
private static String password="rfms";

public static Connection getConnectionO throws Exception


{
Class.forName(driver) .newInstanceO;
//System.out.printlnC'driver Loaded");
Connection connection = DriverManager.getConnection(url,user,password);
//System.out.println("connection established");
return connection;
}
}

43
DateBean.java

// Java Document
package rfms_modules;

import java.io.*;
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
import java.util.*;

public class DateBean {

public static void main(String[] args) {


//System.out.println(getSingleQuote("MSFT")):
}
public static Date getDateOl
retum(new java.util.DateO):
}
public static String getSingleQuote(String symbol) {
String name =
return (name):
1
}

44
Stocklnfo.java

// Java Document for qoute.xml


package rfms_modules;

import java.io.*;
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
import java.util.*;
import org.apache.xerces.parsers. *;

public class Stocklnfo {

public static String marketSession = "";


public static String matchedShares =
public static String matchPrice =
public static String matchTime=

public StocklnfoO {
marketSession =
matchedShares =
matchPrice = "";
matchTime=
1

public static String getMarketSessionO {


return marketSession;
1
public static String getMatchedSharesO {
return matchedShares;
1
public static String getMatchPriceO {
return matchPrice;
1

45
public static String getMatchTimeO {
return matchTime;
}

public static void setMarketSession(String ms) {


marketSession = ms;
}
public static void setMatchedShares(String ms2) {
matchedShares = ms2;
}
public static void setMatchPrice(String mp) {
matchPrice=mp;
}
public static void setMatchTime(String mt) {
matchTime = mt;
}

public static void main(String[] args) {


System.out.printin(getSingleQuote("ORCL"));
System. out.println(""+getMatchPriceO);
System.out.println("Date: "+getDate());
}

public static Date getDate(){


retum(new java.util.DateO);
}

public static String getSingleQuote(String symbol) {


String name = "asdfl111";

try {
String x =
"http://xml.island.com/ws/xml/quote.xml?token=TXHE3PCsMdCGBWd7&sy
mbol="+symbol;
Document d = new SAXBuilderQ.build(x);

46
Element e = new ElementfislandData");
List children = d.getRootElementO.getChildrenO;
//for (Iterator i=children.iterator();i.hasNextO;) {
for (int i=0, size=children.sizeO; i<size;i++) {
//Object child = i.nextO;
Element child = (Element)children.get(i);
/* if (child instanceof Element){
//name +=child.toStringO;
Element e2 = (Element) child;
name += e2.getNameO;
1
*/
name +=child.getNameO;
name +="<br>";
1
Element temp = d.getRootElement().getChild("stock").getChild("matched");
setMarketSession(temp. getAttributefmarketSession")
.getValueO);
setMatchedShares(temp.getChild("matchedShares")
.getValueO);
setMatchPrice(temp.getChild("lastMatch")
. getChildC'matchPrice"). getValueO);
setMatchTime(temp.getChild("lastMatch")
.getChild("matchTime") .getValueO):
1
catch (Exception e) {
e.printStackTraceO;
retumCThere was a exception"+e);
1
return (name);
1
}
TimeAndSales.java

47
// Java Document for timeandsales.xml
package rfms_modules;

import j ava. io. *;


import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
import j ava. util. *;
import org. apache .xerces. parsers. * ;

public class TimeAndSales {

public static void main(String[] args) {


Document dl = buildDocument("MSFT',2O);
/ / displayTopList(d 1);
} // end main

public static Date getDateO {


retum(new java.util.DateO);
} // end getDate

public static Document buildDocument(String symbol, int recNumb) {

if (!(recNumb>0)) { recNumb = 20; }


try {
String timeAndSales =
"http://xml.island.com/ws/xml/timeandsales.xml?token=TXHE3PCsMdCGB
Wd7&symbol="+symbol+"&recNumb="+recNumb;
Document doc = new SAXBuilderO.build(timeAndSales);
return (doc);
}
catch (Exception e) {
e.printStackTraceO;

48
String str = "There was an exception"+e;
Element error = new Element("ERROR");
error. addContent(str);
Document d = new Document(error);
retum(d);
}
} // end builDocument
} // end class TimeAndSales

49
TopList.java

// Java Document for toplist.xml


package rfms_modules;

import java.io.*;
import org.jdom.*;
import org.j dom. input.*;
import org.jdom.output.*;
import java.util.*;
import org.apache.xerces.parsers.*;

public class TopList {

//this is for test purposes only


public static void main(String[] args) {
Document dl = buildDocument(20);
displayTopList(d 1);
} // end main

public static Date getDateO {


retum(newjava.util.DateO);
} // end getDate

public static Document buildDocument(int recNumb) {

if (recNumb==O) { recNumb = 20; }


try {
String topListUrl =
"http://xml.island.com/ws/xml/toplist.xml?token=TXHE3PCsMdCGBWd7&r
ecNumb="+recNumb;
Document doc = new SAXBuilderO.build(topListUrl);
return (doc);
}

50
catch (Exception e) {e.printStackTraceO:
String str = "There was an exception"+e;
Element error = new Element("ERROR");
error. addContent(str);
Document d = new Document(error);
retum(d);
}
} // end builDocument

public static void displayTopList(Document d) {


System. out.println(" \n\n\n\n\n");
//System. out.println(d.getRootElementO);
Element stockList = d.getRootElement0.getChild("stockList");
List stocks = stockList. getChildrenO;
for (int i=0, size=stocks.sizeO; i<size;i++) {
Element stock = (Element)stocks.get(i);
System.out.print(stock.getAttribute("rank") .getValueO);
System.out.println(stock.getAttribute(" symbol") .getValueO):
System.out.println(stock.getChild("market") .getValueO):
System.out.println(stock.getChild("booked").getChild("bookedShares").getValu
eO):

} // end displayTopList
} // end class TopList

51
loginVerify.jsp

<%@ page contentType="text/html; charset=iso-8859-l" language="java"


import="java.sql.*" errorPage="" %>
<%@ page import="rfms_modules.*"%>
<%@ page session="true"%>
<%
String username = request. getParameter ("username");
String password = request.getParameter("password");
boolean foundRecord = false;
boolean matched = false;

Connection con = database.getConnectionO;


Statement st = con.createStatementO;
ResultSet rs = st.executeQueryC'select password,role from user where
usemame=1 "+usemame+""');

foundRecord = rs.firstO;

if (password.equals(rs.getString("password"))) {
matched = true;
} else {
matched = false;
}

if (foundRecord&&matched) {

session. setAttribute("usemame", username);


if (rs.getString("role").equals("admin'j) {
response. sendRedirect("admin .j sp");
}
else {
response. sendRedirect("user.j sp");
}

52
}
else {

response. sendRedireet("index.jsp?login=0");
}
1
catch(SQLException e){
response. sendRedirect("index.j sp?login=0");
}

%>

53
getTopList.jsp

<%@ page import="rfms_modules.*"%>


<%@ page import= "org.jdom.*, org.jdom.input.*, org.apache.xerces.parsers.*,
j ava.sql. * ,java.util.List"%>
<%@ page language="java" contentType="text/html"%>
<%@ page autoFlush = "true"%>
<%@ page session = "false"%>
<jsp;useBean id="tl" scope="page" class="rfms_modules.TopList"/>

<html>
<head>
<title>Real-Time Finance Management System - Portfolio Management</title>
cmeta http-equiv="Content-Type" content="text/html; charset=iso-8859-l">
</head>

<body vLink=#ffe4ca aLink=#ffffff link=#ffffff


background=". ./images/bluebground.gif' text="#FFFFFF">
<TABLE width=500 border=0 align="center" cellPadding=O cellSpacing=O>
<TBODY>
<TR>
<TD height="74" align=middle vAlign=center> <div align="center"xfont
color="#0066FF" size="4" face="Georgia, Times New Roman, Times,
serif'xstrongxemxfont color="#FFCCFF">Real-Time
Finance Management System</fontxbr>
</emx/strongx/font>
<hr width="400" color="#FFOOOO">
<font color="#0066FF" size="4" face="Georgia, Times New Roman,
Times, serif'xstrongxem>
</emx/strongx/fontx/divx/TD>
</TR>
</TBODY>
</TABLE>
<br>

54
ctable align="center" width="100%">
<tr>

ctd width="14%">
ctable align="left" cellpadding="8" cellspaclng="2" width="100%">
<tr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont size="-l"
face="Arial, Helvetica, sans-serif'xa
href="../index.html">Home</ax/fontx/strongx/fontx/divx/td>
</tr>
<tr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont size="-l"
face="Arial, Helvetica, sans-serif >Portfoliocbr>
Managementc/fontx/strongx/fontx/divx/td>
c/tr>
ctr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont size="-l"
face="Arial, Helvetica, sans-serif 'xa
href="reminders/index.html">Remindersc/ax/fontx/strongx/fontx/div>
c/td>
c/tr>
ctr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont size="-l"
face="Arial, Helvetica, sans-serif'xa href="debt/index.html">Debt
Planningc/ax/fontx/strongx/fontx/divx/td>
c/tr>
ctr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont size="-l"
face="Arial, Helvetica, sans-serif >ca
href="expenditures/index.html">Expendituresc/ax/fontx/strongx/fontx
/divx/td>
c/tr>
ctr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont size="-l"
face="Arial, Helvetica, sans-serif xa href="account/index.html">Account

55
Information</ax/font></strong></font></div></td>
</tr>
<tr>
<td>
<p>&nbsp;</p>
</td>
</tr>
</table>

<p>&nbsp;</px/td>
ctd width="86%"xtable width='TOO°/o"xtrxtd>
<p align="center">
<form name="forml" method="post" action="getQuote.jsp">
<p align="right"xfont color="#FFFFFF"xstrongxfont size="-l">Get
Quote: </fontx/strongx/font> <font size="-l">
<input name="stockName" type="text" id="stockName" size="10">
cinput type="submit" name="Submit" value="GO">
</font> </p>
</form>
<div align="center">
<pxstrongxfont color="#FF6666" size="6">Top
<%out.print("
out.print(request.getParameter("recNumb"));
out.print(" ");%>
List</fontx/strongx/p>
ctable width="100%" border="2" align="center" cellpadding="2"
cellspacing="2">
<tr>
ctdxdiv allgn="center"xstrongxfont size="-l"> RANK</font>
</strongx/divx/td>
ctdxdiv align="center"xstrongxfont size="-l">
SYMBOLc/fontx/strongx/divx/td>
ctdxdiv align="center"xstrongxfont size="-l">
MARKETc / fontx/strongx/divx/td>

56
ctdxdiv align="center">cstrong>cfont size="-l">
PRICEc/font>c/strong>c/div>c/td>
ctdxdiv align="center"xstrongxfont size="-l">
TIME</fontx/strongx/divx/td>
ctdxdiv align="center"xstrongxfont size="-l">MATCHED SHARES
c/fontx/strongx/divx/td>
c/tr>
c%
Document d = tl.buildDocument(Integer.parseInt(request.getParameter("recNumb")));
Element root = d.getRootElementO;
Element stockList = root.getChild("stockList");
List stocks = stockList. getChildrenO:
for (inti=O, size=stocks.sizeO; icsize;i++) {
Element stock = (Element)stocks.get(i); %>
ctr>
ctdxdiv align="center"xfont size="-l">
c%out.print(stock.getAttribute("rank").getValueO);%x/fontx/divx/td>
ctdxdiv align="center"xfont size="-l">
c%out.print(stock.getAttribute("syrnbol").getValueO);%x/fontx/divx/td>
ctdxdiv align="center"xfont size="-
l"x%out.print(stock.getChild("market").getValueO);%x/fontx/divx/td>
ctdxdiv align="center"xfont size="-
l">c%out.print(stock.getChild("matched").getChild("lastMatch").getChild("mat
chPrice").getValue());%x/fontx/divx/td>
ctdxdiv align="center"xfont size="-
1 ">c%out.print(stock.getChild("matched") .getChild("lastMatch") .getChild("mat
chTime") .getValueO) ;%x/fontx/divx/td>
ctdxdiv align="center"xfont size="-l">
c°/oout.print(stock.getChild("matched") .getChild("matchedShares") .getValueO);
%x/fontx/divx/td>

c/tr>
c%
}
%>
c/table>

57
<p>&nbsp;</p>
</div>
<p align="center"x/form> </p>
<p align="center">&nbsp;</p>
</td>
</trx/table>
</tdx/tr>
</table>

</body>
</html>

// end getTopList.java

getQuote.jsp

<%@ page import="rfms_modules.*"%>


<%@ page import="org.jdom.input.*"%>
<%@ page import="java.sql.*"%>
<%@ page language="java" contentiype="text/html"%>
<%@ page autoFlush = "true"%>
<%@ page session = "false"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


<html>
<head>
<title>Real-Time Finance Management System - Portfolio Management</title>
cmeta http-equiv="Content-Type" content="text/html; charset=iso-8859-l">
</head>

cbody vLink=#ffe4ca aLink=#ffffff link=#ffffff


background^'.. /images/bluebground.gif'>
<TABLE width=500 border=0 align="center" cellPadding=0 cellSpacing=0>
<TBODY>
<TR>

58
<TD height="74" align=middle vAlign=center> <dlv align="center"xfont
color="#0066FF" size="4" face="Georgia, Times New Roman, Times,
serif'xstrongxemxfont color="#FFCCFF">Real-Time
Finance Management System</fontxbr>
</emx/strongx/font>
chr width="400" color="#FFOOOO">
<font color="#0066FF" size="4" face="Georgia, Times New Roman, Times,
serif'xstrongxem>
c/emx/strongx/fontx/divx/TD>
</TR>
</TBODY>
c/TABLE>
<br>
<table align="center" width="100%">
<tr>

ctd width="14%">
<table align="left" cellpadding="8" cellspacing="2" width="100%">
<tr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont size="-l"
face="Arial, Helvetica, sans-serif'xa
href="../index.html">Home</ax/fontx/strongx/fontx/divx/td>
</tr>
<tr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont size="-l"
face="Arial, Helvetica, sans-serif’>Portfoliocbr>
Management</fontx/strongx/fontx/divx/td>
</tr>
<tr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont size="-l"
face="Arial, Helvetica, sans-serif 'xa
href="reminders/index.html">Remindersc/ax/fontx/strongx/fontx/divx/td>
c/tr>
ctr>

59
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont size="-l"
face="Arial, Helvetica, sans-serif'xa href="debt/index.htxnl">Debt
Planning</ax/fontx/strongx/fontx/divx/td>
</tr>
<tr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont size="-l"
face="Arial, Helvetica, sans-serif'xa
href="expenditures/index.html">Expenditures</ax/fontx/strongx/fontx/divx/
td>
</tr>
<tr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont size="-l"
face="Arial, Helvetica, sans-serif'xa href="account/index.html">Account
Informationc/ax/fontx/strongx/fontx/divx/td>
c/tr>
c/table>

cp>&nbsp;c/p>
cp>&nbsp;c/p>
cp>&nbsp;c/p>
cp>&nbsp;c/p>
cp>&nbsp;c/p>
cp>&nbsp;c/p>
cp>&nbsp;c/p>
cp>&nbsp;c/p>
cp>&nbsp;c/p>
cp>&nbsp;c/p>
cp>&nbsp;c/px/td>
ctd width="86%"xtable width="100%"xtrxtd>
cp align="center">
cform name="forml" method="post" action="getQuote.jsp">
cp align="center"xfont color="#FFFFFF"xstrong>Get Quote:
c/strongx/font>
cinput name="stockName" type="text" id="stockName" size="10">
cinput type="submit" name="Submit" value="GO">

60
</p>
</form> <p align="center"xfont color="#FFFFFF">cstrong>Here is the
quote that you requested for:
<% out.print(request.getParameter("stockName"));%>
</strongx/fontx/p>
<p align="center"xfont color="#FFFFFF">
<jsp:useBean id="date" class="DateBean">
</jsp:useBean>
<jsp:useBean id="si" class="StockInfo">
</jsp:useBean>
</font> </p>
<p align="center"xfont color="#FFFFFF">
<%
//Stocklnfo si = new StocklnfoO;
String stockQuote =
si.getSingleQuote(request.getParameter("stockName")):
//out.println("My Name is Muku'j;
/ /out.println(stockQuote);
//out.println("cbr>");
//out.println(date.getDateO);
%>
</fontx/code> </p>
<div align="center">
ctable width="50%" border="2" align="center" cellpadding="2"
cellspacing="2">
ctr>
ctd colspan="2"xdiv align="center">
ch2> cfont color="#66FFFF" face="Georgia, Times New Roman, Times,
serif’>
c%out.print(request.getParameter("stockName"));%>
c/fontx/h2>
c/divx/td>
c/tr>
ctr>

61
<td colspan="2"xdiv align="center"xfont color="#66FFFF"
face="Georgia, Times New Roman, Times, serif>
<%out.print(date.getDate()) ;%>
</fontx/div>
<div align="center"x/divx/td>
c/tr>
<tr>
<tdxdiv align="center"xfont color="#66FFFF" face="Georgia, Times New
Roman, Times, serif'>Market
Session </fontx/divx/td>
<tdxdiv align="center"xfont color="#66FFFF">
<%out.print(si.getMarketSession()); %>
</fontx/divx/td>
</tr>
<tr>
ctdxdiv align="center"xfont color="#66FFFF">Match
Price:</fontx/divx/td>
ctdxdiv align="center"xfont color="#66FFFF">
<%out.print(""+si.getMatchPriceO);%>
</fontx/divx/td>
</tr>
<tr>
ctdxdiv align="center"xfont color="#66FFFF">Match Time:
c/fontx/divx/td>
ctdxdiv align="center"xfont color="#66FFFF">
c%out.print(si.getMatchTime()); %>
c/fontx/divx/td>
c/tr>
ctr>
ctdxdiv align="center"xfont color="#66FFFF">Matched Shares:
c/fontx/divx/td>
ctdxdiv align="center"xfont color="#66FFFF">
c%out.print(si.getMatchedSharesO):%>
c/fontx/divx/td>
c/tr>

62
</table>
</div>
<p align="center">&nbsp;</p>
<p align="center"x/form> </p>
</td>
</trx/table>

</td>
</trx/table>

<p>&nbsp;</p>
<p>&nbsp; </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<p>&nbsp; </p>
<p>&nbsp;</p>
<p>&nbsp; </p>
</body>
</html>
// end getQuote.jsp

getTimeAndSales.jsp
<%@ page import="rfms_modules .*"%>
<%@ page import= "org.jdom.*, org.jdom.input.*,
org.apache.xerces.parsers.*, java.sql.*,java.util.List"%>
<%@ page language="java" contentType="text/html"%>
<%@ page autoFlush = "true"%>
<%@ page session = "false"%>
<jsp:useBean id="ts" scope="page"
class="rfms_modules.TimeAndSales" />

<html>

63
<head>
ctitle>Real-Time Finance Management System - Portfolio
Managementc/1 i 11e>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1">
</head>

<body vLink=#ffe4ca aLink=#ffffff link=#ffffff


background="../images/bluebground.gif" text="#FFFFFF">
cTABLE width=500 border=0 align="center" cellPadding=O cellSpacing=O>
cTBODY>
<TR>
<TD height="74" align=middle vAlign=center> <div
align="center"xfont color="#0066FF" size="4" face="Georgia, Times
New Roman, Times, serif"xstrongxemxfont color="#FFCCFF">Real-Time
Finance Management System</font><br>
< /emx/ strongx /font>
<hr width="400" color="#FF0000">
<font color="#0066FF" size="4" face="Georgia, Times New
Roman, Times, serif"><strong><em>
< / emx / s tr ongx / f ontx / di v>< / TD>
</TR>
</TBODY>
</TABLE>
<br>
ctable align="center" width="100%">
<tr>

<td width="14%">
ctable align="left" cellpadding="8" cellspacing="2" width="100%">
<tr>
ctdxdiv align=" center "xfont color="#FFFFFF">cstrong>cfont
size="-l" face="Arial, Helvetica, sans-serif"><a
href=" . . /index.html">Homec/a></font></strongx/fontx/div>c/td>
</tr>
<tr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont
size="-l" face="Arial, Helvetica, sans-serif">Portfolio<br>
Managementc/f on tx/s trongx/f ontx/divx/td>
</tr>
<tr>
ctdxdiv align=" center "xfont color="#FFFFFF" xstrongxf ont
size="-l" face="Arial, Helvetica, sans-serif"xa
hre f =" reminders / index. html" >Reminder sc / ax / f ontx / s t rongx / f ont >c / div
x/td>
</tr>
<tr>
ctdxdiv align="center">cfont color="#FFFFFF"xstrongxfont
size="-l" face="Arial, Helvetica, sans-serif "xa
hre f ="debt/index.html">Debt
Planning< / ax / f ontx / s trongx / f ontx / divx / td>
</tr>
<tr>
ctdxdiv align=" center "xfont color="#FFFFFF" xstrongxf ont
size="-l" face="Arial, Helvetica, sans-serif "xa
href =" expenditures / index. html" >Expendi turesc /ax / f ontx / strongx / font
x/divx/td>

64
</tr>
<tr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont
size="-l" face="Arial, Helvetica, sans-serif "xa
href="account/index.html">Account
Inf ormationc/ ax / f ontx / strongx / f ontx /divx/ td>
</tr>
<tr>
ctdxdiv align="center"xfont color="#FFFFFF"><strongxfont
size="-l" face="Arial, Helvetica, sans-serif "xa
href="expense/index.html">Expense
Plannerc / ax / f ontx / s trongx / f ont >< / divx / td>
</tr>
<tr>
ctdxdiv align="center"xfont color="#FFFFFF"xstrongxfont
size="-l" face="Arial, Helvetica, sans-serif "xa
hre f =" bills/index.html">Bi11s
& Dues</ax/fontx/strongx/fontx/divx/td>
</tr>
</table>

cp>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
cp>&nbsp;c/p>
cp>&nbsp;</p>
<p>&nbsp;</p>
cp>&nbsp;</p>
cp>&nbsp;c/p>
<p>&nbsp; c /px / td>
ctd width="86%"><table width="100%"xtrxtd>
<p align="center">
cform name="forml" method="post" action="getQuote.jsp">
<p align="right">cfont color="#FFFFFF"xstrong>cfont
size="-l">Get
Quote: </fontx/strongx/font> cfont size="-l">
cinput name="stockName" type="text" id="stockName"
size="10 ">
cinput type="submit" name="Submit" value="G0">
c/font> </p>
</form>
<div align="center">
cpxstrongxfont color="#FF6666" size="6">Time and
Sales</fontxbrxbr>
cfont color="FF6666" size="4">The last
<%out.print(" ");
String recNumbString=
request.getParameter("recNumb");
int recNumbInt=
Integer.parselnt(recNumbString);
String symbol =
request.getParameter("symbol");
out.print(recNumbString) ;
out.printC ");

65
if (recNumbInt>l) {out.print("Sales");} else
{out.print("Sale");}
out.print(" for "+symbol);
%>
< / f ont>< / s trongx /p>
ctable width="100%" border="2" align="center"
cellpadding="2" cellspacing="2">
<tr>
<tdxdiv align="center"xstrongxfont size="~
1" >#</f ontx/strongx/divx/td>
ctdxdiv align=" center "xstrongxfont size="-
1" >MATCHED<br>SHARES< / f ontx I s trongx / divx / td>
ctdxdiv align=" center "xstrongxfont size="-
1" >PRICEc / f ontx / s trongx / divx / td>
ctdxdiv align=”center"xstrongxfont size="-
1" >TIMEc / f ont>c / s trongx / divx / td>
ctdxdiv align=" center "xstrongxfont size="-
1" >MATCHcBR>TYPEc / f ontx / s trongx / divx / td>
ctdxdiv align="center"xstrongxfont
size="-l" >REFERENCEcBR>NUMBERc / f ontx / s trongx / divx / td>
c/tr>

c%
Document d =
ts.buildDocument(symbol,recNumblnt);
Element root = d.getRootElement();
Element matchList =
root.getChild("stock").getChild("matched").getChild("matchList");
List matches = matchList.getChildren();
for (int i=0, size=matches.size();
icsize;i++) {
Element match =
(Element)matches.get(i); %>
ctr>
ctdxdiv align="center"xfont size="-
l”x%out .print (i+1) ; %> .c/f ontx/divx/ td>
ctdxdiv align="center">cfont size="-
l"x%out .print (match.getChild("matchedShares") .getValueO ) ;%x/fontx
/divx/td>
ctdxdiv align="center"xfont size="~
l"x%out .print (match. getChild( "matchPrice") .getValueO ) ; %x/fontx/di
vx/td>
ctdxdiv align="center">cfont size="-
1" >c%out .print (match. getChild ("matchTime") .getValueO ) ; %x/fontx/div
>c/td>
ctdxdiv align=11 center">cfont size="-
1 ">c%out .print (match.getChild("matchType”) .getValue ()) ; %x/fontx/div
>c/td>
ctdxdiv align="center"xfont size="-
l"x%out .print (match.getAttribute ("refNumb") . getValue () ) ; %x/fontx/d
ivx/td>
c/tr>
c% } %>

c/table>
cp>&nbsp;c/p>

66
</div>
<p align="center">&nbsp;</p>
<p align="center"x/form> </p>
</td>
</tr></table>

</td>
</trx/table>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<p>&nbsp;</p>
<p>&nbsp; </p>
</body>
</html>
// end getTimeAndSales.jsp
web.xml
<?xml version="1.0" encoding="ISO-8859-l"?>
<!—
Copyright 2004 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");


you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.Org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software


distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www. w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-
app_2_4.xsd"
version="2.4">

<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>

67
<!— JSPC servlet mappings end —>

<resource-ref>
<description>
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
</description>
<res-ref-name>
jdbc/rfms
</res-ref-name>
<res-type>
j avax. sql.DataSource
</res-type>
<res-auth>
Container
</res-auth>
</resource-ref>

</web-app>

// end web.xml

server.xml
<!— Example Server Configuration File —>
<!- Note that component elements are nested corresponding to their
parent-child relationships with each other —>

<!— A "Server" is a singleton element that represents the entire JVM,


which may contain one or more "Service" instances. The Server
listens for a shutdown command on the indicated port.

Note: A "Server" is not itself a "Container", so you may not


define subcomponents such as "Valves" or "Loggers" at this level.
~>

cServer port="8005" shutdown="SHUTDOWN">

<!— Comment these entries out to disable JMX MBeans support used for the
administration web application —>
cListener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
•^Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
cListener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>

<!-- Global JNDI resources ->

68
<GlobalNamingResources>

<!-- Test entry for demonstration purposes ->


Environment name="simpleVaIue" type="java.lang.Integer" value="30"/>

<!— Editable user database that can also be used by


UserDatabaseRealm to authenticate users —>
cResource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />

</GlobalNamingResources>

<!— A "Service" is a collection of one or more "Connectors" that share


a single "Container" (and therefore the web applications visible
within that Container). Normally, that Container is an "Engine",
but this is not required.

Note: A "Service" is not itself a "Container", so you may not


define subcomponents such as "Valves" or "Loggers" at this level.
->

<!— Define the Tomcat Stand-Alone Service —>


<Service name="Catalina">

<!— A "Connector" represents an endpoint by which requests are received


and responses are returned. Each Connector passes requests on to the
associated "Container" (normally an Engine) for processing.

By default, a non-SSL HTTP/1.1 Connector is established on port 8080.


You can also enable an SSL HTTP/1.1 Connector on port 8443 by
following the instructions below and uncommenting the second Connector
entry. SSL support requires the following steps (see the SSL Config
HOWTO in the Tomcat 5 documentation bundle for more detailed
instructions):
* If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
* Execute:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
with a password value of "changeit" for both the certificate and
the keystore itself.

By default, DNS lookups are enabled when a web application calls


request.getRemoteHost(). This can have an adverse impact on
performance, so you can disable it by setting the
"enableLookups" attribute to "false". When DNS lookups are disabled,
request.getRemoteHost() will return the String version of the
IP address of the remote client.

69
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector=”8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 ->

<!-- Note : To use gzip compression you could set the following properties :

compression^' on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
-->

<!-- Define a SSL HTTP/1.1 Connector on port 8443 ->


<!—
cConnector port="8443"
maxThreads=" 150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />

<!-- Define an AJP 1.3 Connector on port 8009 ->


cConnector port="8009"
enableLookups="false" redirectPort="8443" protocol^'AJP/1.3" />

c!~ Define a Proxied HTTP/1.1 Connector on port 8082 —>


c!~ See proxy documentation for more information about using this. —>
c!~
cConnector port="8082"
maxThreads="150" minSpareThreads="25” maxSpareThreads="75"
enableLookups="false" acceptCount=" 100" connectionTimeout="20000"
proxyPort="80" disableUploadTimeout="true" />
-->

c!~ An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host). ->

c!~ You should set jvmRoute to support load-balancing via AJP ie :


cEngine name="Standalone" defaultHost="localhost" jvmRoute="jvml ">
-->

c!~ Define the top level container in our container hierarchy —>
/c!-cEngine name="Catalina" defaultHost="localhost">->
cEngine name="Catalina" defaultHost="localhost">
<!-- The request dumper valve dumps useful debugging information about
the request headers and cookies that were received, and the response

70
headers and cookies that were sent, for all requests received by
this instance of Tomcat. If you care only about requests to a
particular virtual host, or a particular application, nest this
element inside the corresponding <Host> or <Context> entry instead.

For a similar mechanism that is portable to all Servlet 2.4


containers, check out the "RequestDumperFilter" Filter in the
example application (the source for this filter may be found in
"$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").

Request dumping is disabled by default. Uncomment the following


element to enable it. ->
<!-
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>

<!-- Because this Realm is here, an instance will be shared globally ->

<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. —>
<RealmclassName="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>

<!- Comment out the old realm but leave here for now in case we
need to go back quickly ~>
<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->

<!-- Replace the above Realm with one of the following to get a Realm
stored in a database and accessed via JDBC —>

<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="org.gjt.mm.mysql.Driver"
connectionURlL="jdbc:mysql://localhost/authority"
connectionName="test" connectionPassword="test"
userTab!e="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->

<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURJ>="jdbc:oracle:thin: @ntserver: 1521 :ORCL"
connectionName="seott" connectionPassword="tiger"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
->

71
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL= "j dbc: odbc: CATALINA"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->

<!-- Define the default virtual host


Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<!— Defines a cluster for this node,


By defining this element, means that every manager will be changed.
So when running a cluster, only make sure that you have webapps in there
that need to be clustered and remove the other ones.
A cluster has the following parameters:

className = the fully qualified name of the cluster class

name = a descriptive name for your cluster, can be anything

mcastAddr = the multicast address, has to be the same for all the nodes

mcastPort = the multicast port, has to be the same for all the nodes

mcastBindAddr = bind the multicast socket to a specific address

mcastTTL = the multicast TTL if you want to limit your broadcast

mcastSoTimeout = the multicast readtimeout

mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat

mcastDropTime = the number a milliseconds before a node is considered "dead” if no heartbeat


is received

tcpThreadCount = the number of threads to handle incoming replication requests, optimal would
be the same amount of threads as nodes

tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
in case of multiple ethernet cards,
auto means that address becomes
InetAddress.getLocalHost().getHostAddress()

tcpListenPort = the tcp listen port

tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
has a wakup bug in java.nio. Set to 0 for no timeout

72
printToScreen = true means that managers will also print to std.out

expireSessionsOnShutdown = true means that

useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has
been called.
false means to replicate the session after each request.
false means that replication would work for the following piece of code: (only for
SimpleTcpReplicationManager)
<%
HashMap map = (HashMap)session.getAttribute("map'j;
map.put("key","value");
%>
replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
* Pooled means that the replication happens using several sockets in a synchronous
way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting
except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To
use this, also increase the nr of tcp threads that you have dealing with replication.
* Synchronous means that the thread that executes the request, is also the
thread the replicates the data to the other nodes, and will not return until all
nodes have received the information-
* Asynchronous means that there is a specific 'sender' thread for each cluster node,
so the request thread will queue the replication request into a "smart" queue,
and then return to the client.
The "smart" queue is a queue where when a session is added to the queue, and the
same session
already exists in the queue from a previous request, that session will be replaced
in the queue instead of replicating two requests. This almost never happens, unless
there is a
large network delay.
-->
<!--
When configuring for clustering, you also add in a valve to catch all the requests
coming in, at the end of the request, the session may or may not be replicated.
A session is replicated if and only if all the conditions are met:
1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
2. a session exists (has been created)
3. the request is not trapped by the "filter" attribute

The filter attribute is to filter out requests that could not modify the session,
hence we don't replicate the session after the end of this request.
The filter is negative, ie, anything you put in the filter, you mean to filter out,
ie, no replication will be done on requests that match one of the filters.
The filter attribute is delimited by ;, so you can't escape out; even if you wanted to.

filter-'.*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
ending with .gif and .js are intercepted.

The deployer element can be used to deploy apps cluster wide.


Currently the deployment only deploys/undeploys to working members in the cluster
so no WARs are copied upons startup of a broken node.

73
The deployer watches a directory (watchDir) for WAR files when watchEnabled="true
When a new war file is added the war gets deployed to the local instance,
and then deployed to the other instances in the cluster.
When a war file is deleted from the watchDir the war is undeployed locally
and cluster wide

cCluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">

cMembership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>

cReceiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress=" auto"
tcpListenPort="4001"
tcpSelectorTimeout=" 100"
tcpThreadCount=" 6 "/>

cSender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="pooled"
ackTimeout=" 15000"/>

<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>

cDeployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
</Cluster>

<!-- Normally, users must authenticate themselves to each web app


individually. Uncomment the following entry if you would like
a user to be authenticated the first time they encounter a
resource protected by a security constraint, and then have that
user identity maintained across *all* web applications contained
in this virtual host. -->

74
<!--
cValve className="org.apache.catalina.authenticator.SingIeSignOn" />
~>

<!— Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
->
<!-
cValve className="org.apache.catalina. valves. AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resoiveHosts="false"/>
->

<!— Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
This access log implementation is optimized for maximum performance,
but is hardcoded to support only the "common" and "combined" patterns.
-->
<!--
<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
<!-
| Begin MyWebApp context definition.
+-->
<!-
| End MyWebApp context definition.
+-->

cContext path="/rfms" docBase="rfms" reloadable="true" debug="0">

<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_rfms" suffix=".txt" timestamp="true"/>

<Resource name="jdbc/rfmsDS" auth="Container"


type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/rfmsDS">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>

<!--
| The JDBC connection URL for connecting to your MySQL DB.

75
| The autoReconnect=true argument to the URL makes sure that the
j MySQL JDBC Driver will automatically reconnect if mysqld closed
| the connection, mysqld by default closes idle connections after
| 8 hours.
+->
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost/rfms
autoReconnect=true</value>
</parameter>

<!--
| MySQL username and password for DB connections.
+->

<!-
[ Class name for MySQL JDBC driver.
+-->
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>

<!—
| Maximum number of DB connections in pool. Make sure you
| configure your mysqld max_connections large enough to handle
| all of your DB connections. Set to 0 for no limit.
+->
<parameter>
<name>maxActive</name>
<value> 100</value>
</parameter>

<!—
| Maximum number of idle DB connections to retain in pool.
| Set to 0 for no limit.
+-->
<parameter>
<name>maxldle</name>
<vaiue>30</value>
</parameter>

<!-
| Maximum time to wait for a DB connection to become available
| in ms, in this example 10 seconds. An exception is thrown if
| this timeout is exceeded.
| Set to -1 to wait indefinitely.
+->
<parameter>
<name>maxWait</name>
<value> 10000</value>

76
</parameter>
</ResourceParams>

</Context>

</Host>

</Engine>

</Service>

</Server>

// end server.xml

77
REFERENCES

[1] Brown et al., Pro JSP, Third Edition, Shroff


Publishers & Distributors Pvt. Ltd., 2004.

[2] Whitehead P.,Friedman-Hill E.,Vanderveer E., Java and


XML Your Visual blueprint for creating Java-enhanced
Web Programs, Wiley Publishing, 2002. I

[3] Flower and Scott, UML Distilled, A Brief Guide to


Standard Object Modelling Language, 1999.

[4] Naughton P.,Schildt H., Java 2 - The Complete


Reference, Tata McGraw Hill 1999.

[5] Tremblett P., Instant JavaServer Pages, McGraw Hill


2000 .

78

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy