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

📄 appmodelmanager.java

📁 《Java网络程序设计.rar》包括三个网络程序的源代码。
💻 JAVA
字号:
/*  */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.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.perspectivemd.perspective.ejb.PerspectiveLocal;//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 application level JavaBean as view. * Application shared java beans are accessed here. */public class AppModelManager extends ModelUpdateNotifier implements java.io.Serializable {    private ServletContext context;/*    private ConceptstrLocal conceptstrEjb = null;    private ConceptLocal conceptEjb = null;    private ConflictLocal conflictEjb = null;    private PerspectiveLocal perspectiveEjb = null;  */      public AppModelManager() { }    public void init(ServletContext context) {        Debug.println("ini AppModelManager ...");        //this.context = context;        this.context = context;        //getConflictWebImpl();        //getConceptstrModel();        //getConceptModel();        //getProfileMgrModel();        //getPerspectiveModel();    }    public PerspectiveWebImpl getPerspectiveWebImpl() {        PerspectiveWebImpl perspective = (PerspectiveWebImpl)        context.getAttribute(WebKeys.PerspectiveModelKey);        if (perspective == null) {            perspective = new PerspectiveWebImpl();            context.setAttribute(WebKeys.PerspectiveModelKey, perspective);        }        return perspective;    }    public ConceptWebImpl getConceptWebImpl() {        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)        context.getAttribute(WebKeys.ConflictModelKey);        if (conflict == null) {            conflict = new ConflictWebImpl();            context.setAttribute(WebKeys.ConflictModelKey, conflict);        }        return conflict;    }        public ConceptstrWebImpl getConceptstrWebImpl(String conceptstrID) {        String WebKeyconceptstrID ="ConceptStr" + conceptstrID;        Debug.println("AppModelManager: getConceptstrWebImpl: " + WebKeyconceptstrID);        ConceptstrWebImpl conceptstr = (ConceptstrWebImpl)        context.getAttribute(WebKeyconceptstrID);        if (conceptstr == null) {                         try{                    conceptstr = new ConceptstrWebImpl();                    conceptstr.init(context);                    conceptstr.setConceptstrID(conceptstrID); //set the ID to retrieve concept from EJB                    conceptstr.performUpdate();                 }                catch (StarsAppException fde) {                Debug.println("unable to initialize cstr: "+WebKeyconceptstrID);                                    }            context.setAttribute(WebKeyconceptstrID, conceptstr);        }        return conceptstr;    }/*        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;    }*/}

⌨️ 快捷键说明

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