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

📄 portletapplicationmanager.java

📁 GridSphere 门户 提供一个基于 portlet 的高级开放源代码门户。GridSphere 是在欧盟提供基金的 GridLab 项目下开发的
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    }    public void deployWebapp(ActionFormEvent event) throws PortletException {        log.debug("in PortletApplicationManager: deployWebapp");        PortletRequest req = event.getActionRequest();        PortletResponse res = event.getActionResponse();        HttpServletRequest hReq = (HttpServletRequest) req;        HttpServletResponse hRes = (HttpServletResponse) res;        try {            TextFieldBean tf = event.getTextFieldBean("webappNameTF");            String webappName = tf.getValue();            if (webappName == null) return;            String webappPath = getPortletContext().getRealPath("");            int idx = webappPath.lastIndexOf(File.separator);            webappPath = webappPath.substring(0, idx + 1);            tomcatManager.installWebApp(req, res, webappName);            File pfile = new File(webappPath + webappName + File.separator + "WEB-INF" + File.separator + "portlet.xml");            System.err.println(webappPath + webappName + File.separator + "WEB-INF" + File.separator + "portlet.xml");            if (pfile.exists()) {                portletManager.initPortletWebApplication(webappName, hReq, hRes);            }            createSuccessMessage(event, this.getLocalizedText(req, "PORTLET_SUC_DEPLOY") + " " + webappName);        } catch (Exception e) {            createErrorMessage(event, this.getLocalizedText(req, "PORTLET_ERR_DEPLOY"));            log.error("Unable to deploy webapp  ", e);        }        setNextState(req, DEFAULT_VIEW_PAGE);    }    public void displayWebapp(ActionFormEvent event) {        ActionRequest req = event.getActionRequest();        String webapp = event.getAction().getParameter("appname");        req.setAttribute("webappname", webapp);        setNextState(req, "displayWebApp");    }    public void displayWebApp(RenderFormEvent event) {        RenderRequest req = event.getRenderRequest();        RenderResponse res = event.getRenderResponse();        String webapp = (String) req.getAttribute("webappname");        PanelBean panel = event.getPanelBean("panel");        FrameBean frame = new FrameBean();        DefaultTableModel model = new DefaultTableModel();        TableRowBean tr = new TableRowBean();        tr.setHeader(true);        TableCellBean tc = new TableCellBean();        TextBean text = new TextBean();        text.setValue(portletManager.getPortletWebApplicationDescription(webapp));        tc.addBean(text);        tr.addBean(tc);        tc = new TableCellBean();        text = new TextBean();        text.setValue(this.getLocalizedText(req, "SUBSCRIPTION_DESC"));        tc.addBean(text);        tr.addBean(tc);        TableCellBean tc2 = new TableCellBean();        TextBean text2 = new TextBean();        text2.setValue(this.getLocalizedText(req, "PORTLET_STATUS"));        tc2.addBean(text2);        tr.addBean(tc2);        model.addTableRowBean(tr);        List appColl = registry.getApplicationPortlets(webapp);        if (appColl.isEmpty()) appColl = registry.getApplicationPortlets(webapp);        for (Object anAppColl : appColl) {            ApplicationPortlet app = (ApplicationPortlet) anAppColl;            System.err.println("app portlet= \n" + app.toString());            System.err.println("app statusmsg = " + app.getApplicationPortletStatusMessage());            System.err.println("app status = " + app.getApplicationPortletStatus());            // System.err.println("conc portlet= \n" + conc.toString());            String concID = app.getConcretePortletID();            // we don't want to list PortletServlet loader!            if (concID.startsWith(PortletServlet.class.getName())) continue;            TableRowBean newtr = new TableRowBean();            TableCellBean newtc2 = new TableCellBean();            TextBean tb = new TextBean();            // set 2nd column to portlet display name from concrete portlet            Locale loc = req.getLocale();            String dispName = app.getDisplayName(loc);            tb.setValue(dispName);            newtc2.addBean(tb);            newtr.addBean(newtc2);            TableCellBean newtc = new TableCellBean();            TextBean tb2 = new TextBean();            // set 3rd column to portlet description from concrete portlet            //tb2.setValue(conc.getPortletSettings().getDescription(loc, null));            tb2.setValue(app.getDescription(loc));            newtc.addBean(tb2);            newtr.addBean(newtc);            newtc = new TableCellBean();            //newtc.setAlign("center");            tb = new TextBean();            ImageBean img = new ImageBean();            if (app.getApplicationPortletStatus().equals(PortletStatus.FAILURE)) {                img.setSrc(req.getContextPath() + "/themes/brush/default/images/msgicons/portlet-msg-error.gif");                newtc.addBean(img);                tb.setValue("   " + getLocalizedText(req, "FAILURE"));                tb.setId(app.getApplicationPortletName());                tb.setStyle(MessageStyle.MSG_UNDERLINE);                TooltipBean tt = new TooltipBean();                tt.setName(app.getApplicationPortletName());                tt.setId("tt" + app.getApplicationPortletName());                String status = app.getApplicationPortletStatusMessage();                tt.setValue(status);                tt.setRenderResponse(res);                newtc.addBean(tb);                newtc.addBean(tt);            } else {                img.setSrc(req.getContextPath() + "/themes/brush/default/images/msgicons/portlet-msg-success.gif");                newtc.addBean(img);                tb.setValue("   " + getLocalizedText(req, "SUCCESS"));                newtc.addBean(tb);            }            newtr.addBean(newtc);            model.addTableRowBean(newtr);        }        frame.setTableModel(model);        panel.addBean(frame);        setNextState(req, VIEW_APP_JSP);    }    public List getPortletAppList(PortletRequest req, PortletResponse res) throws TomcatManagerException {        List webapps = portletManager.getPortletWebApplicationNames();        List l = new ArrayList();        TomcatWebAppResult result = tomcatManager.getWebAppList(req, res);        if (result != null) {            Iterator it = result.getWebAppDescriptions().iterator();            while (it.hasNext()) {                TomcatWebAppDescription webAppDesc = (TomcatWebAppDescription) it.next();                //System.err.println(webAppDesc.toString());                if (webapps.contains((webAppDesc.getContextPath()))) {                    String desc = portletManager.getPortletWebApplicationDescription(webAppDesc.getContextPath());                    webAppDesc.setDescription(desc);                    PortletWebApplication webapp = registry.getWebApplication(webAppDesc.getContextPath());                    if (webapp != null) {                        webAppDesc.setStatus(webapp.getWebApplicationStatus());                        webAppDesc.setStatusMessage(webapp.getWebApplicationStatusMessage());                    }                    l.add(webAppDesc);                }            }        }        return l;    }    public List getNonPortletAppList(PortletRequest req, PortletResponse res) throws TomcatManagerException {        List webapps = portletManager.getPortletWebApplicationNames();        List l = new ArrayList();        TomcatWebAppResult result = tomcatManager.getWebAppList(req, res);        if (result != null) {            Iterator it = result.getWebAppDescriptions().iterator();            while (it.hasNext()) {                TomcatWebAppDescription webAppDesc = (TomcatWebAppDescription) it.next();                //System.err.println(webAppDesc.toString());                if (!webapps.contains((webAppDesc.getContextPath()))) {                    //String desc = pm.getPortletWebApplicationDescription(webAppDesc.getContextPath());                    //webAppDesc.setDescription("");                    l.add(webAppDesc);                }            }        }        return l;    }}

⌨️ 快捷键说明

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