⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usercontrollerwebimpl.java

📁 J2EE & Tomcat books published by hope
💻 JAVA
字号:
/*  */package org.impact.stars.control.web;import java.util.Locale;import java.util.Collection;import javax.rmi.PortableRemoteObject;import javax.naming.InitialContext;import javax.servlet.http.HttpSession;import org.impact.stars.util.Debug;import org.impact.stars.util.JNDINames;import org.impact.stars.util.WebKeys;import org.impact.stars.util.JSPUtil;import org.impact.stars.control.event.StarsEvent;import org.impact.stars.control.ejb.UserControllerLocal;import org.impact.stars.control.ejb.UserControllerLocalHome;import org.impact.stars.conceptmd.concept.model.ConceptModel;import org.impact.stars.conceptmd.conceptstr.ejb.ConceptstrLocal;import org.impact.stars.organizationmd.profilemgr.model.ProfileMgrModel;import org.impact.stars.organizationmd.profilemgr.ejb.ProfileMgrLocal;//import org.impact.stars.organizationmd.user.model.UserModel;import org.impact.stars.organizationmd.user.ejb.UserLocal;import org.impact.stars.control.web.ModelManager;import java.rmi.RemoteException;import javax.ejb.FinderException;import javax.ejb.CreateException;import javax.ejb.RemoveException;import javax.naming.NamingException;import org.impact.stars.control.exceptions.GeneralFailureException;import org.impact.stars.control.exceptions.StarsEventException;import org.impact.stars.control.exceptions.StarsAppException;/** * This class is essentially just a proxy object that calls methods on the * EJB tier using the org.impact.stars.control.ejb.UserControllerEJB * object. All the methods that access the EJB are synchronized so * that concurrent requests do not happen to the stateful session bean. * * @see org.impact.stars.control.ejb.UserController * @see org.impact.stars.control.ejb.UserControllerEJB * @see org.impact.stars.control.event.StarsEvent */public class UserControllerWebImpl implements java.io.Serializable {    private org.impact.stars.control.ejb.UserControllerLocal uclEjb;    private HttpSession session;    public UserControllerWebImpl() {    }    /**     * constructor for an HTTP client.     * @param the HTTP session object for a client     */    public UserControllerWebImpl(HttpSession session) {        this.session = session;        ModelManager mm = (ModelManager)session.getAttribute(WebKeys.ModelManagerKey);        uclEjb = mm.getURCEJB();    }/*    public synchronized ConceptstrLocal getConceptstrEJB() {        try {            return uclEjb.getConceptstr();        } catch (StarsAppException fe) {            throw new GeneralFailureException(fe.getMessage());        } catch (RemoteException re) {            throw new GeneralFailureException(re.getMessage());        }    }*/    public synchronized ProfileMgrLocal getProfileMgrEJB() {        try {            return uclEjb.getProfileMgr();        } catch (StarsAppException fe) {            throw new GeneralFailureException(fe.getMessage());    }    }        public synchronized UserLocal getUserEJB() {        try {            return uclEjb.getUser();        } catch (StarsAppException fe) {            throw new GeneralFailureException(fe.getMessage());    }    }    /**     * @return the profile corresponding to the current user.     * @exception org.impact.stars.control.GeneralFailureException     */    /*    public synchronized ProfileMgrModel getProfileMgr() {        try {            return uclEjb.getProfileMgr().getDetails();        } catch (StarsAppException fe) {            throw new GeneralFailureException(fe.getMessage());        }    }    */    public synchronized Collection handleEvent(StarsEvent ese)        throws StarsEventException {        try {            Debug.println("UserControllerWebImpl: handleEvent");            return uclEjb.handleEvent(ese);        } catch (StarsAppException re) {                throw new GeneralFailureException(re.getMessage());        }    }     /**     * frees up all the resources associated with this controller and     * destroys itself.     */    public synchronized void remove() {        // call ejb remove on self/shopping cart/etc.        try {            uclEjb.remove();        } catch(RemoveException re){            // ignore, after all its only a remove() call!            Debug.print(re);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -