Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.net.InetAddress;
- import java.rmi.Naming;
- import java.rmi.RemoteException;
- import java.rmi.registry.LocateRegistry;
- import java.rmi.server.UnicastRemoteObject;
- public class EchoBankServer extends UnicastRemoteObject
- implements TellerServer
- {
- public static void main(String[] args) throws Exception
- {
- System.out.println("ECE 309 - Nivesh Varma - Lab8 CommandLineTeller");
- new EchoBankServer();
- }
- protected EchoBankServer() throws Exception
- {
- super();
- LocateRegistry.createRegistry(1099);
- System.out.println("rmiregistry must be started before the server.");
- Naming.rebind("TellerServices",this);
- System.out.println("TellerServices is up at " + InetAddress.getLocalHost().getHostAddress());
- }
- public String openNewAccount(String accountType,
- String customerName) throws RemoteException
- {
- return "Opening a " + accountType + " account for " + customerName;
- }
- public String closeOutAccount(int accountNumber,
- String customerName) throws RemoteException
- {
- return "Closing account #" + accountNumber + " for " + customerName;
- }
- public String processAccount(String processType,
- int accountNumber,
- double amount) throws RemoteException
- {
- return "Executing " + processType + " for account #"
- + accountNumber + " of amount $" + amount;
- }
- public String showAccount(int accountNumber) throws RemoteException
- {
- return "Showing account #" + accountNumber;
- }
- public String showAccounts(String customerName) throws RemoteException
- {
- return "Showing all the accounts for " + customerName;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement