📄 ejbgetter.java~11~
字号:
package bookstore.util;import bookstore.ejb.*;import javax.rmi.PortableRemoteObject;import javax.naming.InitialContext;import javax.naming.NamingException;/*** This helper class fetches EJB home references.*/public final class EJBGetter { public static CustomerHome getCustomerHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("Customer"); return (CustomerHome) PortableRemoteObject.narrow(objref, CustomerHome.class); }//getCustomerHome public static CustomerControllerHome getCustomerControllerHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("CustomerController"); return (CustomerControllerHome) PortableRemoteObject.narrow(objref, CustomerControllerHome.class); }//getCustomerControllerHome public static CommentHome getCommentHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("Comment"); return (CommentHome) PortableRemoteObject.narrow(objref, CommentHome.class); }//getCommentHome public static CommentControllerHome getCommentControllerHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("CommentController"); return (CommentControllerHome) PortableRemoteObject.narrow(objref, CommentControllerHome.class); }//getCommentControllerHome public static ManagerHome getManagerHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("Manager"); return (ManagerHome) PortableRemoteObject.narrow(objref, ManagerHome.class); }//getManagerHome public static ManagerControllerHome getManagerControllerHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("ManagerController"); return (ManagerControllerHome) PortableRemoteObject.narrow(objref, ManagerControllerHome.class); }//getManagerControllerHome public static SupplierHome getSupplierHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("Supplier"); return (SupplierHome) PortableRemoteObject.narrow(objref, SupplierHome.class); }//getSupplierHome public static SupplierControllerHome getSupplierControllerHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("SupplierController"); return (SupplierControllerHome) PortableRemoteObject.narrow(objref, SupplierControllerHome.class); }//getSupplierControllerHome public static BasketHome getBasketHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("Basket"); return (BasketHome) PortableRemoteObject.narrow(objref, BasketHome.class); }//getBasketHome public static BasketControllerHome getBasketControllerHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("BasketController"); return (BasketControllerHome) PortableRemoteObject.narrow(objref, BasketControllerHome.class); }//getBasketControllerHome public static BookHome getBookHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("Book"); return (BookHome) PortableRemoteObject.narrow(objref, BookHome.class); }//getBookHome public static BookControllerHome getBookControllerHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("BookController"); return (BookControllerHome) PortableRemoteObject.narrow(objref, BookControllerHome.class); }//getBookControllerHome public static OrdersHome getOrdersHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("Orders"); return (OrdersHome) PortableRemoteObject.narrow(objref, OrdersHome.class); }//getOrdersHome public static OrderControllerHome getOrdersControllerHome() throws NamingException { InitialContext initial = new InitialContext(); Object objref = initial.lookup("OrderController"); return (OrderControllerHome) PortableRemoteObject.narrow(objref, OrderControllerHome.class); }//getOrdersControllerHome } // EJBGetter
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -