ejbgetter.java

来自「一个java」· Java 代码 · 共 136 行

JAVA
136
字号
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 getOrderHome() throws NamingException  {      InitialContext initial = new InitialContext();      Object objref = initial.lookup("Orders");      return (OrdersHome)          PortableRemoteObject.narrow(objref, OrdersHome.class);  }//getOrdersHome  public static OrderControllerHome getOrderControllerHome()      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 + =
减小字号Ctrl + -
显示快捷键?