1 27 28 29 package com.sun.ebank.util; 30 31 import javax.rmi.PortableRemoteObject ; 32 import javax.naming.InitialContext ; 33 import javax.naming.NamingException ; 34 import com.sun.ebank.ejb.account.AccountHome; 35 import com.sun.ebank.ejb.account.AccountControllerHome; 36 import com.sun.ebank.ejb.customer.CustomerHome; 37 import com.sun.ebank.ejb.customer.CustomerControllerHome; 38 import com.sun.ebank.ejb.tx.TxHome; 39 import com.sun.ebank.ejb.tx.TxControllerHome; 40 import com.sun.ebank.ejb.exception.*; 41 42 43 46 public final class EJBGetter { 47 public static AccountHome getAccountHome() throws NamingException { 48 InitialContext initial = new InitialContext (); 49 Object objref = initial.lookup(CodedNames.ACCOUNT_EJBHOME); 50 51 return (AccountHome) PortableRemoteObject.narrow(objref, 52 AccountHome.class); 53 } 54 55 public static AccountControllerHome getAccountControllerHome() 56 throws NamingException { 57 InitialContext initial = new InitialContext (); 58 Object objref = initial.lookup(CodedNames.ACCOUNT_CONTROLLER_EJBHOME); 59 60 return (AccountControllerHome) PortableRemoteObject.narrow(objref, 61 AccountControllerHome.class); 62 } 63 64 public static CustomerHome getCustomerHome() throws NamingException { 65 InitialContext initial = new InitialContext (); 66 Object objref = initial.lookup(CodedNames.CUSTOMER_EJBHOME); 67 68 return (CustomerHome) PortableRemoteObject.narrow(objref, 69 CustomerHome.class); 70 } 71 72 public static CustomerControllerHome getCustomerControllerHome() 73 throws NamingException { 74 InitialContext initial = new InitialContext (); 75 Object objref = initial.lookup(CodedNames.CUSTOMER_CONTROLLER_EJBHOME); 76 77 return (CustomerControllerHome) PortableRemoteObject.narrow(objref, 78 CustomerControllerHome.class); 79 } 80 81 public static TxHome getTxHome() throws NamingException { 82 InitialContext initial = new InitialContext (); 83 Object objref = initial.lookup(CodedNames.TX_EJBHOME); 84 85 return (TxHome) PortableRemoteObject.narrow(objref, TxHome.class); 86 } 87 88 public static TxControllerHome getTxControllerHome() 89 throws NamingException { 90 InitialContext initial = new InitialContext (); 91 Object objref = initial.lookup(CodedNames.TX_CONTROLLER_EJBHOME); 92 93 return (TxControllerHome) PortableRemoteObject.narrow(objref, 94 TxControllerHome.class); 95 } 96 } 97 | Popular Tags |