JBoss Portal SVN: r13126 - in modules/metadata/trunk: theme and 3 other directories.
by portal-commits@lists.jboss.org
Author: mwringe
Date: 2009-04-02 18:37:21 -0400 (Thu, 02 Apr 2009)
New Revision: 13126
Added:
modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/adapter/RegionsAdapter.java
Removed:
modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/RegionsMetaData.java
Modified:
modules/metadata/trunk/build/pom.xml
modules/metadata/trunk/theme/pom.xml
modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/PortalLayoutMetaData.java
modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/URIMetaData.java
modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/renderset/PortalRenderSetsMetaData.java
Log:
Minor code cleanup and refactoring.
Modified: modules/metadata/trunk/build/pom.xml
===================================================================
--- modules/metadata/trunk/build/pom.xml 2009-04-02 21:40:32 UTC (rev 13125)
+++ modules/metadata/trunk/build/pom.xml 2009-04-02 22:37:21 UTC (rev 13126)
@@ -17,6 +17,7 @@
<version.jboss-metadata>1.0.0.CR1</version.jboss-metadata>
<version.jboss.jbossxb>2.0.0.CR15</version.jboss.jbossxb>
<version.jaxb>2.1</version.jaxb>
+ <version.junit>3.8.2-brew</version.junit>
</properties>
<repositories>
@@ -68,6 +69,11 @@
<artifactId>jaxb-api</artifactId>
<version>${version.jaxb}</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
Modified: modules/metadata/trunk/theme/pom.xml
===================================================================
--- modules/metadata/trunk/theme/pom.xml 2009-04-02 21:40:32 UTC (rev 13125)
+++ modules/metadata/trunk/theme/pom.xml 2009-04-02 22:37:21 UTC (rev 13126)
@@ -28,6 +28,13 @@
<artifactId>jaxb-api</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
Modified: modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/PortalLayoutMetaData.java
===================================================================
--- modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/PortalLayoutMetaData.java 2009-04-02 21:40:32 UTC (rev 13125)
+++ modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/PortalLayoutMetaData.java 2009-04-02 22:37:21 UTC (rev 13126)
@@ -26,7 +26,11 @@
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.jboss.portal.metadata.layout.adapter.RegionAdapter;
+
/**
* @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
* @version $Revision$
@@ -40,12 +44,13 @@
protected List<URIMetaData> uris;
- protected RegionsMetaData regions;
+ protected List<String> regions;
public PortalLayoutMetaData()
{
classname = "org.jboss.portal.theme.impl.JSPLayout";
uris = new ArrayList<URIMetaData>();
+ regions = new ArrayList<String>();
}
@XmlElement(name = "name")
@@ -81,13 +86,15 @@
this.uris = uris;
}
- @XmlElement(name = "regions")
- public RegionsMetaData getRegions()
+ @XmlElementWrapper(name = "regions")
+ @XmlElement(name="region")
+ @XmlJavaTypeAdapter(RegionAdapter.class)
+ public List<String> getRegions()
{
return regions;
}
- public void setRegions(RegionsMetaData regions)
+ public void setRegions(List<String> regions)
{
this.regions = regions;
}
Deleted: modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/RegionsMetaData.java
===================================================================
--- modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/RegionsMetaData.java 2009-04-02 21:40:32 UTC (rev 13125)
+++ modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/RegionsMetaData.java 2009-04-02 22:37:21 UTC (rev 13126)
@@ -1,59 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.metadata.layout;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.jboss.portal.metadata.layout.adapter.RegionAdapter;
-
-/**
- * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
- * @version $Revision$
- */
-public class RegionsMetaData
-{
-
- protected List<String> regions;
-
- public RegionsMetaData()
- {
- this.regions = new ArrayList<String>();
- }
-
- @XmlElement(name = "region")
- @XmlJavaTypeAdapter(RegionAdapter.class)
- public List<String> getRegions()
- {
- return regions;
- }
-
- public void setRegions(List<String> regions)
- {
- this.regions = regions;
- }
-
-}
Modified: modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/URIMetaData.java
===================================================================
--- modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/URIMetaData.java 2009-04-02 21:40:32 UTC (rev 13125)
+++ modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/URIMetaData.java 2009-04-02 22:37:21 UTC (rev 13126)
@@ -23,6 +23,7 @@
package org.jboss.portal.metadata.layout;
import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlValue;
/**
@@ -36,6 +37,15 @@
protected String uri;
+ public URIMetaData ()
+ {}
+
+ public URIMetaData (String state, String uri)
+ {
+ this.state = state;
+ this.uri = uri;
+ }
+
@XmlAttribute(name = "state")
public String getState()
{
@@ -57,4 +67,42 @@
{
this.uri = uri;
}
+
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof URIMetaData)
+ {
+ URIMetaData uri = (URIMetaData) obj;
+ if (compareString(uri.getState(), this.getState()) && compareString(uri.getUri(), this.getUri()))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ private boolean compareString (String string1, String string2)
+ {
+ // if both strings are null, then return true
+ if (string1 == null && string2 == null)
+ {
+ return true;
+ }
+ else if (string1 != null && string1.equals(string2))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
}
Added: modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/adapter/RegionsAdapter.java
===================================================================
--- modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/adapter/RegionsAdapter.java (rev 0)
+++ modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/layout/adapter/RegionsAdapter.java 2009-04-02 22:37:21 UTC (rev 13126)
@@ -0,0 +1,52 @@
+///******************************************************************************
+// * JBoss, a division of Red Hat *
+// * Copyright 2009, Red Hat Middleware, LLC, and individual *
+// * contributors as indicated by the @authors tag. See the *
+// * copyright.txt in the distribution for a full listing of *
+// * individual contributors. *
+// * *
+// * This is free software; you can redistribute it and/or modify it *
+// * under the terms of the GNU Lesser General Public License as *
+// * published by the Free Software Foundation; either version 2.1 of *
+// * the License, or (at your option) any later version. *
+// * *
+// * This software is distributed in the hope that it will be useful, *
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+// * Lesser General Public License for more details. *
+// * *
+// * You should have received a copy of the GNU Lesser General Public *
+// * License along with this software; if not, write to the Free *
+// * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+// * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+// ******************************************************************************/
+//package org.jboss.portal.metadata.layout.adapter;
+//
+//import java.util.List;
+//
+//import javax.naming.OperationNotSupportedException;
+//import javax.xml.bind.annotation.adapters.XmlAdapter;
+//
+//import org.jboss.portal.metadata.layout.RegionsMetaData;
+//
+///**
+// * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+// * @version $Revision$
+// */
+//public class RegionsAdapter extends XmlAdapter<RegionsMetaData, List<String>>
+//{
+//
+// @Override
+// public RegionsMetaData marshal(List<String> arg0) throws Exception
+// {
+// throw new OperationNotSupportedException();
+// }
+//
+// @Override
+// public List<String> unmarshal(RegionsMetaData regions) throws Exception
+// {
+// return regions.getRegions();
+// }
+//
+//}
+//
Modified: modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/renderset/PortalRenderSetsMetaData.java
===================================================================
--- modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/renderset/PortalRenderSetsMetaData.java 2009-04-02 21:40:32 UTC (rev 13125)
+++ modules/metadata/trunk/theme/src/main/java/org/jboss/portal/metadata/renderset/PortalRenderSetsMetaData.java 2009-04-02 22:37:21 UTC (rev 13126)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.metadata.renderset;
+import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
@@ -36,7 +37,12 @@
{
protected List<RenderSetMetaData> renderSets;
- @XmlElement (name = "renderSet")
+ public PortalRenderSetsMetaData()
+ {
+ renderSets = new ArrayList<RenderSetMetaData>();
+ }
+
+ @XmlElement (name = "renderSet", required = true)
public List<RenderSetMetaData> getRenderSets()
{
return renderSets;
15 years, 6 months
JBoss Portal SVN: r13125 - branches/Enterprise_Portal_Platform_4_3/core-samples/src/resources/portal-basic-samples-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: prabhat.jha(a)jboss.com
Date: 2009-04-02 17:40:32 -0400 (Thu, 02 Apr 2009)
New Revision: 13125
Modified:
branches/Enterprise_Portal_Platform_4_3/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
Log:
[JBPORTAL-2313] adding correct portlets for Page Event Test. Similar to Branch27
Modified: branches/Enterprise_Portal_Platform_4_3/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml 2009-04-02 20:35:03 UTC (rev 13124)
+++ branches/Enterprise_Portal_Platform_4_3/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml 2009-04-02 21:40:32 UTC (rev 13125)
@@ -424,42 +424,42 @@
<page-name>Page event test</page-name>
<listener>window_event_listener</listener>
<window>
- <window-name>CatalogPortletWindow1</window-name>
- <instance-ref>CatalogPortletInstance</instance-ref>
+ <window-name>EventPortletWindow1</window-name>
+ <instance-ref>EventPortletInstance</instance-ref>
<region>left</region>
<height>0</height>
</window>
<window>
- <window-name>CatalogPortletWindow2</window-name>
- <instance-ref>CatalogPortletInstance</instance-ref>
+ <window-name>EventPortletWindow2</window-name>
+ <instance-ref>EventPortletInstance</instance-ref>
<region>left</region>
<height>1</height>
</window>
<window>
- <window-name>CatalogPortletWindow3</window-name>
- <instance-ref>CatalogPortletInstance</instance-ref>
+ <window-name>EventPortletWindow3</window-name>
+ <instance-ref>EventPortletInstance</instance-ref>
<region>left</region>
<height>2</height>
</window>
<window>
- <window-name>CatalogPortletWindow4</window-name>
- <instance-ref>CatalogPortletInstance</instance-ref>
+ <window-name>EventPortletWindow4</window-name>
+ <instance-ref>EventPortletInstance</instance-ref>
<region>center</region>
<height>0</height>
</window>
<window>
- <window-name>CatalogPortletWindow5</window-name>
- <instance-ref>CatalogPortletInstance</instance-ref>
+ <window-name>EventPortletWindow5</window-name>
+ <instance-ref>EventPortletInstance</instance-ref>
<region>center</region>
<height>1</height>
</window>
<window>
- <window-name>CatalogPortletWindow6</window-name>
- <instance-ref>CatalogPortletInstance</instance-ref>
+ <window-name>EventPortletWindow6</window-name>
+ <instance-ref>EventPortletInstance</instance-ref>
<region>center</region>
<height>2</height>
</window>
- </page>
+ </page>
<page>
<page-name>Secure test</page-name>
<window>
15 years, 6 months
JBoss Portal SVN: r13124 - in modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer: theme and 1 other directory.
by portal-commits@lists.jboss.org
Author: mwringe
Date: 2009-04-02 16:35:03 -0400 (Thu, 02 Apr 2009)
New Revision: 13124
Added:
modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/
modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestPortalLayoutMetaData.java
modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestPortalThemeMetaData.java
modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestRenderSetMetaData.java
Log:
Add theme metadata tests.
Added: modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestPortalLayoutMetaData.java
===================================================================
--- modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestPortalLayoutMetaData.java (rev 0)
+++ modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestPortalLayoutMetaData.java 2009-04-02 20:35:03 UTC (rev 13124)
@@ -0,0 +1,198 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.deployer.theme;
+
+import junit.framework.TestCase;
+
+import org.jboss.portal.deployer.portal.PortalUnmarshallerFactory;
+import org.jboss.portal.metadata.layout.PortalLayoutMetaData;
+import org.jboss.portal.metadata.layout.PortalLayoutsMetaData;
+import org.jboss.portal.metadata.layout.URIMetaData;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+
+import java.io.StringReader;
+import java.util.List;
+
+/**
+ * Test all aspects of the portal layout meta data.
+ *
+ * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
+ * @version $Revision: 8784 $
+ */
+public class TestPortalLayoutMetaData extends TestCase
+{
+ public void testBuildLayoutMetaDataList() throws Exception
+ {
+ try
+ {
+ // create a descriptor for the tests
+ StringBuffer testString = new StringBuffer();
+ testString.append("<layouts>");
+ testString.append("<layout>");
+ testString.append("<name>nodesk</name>");
+ testString.append("<uri>/nodesk/index.jsp</uri>");
+ testString.append("<regions>");
+ testString.append("<region name=\"left\"/>");
+ testString.append("<region name=\"center\"/>");
+ testString.append("</regions>");
+ testString.append("</layout>");
+ testString.append("<layout>");
+ testString.append("<name>generic</name>");
+ testString.append("<uri>/layouts/generic/index.jsp</uri>");
+ testString.append("<uri state=\"maximized\">/layouts/generic/maximized.jsp</uri>");
+ testString.append("<regions>");
+ testString.append("<region name=\"left\"/>");
+ testString.append("<region name=\"center\"/>");
+ testString.append("<region name=\"navigation\"/>");
+ testString.append("</regions>");
+ testString.append("</layout>");
+ testString.append("</layouts>");
+
+ PortalLayoutsMetaData layoutsMD = getLayoutMetaData(testString);
+
+ assertNotNull(layoutsMD);
+ assertTrue(layoutsMD.getLayouts().size() == 2);
+
+ PortalLayoutMetaData layoutMD = (PortalLayoutMetaData)layoutsMD.getLayouts().get(0);
+ assertEquals("nodesk", layoutMD.getName());
+ assertEquals("/nodesk/index.jsp", layoutMD.getUris().get(0).getUri());
+ assertNotNull(layoutMD.getUris());
+ assertEquals(1, layoutMD.getUris().size());
+ assertNotNull(layoutMD.getClassName());
+ assertNotNull(layoutMD.getRegions());
+ String foo = layoutMD.getRegions().get(0);
+
+ assertEquals(2, layoutMD.getRegions().size());
+ assertTrue(layoutMD.getRegions().contains("left"));
+ assertTrue(layoutMD.getRegions().contains("center"));
+
+ layoutMD = (PortalLayoutMetaData)layoutsMD.getLayouts().get(1);
+ URIMetaData uriMetaData1 = new URIMetaData (null, "/layouts/generic/index.jsp");
+ URIMetaData uriMetaData2 = new URIMetaData ("maximized", "/layouts/generic/maximized.jsp");
+ assertEquals("generic", layoutMD.getName());
+ assertTrue(layoutMD.getUris().contains(uriMetaData1));
+ assertTrue(layoutMD.getUris().contains(uriMetaData2));
+ assertNotNull(layoutMD.getUris());
+ assertEquals(2, layoutMD.getUris().size());
+ assertNotNull(layoutMD.getClassName());
+ assertNotNull(layoutMD.getRegions());
+ assertEquals(3, layoutMD.getRegions().size());
+ assertTrue(layoutMD.getRegions().contains("left"));
+ assertTrue(layoutMD.getRegions().contains("center"));
+ assertTrue(layoutMD.getRegions().contains("navigation"));
+ }
+ catch (IllegalArgumentException e)
+ {
+ // the layout meta needs the portal web app to be not null and have an id
+ assertTrue("expected exception did occur", true);
+ }
+ }
+
+ public void testLayoutMetaDataNoName() throws Exception
+ {
+ StringBuffer testString = new StringBuffer();
+ testString.append("<layouts>");
+
+ // no name
+ testString.append("<layout>");
+// testString.append("<name>nodesk</name>");
+ testString.append("<uri>/nodesk/index.jsp</uri>");
+ testString.append("<regions>");
+ testString.append("<region name=\"left\"/>");
+ testString.append("<region name=\"center\"/>");
+ testString.append("</regions>");
+ testString.append("</layout>");
+
+ testString.append("</layouts>");
+
+ PortalLayoutsMetaData layoutsMD = getLayoutMetaData(testString);
+ PortalLayoutMetaData layoutMD = (PortalLayoutMetaData)layoutsMD.getLayouts().get(0);
+ assertTrue(layoutMD.getName() == null);
+ }
+
+ public void testLayoutMetaDataNoURI() throws JBossXBException
+ {
+ StringBuffer testString = new StringBuffer();
+ testString.append("<layouts>");
+
+ // no uri
+ testString.append("<layout>");
+ testString.append("<name>nodesk</name>");
+ testString.append("</layout>");
+// testString.append("<uri>/nodesk/index.jsp</uri>");
+ testString.append("</layouts>");
+
+ PortalLayoutsMetaData layoutsMD = getLayoutMetaData(testString);
+ PortalLayoutMetaData layoutMD = (PortalLayoutMetaData)layoutsMD.getLayouts().get(0);
+ assertTrue(layoutMD.getUris().size() == 0);
+ }
+
+ public void testLayoutMetaDataNoRegions() throws Exception
+ {
+ StringBuffer testString = new StringBuffer();
+ testString.append("<layouts>");
+ // no regions
+ testString.append("<layout>");
+ testString.append("<name>nodesk</name>");
+ testString.append("<uri>/nodesk/index.jsp</uri>");
+ testString.append("</layout>");
+ testString.append("</layouts>");
+ PortalLayoutsMetaData layoutsMD = getLayoutMetaData(testString);
+ assertNotNull(layoutsMD);
+ PortalLayoutMetaData layoutMD = (PortalLayoutMetaData)layoutsMD.getLayouts().get(0);
+ assertNotNull(layoutMD.getRegions());
+ assertTrue(layoutMD.getRegions().size() == 0);
+ }
+
+ // What in the world does this do?
+/*
+ public void testLayoutMetaData4() throws Exception
+ {
+ StringBuffer testString = new StringBuffer();
+ testString.append("<layouts>");
+ // fragment assembler class specified
+ testString.append("<layout>");
+ testString.append("<name>nodesk</name>");
+ testString.append("<uri>/nodesk/index.jsp</uri>");
+ testString.append("<fragment-assembler-implementation>TestFragmentAssembler</fragment-assembler-implementation>");
+ testString.append("</layout>");
+ testString.append("</layouts>");
+ List layoutMDList = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new PortalLayoutMetaDataFactory(), null);
+ assertNotNull(layoutMDList);
+ PortalLayoutMetaData layoutMD = (PortalLayoutMetaData)layoutMDList.get(0);
+ assertNotNull(layoutMD.getClassName());
+ assertEquals("org.jboss.portal.theme.impl.JSPLayout", layoutMD.getClassName());
+ }
+*/
+
+ private PortalLayoutsMetaData getLayoutMetaData(StringBuffer testString) throws JBossXBException
+ {
+ DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+ resolver.addClassBindingForLocation("layouts", PortalLayoutsMetaData.class);
+ return (PortalLayoutsMetaData) PortalUnmarshallerFactory.getInstance()
+ .getUnmarshaller().unmarshal(new StringReader(testString.toString()), resolver);
+ }
+
+}
\ No newline at end of file
Property changes on: modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestPortalLayoutMetaData.java
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestPortalThemeMetaData.java
===================================================================
--- modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestPortalThemeMetaData.java (rev 0)
+++ modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestPortalThemeMetaData.java 2009-04-02 20:35:03 UTC (rev 13124)
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.deployer.theme;
+
+import junit.framework.TestCase;
+
+import org.jboss.portal.deployer.portal.PortalUnmarshallerFactory;
+import org.jboss.portal.metadata.theme.PortalThemeMetaData;
+import org.jboss.portal.metadata.theme.PortalThemesMetaData;
+import org.jboss.portal.metadata.theme.ThemeLinkMetaData;
+import org.jboss.portal.metadata.theme.ThemeScriptMetaData;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+
+import java.io.StringReader;
+import java.util.List;
+
+/**
+ * Testcase for the portal theme meta data parsing from the descriptor
+ * <p/>
+ * example descriptor:
+ * <p/>
+ * <themes> <theme> <name>industrial</name> <link rel="stylesheet" id="main_css" href="/themes/industrial/portal_style.css"
+ * type="text/css" /> <link rel="shortcut icon" href="/themes/industrial/images/favicon.ico" /> </theme> <theme>
+ * <name>Nphalanx</name> <link rel="stylesheet" id="main_css" href="/themes/phalanx/portal_style.css" type="text/css" />
+ * <link rel="shortcut icon" href="/themes/phalanx/images/favicon.ico" /> </theme> <theme> <name>mission-critical</name>
+ * <link rel="stylesheet" id="main_css" href="/themes/mission-critical/portal_style.css" type="text/css" /> <link
+ * rel="shortcut icon" href="/themes/mission-critical/images/favicon.ico" /> </theme> <theme> <name>Maple</name> <link
+ * rel="stylesheet" id="main_css" href="/themes/maple/portal_style.css" type="text/css"/> <link rel="shortcut icon"
+ * href="/themes/maple/images/favicon.ico"/> </theme> </themes> *
+ *
+ * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
+ * @version $Revision: 8784 $
+ */
+public class TestPortalThemeMetaData extends TestCase
+{
+
+ public void testBuildThemeMetaDataList() throws JBossXBException
+ {
+ try
+ {
+ // create a descriptor for the tests
+ StringBuffer testString = new StringBuffer();
+ testString.append("<themes>");
+
+ testString.append("<theme>");
+ testString.append("<name>industrial</name>");
+ testString.append("<link rel=\"stylesheet\" id=\"main_css\" href=\"/themes/industrial/portal_style.css\" type=\"text/css\" />");
+ testString.append("<link rel=\"shortcut icon\" href=\"/themes/industrial/images/favicon.ico\" />");
+ testString.append("</theme>");
+
+ testString.append("<theme>");
+ testString.append("<name>mission-critical</name>");
+ testString.append("<link rel=\"stylesheet\" id=\"main_css\" href=\"/themes/mission-critical/portal_style.css\" type=\"text/css\" />");
+ testString.append("<link rel=\"shortcut icon\" href=\"/themes/mission-critical/images/favicon.ico\" />");
+ testString.append("<script id=\"scriptWithBody\" type=\"text/javascript\">some script content here...</script>");
+ testString.append("<script src=\"srcURL\" id=\"scriptWithNoBody\" type=\"text/javascript\"/>");
+ testString.append("</theme>");
+
+ testString.append("</themes>");
+
+ PortalThemesMetaData themes= getThemeMetaData(testString);
+
+ assertTrue(themes.getThemes().size() == 2);
+
+ PortalThemeMetaData meta = (PortalThemeMetaData)themes.getThemes().get(0);
+ assertEquals("industrial", meta.getName());
+ assertTrue(meta.getLinks().size() == 2);
+ assertTrue(meta.getScripts().size() == 0);
+
+ List links = meta.getLinks();
+ ThemeLinkMetaData link = (ThemeLinkMetaData)links.get(0);
+ assertEquals("/themes/industrial/portal_style.css", link.getHref());
+ assertEquals("text/css", link.getType());
+
+ // second link
+ link = (ThemeLinkMetaData)links.get(1);
+ assertEquals("/themes/industrial/images/favicon.ico", link.getHref());
+ assertEquals("shortcut icon", link.getRel());
+
+ // test the second theme
+ meta = (PortalThemeMetaData)themes.getThemes().get(1);
+ assertEquals("mission-critical", meta.getName());
+ assertTrue(meta.getLinks().size() == 2);
+ assertTrue(meta.getScripts().size() == 2);
+
+ ThemeScriptMetaData script = (ThemeScriptMetaData)meta.getScripts().get(0);
+ assertTrue(script.getSrc() == null);
+ assertEquals("scriptWithBody", script.getId());
+ assertEquals("text/javascript", script.getType());
+
+ script = (ThemeScriptMetaData)meta.getScripts().get(1);
+ assertEquals("srcURL", script.getSrc());
+ assertEquals("scriptWithNoBody", script.getId());
+ }
+ catch (Exception e)
+ {
+ assertFalse("unexpected exception occured", true);
+ }
+ }
+
+ public void testThemeMetaDataNoName() throws JBossXBException
+ {
+ StringBuffer testString = new StringBuffer();
+ testString.append("<themes>");
+
+ // no name defined
+ testString.append("<theme>");
+// testString.append("<name>industrial</name>");
+ testString.append("<link rel=\"stylesheet\" id=\"main_css\" href=\"/themes/industrial/portal_style.css\" type=\"text/css\" />");
+ testString.append("<link rel=\"shortcut icon\" href=\"/themes/industrial/images/favicon.ico\" />");
+ testString.append("</theme>");
+
+ testString.append("</themes>");
+
+ PortalThemesMetaData themes= getThemeMetaData(testString);
+ PortalThemeMetaData meta = (PortalThemeMetaData)themes.getThemes().get(0);
+ assertTrue(meta.getName() == null);
+ }
+
+ public void testThemeMetaDataNoLinks() throws JBossXBException
+ {
+ StringBuffer testString = new StringBuffer();
+ testString.append("<themes>");
+
+ // no link, no script defined
+ testString.append("<theme>");
+ testString.append("<name>industrial</name>");
+ testString.append("</theme>");
+
+ testString.append("</themes>");
+
+ PortalThemesMetaData themes= getThemeMetaData(testString);
+ PortalThemeMetaData meta = (PortalThemeMetaData)themes.getThemes().get(0);
+ assertTrue(meta.getLinks().size() == 0);
+ assertTrue(meta.getScripts().size() == 0);
+ }
+
+ private PortalThemesMetaData getThemeMetaData(StringBuffer testString) throws JBossXBException
+ {
+ DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+ resolver.addClassBindingForLocation("themes", PortalThemesMetaData.class);
+ return (PortalThemesMetaData) PortalUnmarshallerFactory.getInstance()
+ .getUnmarshaller().unmarshal(new StringReader(testString.toString()), resolver);
+ }
+}
Property changes on: modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestPortalThemeMetaData.java
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestRenderSetMetaData.java
===================================================================
--- modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestRenderSetMetaData.java (rev 0)
+++ modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestRenderSetMetaData.java 2009-04-02 20:35:03 UTC (rev 13124)
@@ -0,0 +1,205 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.deployer.theme;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import junit.framework.TestCase;
+
+import org.jboss.portal.deployer.portal.PortalUnmarshallerFactory;
+import org.jboss.portal.metadata.renderset.PortalRenderSetsMetaData;
+import org.jboss.portal.metadata.renderset.RenderSetMetaData;
+import org.jboss.portal.metadata.renderset.SetMetaData;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.xml.sax.SAXException;
+
+/**
+ * Test cases for the render set meta data <p/> <p/> exmaple of a render set descriptor: <p/> <portal-renderSet>
+ * <renderSet name="divRenderer"> <set content-type="text/html"> <region-renderer>org.jboss.portal.theme.impl.render.div.DivRegionRenderer</region-renderer>
+ * <window-renderer>org.jboss.portal.theme.impl.render.div.DivWindowRenderer</window-renderer>
+ * <portlet-renderer>org.jboss.portal.theme.impl.render.div.DivPortletRenderer</portlet-renderer>
+ * <decoration-renderer>org.jboss.portal.theme.impl.render.div.DivDecorationRenderer</decoration-renderer> </set>
+ * </renderSet> <renderSet name="emptyRenderer"> <set content-type="text/html"> <region-renderer>org.jboss.portal.theme.impl.render.empty.EmptyRegionRenderer</region-renderer>
+ * <window-renderer>org.jboss.portal.theme.impl.render.empty.EmptyWindowRenderer</window-renderer>
+ * <portlet-renderer>org.jboss.portal.theme.impl.render.empty.EmptyPortletRenderer</portlet-renderer>
+ * <decoration-renderer>org.jboss.portal.theme.impl.render.empty.EmptyDecorationRenderer</decoration-renderer> </set>
+ * </renderSet> </portal-renderSet> <p/> </p>
+ *
+ * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
+ * @version $Revision: 10337 $
+ */
+public class TestRenderSetMetaData extends TestCase
+{
+
+ public void testBuildRenderSetMD() throws IOException, ParserConfigurationException, SAXException
+ {
+ try
+ {
+ StringBuffer testString = new StringBuffer();
+ testString.append("<portal-renderSet>");
+
+ testString.append("<renderSet name=\"divRenderer\">");
+
+ testString.append("<set content-type=\"text/html\">");
+ testString.append("<region-renderer>DivRegionRenderer</region-renderer>");
+ testString.append("<window-renderer>DivWindowRenderer</window-renderer>");
+ testString.append("<portlet-renderer>DivPortletRenderer</portlet-renderer>");
+ testString.append("<decoration-renderer>DivDecorationRenderer</decoration-renderer>");
+ testString.append("</set>");
+
+ testString.append("</renderSet>");
+
+
+ testString.append("<renderSet name=\"emptyRenderer\">");
+
+ testString.append("<set content-type=\"text/html\">");
+ testString.append("<region-renderer>EmptyRegionRendererHTML</region-renderer>");
+ testString.append("<window-renderer>EmptyWindowRendererHTML</window-renderer>");
+ testString.append("<portlet-renderer>EmptyPortletRendererHTML</portlet-renderer>");
+ testString.append("<decoration-renderer>EmptyDecorationRendererHTML</decoration-renderer>");
+ testString.append("</set>");
+
+ testString.append("<set content-type=\"application/xhtml+xml\">");
+ testString.append("<region-renderer>EmptyRegionRendererXHTML</region-renderer>");
+ testString.append("<window-renderer>EmptyWindowRendererXHTML</window-renderer>");
+ testString.append("<portlet-renderer>EmptyPortletRendererXHTML</portlet-renderer>");
+ testString.append("<decoration-renderer>EmptyDecorationRendererXHTML</decoration-renderer>");
+ testString.append("</set>");
+
+ testString.append("</renderSet>");
+
+ testString.append("</portal-renderSet>");
+
+ PortalRenderSetsMetaData setList = getRenderSetMetaData(testString);
+
+ assertNotNull(setList);
+ assertTrue(setList.getRenderSets().size() == 2);
+
+ RenderSetMetaData renderSetMD = (RenderSetMetaData)setList.getRenderSets().get(0);
+ assertEquals("divRenderer", renderSetMD.getName());
+ assertNotNull(renderSetMD.getSet());
+ assertTrue(renderSetMD.getSet().size() == 1);
+ SetMetaData rendererSetMD = (SetMetaData)renderSetMD.getSet().get(0);
+ assertEquals("text/html", rendererSetMD.getContentType());
+ assertEquals("DivPortletRenderer", rendererSetMD.getPortletRenderer());
+
+ renderSetMD = (RenderSetMetaData)setList.getRenderSets().get(1);
+ assertEquals("emptyRenderer", renderSetMD.getName());
+ assertNotNull(renderSetMD.getSet());
+ assertTrue(renderSetMD.getSet().size() == 2);
+
+ rendererSetMD = (SetMetaData)renderSetMD.getSet().get(0);
+ assertEquals("text/html", rendererSetMD.getContentType());
+ assertEquals("EmptyPortletRendererHTML", rendererSetMD.getPortletRenderer());
+
+ rendererSetMD = (SetMetaData)renderSetMD.getSet().get(1);
+ assertEquals("application/xhtml+xml", rendererSetMD.getContentType());
+ assertEquals("EmptyDecorationRendererXHTML", rendererSetMD.getDecorationRenderer());
+ }
+ catch (Exception e)
+ {
+ assertFalse("unexpected exception occured" + e.getMessage(), true);
+ }
+ }
+
+// TODO: reenable this test later once it determined how to throw the XBException properly
+// public void testRenderSetMetaDataNoMime() throws JBossXBException
+// {
+// StringBuffer testString = new StringBuffer();
+// // no content type attribute in the set
+// testString.append("<portal-renderSet>");
+// testString.append("<renderSet name=\"divRenderer\">");
+// testString.append("<set>");
+// testString.append("<region-renderer>DivRegionRenderer</region-renderer>");
+// testString.append("<window-renderer>DivWindowRenderer</window-renderer>");
+// testString.append("<portlet-renderer>DivPortletRenderer</portlet-renderer>");
+// testString.append("<decoration-renderer>DivDecorationRenderer</decoration-renderer>");
+// testString.append("</set>");
+// testString.append("</renderSet>");
+// testString.append("</portal-renderSet>");
+// try
+// {
+// PortalRenderSetsMetaData setList = getRenderSetMetaData(testString);
+// RenderSetMetaData renderSetMD = (RenderSetMetaData)setList.getRenderSets().get(0);
+// SetMetaData rendererSetMD = (SetMetaData)renderSetMD.getSet().get(0);
+// assertFalse("expected exception did not occur", true);
+// }
+// catch (JBossXBException e)
+// {
+// // expected
+// }
+// }
+
+ public void testRenderSetMetaDataNoWindowRenderer() throws JBossXBException
+ {
+ StringBuffer testString = new StringBuffer();
+ // no window renderer defined in the set
+ testString.append("<portal-renderSet>");
+ testString.append("<renderSet name=\"divRenderer\">");
+ testString.append("<set content-type=\"text/html\">");
+ testString.append("<region-renderer>DivRegionRenderer</region-renderer>");
+// testString.append("<window-renderer>DivWindowRenderer</window-renderer>");
+ testString.append("<portlet-renderer>DivPortletRenderer</portlet-renderer>");
+ testString.append("<decoration-renderer>DivDecorationRenderer</decoration-renderer>");
+ testString.append("</set>");
+ testString.append("</renderSet>");
+ testString.append("</portal-renderSet>");
+
+ PortalRenderSetsMetaData setList = getRenderSetMetaData(testString);
+ RenderSetMetaData renderSetMD = (RenderSetMetaData)setList.getRenderSets().get(0);
+ SetMetaData rendererSetMD = (SetMetaData)renderSetMD.getSet().get(0);
+ assertTrue(rendererSetMD.getWindowRenderer() == null);
+ }
+
+ public void testRenderSetMetaDataEmpty() throws JBossXBException
+ {
+ StringBuffer testString = new StringBuffer();
+ // empty render set descriptor
+ testString.append("<portal-renderSet>");
+ testString.append("</portal-renderSet>");
+
+ PortalRenderSetsMetaData setList = getRenderSetMetaData(testString);
+ try
+ {
+ RenderSetMetaData renderSetMD = (RenderSetMetaData)setList.getRenderSets().get(0);
+ assertFalse("expected exception did not occur", true);
+ }
+ catch (IndexOutOfBoundsException ioe)
+ {
+ // expected
+ }
+ }
+
+ private PortalRenderSetsMetaData getRenderSetMetaData(StringBuffer testString) throws JBossXBException
+ {
+ DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+ resolver.addClassBindingForLocation("portal-renderSet", PortalRenderSetsMetaData.class);
+ Unmarshaller unmarshaller = PortalUnmarshallerFactory.getInstance().getUnmarshaller();
+ return (PortalRenderSetsMetaData) unmarshaller.unmarshal(new StringReader(testString.toString()), resolver);
+ }
+}
Property changes on: modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/theme/TestRenderSetMetaData.java
___________________________________________________________________
Name: svn:executable
+ *
15 years, 6 months
JBoss Portal SVN: r13123 - in modules/deployer/trunk: deployer/src/main/deployer/META-INF and 10 other directories.
by portal-commits@lists.jboss.org
Author: mwringe
Date: 2009-04-02 15:36:56 -0400 (Thu, 02 Apr 2009)
New Revision: 13123
Added:
modules/deployer/trunk/deployer/src/main/deployer/tld/portal-layout.tld
modules/deployer/trunk/portal/src/main/java/org/jboss/portal/deployer/portal/webapp/TLDDeployer.java
modules/deployer/trunk/theme/src/main/java/org/jboss/portal/deployer/theme/webapp/
modules/deployer/trunk/theme/src/main/java/org/jboss/portal/deployer/theme/webapp/LayoutTLDDeployer.java
modules/deployer/trunk/theme/src/test/
modules/deployer/trunk/theme/src/test/java/
modules/deployer/trunk/theme/src/test/java/org/
modules/deployer/trunk/theme/src/test/java/org/jboss/
modules/deployer/trunk/theme/src/test/java/org/jboss/portal/
modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/
Modified:
modules/deployer/trunk/.classpath
modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml
Log:
Add layout TLD deployer.
Modified: modules/deployer/trunk/.classpath
===================================================================
--- modules/deployer/trunk/.classpath 2009-04-02 18:14:35 UTC (rev 13122)
+++ modules/deployer/trunk/.classpath 2009-04-02 19:36:56 UTC (rev 13123)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="theme/src/main/java"/>
+ <classpathentry kind="src" path="theme/src/test/java"/>
<classpathentry kind="src" path="portal/src/main/java"/>
<classpathentry kind="src" path="portlet/src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
Modified: modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml
===================================================================
--- modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml 2009-04-02 18:14:35 UTC (rev 13122)
+++ modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml 2009-04-02 19:36:56 UTC (rev 13123)
@@ -200,5 +200,10 @@
<bean name="LayoutDeployer" class="org.jboss.portal.deployer.theme.LayoutDeployer"/>
<bean name="RenderSetDeployer" class="org.jboss.portal.deployer.theme.RenderSetDeployer"/>
+
+ <bean name="LayoutTLDDeployer" class="org.jboss.portal.deployer.theme.webapp.LayoutTLDDeployer">
+ <property name="MBeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ <property name="TLDDirectory">tld</property>
+ </bean>
</deployment>
Added: modules/deployer/trunk/deployer/src/main/deployer/tld/portal-layout.tld
===================================================================
--- modules/deployer/trunk/deployer/src/main/deployer/tld/portal-layout.tld (rev 0)
+++ modules/deployer/trunk/deployer/src/main/deployer/tld/portal-layout.tld 2009-04-02 19:36:56 UTC (rev 13123)
@@ -0,0 +1,77 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<taglib
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3c.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ version="2.0">
+ <tlib-version>1.0</tlib-version>
+ <jsp-version>2.0</jsp-version>
+ <short-name></short-name>
+ <uri>http://www.jboss.org/portal</uri>
+ <tag>
+ <name>region</name>
+ <tag-class>org.jboss.portal.theme.tag.RegionTagHandler</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>orientation</name>
+ </attribute>
+ <attribute>
+ <name>regionName</name>
+ </attribute>
+ <attribute>
+ <name>regionID</name>
+ </attribute>
+ </tag>
+ <tag>
+ <name>portlet</name>
+ <tag-class>org.jboss.portal.theme.tag.PortletTagHandler</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>windowName</name>
+ </attribute>
+ </tag>
+ <tag>
+ <name>theme</name>
+ <tag-class>org.jboss.portal.theme.tag.ThemeTagHandler</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>themeName</name>
+ </attribute>
+ </tag>
+ <tag>
+ <name>headerContent</name>
+ <tag-class>org.jboss.portal.theme.tag.HeaderContentTagHandler</tag-class>
+ <body-content>empty</body-content>
+ </tag>
+ <tag>
+ <name>title</name>
+ <tag-class>org.jboss.portal.theme.tag.TitleTagHandler</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>default</name>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+</taglib>
Property changes on: modules/deployer/trunk/deployer/src/main/deployer/tld/portal-layout.tld
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/deployer/trunk/portal/src/main/java/org/jboss/portal/deployer/portal/webapp/TLDDeployer.java
===================================================================
--- modules/deployer/trunk/portal/src/main/java/org/jboss/portal/deployer/portal/webapp/TLDDeployer.java (rev 0)
+++ modules/deployer/trunk/portal/src/main/java/org/jboss/portal/deployer/portal/webapp/TLDDeployer.java 2009-04-02 19:36:56 UTC (rev 13123)
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.deployer.portal.webapp;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.web.WebApplication;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public abstract class TLDDeployer extends AbstractDeployer
+{
+
+ protected String tldDirectory;
+
+ protected MBeanServer server;
+
+ public void setTLDDirectory(String path)
+ {
+ this.tldDirectory = path;
+ }
+
+ public void setMBeanServer(MBeanServer server)
+ {
+ this.server = server;
+ }
+
+ protected String getDocLocation (WebApplication webApp) throws DeploymentException
+ {
+ ObjectName objectName = (ObjectName) webApp.getAppData();
+ try
+ {
+ return (String) server.getAttribute(objectName, "docBase");
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException ("Could get doc base for " + webApp.getName(), e);
+ }
+ }
+
+ protected void copyTld(String tldFileLocation, String tldName, String location) throws IOException
+ {
+ File fileLocation = new File(location);
+
+ if (!fileLocation.exists())
+ {
+ fileLocation.mkdirs();
+ }
+
+ if (fileLocation.isFile())
+ {
+ throw new IOException("The directory for the tld [" + fileLocation + "] is a file instead of a directory");
+ }
+ else if (fileLocation.isDirectory())
+ {
+ InputStream fileInput = Thread.currentThread().getContextClassLoader().getResourceAsStream(tldFileLocation);
+ FileOutputStream fileOutput = new FileOutputStream(new File(fileLocation, tldName));
+
+ int in = fileInput.read();
+ while (in > 0)
+ {
+ fileOutput.write(in);
+ in = fileInput.read();
+ }
+ fileInput.close();
+ fileOutput.close();
+ }
+
+ }
+
+}
+
Added: modules/deployer/trunk/theme/src/main/java/org/jboss/portal/deployer/theme/webapp/LayoutTLDDeployer.java
===================================================================
--- modules/deployer/trunk/theme/src/main/java/org/jboss/portal/deployer/theme/webapp/LayoutTLDDeployer.java (rev 0)
+++ modules/deployer/trunk/theme/src/main/java/org/jboss/portal/deployer/theme/webapp/LayoutTLDDeployer.java 2009-04-02 19:36:56 UTC (rev 13123)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.deployer.theme.webapp;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.portal.deployer.portal.webapp.TLDDeployer;
+import org.jboss.portal.metadata.layout.PortalLayoutsMetaData;
+import org.jboss.web.WebApplication;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class LayoutTLDDeployer extends TLDDeployer
+{
+
+ public LayoutTLDDeployer()
+ {
+ setAllInputs(false);
+ setInput(PortalLayoutsMetaData.class);
+ addInput(WebApplication.class);
+ setStage(DeploymentStages.INSTALLED);
+ }
+
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ WebApplication webApp = (WebApplication)unit.getAttachment(WebApplication.class);
+ if (webApp == null)
+ {
+ throw new DeploymentException("Could not deploy Theme TLD file. Could not find WebApplication class");
+ }
+ String location = getDocLocation(webApp);
+
+ try
+ {
+ copyTld(tldDirectory + "/portal-layout.tld", "portal-layout.tld", location + "/WEB-INF/theme");
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException ("Error trying to deploy theme tld file.", e);
+ }
+ }
+
+}
+
15 years, 6 months
JBoss Portal SVN: r13122 - branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-04-02 14:14:35 -0400 (Thu, 02 Apr 2009)
New Revision: 13122
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
Log:
- JBPORTAL-2367: should solve the infinite loop issue.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2009-04-02 18:11:11 UTC (rev 13121)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2009-04-02 18:14:35 UTC (rev 13122)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -252,7 +252,7 @@
return oldValue;
}
- private void initServiceFactoryIfNeeded() throws RuntimeException
+ private ServiceFactory initServiceFactoryIfNeeded() throws RuntimeException
{
if (serviceFactory == null)
{
@@ -279,6 +279,8 @@
startServiceFactoryIfNeeded();
}
+
+ return serviceFactory;
}
private void startServiceFactoryIfNeeded()
@@ -290,7 +292,7 @@
try
{
serviceFactory.start();
- refreshServices();
+ refreshServices(serviceFactory);
}
catch (Exception e)
{
@@ -390,16 +392,21 @@
private <T extends Remote> T getService(Class<T> clazz) throws InvokerUnavailableException
{
+ return getService(clazz, getServiceFactory());
+ }
+
+ private <T extends Remote> T getService(Class<T> clazz, ServiceFactory serviceFactory) throws InvokerUnavailableException
+ {
try
{
- T service = getServiceFactory().getService(clazz);
+ T service = serviceFactory.getService(clazz);
clean.set(getIndexFor(clazz));
return service;
}
catch (Exception e)
{
throw new InvokerUnavailableException("Couldn't access " + clazz.getSimpleName() + " service. Cause: "
- + e.getLocalizedMessage(), e);
+ + e.getLocalizedMessage(), e);
}
}
@@ -445,7 +452,7 @@
private boolean areURLsDirty()
{
return !clean.get(SD) || !clean.get(M) || (persistentPortletManagementURL != null && !clean.get(PM))
- || (persistentRegistrationURL != null && !clean.get(R));
+ || (persistentRegistrationURL != null && !clean.get(R));
}
public void refresh() throws InvokerUnavailableException
@@ -458,23 +465,23 @@
void forceRefresh() throws InvokerUnavailableException
{
- initServiceFactoryIfNeeded();
- refreshServices();
+ ServiceFactory serviceFactory = initServiceFactoryIfNeeded();
+ refreshServices(serviceFactory);
}
- private void refreshServices() throws InvokerUnavailableException
+ private void refreshServices(ServiceFactory serviceFactory) throws InvokerUnavailableException
{
if (areURLsDirty())
{
- getServiceDescriptionService();
- getMarkupService();
+ getService(WSRP_v1_ServiceDescription_PortType.class, serviceFactory);
+ getService(WSRP_v1_Markup_PortType.class, serviceFactory);
if (persistentPortletManagementURL != null)
{
- getPortletManagementService();
+ getService(WSRP_v1_PortletManagement_PortType.class, serviceFactory);
}
if (persistentRegistrationURL != null)
{
- getRegistrationService();
+ getService(WSRP_v1_Registration_PortType.class, serviceFactory);
}
}
}
15 years, 6 months
JBoss Portal SVN: r13121 - in branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp: producer and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-04-02 14:11:11 -0400 (Thu, 02 Apr 2009)
New Revision: 13121
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java
Log:
- JBPORTAL-2366:
+ RequestProcessor.initInvocation now takes a more specific WSRPPortletInvocationContext as parameter for downstream processing of WindowContext.
+ RequestProcessor.createNavigationalState now uses StateString factory method as it should (which should lead to less duplicated processing).
+ RenderRequestProcessor.initInvocation now remembers which namespace is used for this invocation so that it can be re-written when the markup is processed
without having to bracket it with marker strings.
+ WSRPPortletInvocationContext now provides access to WindowContext so that request processors can know what the namespace is.
+ Use safer namespace generation algorithm.
- Use StateString.JBPNS_PREFIX since it's where the constant is instead of ParametersStateString.
- ActionRequestProcessor.initInvocation doesn't deal with navigational state anymore since it's dealt with in RequestProcessor (less duplicated processing).
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java 2009-04-02 17:50:29 UTC (rev 13120)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java 2009-04-02 18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -27,10 +27,8 @@
import org.apache.commons.fileupload.FileItemStream;
import org.apache.commons.fileupload.FileUpload;
import org.apache.commons.fileupload.util.Streams;
-import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.portlet.OpaqueStateString;
-import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateEvent;
import org.jboss.portal.portlet.StateString;
@@ -102,7 +100,7 @@
if (interactionState != null)
{
String state = interactionState.getStringValue();
- if (!ParametersStateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
+ if (!StateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
{
interactionParams.setInteractionState(state);
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2009-04-02 17:50:29 UTC (rev 13120)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2009-04-02 18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -25,7 +25,6 @@
import org.jboss.logging.Logger;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -149,7 +148,17 @@
protected String getNamespaceFrom(WindowContext windowContext)
{
- return windowContext == null ? null : PortletUtils.generateNamespaceFrom(windowContext.getId());
+ // todo: use URLTools.EncodeForHTMLId when it's available in common
+ if (windowContext != null)
+ {
+ String id = windowContext.getId();
+ id = id.replace('=', '_');
+ id = id.replace('/', '_');
+ id = id.replace('.', '_');
+ return id.replace('+', '_');
+ }
+
+ return null;
}
/**
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2009-04-02 17:50:29 UTC (rev 13120)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2009-04-02 18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -26,7 +26,6 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ContentInfo;
import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -118,7 +117,7 @@
if (navigationalState != null)
{
String state = navigationalState.getStringValue();
- if (!ParametersStateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
+ if (!StateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
{
markupParams.setNavigationalState(state);
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java 2009-04-02 17:50:29 UTC (rev 13120)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java 2009-04-02 18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -29,7 +29,6 @@
import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.state.AccessMode;
import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPTypeFactory;
@@ -107,7 +106,7 @@
return WSRPUtils.getAccessModeFromStateChange(stateChange);
}
- PortletInvocation initInvocation(PortletInvocationContext context)
+ PortletInvocation initInvocation(WSRPPortletInvocationContext context)
{
ActionInvocation invocation = new ActionInvocation(context);
@@ -115,14 +114,10 @@
WSRPRequestContext requestContext = WSRPRequestContext.createRequestContext(markupRequest, interactionParams);
invocation.setRequestContext(requestContext);
- // Interaction state
+ // Interaction state, navigational state is already taken care of in RequestProcessor.prepareInvocation
StateString interactionState = createNavigationalState(interactionParams.getInteractionState());
invocation.setInteractionState(interactionState);
- // Navigational state
- StateString navigationalState = createNavigationalState(getMarkupParams().getNavigationalState());
- invocation.setNavigationalState(navigationalState);
-
// Form parameters
invocation.setForm(requestContext.getForm());
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2009-04-02 17:50:29 UTC (rev 13120)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2009-04-02 18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -24,13 +24,11 @@
package org.jboss.portal.wsrp.producer;
import org.jboss.portal.common.net.URLTools;
-import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.state.AccessMode;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPRewritingConstants;
@@ -60,10 +58,11 @@
{
private static final String EMPTY = "";
private final GetMarkup getMarkup;
+ private String namespace;
public RenderRequestProcessor(WSRPProducerImpl producer, GetMarkup getMarkup) throws UnsupportedMimeTypeFault,
- UnsupportedWindowStateFault, InvalidHandleFault, UnsupportedModeFault, MissingParametersFault,
- InvalidRegistrationFault, OperationFailedFault
+ UnsupportedWindowStateFault, InvalidHandleFault, UnsupportedModeFault, MissingParametersFault,
+ InvalidRegistrationFault, OperationFailedFault
{
super(producer);
this.getMarkup = getMarkup;
@@ -105,8 +104,11 @@
return AccessMode.READ_ONLY;
}
- PortletInvocation initInvocation(PortletInvocationContext context)
+ PortletInvocation initInvocation(WSRPPortletInvocationContext context)
{
+ // MUST match namespace generation used in PortletResponseImpl.getNamespace in portlet module...
+ namespace = PortletUtils.generateNamespaceFrom(context.getWindowContext().getId());
+
return new RenderInvocation(context);
}
@@ -168,11 +170,7 @@
*/
private String processFragmentString(String renderString)
{
- String result = Tools.replaceAllInstancesOfBoundedString(
- renderString,
- PortletUtils.PREFIX,
- PortletUtils.SUFFIX,
- WSRPRewritingConstants.WSRP_REWRITE_TOKEN);
+ String result = renderString.replaceAll(namespace, WSRPRewritingConstants.WSRP_REWRITE_TOKEN);
result = URLTools.replaceURLsBy(result, new AbsoluteURLReplacementGenerator(ServletAccess.getRequest()));
return result;
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2009-04-02 17:50:29 UTC (rev 13120)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2009-04-02 18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -28,14 +28,12 @@
import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.portlet.OpaqueStateString;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.spi.PortalContext;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.spi.SecurityContext;
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
@@ -175,7 +173,7 @@
abstract AccessMode getAccessMode();
- abstract PortletInvocation initInvocation(PortletInvocationContext context);
+ abstract PortletInvocation initInvocation(WSRPPortletInvocationContext context);
abstract Object processResponse(PortletInvocationResponse response);
@@ -358,7 +356,7 @@
}
else
{
- return new OpaqueStateString(navigationalState);
+ return StateString.create(navigationalState);
}
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java 2009-04-02 17:50:29 UTC (rev 13120)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java 2009-04-02 18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -20,6 +20,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
******************************************************************************/
+
package org.jboss.portal.wsrp.producer;
import org.jboss.portal.common.NotYetImplemented;
@@ -159,4 +160,9 @@
invocation.setPortalContext(portalContext);
invocation.setUserContext(userContext);
}
+
+ WindowContext getWindowContext()
+ {
+ return windowContext;
+ }
}
15 years, 6 months
JBoss Portal SVN: r13120 - in branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal: wsrp and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-04-02 13:50:29 -0400 (Thu, 02 Apr 2009)
New Revision: 13120
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
Log:
- JBPORTAL-2355:
+ Do no use & in URLs anymore, use &.
+ Now throws an exception in case a doubly encoded & is ever detected again (so that we can detect them better)
+ Adapted test to change of behavior.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2009-04-02 17:46:59 UTC (rev 13119)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2009-04-02 17:50:29 UTC (rev 13120)
@@ -101,11 +101,15 @@
public void testDoublyEncodedAmpersand()
{
String expected = "wsrp_rewrite?wsrp-urlType=render&amp;wsrp-mode=wsrp:help&amp;wsrp-windowState=wsrp:maximized/wsrp_rewrite";
- WSRPPortletURL url = WSRPPortletURL.create(expected);
-
- assertTrue(url instanceof WSRPRenderURL);
- assertEquals(Mode.HELP, url.getMode());
- assertEquals(WindowState.MAXIMIZED, url.getWindowState());
+ try
+ {
+ WSRPPortletURL.create(expected);
+ fail("Should have thrown an exception on doubly encoded &!");
+ }
+ catch (Exception e)
+ {
+ // expected
+ }
}
/** Relax validation and test that we now accept normally invalid URLs. */
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java 2009-04-02 17:46:59 UTC (rev 13119)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java 2009-04-02 17:50:29 UTC (rev 13120)
@@ -51,19 +51,21 @@
private static final Logger log = Logger.getLogger(WSRPPortletURL.class);
private static final String EQUALS = "=";
+
private static final String ENCODED_AMPERSAND = "&";
private static final String AMPERSAND = "&";
+ private static final String AMP_AMP = "&amp;";
+
private static final String PARAM_SEPARATOR = "|";
-
private static final int URL_TYPE_END = WSRPRewritingConstants.URL_TYPE_NAME.length() + EQUALS.length();
private boolean secure;
+
private Mode mode;
private WindowState windowState;
/** Are we using strict rewriting parameters validation mode? */
private static boolean strict = true;
-
/** Holds extra parameters if we are in relaxed validation mode */
private Map<String, String> extraParams;
/** Remember position of extra parameters wrt end token */
@@ -174,6 +176,10 @@
}
// standardize parameter separators
+ if (encodedURL.contains(AMP_AMP))
+ {
+ throw new IllegalArgumentException(encodedURL + " contains a doubly encoded &!");
+ }
encodedURL = Tools.replace(encodedURL, ENCODED_AMPERSAND, PARAM_SEPARATOR);
encodedURL = Tools.replace(encodedURL, AMPERSAND, PARAM_SEPARATOR);
15 years, 6 months
JBoss Portal SVN: r13119 - branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-04-02 13:46:59 -0400 (Thu, 02 Apr 2009)
New Revision: 13119
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
Log:
- JBPORTAL-2365: make injected services transient as they shouldn't be serialized... A better analysis of the situation is still required.
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2009-04-02 17:43:28 UTC (rev 13118)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2009-04-02 17:46:59 UTC (rev 13119)
@@ -90,28 +90,28 @@
// Wired services
/** . */
- private PortalObjectContainer portalObjectContainer;
+ private transient PortalObjectContainer portalObjectContainer;
/** . */
- private CoordinationConfigurator coordinationService;
+ private transient CoordinationConfigurator coordinationService;
/** . */
- private InstanceContainer instanceContainer;
+ private transient InstanceContainer instanceContainer;
/** . */
- private LayoutService layoutService;
+ private transient LayoutService layoutService;
/** . */
- private ThemeService themeService;
+ private transient ThemeService themeService;
/** . */
- private DomainConfigurator domainConfigurator;
+ private transient DomainConfigurator domainConfigurator;
/** . */
- private RoleModule roleModule;
+ private transient RoleModule roleModule;
/** Listener registry to bind even listener to PortalNodes. */
- private PortalEventListenerRegistry listenerRegistry;
+ private transient PortalEventListenerRegistry listenerRegistry;
// Navigational state
15 years, 6 months
JBoss Portal SVN: r13118 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-04-02 13:43:28 -0400 (Thu, 02 Apr 2009)
New Revision: 13118
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
Log:
- JBPORTAL-2366: Removed bracketing of id by jbpns / snpbj when creating a namespace. This was used to allow re-writing of markup but a better alternative should be implemented now.
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2009-04-02 14:38:44 UTC (rev 13117)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2009-04-02 17:43:28 UTC (rev 13118)
@@ -102,33 +102,23 @@
*/
public static String generateNamespaceFrom(String windowId)
{
- if (windowId.startsWith(PREFIX) && windowId.endsWith(SUFFIX))
+ int length = windowId.length();
+ StringBuffer tmp = new StringBuffer(length + 10);
+ for (int i = windowId.lastIndexOf(SLASH) + 1; i < length; i++)
{
- // we already have a namespaced window id
- return windowId;
- }
- else
- {
- int length = windowId.length();
- StringBuffer tmp = new StringBuffer(PREFIX.length() + SUFFIX.length() + length + 5);
- tmp.append(PREFIX);
- for (int i = windowId.lastIndexOf(SLASH) + 1; i < length; i++)
+ char c = windowId.charAt(i);
+ if (((int)c >= 65 && (int)c <= 90) || ((int)c >= 97 && (int)c <= 122) || ((int)c >= 48 && (int)c <= 57) || ((int)c == 95) || (int)c == 36)
{
- char c = windowId.charAt(i);
- if (((int)c >= 65 && (int)c <= 90) || ((int)c >= 97 && (int)c <= 122) || ((int)c >= 48 && (int)c <= 57) || ((int)c == 95) || (int)c == 36)
- {
- tmp.append(c);
- }
- else
- {
- tmp.append('_');
- tmp.append(Character.forDigit((((int)c) & 0XF0) >> 4, 16));
- tmp.append(Character.forDigit((((int)c) & 0X0F), 16));
- }
+ tmp.append(c);
}
- tmp.append(SUFFIX);
- return tmp.toString();
+ else
+ {
+ tmp.append('_');
+ tmp.append(Character.forDigit((((int)c) & 0XF0) >> 4, 16));
+ tmp.append(Character.forDigit((((int)c) & 0X0F), 16));
+ }
}
+ return tmp.toString();
}
public static <U extends PortletRequest> U unwrap(PortletRequest wrapped, Class<U> unwrapped)
15 years, 6 months
JBoss Portal SVN: r13117 - branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/selenium-rc-server.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-04-02 10:38:44 -0400 (Thu, 02 Apr 2009)
New Revision: 13117
Modified:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/selenium-rc-server/user-extensions.js
Log:
[selenium] - new version of extension; finding in table fix
Modified: branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/selenium-rc-server/user-extensions.js
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/selenium-rc-server/user-extensions.js 2009-04-02 13:55:10 UTC (rev 13116)
+++ branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/selenium-rc-server/user-extensions.js 2009-04-02 14:38:44 UTC (rev 13117)
@@ -7,23 +7,24 @@
for (rowNo=0; rowNo<rowObj.length; rowNo++) {
// No need to read too short rows
var maxCol = rowObj[rowNo].cells.length;
- if (maxCol <= searchCol || maxCol <= minCol) {continue;}
- ///alert("1" + searchText);
- // Read the content of the search colomn
+
+ if (maxCol <= searchCol || maxCol <= minCol)
+ continue;
+
searchHtml = rowObj[rowNo].cells[searchCol].innerHTML;
- //alert("2"+searchHtml);
- // Let's ignore <TD> inside <TD>s.
- // Due to some odd reasons 'm' switch does not work in 'match'
- // - Sumith (10th Dec, 2006)
- if (searchHtml.replace(/\n/g, " ").match(/<TD.*>.*<\/TD>/i)) continue;
- ///alert("3"+searchHtml);
+ searchHtml = searchHtml.replace(/(<([^>]+)>)/ig,"");
+
+ //alert(searchHtml);
+ //if (searchHtml.replace(/\n/g, " ").match(/<TD.*>.*<\/TD>/i))
+ // continue;
+
// Build the pattern to check search column
var searchPat = new RegExp(".*"+searchText+".*", "m");
- //var searchPat = new RegExp("^(.*<[^<>]*>)?\\s*"+searchText+"\\s*(<[^<>]*>.*)?$", "m");
- //alert("4"+"|"+searchText+"|"+searchHtml+"|");
+
// No more processing for unmatched rows
- if (!searchHtml.match(searchPat)) {continue;}
- //alert("5"+"|"+searchText+"|"+searchHtml+"|");
+ if (!searchHtml.match(searchPat))
+ continue;
+
// Got the row! Let's simply return it
return rowNo;
}
15 years, 6 months