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 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 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
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)
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
I use several part code from Examples of course WebPage and JAVA
Examples ( RemoteDBBankServer.java )