Advertisement
simeonvarbanov

Untitled

Nov 24th, 2012
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. import java.util.ArrayList;
  2.  
  3. import org.omg.PortableServer.Servant;
  4.  
  5. import bank.Account;
  6.  
  7. public class MyServer {
  8.     public static void main(String[] args) {
  9.         Server s = new Server(args);
  10.         ArrayList<Account> accounts = new ArrayList<Account>();
  11.         // create a Servant object
  12.         Servant customer = new CustomerImpl(accounts);
  13.         Servant administrator = new AdministratorImpl(accounts);
  14.         Servant customerWS = new CustomerWSImpl(accounts);
  15.  
  16.         if (args.length == 0) {
  17.             s.attach(customer, null);
  18.             s.attach(administrator, null);
  19.             s.attach(customerWS, null);
  20.             s.closeFile();
  21.         } else {
  22.             // define the context
  23.             String nameContext1 = "Bank.cxt";
  24.  
  25.             // build the context
  26.             s.bindContext(nameContext1);
  27.  
  28.             // put objects into context
  29.             s.attach(customer, nameContext1 + "/" + "customer.service");
  30.             s.attach(administrator, nameContext1 + "/" + "admin.service");
  31.         }
  32.  
  33.         s.run();
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement