@Override public PortalDeployDefinition parseModule(String modulePath) { LfwLogger.info("Parsing modules in directory '" + modulePath + "'"); try { PortalDeployDefinition define = new PortalDeployDefinition(); PortalModule pm = parsePortalModule(modulePath); String moduleName = pm.getModule(); define.setModule(moduleName); define.setPortalModule(pm); /*Portal*/ PortletApplicationDefinition pad = parsePortlets(modulePath, define, moduleName); define.setPortletDefineModule(pad); /* 加入Portal页面 */ Page[] pages = PmlUtil.getPages(modulePath + "/portalspec/pml"); if (pages != null) { define.setPages(pages); } /*Portlet分组信息*/ Reader displayins = null; try { File f = new File(modulePath + "/portalspec/display.xml"); if (f.exists()) { String xmlText = FileUtils.readFileToString(f, "UTF-8"); displayins = new StringReader(xmlText); Display display = XmlUtil.readDisplay(displayins); if (display != null) define.setDisplay(display); } } catch (JAXBException e) { LfwLogger.error(e.getMessage(), e); } catch (FileNotFoundException e) { LfwLogger.error(e.getMessage(), e); } finally { IOUtils.closeQuietly(displayins); } /*Portal插件*/ PtPlugin plugin = PluginDefParser.reader(modulePath + "/portalspec/plugin.xml"); define.setPlugin(plugin); // /*skin信息*/ // PtSkinVo[] ptSkinVo = parseSkinVo(modulePath,moduleName); // define.setPtSkinVo(ptSkinVo); /*将模块的实际路径放入缓存中*/ IPtPortletRegistryService portletReg = PortalServiceUtil.getPortletRegistryService(); File moduleDir = new File(modulePath); String moduleFolder = moduleDir.getName(); portletReg.addModuleFolder(moduleName, moduleFolder); return define; } catch (Throwable e) { LfwLogger.error("error occurred while parsing module:" + modulePath, e); return null; } }
@Override public Page getPage(String projectPath, String projectModuleName, String PageName) { String filePath = getPortalSpecPath(projectPath, projectModuleName) + "/pml"; String fileName = PageName; File f = new File(filePath + "/" + fileName + ".pml"); try { return PmlUtil.parser(f); } catch (PortalServiceException e) { LfwLogger.error(e.getMessage(), e); return null; } }
@Override public Page[] getAllPages(String projectPath, String projectModuleName) { String filePath = getPortalSpecPath(projectPath, projectModuleName) + "/pml"; return PmlUtil.getPages(filePath); }