1 26 package org.objectweb.speedo.j2eedo.web; 27 28 import java.io.IOException ; 29 import java.rmi.RemoteException ; 30 31 import javax.jdo.JDOException; 32 import javax.servlet.ServletOutputStream ; 33 import javax.servlet.http.HttpServletRequest ; 34 import javax.servlet.http.HttpServletResponse ; 35 36 import org.objectweb.speedo.j2eedo.common.PMHolder; 37 import org.objectweb.speedo.j2eedo.bo.DatabaseImpl; 38 import org.objectweb.speedo.j2eedo.ejb.StoreServicesLocal; 39 import org.objectweb.speedo.j2eedo.ejb.StoreServicesRemote; 40 41 50 public class ApplicationServlet extends MainServlet { 51 56 final public static String PARAMETER_ACTION = "action"; 57 58 private DatabaseImpl departmentImpl = null; 59 60 66 protected void executeSessionBean(HttpServletRequest req, 67 HttpServletResponse resp, 68 StoreServicesLocal storeServices, 69 PMHolder persistenceManagerHolder) throws JDOException, 70 RemoteException , Exception , IOException { 71 ServletOutputStream out = resp.getOutputStream(); 72 out.println(storeServices.doAction( 73 persistenceManagerHolder, req.getParameter(PARAMETER_ACTION))); 74 } 75 76 protected void executeSessionBean(HttpServletRequest req, 77 HttpServletResponse resp, 78 StoreServicesRemote storeServices) 79 throws JDOException, RemoteException , Exception , IOException { 80 ServletOutputStream out = resp.getOutputStream(); 81 out.println(storeServices.doAction(req.getParameter(PARAMETER_ACTION))); 82 } 83 84 90 protected void executeDirectCall( 91 HttpServletRequest req, 92 HttpServletResponse resp, 93 PMHolder persistenceManagerHolder) 94 throws JDOException, IOException , Exception { 95 ServletOutputStream out = resp.getOutputStream(); 96 if (departmentImpl == null) { 97 departmentImpl = new DatabaseImpl(persistenceManagerHolder); 98 } 99 out.println( 100 departmentImpl.doAction( 101 req.getParameter(ApplicationServlet.PARAMETER_ACTION))); 102 } 103 } | Popular Tags |