From a881365f771d8e8231f1e7f6f167742c6ed3ae31 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 17 Feb 2009 13:27:13 +0000 Subject: Fixed build problem (missing beancontainer.jar) Updated portlet configuration generator to include actual demos and to use sampler widgetset Re-added PortletDemo which demonstrates portal integration svn changeset:6872/svn branch:trunk --- .../PortletConfigurationGenerator.java | 65 ++++++++++++++++------ 1 file changed, 47 insertions(+), 18 deletions(-) (limited to 'build/buildhelpers/com') diff --git a/build/buildhelpers/com/itmill/toolkit/buildhelpers/PortletConfigurationGenerator.java b/build/buildhelpers/com/itmill/toolkit/buildhelpers/PortletConfigurationGenerator.java index e7e4ab1cc6..1eae91789b 100644 --- a/build/buildhelpers/com/itmill/toolkit/buildhelpers/PortletConfigurationGenerator.java +++ b/build/buildhelpers/com/itmill/toolkit/buildhelpers/PortletConfigurationGenerator.java @@ -71,11 +71,7 @@ public class PortletConfigurationGenerator { + " \n" + " user\n" + " \n" + " \n"; - private static final String PORTLET_XML_FOOT = "\n" - + " \n" - + " javax.portlet.escapeXml\n" - + " false\n" - + " \n" + ""; + private static final String PORTLET_XML_FOOT = "\n" + ""; private static final String LIFERAY_PORTLET_XML_HEAD = "\n" + "\n" @@ -140,7 +136,7 @@ public class PortletConfigurationGenerator { /** * @param args - * [widgetset to use] + * [default widgetset to use] */ public static void main(String[] args) { if (args.length < 1 || !new File(args[0]).isDirectory()) { @@ -151,9 +147,7 @@ public class PortletConfigurationGenerator { String widgetset = ""; if (args.length > 1) { - widgetset = "\n " - + "widgetset" + args[1] - + ""; + widgetset = args[1]; } /* @@ -234,7 +228,7 @@ public class PortletConfigurationGenerator { } catch (FileNotFoundException e) { System.out.println(jbossObjectXmlFile + " not found!"); } - // open jboss insrance.xml + // open jboss instance.xml File jbossInstanceXmlFile = new File(args[0] + File.separatorChar + JBOSS_INSTANCE_FILE); OutputStreamWriter jiout = null; @@ -257,30 +251,65 @@ public class PortletConfigurationGenerator { Pattern p1 = Pattern .compile(".*?(.*?)<\\/servlet-name>.*?(.*?)<\\/url-pattern>(.*?)<\\/servlet-mapping>"); Pattern p2 = Pattern - .compile(".*?.*?"); + .compile(".*?.*?"); + Pattern findWidgetset = Pattern + .compile(".*?widgetset<\\/param-name>.*?(.*?)<\\/param-value>"); + Matcher m = p1.matcher(webXml); while (m.find()) { if (m.groupCount() < 3) { // don't include continue; } - Matcher m2 = p2.matcher(m.group(3)); + + String name = m.group(1); + // remove leading- and trailing whitespace + name = name.replaceAll("^\\s*", ""); + name = name.replaceAll("\\s*$", ""); + + String comment = m.group(3); + Matcher m2 = p2.matcher(comment); if (!m2.find()) { // don't include continue; } String style = ""; - if (m2.groupCount() == 1 && m2.group(1) != null) { + if (m2.groupCount() == 1 && m2.group(1) != null + && !m2.group(1).equals("")) { style = "style" + m2.group(1) + ""; } - style += widgetset; - String name = m.group(1); - // remove leading- and trailing whitespace - name = name.replaceAll("^\\s*", ""); - name = name.replaceAll("\\s*$", ""); + // Find widgetset + Pattern findServlet = Pattern + .compile(".*?" + name + + "<\\/servlet-name>(.*?)<\\/servlet>"); + Matcher servletMatcher = findServlet.matcher(webXml); + if (servletMatcher.find()) { + String servletXml = servletMatcher.group(1); + Matcher widgetsetMatcher = findWidgetset + .matcher(servletXml); + if (widgetsetMatcher.find()) { + String definedWidgetSet = widgetsetMatcher.group(1); + if (!definedWidgetSet.equals(widgetset)) { + System.err + .println("WARNING: Widgetset in web.xml (" + + definedWidgetSet + + ") does not match used (" + + widgetset + ")"); + } + } + } + + if (widgetset != null && !widgetset.equals("")) { + System.err.println("Using widgetset: " + widgetset); + style += "\n " + + "widgetset" + + widgetset + ""; + + } + String pname = name + "Portlet"; String url = m.group(2); // remove leading- and trailing whitespace -- cgit v1.2.3