Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. import java.net.InetAddress;
  2. import java.rmi.Naming;
  3. import java.rmi.RemoteException;
  4. import java.rmi.registry.LocateRegistry;
  5. import java.rmi.server.UnicastRemoteObject;
  6.  
  7. public class EchoBankServer extends UnicastRemoteObject
  8. implements TellerServer
  9. {
  10. public static void main(String[] args) throws Exception
  11. {
  12. System.out.println("ECE 309 - Nivesh Varma - Lab8 CommandLineTeller");
  13. new EchoBankServer();
  14. }
  15.  
  16. protected EchoBankServer() throws Exception
  17. {
  18. super();
  19. LocateRegistry.createRegistry(1099);
  20. System.out.println("rmiregistry must be started before the server.");
  21. Naming.rebind("TellerServices",this);
  22. System.out.println("TellerServices is up at " + InetAddress.getLocalHost().getHostAddress());
  23.  
  24. }
  25.  
  26. public String openNewAccount(String accountType,
  27. String customerName) throws RemoteException
  28. {
  29. return "Opening a " + accountType + " account for " + customerName;
  30. }
  31.  
  32. public String closeOutAccount(int accountNumber,
  33. String customerName) throws RemoteException
  34. {
  35. return "Closing account #" + accountNumber + " for " + customerName;
  36. }
  37.  
  38. public String processAccount(String processType,
  39. int accountNumber,
  40. double amount) throws RemoteException
  41. {
  42. return "Executing " + processType + " for account #"
  43. + accountNumber + " of amount $" + amount;
  44. }
  45.  
  46. public String showAccount(int accountNumber) throws RemoteException
  47. {
  48. return "Showing account #" + accountNumber;
  49. }
  50.  
  51. public String showAccounts(String customerName) throws RemoteException
  52. {
  53. return "Showing all the accounts for " + customerName;
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement