?? modelmanager.java
字號(hào):
/* */package org.impact.stars.control.web;import java.util.HashMap;import java.util.ArrayList;import java.util.Collection;import java.util.Iterator;import javax.servlet.http.HttpSession;import javax.servlet.ServletContext;import org.impact.stars.util.Debug;import org.impact.stars.util.WebKeys;import org.impact.stars.util.EJBUtil;import org.impact.stars.control.web.ConceptWebImpl;import org.impact.stars.control.web.ConceptstrWebImpl;import org.impact.stars.conceptmd.conceptstr.model.ConceptstrModel;import org.impact.stars.conceptmd.conceptstr.ejb.ConceptstrLocal;import org.impact.stars.perspectivemd.perspective.model.PerspectiveModel;//import org.impact.stars.organizationmd.stakeholder.model.StakeholderModel;import org.impact.stars.conflictmd.conflict.ejb.ConflictLocal;import org.impact.stars.control.web.ConflictWebImpl;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.ProfileMgrWebImpl;import org.impact.stars.control.ejb.UserControllerLocal;import java.rmi.RemoteException;import javax.ejb.CreateException;import javax.ejb.FinderException;import org.impact.stars.control.exceptions.GeneralFailureException;import org.impact.stars.control.exceptions.StarsAppException;/** * Maintain the access of state information data. * Only session related object are stored here. */public class ModelManager extends ModelUpdateNotifier implements java.io.Serializable { private ServletContext context; private HttpSession session; private UserControllerLocal urcEjb = null; private ConceptstrLocal conceptstrEjb = null; private ConceptstrLocal conceptEjb = null; private ConflictLocal conflictEjb = null; private ProfileMgrLocal proEjb = null; private UserLocal userEjb = null; private UserControllerWebImpl urcw = null; public ModelManager() { } public void init(ServletContext context, HttpSession session) { this.session = session; this.context = context; //getConflictWebImpl(); //getConceptstrModel(); //getConceptModel(); getProfileMgrModel(); //getPerspectiveModel(); Debug.println("ModelManager init:"); } public void setURC(UserControllerWebImpl urcw) { this.urcw = urcw; } public PerspectiveWebImpl getPerspectiveModel() { PerspectiveWebImpl Perspective = (PerspectiveWebImpl) context.getAttribute(WebKeys.PerspectiveModelKey); if (Perspective == null) { Perspective = new PerspectiveWebImpl(); context.setAttribute(WebKeys.PerspectiveModelKey, Perspective); } return Perspective; } public ConceptWebImpl getConceptModel() { ConceptWebImpl Concept = (ConceptWebImpl) context.getAttribute(WebKeys.ConceptModelKey); if (Concept == null) { Concept = new ConceptWebImpl(); context.setAttribute(WebKeys.ConceptModelKey, Concept); } return Concept; } public ConflictWebImpl getConflictWebImpl() { ConflictWebImpl conflict = (ConflictWebImpl) session.getAttribute(WebKeys.ConflictModelKey); if (conflict == null) { conflict = new ConflictWebImpl(); session.setAttribute(WebKeys.ConflictModelKey, conflict); } return conflict; } public ProfileMgrModel getProfileMgrModel() { ProfileMgrModel pro = (ProfileMgrModel) session.getAttribute(WebKeys.ProfileMgrModelKey); if (pro == null) { pro = new ProfileMgrWebImpl(this); session.setAttribute(WebKeys.ProfileMgrModelKey, pro); } return pro; } public UserWebImpl getUserWebImpl() { UserWebImpl userwipl = (UserWebImpl) session.getAttribute(WebKeys.UserModelKey); if (userwipl == null) { userwipl = new UserWebImpl(this); session.setAttribute(WebKeys.UserModelKey, userwipl); } return userwipl; } public ConceptstrModel getConceptstrModel() { ConceptstrWebImpl Conceptstr = (ConceptstrWebImpl) context.getAttribute(WebKeys.ConceptstrModelKey); if (Conceptstr == null) { Conceptstr = new ConceptstrWebImpl(); Conceptstr.init(context); context.setAttribute(WebKeys.ConceptstrModelKey, Conceptstr); } return Conceptstr; } public UserControllerLocal getURCEJB() { Debug.println("ModelManager: getURCEJB"); if (urcEjb == null) { try { urcEjb = EJBUtil.getURCLocalHome().create(); } catch (CreateException ce) { Debug.println("ModelManger: urcEjb cannot be created"); throw new GeneralFailureException(ce.getMessage()); } catch (javax.naming.NamingException ne) { Debug.println("ModelManger: urcEjb cannot be created"); throw new GeneralFailureException(ne.getMessage()); } } return urcEjb; } public UserLocal getUserEJB() { if (userEjb == null) { try { userEjb = EJBUtil.getUserLocalHome().create(); } catch (CreateException ce) { throw new GeneralFailureException(ce.getMessage()); } catch (javax.naming.NamingException ne) { throw new GeneralFailureException(ne.getMessage()); } } return userEjb; }/* public ConceptLocal getConceptEJB()throws StarsAppException { if (conceptEjb == null) { if (urcw == null) { throw new GeneralFailureException("ModelManager: Can not get concept Conceptstr EJB"); } else { conceptEjb = urcw.getConceptEJB(); } } return conceptEjb; }*/ /* public ConceptstrLocal getConceptstrEJB()throws StarsAppException { if (conceptstrEjb == null) { if (urcw == null) { throw new GeneralFailureException("ModelManager: Can not get concept Conceptstr EJB"); } else { conceptstrEjb = urcw.getConceptstrEJB(); } } return conceptstrEjb; } *//* public ConflictLocal getConflictEJB() throws StarsAppException { if (conflictEjb == null) { if (urcw == null) { throw new GeneralFailureException("ModelManager: Can not get conflict EJB"); } else { conflictEjb = urcw.getConflictEJB(); } } return conflictEjb; }*/ public ProfileMgrLocal getProfileMgrEJB() throws StarsAppException { if (proEjb == null) { if (urcw == null) { throw new GeneralFailureException("ModelManager: Can not get profilemgr EJB"); } else { proEjb = urcw.getProfileMgrEJB(); } } return proEjb; }}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -