Description for Assignment 3.
---> Bank Of Syracuse -- Remote Banking System



(1) Description of the Problem
(2) Description of the Algorithm
   and Overview of the Program
(3) References


Description of Program
This Java program is for the Remote Banking System. The user can deposit and withdraw from their account, and check their balance either.
For the new customer, it will look up the table and check the account with that name is already their.
So the Five function it has

To enable this remote banking system, remote method invocation (RMI) of JAVA is used. RMI transcends the client/server model of computing with a more general 'remote object' model. Here, the 'server' defines objects that 'clients' can use remotely. The limitation of the RMI is that both of client and server should be Java application/applet, not like CORBA is language independent.

To have this RMI application,
1. Create a interface (Bank.java) that extends the java.rmi.Remote interface. It defines the remote method that client can invoke.
2. Define a sub-class of java.rmi.UnicastRemoteObject that implements Remote interface. This is the class of  'server object' and UnicastRemoteObject will handle remote structure automatically.
3. Run a rmiregistry for create remote object. This should work with the Naming class within 'BankImpl.java' class.
    (rmiregistry xxxx &)
4. Generate the stub and skeleton
    (rmic -d /servers/cgi-http-class/htdoc/cps616spring99-docs/cy99sso/prj3 BankImpl)
5. The RMISecurityManager should be installed to prevent unexpected behavior of stub.
6. Run a server application
    (java -Djava.rmi.server.codebase=http://carver.npac.syr.edu:3768/cps616spring99-docs/cy99sso/prj3 BankImpl & )

Descripition of the Algorithm and Overview of the Program
 

   Link To Program Flow Diagram   :  pflow.gif
 

Database

Table 'accounttable' has customer's NAME, PASSWORD and BALANCE.
 
NAME PASSWD BALANCE
bill gates 1000
ted turner 480

To create and to load database into oracle, accounttable needs script file (.sql) and control file (.ctl)
They are 'bankcreate.sql' and 'bank.ctl'.
 

Java Program
 

public interface Bank extends java.rmi.Remote

public void openAccount(String user, String passwd)
                throws java.rmi.RemoteException
public void closeAccount(String user, String passwd)
                throws java.rmi.RemoteException
public void deposit(String user, String passwd, int money)
                throws java.rmi.RemoteException
public void withdraw(String user, String passwd, int money)
                throws java.rmi.RemoteException
public int getBalance(String user, String passwd)
                throws java.rmi.RemoteException
 

import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;
import java.io.*;
import java.util.*;
import java.util.Date;
import java.sql.*;
import Bank.*;

public class BankImpl extends UnicastRemoteObject implements Bank

public BankImpl(Connection c) throws RemoteException
public int checkAccount(String name, String passwd) throws SQLException
public boolean verify(String name) throws SQLException
public void openAccount(String name, String passwd) throws RemoteException
public void closeAccount(String name, String passwd) throws RemoteException
public void deposit(String name, String passwd, int money) throws RemoteException
public void withdraw(String name, String passwd, int amount) throws RemoteException
public int getBalance(String name, String passwd) throws RemoteException
public static void main(String[] args)
 

import java.io.*;
import java.awt.*;
import java.rmi.*;
import java.applet.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.lang.*;

public class BankApplet extends Applet implements ActionListener

public void init()
public void open(String user, String passwd)
public void close(String user, String passwd)
public void deposit(String user, String passwd, int money)
public void withdraw(String user, String passwd, int money)
public void balance(String user, String passwd)
public void actionPerformed(ActionEvent event)

Reference