JBoss Portal SVN: r10161 - in modules/portlet/trunk: controller/src/main/java/org/jboss/portal/portlet/controller/impl and 29 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-29 18:47:01 -0500 (Fri, 29 Feb 2008)
New Revision: 10161
Added:
modules/portlet/trunk/portal/
modules/portlet/trunk/portal/pom.xml
modules/portlet/trunk/portal/src/
modules/portlet/trunk/portal/src/assembly/
modules/portlet/trunk/portal/src/assembly/simple-portal-jboss42.xml
modules/portlet/trunk/portal/src/build.xml
modules/portlet/trunk/portal/src/main/
modules/portlet/trunk/portal/src/main/java/
modules/portlet/trunk/portal/src/main/java/org/
modules/portlet/trunk/portal/src/main/java/org/jboss/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/InterceptorStackFactoryImpl.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/TestPortletInvoker.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageParameterDef.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PagePortletControllerContext.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalPrepareResponse.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalRenderResponse.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalResponse.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowDef.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowResult.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/AbstractURLTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/Constants.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/HeadersTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/JspWriterResponse.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageParamTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/ParamTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalBodyTagSupport.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalSimpleTagSupport.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletMarkupTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTitleTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletURLTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ExceptionPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/FailDuringInitPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/HeaderPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/NullFilter.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java
modules/portlet/trunk/portal/src/main/resources/
modules/portlet/trunk/portal/src/main/resources/samples/
modules/portlet/trunk/portal/src/main/resources/samples/basic-war/
modules/portlet/trunk/portal/src/main/resources/samples/cart-event-portlet-war/
modules/portlet/trunk/portal/src/main/resources/samples/google-map-portlet-war/
modules/portlet/trunk/portal/src/main/resources/samples/google-weather-portlet-war/
modules/portlet/trunk/portal/src/main/resources/samples/remotecontrol-portlet-war/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/META-INF/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-web.xml
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/images/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/layouts/
modules/portlet/trunk/portal/src/test/
modules/portlet/trunk/portal/src/test/java/
modules/portlet/trunk/portal/src/test/resources/
Removed:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java
modules/portlet/trunk/portal/src/main/resources/samples/basic-war/
modules/portlet/trunk/portal/src/main/resources/samples/cart-event-portlet-war/
modules/portlet/trunk/portal/src/main/resources/samples/google-map-portlet-war/
modules/portlet/trunk/portal/src/main/resources/samples/google-weather-portlet-war/
modules/portlet/trunk/portal/src/main/resources/samples/remotecontrol-portlet-war/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/META-INF/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/images/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/layouts/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/admin/ui/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/
modules/portlet/trunk/test/src/test/resources/portal/samples/
modules/portlet/trunk/test/src/test/resources/simple-portal-war/
Modified:
modules/portlet/trunk/pom.xml
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/portal.tld
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/web.xml
modules/portlet/trunk/test/pom.xml
modules/portlet/trunk/test/src/test/build.xml
Log:
new portal module package for building the simple-portal
Deleted: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java 2008-02-29 17:41:05 UTC (rev 10160)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -1,101 +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.portlet.controller.impl;
-
-import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
-import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
-import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
-import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.io.Serialization;
-import org.jboss.portal.portlet.ContainerURL;
-import org.jboss.portal.portlet.URLFormat;
-import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
-import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class TestPortletInvocationContext extends AbstractPortletInvocationContext
-{
-
- /** . */
- private final PortletURLRenderer urlRenderer;
-
- /** . */
- private final String windowId;
-
- /** . */
- private final HttpServletRequest clientRequest;
-
- /** . */
- private final HttpServletResponse clientResponse;
-
- public TestPortletInvocationContext(
- Serialization<PageNavigationalState> serialization,
- HttpServletRequest clientRequest,
- HttpServletResponse clientResponse,
- String windowId,
- PageNavigationalState pageNavigationalState,
- MarkupInfo markupInfo)
- {
- super(markupInfo);
-
- //
- this.clientRequest = clientRequest;
- this.clientResponse = clientResponse;
- this.windowId = windowId;
- this.urlRenderer = new PortletURLRenderer(pageNavigationalState, clientRequest, clientResponse, serialization);
-
- //
- addResolver(PortletInvocation.PRINCIPAL_SCOPE, new PrincipalAttributeResolver(clientRequest));
- addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(clientRequest));
- }
-
- public String getWindowId()
- {
- return windowId;
- }
-
- public HttpServletRequest getClientRequest() throws IllegalStateException
- {
- return clientRequest;
- }
-
- public HttpServletResponse getClientResponse() throws IllegalStateException
- {
- return clientResponse;
- }
-
- public String renderURL(ContainerURL containerURL, URLFormat format)
- {
- return urlRenderer.renderURL(windowId, containerURL, format);
- }
-}
Modified: modules/portlet/trunk/pom.xml
===================================================================
--- modules/portlet/trunk/pom.xml 2008-02-29 17:41:05 UTC (rev 10160)
+++ modules/portlet/trunk/pom.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -44,6 +44,7 @@
<module>management</module>
<module>mc</module>
<module>test</module>
+ <module>portal</module>
</modules>
</project>
Added: modules/portlet/trunk/portal/pom.xml
===================================================================
--- modules/portlet/trunk/portal/pom.xml (rev 0)
+++ modules/portlet/trunk/portal/pom.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,403 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>portlet-portal</artifactId>
+ <packaging>jar</packaging>
+ <name>Portlet Container Simple Portal</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portlet</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-controller</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portlet</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-mc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-mc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-remote</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-mc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-ant</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>portal-test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>portal-test-generic</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-jdk</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-aop-mc-int</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-classloader</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-container</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-client-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-core-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-structure-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-managed</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-metatype</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>cargo</groupId>
+ <artifactId>cargo-manager</artifactId>
+ <type>war</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.web</groupId>
+ <artifactId>web-web</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>javax.ccpp</groupId>
+ <artifactId>ccpp</artifactId>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-jsr168api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ </dependency>
+
+ <!-- JSTL for Tomcat -->
+ <dependency>
+ <groupId>apache-taglibs</groupId>
+ <artifactId>jstl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>apache-taglibs</groupId>
+ <artifactId>standard</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/simple-portal-jboss42.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+
+<!--
+ <plugin>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-maven2</artifactId>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <testsuites>
+ <testsuite>
+ <config>test/local-jboss-unit.xml</config>
+ </testsuite>
+ </testsuites>
+ <reports>
+ <xml>target/tests/reports/xml/local</xml>
+ <html>target/tests/reports/html/local</html>
+ </reports>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
+ <artifactId>maven-antrun-extended-plugin</artifactId>
+ <version>1.13</version>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-ant</artifactId>
+ <version>${version.jboss.unit}</version>
+ </dependency>
+
+ -->
+<!-- stuff to run servers for tests -->
+<!--
+ <dependency>
+ <groupId>cargo</groupId>
+ <artifactId>cargo-ant</artifactId>
+ <version>${version.cargo}</version>
+ </dependency>
+ <dependency>
+ <groupId>cargo</groupId>
+ <artifactId>cargo-core-uberjar</artifactId>
+ <version>${version.cargo}</version>
+ </dependency>
+
+ </dependencies>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>integration-test</phase>
+ <configuration>
+ <tasks>
+
+ <property name="compile_classpath" refid="maven.compile.classpath"/>
+ <property name="runtime_classpath" refid="maven.runtime.classpath"/>
+ <property name="test_classpath" refid="maven.test.classpath"/>
+ <property name="plugin_classpath" refid="maven.plugin.classpath"/>
+
+ <property name="project.version" value="${project.version}"/>
+
+ <property name="dependency.concurrent.jar"
+ value="${maven.dependency.concurrent.concurrent.jar.path}"/>
+ <property name="dependency.trove.jar" value="${maven.dependency.trove.trove.jar.path}"/>
+ <property name="dependency.jboss-logging-spi.jar"
+ value="${maven.dependency.jboss.jboss-logging-spi.jar.path}"/>
+ <property name="dependency.jboss-logging-jdk.jar"
+ value="${maven.dependency.jboss.jboss-logging-jdk.jar.path}"/>
+ <property name="dependency.jboss-logging-log4j.jar"
+ value="${maven.dependency.jboss.jboss-logging-log4j.jar.path}"/>
+ <property name="dependency.jboss-vfs.jar"
+ value="${maven.dependency.org.jboss.jboss-vfs.jar.path}"/>
+ <property name="dependency.jboss-aop-mc-int.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-aop-mc-int.jar.path}"/>
+ <property name="dependency.jboss-classloader.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-classloader.jar.path}"/>
+ <property name="dependency.jboss-container.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-container.jar.path}"/>
+ <property name="dependency.jboss-dependency.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-dependency.jar.path}"/>
+ <property name="dependency.jboss-deployers-client-spi.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-client-spi.jar.path}"/>
+ <property name="dependency.jboss-deployers-client.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-client.jar.path}"/>
+ <property name="dependency.jboss-deployers-core-spi.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-core-spi.jar.path}"/>
+ <property name="dependency.jboss-deployers-core.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-core.jar.path}"/>
+ <property name="dependency.jboss-deployers-impl.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-impl.jar.path}"/>
+ <property name="dependency.jboss-deployers-spi.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-spi.jar.path}"/>
+ <property name="dependency.jboss-deployers-structure-spi.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-structure-spi.jar.path}"/>
+ <property name="dependency.jboss-deployers-vfs-spi.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-vfs-spi.jar.path}"/>
+ <property name="dependency.jboss-deployers-vfs.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-vfs.jar.path}"/>
+ <property name="dependency.jboss-kernel.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-kernel.jar.path}"/>
+ <property name="dependency.jboss-managed.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss-managed.jar.path}"/>
+ <property name="dependency.jboss-metatype.jar"
+ value="${maven.dependency.org.jboss.microcontainer.jboss.metatype.jar.path}"/>
+ <property name="dependency.jboss-aop.jar"
+ value="${maven.dependency.org.jboss.aop.jboss-aop.jar.path}"/>
+ <property name="dependency.pluggable-instrumentor.jar"
+ value="${maven.dependency.jboss.aop.pluggable-instrumentor.jar.path}"/>
+ <property name="dependency.javassist.jar"
+ value="${maven.dependency.org.jboss.javassist.jar.path}"/>
+ <property name="dependency.jboss-common-core.jar"
+ value="${maven.dependency.org.jboss.jboss-common-core.jar.path}"/>
+ <property name="dependency.resolver.jar"
+ value="${maven.dependency.apache-xerces.resolver.jar.path}"/>
+ <property name="dependency.xercesImpl.jar"
+ value="${maven.dependency.apache-xerces.xercesImpl.jar.path}"/>
+ <property name="dependency.xml-apis.jar"
+ value="${maven.dependency.apache-xerces.xml-apis.jar.path}"/>
+ <property name="dependency.jbossxb.jar" value="${maven.dependency.org.jboss.jbossxb.jar.path}"/>
+ <property name="dependency.jboss-remoting.jar"
+ value="${maven.dependency.jboss.jboss-remoting.jar.path}"/>
+ <property name="dependency.portal-common.jar"
+ value="${maven.dependency.org.jboss.portal.common.common-common.jar.path}"/>
+ <property name="dependency.portal-common-portal.jar"
+ value="${maven.dependency.org.jboss.portal.common.common-portal.jar.path}"/>
+ <property name="dependency.portal-common-mc.jar"
+ value="${maven.dependency.org.jboss.portal.common.common-mc.jar.path}"/>
+ <property name="dependency.jboss-unit.jar"
+ value="${maven.dependency.org.jboss.unit.jboss-unit.jar.path}"/>
+ <property name="dependency.jboss-unit-mc.jar"
+ value="${maven.dependency.org.jboss.unit.jboss-unit-mc.jar.path}"/>
+ <property name="dependency.jboss-unit-remote.jar"
+ value="${maven.dependency.org.jboss.unit.jboss-unit-remote.jar.path}"/>
+ <property name="dependency.portal-test.jar"
+ value="${maven.dependency.org.jboss.unit.portal-test.jar.path}"/>
+ <property name="dependency.portal-test-generic.jar"
+ value="${maven.dependency.org.jboss.unit.portal-test-generic.jar.path}"/>
+ <property name="dependency.log4j.jar" value="${maven.dependency.log4j.log4j.jar.path}"/>
+ <property name="dependency.commons-logging.jar"
+ value="${maven.dependency.commons-logging.commons-logging.jar.path}"/>
+ <property name="dependency.commons-httpclient.jar"
+ value="${maven.dependency.commons-httpclient.commons-httpclient.jar.path}"/>
+ <property name="dependency.activation.jar"
+ value="${maven.dependency.javax.activation.activation.jar.path}"/>
+ <property name="dependency.junit.jar" value="${maven.dependency.junit.junit.jar.path}"/>
+ <property name="dependency.cargo-manager.war"
+ value="${maven.dependency.cargo.cargo-manager.war.path}"/>
+ <property name="dependency.portal-web.jar" value="${maven.dependency.org.jboss.portal.web.web-web.jar.path}"/>
+ -->
+<!--<property name="dependency.jsr168api.jar" value="${maven.dependency.org.jboss.portal.portlet.portlet-jsr168api.jar.path}"/>-->
+<!--
+ <property name="dependency.jsr168api.jar" value="${maven.dependency.javax.portlet.portlet-api.jar.path}"/>
+ <property name="dependency.ccpp.jar" value="${maven.dependency.javax.ccpp.ccpp.jar.path}"/>
+
+ <property name="dependency.portal-portlet.jar" value="${maven.dependency.org.jboss.portal.portlet.portlet-portlet.jar.path}"/>
+ <property name="dependency.portal-portlet-controller.jar" value="${maven.dependency.org.jboss.portal.portlet.portlet-controller.jar.path}"/>
+ <property name="dependency.portal-portlet-mc.jar" value="${maven.dependency.org.jboss.portal.portlet.portlet-mc.jar.path}"/>
+ <property name="dependency.portal-portlet-tests.test-jar" value="${maven.dependency.org.jboss.portal.portlet.portlet-portlet.tests.test-jar.path}"/>
+
+ <property name="dependency.cargo-core-uberjar.jar" value="${maven.dependency.cargo.cargo-core-uberjar.jar.path}"/>
+ <property name="dependency.cargo-ant.jar" value="${maven.dependency.cargo.cargo-ant.jar.path}"/>
+ <property name="dependency.jaxb-api.jar"
+ value="${maven.dependency.javax.xml.bind.jaxb-api.jar.path}"/>
+
+ -->
+<!-- JSTL for Tomcat -->
+<!--
+ <property name="dependency.apache-jstl.jar"
+ value="${maven.dependency.apache-taglibs.jstl.jar.path}"/>
+ <property name="dependency.apache-standard.jar"
+ value="${maven.dependency.apache-taglibs.standard.jar.path}"/>
+
+ <ant antfile="${basedir}/src/test/build.xml">
+ <target name="tests"/>
+ <target name="package-simple-portal"/>
+ <target name="package-tck-portal"/>
+ </ant>
+
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+-->
+ </plugins>
+
+ </build>
+
+</project>
\ No newline at end of file
Added: modules/portlet/trunk/portal/src/assembly/simple-portal-jboss42.xml
===================================================================
--- modules/portlet/trunk/portal/src/assembly/simple-portal-jboss42.xml (rev 0)
+++ modules/portlet/trunk/portal/src/assembly/simple-portal-jboss42.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,68 @@
+<assembly>
+ <id>simple-portal-jboss42</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <baseDirectory>simple-portal</baseDirectory>
+
+ <dependencySets>
+
+ <dependencySet>
+ <includes>
+ <include>org.jboss.portal.common:common-common</include>
+ <include>org.jboss.portal.common:common-portal</include>
+ <include>org.jboss.portal.web:web-web</include>
+ <include>org.jboss.portal.portlet:portlet-portlet</include>
+ <include>javax.portlet:portlet-api</include>
+ <include>javax.ccpp:ccpp</include>
+ <include>javax.xml.bind:jaxb-api</include>
+ </includes>
+ </dependencySet>
+
+ <dependencySet>
+ <outputDirectory>simple-portal.war/WEB-INF/lib</outputDirectory>
+ <includes>
+ <include>org.jboss.portal.common:common-mc</include>
+ <include>org.jboss.portal.portlet:portlet-controller</include>
+ <include>org.jboss.portal.portlet:portlet-mc</include>
+ <include>trove:trove</include>
+ <include>org.jboss:jboss-common-core</include>
+ <include>org.jboss:jboss-vfs</include>
+ <include>org.jboss:javassist</include>
+ <include>org.jboss:jbossxb</include>
+ <include>org.jboss.aop:jboss-aop</include>
+ <include>org.jboss.microcontainer:jboss-aop-mc-int</include>
+ <include>org.jboss.microcontainer:jboss-classloader</include>
+ <include>org.jboss.microcontainer:jboss-dependency</include>
+ <include>org.jboss.microcontainer:jboss-container</include>
+ <include>org.jboss.microcontainer:jboss-deployers-client-spi</include>
+ <include>org.jboss.microcontainer:jboss-deployers-client</include>
+ <include>org.jboss.microcontainer:jboss-deployers-core-spi</include>
+ <include>org.jboss.microcontainer:jboss-deployers-core</include>
+ <include>org.jboss.microcontainer:jboss-deployers-impl</include>
+ <include>org.jboss.microcontainer:jboss-deployers-spi</include>
+ <include>org.jboss.microcontainer:jboss-deployers-structure-spi</include>
+ <include>org.jboss.microcontainer:jboss-deployers-vfs-spi</include>
+ <include>org.jboss.microcontainer:jboss-deployers-vfs</include>
+ <include>org.jboss.microcontainer:jboss-kernel</include>
+ <include>org.jboss.microcontainer:jboss-managed</include>
+ </includes>
+ </dependencySet>
+
+ </dependencySets>
+
+ <fileSets>
+
+ <fileSet>
+ <directory>src/main/resources/simple-portal-war</directory>
+ <outputDirectory>simple-portal.war</outputDirectory>
+ </fileSet>
+
+ <fileSet>
+ <directory>target/classes</directory>
+ <outputDirectory>simple-portal.war/WEB-INF/classes</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+
+</assembly>
Added: modules/portlet/trunk/portal/src/build.xml
===================================================================
--- modules/portlet/trunk/portal/src/build.xml (rev 0)
+++ modules/portlet/trunk/portal/src/build.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,1014 @@
+<?xml version="1.0"?>
+<project name="portlet-integration-test">
+
+ <target name="tests" unless="maven.test.skip">
+ <antcall target="__tests"/>
+ </target>
+
+ <target name="__tests" depends="prepare_env, evaluate_properties" >
+
+ <echo message="compile classpath: ${compile_classpath}"/>
+ <echo message="runtime classpath: ${runtime_classpath}"/>
+ <echo message="test classpath: ${test_classpath}"/>
+ <echo message="plugin classpath: ${plugin_classpath}"/>
+
+ <echo message="You can run small subset of tests using -Dtests=local, -Dtests=jboss or -D=tests=tomcat"/>
+
+ <antcall target="package-tests"/>
+
+ <antcall target="tests.call.single"/>
+ <antcall target="tests.call.all"/>
+
+ </target>
+
+ <target name="tests.call.all" unless="tests">
+ <antcall target="tests.jboss"/>
+ <antcall target="tests.tomcat"/>
+ </target>
+
+ <target name="tests.call.single" if="tests">
+ <antcall target="tests.${tests}"/>
+ </target>
+
+ <target name="prepare_env">
+
+ <!--Relative path to target dir-->
+ <property name="target" value="${basedir}/target"/>
+ <property name="test.temp.dir" value="${target}/test/tmp"/>
+ <property name="test.temp.portlet" value="${test.temp.dir}/portlet-test"/>
+ <property name="test.temp.lib" value="${test.temp.dir}/lib"/>
+
+ <mkdir dir="${test.temp.dir}"/>
+ <mkdir dir="${test.temp.lib}"/>
+ <mkdir dir="${test.temp.portlet}"/>
+ <mkdir dir="${target}/jboss-unit"/>
+
+ <echo message="Preparing environment"/>
+
+ <!--Paths-->
+ <path id="mc.concurrent">
+ <pathelement path="${dependency.concurrent.jar}"/>
+ </path>
+ <path id="mc.trove">
+ <pathelement path="${dependency.trove.jar}"/>
+ </path>
+ <path id="mc.xerces">
+ <pathelement path="${dependency.xercesImpl.jar}"/>
+ <pathelement path="${dependency.resolver.jar}"/>
+ <pathelement path="${dependency.xml-apis.jar}"/>
+ </path>
+ <path id="mc.javassist">
+ <pathelement path="${dependency.javassist.jar}"/>
+ </path>
+ <path id="mc.jboss_common_logging_spi">
+ <pathelement path="${dependency.jboss-logging-spi.jar}"/>
+ </path>
+ <path id="mc.jboss_common_logging_jdk">
+ <pathelement path="${dependency.jboss-logging-jdk.jar}"/>
+ </path>
+ <path id="mc.jboss_common_logging_log4j">
+ <pathelement path="${dependency.jboss-logging-log4j.jar}"/>
+ </path>
+ <path id="mc.jboss_common_core">
+ <pathelement path="${dependency.jboss-common-core.jar}"/>
+ </path>
+ <path id="mc.jboss_vfs">
+ <pathelement path="${dependency.jboss-vfs.jar}"/>
+ </path>
+ <path id="mc.jboss_xb">
+ <pathelement path="${dependency.jbossxb.jar}"/>
+ </path>
+ <path id="mc.jboss_aop">
+ <!--<pathelement path="${dependency.jboss-aop-as4-deployer.jar}"/>-->
+ <!--<pathelement path="${dependency.jboss-aop-deployer-jdk50.jar}"/>-->
+ <!--<pathelement path="${dependency.jboss-aop-jdk50.jar}"/>-->
+ <!--<pathelement path="${dependency.jboss-aop-jdk50-client.jar}"/>-->
+ <!--<pathelement path="${dependency.jboss-standalone-aspect-library-jdk50.jar}"/>-->
+ <!--<pathelement path="${dependency.jrockit-pluggable-instrumentor.jar}"/>-->
+ <!--<pathelement path="${dependency.pluggable-instrumentor.jar}"/>-->
+ <pathelement path="${dependency.jboss-aop.jar}"/>
+
+ </path>
+ <path id="mc.jboss_microcontainer">
+ <pathelement path="${dependency.jboss-aop-mc-int.jar}"/>
+ <pathelement path="${dependency.jboss-classloader.jar}"/>
+ <pathelement path="${dependency.jboss-container.jar}"/>
+ <pathelement path="${dependency.jboss-dependency.jar}"/>
+ <pathelement path="${dependency.jboss-container-metadata.jar}"/>
+ <pathelement path="${dependency.jboss-container-metadata-spi.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-core.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-core-spi.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-client.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-client-spi.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-impl.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-spi.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-structure-spi.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-vfs.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-vfs-spi.jar}"/>
+ <pathelement path="${dependency.jboss-managed.jar}"/>
+ <pathelement path="${dependency.jboss.metatype.jar}"/>
+ <pathelement path="${dependency.jboss-kernel.jar}"/>
+ </path>
+ <path id="mc.portal-common">
+ <pathelement path="${dependency.portal-common-mc.jar}"/>
+ </path>
+ <path id="mc.jboss-unit">
+ <pathelement path="${dependency.jboss-unit.jar}"/>
+ <pathelement path="${dependency.jboss-unit-mc.jar}"/>
+ <pathelement path="${dependency.jboss-unit-remote.jar}"/>
+ <pathelement path="${dependency.portal-test-generic.jar}"/>
+ <pathelement path="${dependency.portal-test.jar}"/>
+ </path>
+ <path id="mc.portal-test-generic">
+ <pathelement path="${dependency.portal-test-generic.jar}"/>
+ </path>
+ <path id="mc.jboss-remoting">
+ <pathelement path="${dependency.jboss-remoting.jar}"/>
+ </path>
+ <path id="mc.log4j">
+ <pathelement path="${dependency.log4j.jar}"/>
+ </path>
+ <path id="mc.portal-portlet">
+ <pathelement path="${dependency.portal-portlet.jar}"/>
+ </path>
+ <path id="mc.portal-portlet-controller">
+ <pathelement path="${dependency.portal-portlet-controller.jar}"/>
+ </path>
+ <path id="mc.portal-portlet-mc">
+ <pathelement path="${dependency.portal-portlet-mc.jar}"/>
+ </path>
+ <path id="mc.jaxb-api">
+ <pathelement path="${dependency.jaxb-api.jar}"/>
+ </path>
+ </target>
+
+ <!--Lets make the check in one place so the build fail in the beggining instead of end-->
+ <target name="evaluate_properties">
+
+ <property environment="env"/>
+
+ <!--If properties are not in command line check if they are set in env-->
+ <condition property="JBOSS_4_2_1_HOME" value="${env.JBOSS_4_2_1_HOME}">
+ <and>
+ <isset property="env.JBOSS_4_2_1_HOME"/>
+ <not>
+ <isset property="JBOSS_4_2_1_HOME"/>
+ </not>
+ </and>
+ </condition>
+ <condition property="JBOSS_4_2_2_HOME" value="${env.JBOSS_4_2_2_HOME}">
+ <and>
+ <isset property="env.JBOSS_4_2_2_HOME"/>
+ <not>
+ <isset property="JBOSS_4_2_2_HOME"/>
+ </not>
+ </and>
+ </condition>
+ <condition property="JBOSS_4_2_0_HOME" value="${env.JBOSS_4_2_0_HOME}">
+ <and>
+ <isset property="env.JBOSS_4_2_0_HOME"/>
+ <not>
+ <isset property="JBOSS_4_2_0_HOME"/>
+ </not>
+ </and>
+ </condition>
+ <condition property="TOMCAT_6_0_HOME" value="${env.TOMCAT_6_0_HOME}">
+ <and>
+ <isset property="env.TOMCAT_6_0_HOME"/>
+ <not>
+ <isset property="TOMCAT_6_0_HOME"/>
+ </not>
+ </and>
+ </condition>
+
+ <fail message="Please set the environment variable JBOSS_4_2_0_HOME, JBOSS_4_2_1_HOME or JBOSS_4_2_2_HOME">
+ <condition>
+ <and>
+ <not>
+ <isset property="JBOSS_4_2_0_HOME"/>
+ </not>
+ <not>
+ <isset property="JBOSS_4_2_1_HOME"/>
+ </not>
+ <not>
+ <isset property="JBOSS_4_2_2_HOME"/>
+ </not>
+ </and>
+ </condition>
+ </fail>
+
+ <fail message="Please set the environment variable TOMCAT_6_0_HOME">
+ <condition>
+ <and>
+ <not>
+ <isset property="TOMCAT_6_0_HOME"/>
+ </not>
+ </and>
+ </condition>
+ </fail>
+
+ </target>
+
+ <macrodef name="package-misc-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr168" testsuitetype="misc" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-ext-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr168" testsuitetype="ext" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-tck-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr168" testsuitetype="tck" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-api-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr168" testsuitetype="api" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-jsr286-tck-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr286" testsuitetype="tck" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-jsr286-api-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr286" testsuitetype="api" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-jsr286-ext-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr286" testsuitetype="ext" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-testsuite">
+ <attribute name="testsuiteversion"/>
+ <attribute name="testsuitetype"/>
+ <attribute name="testsuitename"/>
+ <sequential>
+ <mkdir dir="${test.temp.dir}/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}-war/WEB-INF/classes"/>
+ <copy todir="${test.temp.dir}/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}-war/WEB-INF/classes">
+ <fileset
+ dir="${test.temp.portlet}"
+ includes="org/jboss/portal/test/portlet/@{testsuiteversion}/@{testsuitetype}/common/**"/>
+ <fileset
+ dir="${test.temp.portlet}"
+ includes="org/jboss/portal/test/portlet/@{testsuiteversion}/common/**"/>
+ <fileset
+ dir="${test.temp.portlet}"
+ includes="org/jboss/portal/test/portlet/common/**"/>
+ <fileset
+ dir="${test.temp.portlet}"
+ includes="org/jboss/portal/test/portlet/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}/**"/>
+ <fileset
+ dir="${test.temp.portlet}"
+ includes="org/jboss/portal/test/portlet/framework/**"/>
+ </copy>
+ <copy todir="${test.temp.dir}/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}-war/WEB-INF/lib">
+ <fileset
+ dir="${test.temp.lib}"
+ includes="portal-portlet-test-framework-lib.jar"/>
+ </copy>
+ <copy todir="${test.temp.dir}/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}-war">
+ <fileset
+ dir="${target}/test-classes/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}-war"/>
+ </copy>
+ <jar jarfile="${test.temp.lib}/test-@{testsuiteversion}-@{testsuitetype}-(a){testsuitename}.war">
+ <fileset dir="${test.temp.dir}/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}-war"/>
+ </jar>
+ </sequential>
+ </macrodef>
+
+ <target name="package-tests">
+
+ <unjar src="${dependency.portal-portlet-tests.test-jar}" dest="${test.temp.portlet}"/>
+
+ <!--Portlet test framework lib jar-->
+ <jar jarfile="${test.temp.lib}/portal-portlet-test-framework-lib.jar">
+
+ <!-- -->
+ <fileset dir="${test.temp.portlet}" includes="org/jboss/portal/unit/**"/>
+
+ <!-- JSR 168 TLD -->
+ <zipfileset
+ src="${dependency.portal-portlet.jar}"
+ includes="META-INF/portlet.tld"
+ fullpath="META-INF/portlet.tld"/>
+ <zipfileset
+ src="${dependency.portal-portlet.jar}"
+ includes="META-INF/portlet_2_0.tld"
+ fullpath="META-INF/portlet_2_0.tld"/>
+ </jar>
+
+ <!--<jar jarfile="${test.temp.lib}/test-info.jar">-->
+ <!--<fileset dir="${test.temp.portlet}" includes="org/jboss/portal/test/portlet/info/**"/>-->
+ <!--</jar>-->
+ <!--<jar jarfile="${test.temp.lib}/test-info.war">-->
+ <!--<fileset dir="${target}/test-classes/info/test-info-war"/>-->
+ <!--</jar>-->
+
+
+ <!--<jar jarfile="${test.temp.lib}/test-ha-session.war">-->
+ <!--<fileset dir="${target}/test-classes/ha/test-session-war"/>-->
+ <!--<fileset dir="${target}/test-classes" includes="org/jboss/portal/test/portlet/ha/session/**"/>-->
+ <!--<fileset dir="${target}/test-classes" includes="org/jboss/portal/test/portlet/framework/**"/>-->
+ <!--</jar>-->
+
+ <package-tck-test test="portletinterface"/>
+ <package-tck-test test="dispatcher"/>
+ <package-tck-test test="portletrequests"/>
+ <package-tck-test test="portletmode"/>
+ <package-tck-test test="portletconfig"/>
+ <package-tck-test test="portletresponses"/>
+ <package-tck-test test="preferences"/>
+ <package-tck-test test="portletsession"/>
+ <package-tck-test test="portleturl"/>
+ <package-tck-test test="windowstates"/>
+ <package-tck-test test="portletcontext"/>
+ <package-api-test test="portletconfig"/>
+ <package-api-test test="portletmode"/>
+ <package-api-test test="windowstate"/>
+ <package-api-test test="portletsessionutil"/>
+ <package-api-test test="portalcontext"/>
+ <package-api-test test="portletcontext"/>
+ <package-api-test test="portleturl"/>
+ <package-api-test test="portletpreferences"/>
+ <package-api-test test="portletsession"/>
+ <package-api-test test="actionrequest"/>
+ <package-api-test test="renderrequest"/>
+ <package-api-test test="actionresponse"/>
+ <package-api-test test="renderresponse"/>
+ <package-ext-test test="nocache"/>
+ <package-ext-test test="expiringcache"/>
+ <package-ext-test test="neverexpiringcache"/>
+ <package-ext-test test="preferences"/>
+ <package-ext-test test="session"/>
+ <package-ext-test test="portletresponses"/>
+ <package-ext-test test="portletrequests"/>
+ <package-ext-test test="portletmode"/>
+ <package-ext-test test="portletconfig"/>
+ <package-ext-test test="taglib"/>
+ <package-misc-test test="log4j"/>
+ <package-jsr286-tck-test test="dispatcher"/>
+ <package-jsr286-tck-test test="portletconfig"/>
+ <package-jsr286-tck-test test="portletconfignonamespace"/>
+ <package-jsr286-tck-test test="event"/>
+ <package-jsr286-tck-test test="eventnonamespace"/>
+ <package-jsr286-tck-test test="stateawareresponse"/>
+ <package-jsr286-tck-test test="portletrequests"/>
+ <package-jsr286-tck-test test="resourceserving"/>
+ <package-jsr286-tck-test test="portleturl"/>
+ <package-jsr286-tck-test test="portletfilter"/>
+ <package-jsr286-tck-test test="taglib"/>
+ <package-jsr286-api-test test="event"/>
+ <package-jsr286-api-test test="portleturl"/>
+ <package-jsr286-ext-test test="portletrequests"/>
+ <package-jsr286-ext-test test="portletfilter"/>
+ <package-jsr286-ext-test test="portletresponses"/>
+ <package-jsr286-ext-test test="dispatcher"/>
+ <package-jsr286-ext-test test="portletcontext"/>
+ <package-jsr286-ext-test test="portletinterface"/>
+
+ <!-- -->
+ <jar jarfile="${test.temp.lib}/portlet-test-lib.jar">
+ <fileset dir="${target}/test-classes"/>
+ <fileset dir="${target}/classes"/>
+ </jar>
+
+
+ <!-- JBoss 4.2 portlet-test.war -->
+ <copy todir="${test.temp.dir}/jboss-4.2/portlet-test-war">
+ <fileset dir="${target}/test-classes/portlet-test-war"/>
+ <fileset dir="${target}/test-classes/jboss-4.2/portlet-test-war"/>
+ </copy>
+ <copy todir="${test.temp.dir}/jboss-4.2/portlet-test-war/WEB-INF/lib" flatten="true">
+
+ <!-- -->
+ <fileset dir="${test.temp.lib}" includes="portlet-test-lib.jar"/>
+
+ <!-- -->
+ <path refid="mc.portal-common"/>
+
+ <path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
+
+ <!-- Remote plugin -->
+ <path refid="mc.jboss-remoting"/>
+ <path refid="mc.portal-test-generic"/>
+
+
+ <!-- MC 2.0.0.Beta4 -->
+ <path refid="mc.trove"/>
+ <path refid="mc.javassist"/>
+ <path refid="mc.jboss_common_core"/>
+ <path refid="mc.jboss_vfs"/>
+ <path refid="mc.jboss_xb"/>
+ <path refid="mc.jboss_aop"/>
+ <path refid="mc.jboss_microcontainer"/>
+ <path refid="mc.jaxb-api"/>
+
+ </copy>
+ <mkdir dir="${test.temp.lib}/jboss-4.2"/>
+ <jar jarfile="${test.temp.lib}/jboss-4.2/portlet-test.war">
+ <fileset dir="${test.temp.dir}/jboss-4.2/portlet-test-war"/>
+ </jar>
+
+ <!-- Tomcat 6.0 portlet-test.war -->
+ <copy todir="${test.temp.dir}/tomcat-6.0/portlet-test-war">
+ <fileset dir="${target}/test-classes/portlet-test-war"/>
+ <fileset dir="${target}/test-classes/tomcat-6.0/portlet-test-war"/>
+ </copy>
+ <copy todir="${test.temp.dir}/tomcat-6.0/portlet-test-war/WEB-INF/lib" flatten="true">
+
+ <!-- -->
+ <fileset dir="${test.temp.lib}" includes="portlet-test-lib.jar"/>
+
+ <!-- -->
+ <path refid="mc.portal-common"/>
+
+ <path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
+
+ <!-- Remote plugin -->
+ <path refid="mc.jboss-remoting"/>
+ <path refid="mc.portal-test-generic"/>
+
+ <!-- MC 2.0.0.Beta4 -->
+ <path refid="mc.trove"/>
+ <path refid="mc.xerces"/>
+ <path refid="mc.javassist"/>
+ <path refid="mc.jboss_common_core"/>
+ <path refid="mc.jboss_vfs"/>
+ <path refid="mc.jboss_xb"/>
+ <path refid="mc.jboss_aop"/>
+ <path refid="mc.jboss_microcontainer"/>
+
+ </copy>
+ <mkdir dir="${test.temp.lib}/tomcat-6.0"/>
+ <jar jarfile="${test.temp.lib}/tomcat-6.0/portlet-test.war">
+ <fileset dir="${test.temp.dir}/tomcat-6.0/portlet-test-war"/>
+ </jar>
+
+ <!-- Strip cargo manager war filename-->
+ <copy file="${dependency.cargo-manager.war}" tofile="${test.temp.lib}/manager.war"/>
+
+ </target>
+
+ <target name="cargo.setup">
+ <property name="cargo.log.dir" value="${target}/test/cargo"/>
+ <mkdir dir="${cargo.log.dir}"/>
+ <taskdef resource="cargo.tasks">
+ <classpath>
+ <pathelement path="${plugin_classpath}"/>
+ </classpath>
+ </taskdef>
+ </target>
+
+ <target name="cargo.jboss-4.2.start" depends="cargo.setup">
+ <!-- The lib portal-test-lib.jar must be loaded at the shared level rather than in the war file
+ otherwise it is somehow inspected and produce a NoClassDefFoundError in the web service integration
+ layer on the class org/jboss/portal/test/framework/driver/remote/RemoteTestDriver for some unknown
+ reason, the class initiating the loading of the RemoteTestDriver class is
+ org.jboss.ws.integration.jboss42.DeployerInterceptorJSE.isWebserviceDeployment(DeployerInterceptorJSE.java:84)
+ -->
+
+
+ <cargo
+ containerId="jboss42x"
+ home="${test.jboss-4.2.home}"
+ log="${cargo.log.dir}/cargo.${test.id}.shutdown.log"
+ output="${cargo.log.dir}/cargo.${test.id}.server.log"
+ action="start"
+ wait="${cargo.wait}">
+ <!--<sysproperty key="java.io.tmpdir" value="${target}/cargo-tmp"/>-->
+ <sharedClasspath>
+
+ <path location="${dependency.portal-common.jar}"/>
+ <path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
+
+ <path location="${dependency.jboss-unit.jar}"/>
+ <path location="${dependency.jboss-unit-remote.jar}"/>
+ <path location="${dependency.portal-test.jar}"/>
+
+ </sharedClasspath>
+ <configuration home="${test.jboss-4.2.tempdir}">
+ <property name="cargo.servlet.port" value="8080"/>
+ <property name="cargo.logging" value="high"/>
+ <!--<property name="cargo.jvmargs" value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>-->
+ <deployable type="war" file="${test.temp.lib}/jboss-4.2/portlet-test.war"/>
+ </configuration>
+ </cargo>
+ </target>
+
+ <target name="cargo.jboss-4.2.stop" depends="cargo.setup">
+ <cargo
+ containerId="jboss42x"
+ home="${test.jboss-4.2.home}"
+ log="${cargo.log.dir}/cargo.${test.id}.startup.log"
+ action="stop">
+ <!--<sysproperty key="java.io.tmpdir" value="${target}/cargo-tmp"/>-->
+ <configuration home="${test.jboss-4.2.tempdir}">
+ <property name="cargo.rmi.port" value="1099"/>
+ </configuration>
+ </cargo>
+ </target>
+
+ <target name="tests.jboss-4.2.container-servlet" if="${test.jboss-4.2.home.variable-name}">
+ <echo message="Starting JBoss 4.2 container-servlet tests with ${test.jboss-4.2.home}"/>
+ <antcall target="cargo.jboss-4.2.start">
+ <param name="cargo.wait" value="false"/>
+ <param name="test.spi.server.path" value="${test.archive.path}"/>
+ </antcall>
+ <antcall target="tests.remote">
+ <param name="test.server.name" value="${test.jboss-4.2.name}"/>
+ <param name="test.deploy.name" value="jboss-4.2-container-servlet"/>
+ </antcall>
+ <antcall target="cargo.jboss-4.2.stop">
+ </antcall>
+ </target>
+
+ <target name="tests.jboss-4.2.generic" if="${test.jboss-4.2.home.variable-name}">
+ <echo message="Starting JBoss 4.2 generic tests with ${test.jboss-4.2.home}"/>
+ <antcall target="cargo.jboss-4.2.start">
+ <param name="cargo.wait" value="false"/>
+ <param name="test.spi.server.path" value="${test.archive.path}"/>
+ </antcall>
+ <antcall target="tests.remote">
+ <param name="test.server.name" value="${test.jboss-4.2.name}"/>
+ <param name="test.deploy.name" value="jboss-4.2-generic"/>
+ </antcall>
+ <antcall target="cargo.jboss-4.2.stop">
+ </antcall>
+ </target>
+
+ <target name="tests.jboss-4.2">
+ <antcall target="tests.jboss-4.2.container-servlet">
+ <param name="test.id" value="JBoss-4_2_0-container-servlet"/>
+ <param name="test.jboss-4.2.name" value="RemoteJBoss_4_2_0"/>
+ <param name="test.jboss-4.2.home" value="${JBOSS_4_2_0_HOME}"/>
+ <param name="test.jboss-4.2.home.variable-name" value="JBOSS_4_2_0_HOME"/>
+ <param name="test.jboss-4.2.tempdir" value="${target}/cargo-tmp/4_2_0"/>
+ </antcall>
+ <antcall target="tests.jboss-4.2.container-servlet">
+ <param name="test.id" value="JBoss-4_2_1-container-servlet"/>
+ <param name="test.jboss-4.2.name" value="RemoteJBoss_4_2_1"/>
+ <param name="test.jboss-4.2.home" value="${JBOSS_4_2_1_HOME}"/>
+ <param name="test.jboss-4.2.home.variable-name" value="JBOSS_4_2_1_HOME"/>
+ <param name="test.jboss-4.2.tempdir" value="${target}/cargo-tmp/4_2_1"/>
+ </antcall>
+ <antcall target="tests.jboss-4.2.container-servlet">
+ <param name="test.id" value="JBoss-4_2_2-container-servlet"/>
+ <param name="test.jboss-4.2.name" value="RemoteJBoss_4_2_2"/>
+ <param name="test.jboss-4.2.home" value="${JBOSS_4_2_2_HOME}"/>
+ <param name="test.jboss-4.2.home.variable-name" value="JBOSS_4_2_2_HOME"/>
+ <param name="test.jboss-4.2.tempdir" value="${target}/cargo-tmp/4_2_2"/>
+ </antcall>
+ </target>
+
+ <target name="tests.jboss">
+ <antcall target="tests.jboss-4.2"/>
+ </target>
+
+ <target name="cargo.tomcat-6.start" depends="cargo.setup">
+
+ <taskdef resource="cargo.tasks">
+ <classpath>
+ <pathelement path="${plugin_classpath}"/>
+ </classpath>
+ </taskdef>
+
+ <cargo
+ containerId="tomcat5x"
+ home="${test.tomcat-6.home}"
+ output="${cargo.log.dir}/cargo.${test.id}.server.log"
+ log="${cargo.log.dir}/cargo.${test.id}.start.log"
+ action="start"
+ wait="${cargo.wait}">
+ <sharedClasspath>
+
+ <path location="${dependency.log4j.jar}"/>
+ <path location="${dependency.concurrent.jar}"/>
+ <path location="${dependency.activation.jar}"/>
+ <path location="${dependency.jaxb-api.jar}"/>
+
+ <path refid="mc.jboss_common_logging_spi"/>
+ <path refid="mc.jboss_common_logging_jdk"/>
+
+ <path location="${dependency.portal-common.jar}"/>
+ <path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
+
+ <path location="${dependency.jboss-unit.jar}"/>
+ <path location="${dependency.jboss-unit-remote.jar}"/>
+ <path location="${dependency.portal-test.jar}"/>
+
+ </sharedClasspath>
+ <configuration>
+ <property name="cargo.servlet.port" value="8080"/>
+ <property name="cargo.logging" value="high"/>
+ <!--<property name="cargo.jvmargs" value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9000"/>-->
+ <deployable type="war" file="${test.temp.lib}/manager.war"/>
+ <deployable type="war" file="${test.temp.lib}/tomcat-6.0/portlet-test.war"/>
+ </configuration>
+ </cargo>
+ </target>
+
+ <target name="cargo.tomcat-6.stop" depends="cargo.setup">
+ <cargo
+ containerId="tomcat5x"
+ home="${test.tomcat-6.home}"
+ log="${cargo.log.dir}/cargo.${test.id}.shutdown.log"
+ action="stop">
+ <configuration/>
+ </cargo>
+ </target>
+
+ <target name="tests.tomcat-6.container-servlet" if="${test.tomcat-6.home.variable-name}">
+ <echo message="Starting Tomcat 6 container-servlet tests with ${test.tomcat-6.home}"/>
+ <antcall target="cargo.tomcat-6.start">
+ <param name="cargo.wait" value="false"/>
+ </antcall>
+ <antcall target="tests.remote">
+ <param name="test.server.name" value="RemoteTomcat_6_0"/>
+ </antcall>
+ <antcall target="cargo.tomcat-6.stop"/>
+ </target>
+
+ <target name="tests.tomcat-6">
+ <antcall target="tests.tomcat-6.container-servlet">
+ <param name="test.id" value="Tomcat-6_0-container-servlet"/>
+ <param name="test.tomcat-6.name" value="RemoteTomcat_6_0"/>
+ <param name="test.tomcat-6.home" value="${TOMCAT_6_0_HOME}"/>
+ <param name="test.tomcat-6.home.variable-name" value="TOMCAT_6_0_HOME"/>
+ </antcall>
+ </target>
+
+ <target name="tests.tomcat">
+ <antcall target="tests.tomcat-6"/>
+ </target>
+
+ <target name="tests.remote">
+
+ <taskdef name="jboss-unit" classname="org.jboss.unit.tooling.ant.JBossUnitTask" classpath="${plugin_classpath}"/>
+
+ <jboss-unit jpda="false" jpdaPort="9000" jpdaSuspend="true" failOnError="false">
+
+ <tests config="${target}/test-classes/test/remote-jboss-unit.xml">
+ <property name="archivePath" value="${test.temp.lib}"/>
+ <property name="serverName" value="${test.server.name}"/>
+ </tests>
+
+ <reports>
+ <xml toDir="${target}/tests/reports/xml/${test.server.name}"/>
+ <html toDir="${target}/tests/reports/html/${test.server.name}"/>
+ </reports>
+
+ <classpath>
+ <pathelement location="${target}/classes"/>
+ <pathelement location="${test.temp.lib}"/>
+ <!--<pathelement location="${target}/test-classes"/>-->
+ <pathelement location="${target}/test-classes/test"/>
+ <pathelement path="${test_classpath}"/>
+ </classpath>
+
+ </jboss-unit>
+
+ </target>
+
+
+ <macrodef name="generic-package-simple-portal">
+ <attribute name="server"/>
+ <sequential>
+ <copy todir="@{server}/simple-portal" flatten="true">
+ <path>
+ <path location="${dependency.portal-common.jar}"/>
+ <path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
+ <path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
+ </path>
+ </copy>
+
+ <copy todir="@{server}/simple-portal/simple-portal.war">
+ <fileset dir="${test.temp.dir}/simple-portal-war"/>
+ </copy>
+ </sequential>
+ </macrodef>
+
+ <target name="package-tck-portal" depends="prepare_env">
+
+ <property name="tck" value="${target}/tck"/>
+ <property name="tck-jboss" value="${tck}/jboss42"/>
+ <property name="tck-tomcat" value="${tck}/tomcat6"/>
+
+
+ <mkdir dir="${tck}"/>
+ <mkdir dir="${tck-jboss}"/>
+ <mkdir dir="${tck-tomcat}"/>
+ <!--<mkdir dir="${tck}/tomcat6"/>-->
+
+
+ <jar jarfile="${target}/portlet-test-lib.jar">
+ <fileset dir="${target}/classes" excludes="org/jboss/portal/portlet/portal/samples/**"/>
+ </jar>
+
+ <copy todir="${tck-jboss}/portlet-tck-war">
+ <fileset dir="${target}/test-classes/portlet-tck-war"/>
+ </copy>
+ <copy todir="${tck-jboss}/portlet-tck-war">
+ <fileset dir="${target}/test-classes/jboss-4.2/portlet-tck-war"/>
+ </copy>
+
+ <copy todir="${tck-jboss}/portlet-tck-war/WEB-INF/lib" flatten="true">
+
+ <!-- -->
+ <fileset dir="${target}" includes="portlet-test-lib.jar"/>
+
+ <!-- -->
+ <path refid="mc.portal-common"/>
+
+ <path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
+
+ <!-- Remote plugin -->
+ <path refid="mc.jboss-remoting"/>
+ <path refid="mc.portal-test-generic"/>
+
+
+ <!-- MC 2.0.0.Beta4 -->
+ <path refid="mc.trove"/>
+ <path refid="mc.javassist"/>
+ <path refid="mc.jboss_common_core"/>
+ <path refid="mc.jboss_vfs"/>
+ <path refid="mc.jboss_xb"/>
+ <path refid="mc.jboss_aop"/>
+ <path refid="mc.jboss_microcontainer"/>
+
+
+ </copy>
+
+ <mkdir dir="${tck-jboss}/tck-portal"/>
+
+ <jar jarfile="${tck-jboss}/tck-portal/portlet-tck.war">
+ <fileset dir="${tck-jboss}/portlet-tck-war"/>
+ </jar>
+
+ <copy todir="${tck-jboss}/tck-portal" flatten="true">
+
+ <!--Stuff from shared classpath-->
+ <path location="${dependency.portal-common.jar}"/>
+ <path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
+ <path location="${dependency.jaxb-api.jar}"/>
+
+ <path location="${dependency.jboss-unit.jar}"/>
+ <path location="${dependency.jboss-unit-remote.jar}"/>
+ <path location="${dependency.portal-test.jar}"/>
+
+ </copy>
+
+
+ <!--TOMCAT-->
+
+ <copy todir="${tck-tomcat}/portlet-tck-war">
+ <fileset dir="${target}/test-classes/portlet-tck-war"/>
+ </copy>
+ <copy todir="${tck-tomcat}/portlet-tck-war">
+ <fileset dir="${target}/test-classes/tomcat-6.0/portlet-tck-war"/>
+ </copy>
+
+ <copy todir="${tck-tomcat}/portlet-tck-war/WEB-INF/lib" flatten="true">
+
+ <!-- -->
+ <fileset dir="${target}" includes="portlet-test-lib.jar"/>
+
+ <!-- -->
+ <path refid="mc.portal-common"/>
+
+ <path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
+
+ <!-- Remote plugin -->
+ <path refid="mc.jboss-remoting"/>
+ <path refid="mc.portal-test-generic"/>
+
+ <!-- MC 2.0.0.Beta4 -->
+ <path refid="mc.trove"/>
+ <path refid="mc.xerces"/>
+ <path refid="mc.javassist"/>
+ <path refid="mc.jboss_common_core"/>
+ <path refid="mc.jboss_vfs"/>
+ <path refid="mc.jboss_xb"/>
+ <path refid="mc.jboss_aop"/>
+ <path refid="mc.jboss_microcontainer"/>
+
+
+ </copy>
+
+ <mkdir dir="${tck-tomcat}/tck-portal"/>
+
+ <jar jarfile="${tck-tomcat}/tck-portal/portlet-tck.war">
+ <fileset dir="${tck-tomcat}/portlet-tck-war"/>
+ </jar>
+
+ <copy todir="${tck-tomcat}/tck-portal" flatten="true">
+
+ <!--Stuff from shared classpath-->
+ <path location="${dependency.log4j.jar}"/>
+ <path location="${dependency.concurrent.jar}"/>
+ <path location="${dependency.activation.jar}"/>
+ <path location="${dependency.jaxb-api.jar}"/>
+
+ <path refid="mc.jboss_common_logging_spi"/>
+ <path refid="mc.jboss_common_logging_jdk"/>
+
+ <path location="${dependency.portal-common.jar}"/>
+ <path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
+
+ <path location="${dependency.jboss-unit.jar}"/>
+ <path location="${dependency.jboss-unit-remote.jar}"/>
+ <path location="${dependency.portal-test.jar}"/>
+
+ </copy>
+
+
+
+ <delete file="${target}/portlet-test-lib.jar"/>
+
+ </target>
+
+ <target name="package-simple-portal" depends="prepare_env">
+ <property name="portal.dir" value="${target}/portal"/>
+ <property name="simple.tomcat.dir" value="${portal.dir}/tomcat"/>
+ <property name="simple.as42.dir" value="${portal.dir}/as42"/>
+ <!--<property name="simple.as5.dir" value="${portal.dir}/as5"/>-->
+
+ <delete dir="${portal.dir}"/>
+
+ <mkdir dir="${portal.dir}"/>
+ <mkdir dir="${simple.tomcat.dir}"/>
+ <mkdir dir="${simple.as42.dir}"/>
+ <!--<mkdir dir="${simple.as5.dir}"/>-->
+
+
+ <jar jarfile="${target}/portlet-test-lib.jar">
+ <fileset dir="${target}/classes" excludes="org/jboss/portal/portlet/portal/samples/**"/>
+ </jar>
+
+ <copy todir="${test.temp.dir}/simple-portal-war">
+ <fileset dir="src/test/resources/simple-portal-war"/>
+ </copy>
+
+ <!-- simple-portal.war -->
+ <copy todir="${test.temp.dir}/simple-portal-war/WEB-INF/lib" flatten="true">
+
+ <!-- -->
+ <fileset dir="${target}" includes="portlet-test-lib.jar"/>
+
+
+ <path refid="mc.portal-common"/>
+
+ <!-- MC 2.0.0.Beta4 -->
+ <path refid="mc.trove"/>
+ <path refid="mc.xerces"/>
+ <path refid="mc.javassist"/>
+ <path refid="mc.jboss_common_logging_spi"/>
+ <path refid="mc.jboss_common_logging_jdk"/>
+ <path refid="mc.jboss_common_logging_log4j"/>
+ <path refid="mc.jboss_common_core"/>
+ <path refid="mc.jboss_vfs"/>
+ <path refid="mc.jboss_xb"/>
+ <path refid="mc.jboss_aop"/>
+ <path refid="mc.jboss_microcontainer"/>
+ </copy>
+
+ <!-- AS 4.2 -->
+ <generic-package-simple-portal server="${simple.as42.dir}"/>
+
+ <!-- Tomcat -->
+ <generic-package-simple-portal server="${simple.tomcat.dir}"/>
+ <copy todir="${simple.tomcat.dir}/simple-portal" flatten="true">
+ <path>
+ <pathelement path="${dependency.log4j.jar}"/>
+ <pathelement path="${dependency.activation.jar}"/>
+ <pathelement path="${dependency.apache-jstl.jar}"/>
+ <pathelement path="${dependency.apache-standard.jar}"/>
+ <pathelement path="${dependency.concurrent.jar}"/>
+ <path refid="mc.jboss_common_logging_spi"/>
+ <path refid="mc.jaxb-api"/>
+ </path>
+ </copy>
+ <jar jarfile="${simple.tomcat.dir}/simple-portal.war">
+ <fileset dir="${simple.tomcat.dir}/simple-portal/simple-portal.war"/>
+ </jar>
+ <delete dir="${simple.tomcat.dir}/simple-portal/simple-portal.war"/>
+ <move todir="${simple.tomcat.dir}/copy-to-tomcat-lib">
+ <fileset dir="${simple.tomcat.dir}/simple-portal/"/>
+ </move>
+
+ <!-- AS 5 -->
+ <!--<generic-package-simple-portal server="${simple.as5.dir}"/>-->
+
+ <delete file="${target}/portlet-test-lib.jar"/>
+
+ <antcall target="__package-demo-portlets"/>
+ </target>
+
+ <target name="__package-demo-portlets" depends="prepare_env">
+
+ <property name="samples.target.dir" value="${portal.dir}/samples"/>
+ <property name="samples.tmp.dir" value="${test.temp.dir}/portal"/>
+
+ <mkdir dir="${samples.tmp.dir}"/>
+ <mkdir dir="${samples.target.dir}"/>
+
+ <copy todir="${samples.tmp.dir}/samples-google-map-portlet-war">
+ <fileset dir="src/test/resources/portal/samples/google-map-portlet-war"/>
+ </copy>
+ <copy todir="${samples.tmp.dir}/samples-google-map-portlet-war/WEB-INF/classes">
+ <fileset dir="${target}/classes"
+ includes="org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.class"/>
+ </copy>
+ <jar jarfile="${samples.target.dir}/samples-google-map-portlet.war">
+ <fileset dir="${samples.tmp.dir}/samples-google-map-portlet-war"/>
+ </jar>
+
+ <copy todir="${samples.tmp.dir}/samples-google-weather-portlet-war">
+ <fileset dir="src/test/resources/portal/samples/google-weather-portlet-war"/>
+ </copy>
+ <copy todir="${samples.tmp.dir}/samples-google-weather-portlet-war/WEB-INF/classes">
+ <fileset dir="${target}/classes" includes="org/jboss/portal/portlet/portal/samples/*.class"
+ excludes="org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.class"/>
+ </copy>
+ <jar jarfile="${samples.target.dir}/samples-google-weather-portlet.war">
+ <fileset dir="${samples.tmp.dir}/samples-google-weather-portlet-war"/>
+ </jar>
+
+ <copy todir="${samples.tmp.dir}/samples-remotecontrol-portlet-war">
+ <fileset dir="src/test/resources/portal/samples/remotecontrol-portlet-war"/>
+ </copy>
+ <copy todir="${samples.tmp.dir}/samples-remotecontrol-portlet-war/WEB-INF/classes">
+ <fileset dir="${target}/classes"
+ includes="org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.class"/>
+ </copy>
+ <jar jarfile="${samples.target.dir}/samples-remotecontrol-portlet.war">
+ <fileset dir="${samples.tmp.dir}/samples-remotecontrol-portlet-war"/>
+ </jar>
+
+ <copy todir="${samples.tmp.dir}/samples-cart-event-portlet-war">
+ <fileset dir="src/test/resources/portal/samples/cart-event-portlet-war"/>
+ </copy>
+ <copy todir="${samples.tmp.dir}/samples-cart-event-portlet-war/WEB-INF/classes">
+ <fileset dir="${target}/classes" includes="org/jboss/portal/portlet/portal/samples/event/*.class"/>
+ </copy>
+ <jar jarfile="${samples.target.dir}/samples-cart-event-portlet.war">
+ <fileset dir="${samples.tmp.dir}/samples-cart-event-portlet-war"/>
+ </jar>
+
+ <copy todir="${samples.tmp.dir}/samples-basic-war">
+ <fileset dir="src/test/resources/portal/samples/basic-war"/>
+ </copy>
+ <copy todir="${samples.tmp.dir}/samples-basic-war/WEB-INF/classes">
+ <fileset dir="${target}/classes" includes="org/jboss/portal/portlet/portal/samples/basic/**"/>
+ </copy>
+ <jar jarfile="${samples.target.dir}/samples-basic.war">
+ <fileset dir="${samples.tmp.dir}/samples-basic-war"/>
+ </jar>
+
+ </target>
+
+</project>
\ No newline at end of file
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/InterceptorStackFactoryImpl.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/InterceptorStackFactoryImpl.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/InterceptorStackFactoryImpl.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * 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.portlet.portal;
+
+import org.jboss.portal.common.invocation.Interceptor;
+import org.jboss.portal.common.invocation.InterceptorStack;
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InterceptorStackFactoryImpl implements InterceptorStackFactory
+{
+
+ /** . */
+ private volatile Interceptor[] interceptors;
+
+ /** . */
+ private final InterceptorStackImpl stack = new InterceptorStackImpl();
+
+ public Interceptor[] getInterceptors()
+ {
+ return interceptors;
+ }
+
+ public void setInterceptors(Interceptor[] interceptors)
+ {
+ this.interceptors = interceptors;
+ }
+
+ public InterceptorStack getInterceptorStack()
+ {
+ return stack;
+ }
+
+ private class InterceptorStackImpl implements InterceptorStack
+ {
+
+ public int getLength()
+ {
+ // Avoid dirty reads
+ Interceptor[] interceptors = InterceptorStackFactoryImpl.this.interceptors;
+
+ //
+ return interceptors != null ? interceptors.length : 0;
+ }
+
+ public Interceptor getInterceptor(int i) throws ArrayIndexOutOfBoundsException
+ {
+ // Avoid dirty reads
+ Interceptor[] interceptors = InterceptorStackFactoryImpl.this.interceptors;
+
+ //
+ if (interceptors == null)
+ {
+ throw new ArrayIndexOutOfBoundsException("No interceptors");
+ }
+
+ //
+ return interceptors[i];
+ }
+ }
+}
\ No newline at end of file
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/TestPortletInvoker.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/TestPortletInvoker.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/TestPortletInvoker.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,159 @@
+/******************************************************************************
+ * 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.portlet.portal;
+
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.common.invocation.Invocation;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.InvocationHandler;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.state.DestroyCloneFailure;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.PropertyMap;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A simple consumer.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6712 $
+ */
+public class TestPortletInvoker implements PortletInvoker
+{
+
+ /** . */
+ private InterceptorStackFactory stackFactory;
+
+ /** . */
+ private PortletInvoker producer;
+
+ /** . */
+ private InvocationHandler handler = new InvocationHandler()
+ {
+ public Object invoke(Invocation invocation) throws Exception, InvocationException
+ {
+ PortletInvocation portletInvocation = (PortletInvocation)invocation;
+ try
+ {
+ portletInvocation.setHandler(null);
+ return producer.invoke(portletInvocation);
+ }
+ finally
+ {
+ portletInvocation.setHandler(this);
+ }
+ }
+ };
+
+ public InterceptorStackFactory getStackFactory()
+ {
+ return stackFactory;
+ }
+
+ public void setStackFactory(InterceptorStackFactory stackFactory)
+ {
+ this.stackFactory = stackFactory;
+ }
+
+ public PortletInvoker getProducer()
+ {
+ return producer;
+ }
+
+ public void setProducer(PortletInvoker producer)
+ {
+ this.producer = producer;
+ }
+
+ public Set<Portlet> getPortlets() throws PortletInvokerException
+ {
+ return producer.getPortlets();
+ }
+
+ public Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException
+ {
+ return producer.getPortlet(portletContext);
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
+ {
+ InvocationHandler prevHandler = invocation.getHandler();
+ try
+ {
+ invocation.setHandler(handler);
+ return (PortletInvocationResponse)invocation.invoke(stackFactory.getInterceptorStack());
+ }
+ catch (Exception e)
+ {
+ if (e instanceof PortletInvokerException)
+ {
+ throw (PortletInvokerException)e;
+ }
+ else if (e instanceof RuntimeException)
+ {
+ throw (RuntimeException)e;
+ }
+ else
+ {
+ throw new PortletInvokerException(e);
+ }
+ }
+ finally
+ {
+ invocation.setHandler(prevHandler);
+ }
+ }
+
+ public PortletContext createClone(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public List<DestroyCloneFailure> destroyClones(List<PortletContext> portletContexts) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext, Set keys) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+}
\ No newline at end of file
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,172 @@
+/******************************************************************************
+ * 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.portlet.portal.admin.ui;
+
+import org.jboss.portal.portlet.container.managed.PortletApplicationRegistry;
+import org.jboss.portal.portlet.container.managed.ManagedPortletApplication;
+import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
+import org.jboss.portal.portlet.container.managed.ManagedPortletFilter;
+import org.jboss.portal.portlet.container.managed.ManagedObject;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletURL;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AdminPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, IOException
+ {
+
+ String lifeCycle = req.getParameter("lifecycle");
+
+ //
+ String applicationId = req.getParameter("application");
+
+ //
+ if (applicationId != null)
+ {
+ // Use an alias
+ PortletApplicationRegistry registry = (PortletApplicationRegistry)getPortletContext().getAttribute("PortletApplicationDeployer");
+
+ //
+ ManagedPortletApplication application = registry.getManagedPortletApplication(applicationId);
+ ManagedObject managedObject = application;
+
+ //
+ String containerId = req.getParameter("container");
+ if (containerId != null)
+ {
+ managedObject = application.getManagedPortletContainer(containerId);
+ }
+ else
+ {
+ String filterId = req.getParameter("filter");
+ if (filterId != null)
+ {
+ managedObject = application.getManagedPortletFilter(filterId);
+ }
+ }
+
+ //
+ final ManagedObject tmp = managedObject;
+ if (tmp != null)
+ {
+ if ("start".equals(lifeCycle))
+ {
+ tmp.managedStart();
+ }
+ else if ("stop".equals(lifeCycle))
+ {
+ // Async stop otherwise it is not possible to stop the admin portlet (self deadlock)
+ new Thread()
+ {
+ public void run()
+ {
+ tmp.managedStop();
+ }
+ }.start();
+ }
+ }
+ }
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, IOException
+ {
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ // Use an alias
+ PortletApplicationRegistry registry = (PortletApplicationRegistry)getPortletContext().getAttribute("PortletApplicationDeployer");
+
+ //
+ for (ManagedPortletApplication application : registry.getManagedPortletApplications())
+ {
+ PortletURL url = resp.createActionURL();
+ url.setParameter("application", application.getId());
+
+ //
+ url.setParameter("lifecycle", "stop");
+ String stopURL = url.toString();
+
+ //
+ url.setParameter("lifecycle", "start");
+ String startURL = url.toString();
+
+ //
+ writer.print("<ul><li>Application " + application.getId() + " " + application.getStatus() +
+ " <a href=\"" + startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li><ul>");
+
+ //
+ for (ManagedPortletFilter filter : application.getManagedPortletFilters())
+ {
+ url.setParameter("filter", filter.getId());
+
+ //
+ url.setParameter("lifecycle", "stop");
+ stopURL = url.toString();
+
+ //
+ url.setParameter("lifecycle", "start");
+ startURL = url.toString();
+
+ //
+ writer.print("<li>Filter " + filter.getId() + " " + filter.getStatus() + " <a href=\"" +
+ startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li>");
+ }
+
+ //
+ for (ManagedPortletContainer container : application.getManagedPortletContainers())
+ {
+ url.setParameter("container", container.getId());
+
+ //
+ url.setParameter("lifecycle", "stop");
+ stopURL = url.toString();
+
+ //
+ url.setParameter("lifecycle", "start");
+ startURL = url.toString();
+
+ //
+ writer.print("<li>Container " + container.getId() + " " + container.getStatus() + " <a href=\"" +
+ startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li>");
+ }
+ writer.print("</ul></ul>");
+ }
+
+ //
+ writer.close();
+
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,273 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp;
+
+import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
+import org.jboss.portal.portlet.controller.impl.URLParameterConstants;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.URLFormat;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
+import org.jboss.portal.portlet.controller.PortletController;
+import org.jboss.portal.portlet.controller.request.PortletActionRequest;
+import org.jboss.portal.portlet.controller.impl.request.ControllerRequestFactory;
+import org.jboss.portal.portlet.controller.request.ControllerRequest;
+import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterNames;
+import org.jboss.portal.portlet.controller.response.ControllerResponse;
+import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
+import org.jboss.portal.portlet.controller.response.ResourceResponse;
+import org.jboss.portal.portlet.controller.response.PortletResponse;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.common.util.Base64;
+import org.jboss.portal.web.WebRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletContext;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ControllerFilter implements Filter
+{
+
+ /** . */
+ private FilterConfig config;
+
+ private ServletContext getServletContext()
+ {
+ return config.getServletContext();
+ }
+
+ public void init(FilterConfig config) throws ServletException
+ {
+ this.config = config;
+ }
+
+ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException
+ {
+ try
+ {
+ doFilter((HttpServletRequest)req, (HttpServletResponse)resp, chain);
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new ServletException(e);
+ }
+ }
+
+ public void doFilter(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException, PortletInvokerException
+ {
+ PortletInvoker invoker = (PortletInvoker)getServletContext().getAttribute("ConsumerPortletInvoker");
+
+ //
+ PortalPrepareResponse prepareResponse = new PortalPrepareResponse(req, resp);
+
+ // Discover existing portlets on the page (introspection phase)
+ chain.doFilter(req, prepareResponse);
+
+ // Now we can create a populated context
+ PagePortletControllerContext context = new PagePortletControllerContext(req, resp, invoker, getServletContext(), prepareResponse);
+
+ // The type of invocation
+ String type = req.getParameter(URLParameterConstants.TYPE);
+
+ // Process only portlet type
+ // The request decoded if not null
+ PageNavigationalState pageNavigationalState = null;
+ if (URLParameterConstants.PORTLET_TYPE.equals(type))
+ {
+ WebRequest wr = new WebRequest(req);
+ ControllerRequestFactory factory = new ControllerRequestFactory(context.getPageNavigationalStateSerialization());
+ ControllerRequest request = factory.createRequest(wr);
+
+ ControllerResponse controllerResponse;
+ try
+ {
+ controllerResponse = new PortletController().process(context, request);
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new ServletException(e);
+ }
+
+ //
+ if (controllerResponse instanceof PageUpdateResponse)
+ {
+ PageUpdateResponse pageUpdate = (PageUpdateResponse)controllerResponse;
+
+ // We perform a send redirect on actions
+ if (request instanceof PortletActionRequest)
+ {
+ //
+ PortletURLRenderer renderer = new PortletURLRenderer(
+ pageUpdate.getPageNavigationalState(),
+ context.getClientRequest(),
+ context.getClientResponse(),
+ context.getPageNavigationalStateSerialization());
+
+ //
+ String url = renderer.renderURL(new URLFormat(null, null, true, null));
+
+ //
+ resp.sendRedirect(url);
+
+ //
+ return;
+ }
+ else
+ {
+ pageNavigationalState = pageUpdate.getPageNavigationalState();
+ }
+ }
+ else if (controllerResponse instanceof ResourceResponse)
+ {
+ ResourceResponse resourceResponse = (ResourceResponse)controllerResponse;
+ PortletInvocationResponse pir = resourceResponse.getResponse();
+
+ //
+ if (pir instanceof ContentResponse)
+ {
+ ContentResponse contentResponse = (ContentResponse)pir;
+
+ //
+ if (contentResponse.getType() == ContentResponse.TYPE_EMPTY)
+ {
+ resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
+ }
+ else
+ {
+ String contentType = contentResponse.getContentType();
+ if (contentType != null)
+ {
+ resp.setContentType(contentType);
+ }
+
+ //
+ if (contentResponse.getType() == ContentResponse.TYPE_BYTES)
+ {
+ ServletOutputStream out = null;
+ try
+ {
+ out = resp.getOutputStream();
+ out.write(contentResponse.getBytes());
+ }
+ finally
+ {
+ IOTools.safeClose(out);
+ }
+ }
+ else
+ {
+ Writer writer = null;
+ try
+ {
+ writer = resp.getWriter();
+ writer.write(contentResponse.getChars());
+ }
+ finally
+ {
+ writer.close();
+ }
+ }
+ }
+ }
+ else
+ {
+ // todo
+ }
+
+ //
+ return;
+ }
+ else if (controllerResponse instanceof PortletResponse)
+ {
+ PortletResponse portletResponse = (PortletResponse)controllerResponse;
+ PortletInvocationResponse pir = portletResponse.getResponse();
+
+ //
+ if (pir instanceof ErrorResponse)
+ {
+ ErrorResponse errorResponse = (ErrorResponse)pir;
+
+ //
+ if (errorResponse.getCause() != null)
+ {
+ throw new ServletException(errorResponse.getMessage(), errorResponse.getCause());
+ }
+ else
+ {
+ throw new ServletException(errorResponse.getMessage());
+ }
+ }
+ else
+ {
+ // todo
+ }
+ }
+ else
+ {
+ // todo
+ }
+ }
+ else
+ {
+ PageNavigationalStateSerialization serialization = new PageNavigationalStateSerialization(context.getStateControllerContext());
+ // The nav state provided with the request
+ // Unmarshall portal navigational state if it is provided
+ pageNavigationalState = null;
+ String blah = req.getParameter(ControllerRequestParameterNames.PAGE_NAVIGATIONAL_STATE);
+ if (blah != null)
+ {
+ byte[] bytes = Base64.decode(blah, true);
+ pageNavigationalState = IOTools.unserialize(serialization, SerializationFilter.COMPRESSOR, bytes);
+ }
+ }
+
+ //
+ PortalRenderResponse renderResponse = new PortalRenderResponse(req, resp, context, pageNavigationalState, prepareResponse);
+
+ //
+ chain.doFilter(req, renderResponse);
+ }
+
+ public void destroy()
+ {
+ this.config = null;
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp;
+
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.event.Event;
+import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.info.PortletInfo;
+
+/**
+ * Route events according to the portlets discovered on the page. For now it is pretty trivial.
+ * We could leverage JSP tags to 'wire' portlets on the same page for instance.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageEventControllerContext implements EventControllerContext
+{
+
+ /** . */
+ private final PortalPrepareResponse prepareResponse;
+
+ /** . */
+ private final PagePortletControllerContext context;
+
+ public PageEventControllerContext(
+ PagePortletControllerContext context,
+ PortalPrepareResponse prepareResponse)
+ {
+ this.context = context;
+ this.prepareResponse = prepareResponse;
+ }
+
+ public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
+ {
+ for (String windowId : prepareResponse.getWindowIds())
+ {
+ try
+ {
+ Portlet portlet = context.getPortlet(windowId);
+
+ //
+ if (portlet != null)
+ {
+ PortletInfo portletInfo = portlet.getInfo();
+
+ //
+ if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
+ {
+ Event distributedEvent = new Event(producedEvent.getName(), producedEvent.getPayload(), windowId);
+ session.queueEvent(distributedEvent);
+ }
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ session.interrupt();
+ }
+ }
+ }
+
+ public void eventConsumed(EventPhaseSession session, Event sourceEvent, Event consumedEvent)
+ {
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageParameterDef.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageParameterDef.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageParameterDef.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageParameterDef
+{
+
+ /** . */
+ private QName name;
+
+ /** . */
+ private String value;
+
+ /** . */
+ private boolean frozen;
+
+ public PageParameterDef(QName name, String value, boolean frozen)
+ {
+ this.name = name;
+ this.value = value;
+ this.frozen = frozen;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public boolean isFrozen()
+ {
+ return frozen;
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PagePortletControllerContext.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PagePortletControllerContext.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PagePortletControllerContext.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,169 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp;
+
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
+import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.controller.impl.AbstractPortletControllerContext;
+import org.jboss.portal.web.IllegalRequestException;
+import org.jboss.portal.common.io.Serialization;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PagePortletControllerContext extends AbstractPortletControllerContext
+{
+
+ /** . */
+ private final PageEventControllerContext eventControllerContext;
+
+ /** . */
+ private final StateControllerContext stateControllerContext;
+
+ /** . */
+ private final Serialization<PageNavigationalState> serialization;
+
+ /** . */
+ private final PortalPrepareResponse prepareResponse;
+
+ /** . */
+ private final Map<Key, Portlet> portlets;
+
+ /** . */
+ private final PortletInvoker invoker;
+
+ public PagePortletControllerContext(
+ HttpServletRequest req,
+ HttpServletResponse resp,
+ PortletInvoker invoker,
+ ServletContext servletContext,
+ PortalPrepareResponse prepareResponse)
+ throws IllegalRequestException, IOException, ServletException, PortletInvokerException
+ {
+ super(req, resp);
+
+ //
+ Map<Key, Portlet> portlets = new HashMap<Key, Portlet>();
+ for (Portlet portlet : invoker.getPortlets())
+ {
+ PortletInfo portletInfo = portlet.getInfo();
+ String portletName = portletInfo.getName();
+ String applicationName = portletInfo.getApplicationName();
+ Key key = new Key(applicationName, portletName);
+ portlets.put(key, portlet);
+ }
+
+ //
+ this.invoker = invoker;
+ this.portlets = portlets;
+ this.prepareResponse = prepareResponse;
+ this.stateControllerContext = new StateControllerContextImpl(this);
+ this.eventControllerContext = new PageEventControllerContext(this, prepareResponse);
+ this.serialization = new PageNavigationalStateSerialization(stateControllerContext);
+ }
+
+ public Portlet findPortlet(String applicationName, String portletName)
+ {
+ return portlets.get(new Key(applicationName, portletName));
+ }
+
+ protected Portlet getPortlet(String windowId) throws PortletInvokerException
+ {
+ WindowDef windowDef = prepareResponse.getWindowDef(windowId);
+
+ //
+ return findPortlet(windowDef.getApplicationName(), windowDef.getPortletName());
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
+ {
+ return invoker.invoke(invocation);
+ }
+
+ public PageEventControllerContext getEventControllerContext()
+ {
+ return eventControllerContext;
+ }
+
+ public StateControllerContext getStateControllerContext()
+ {
+ return stateControllerContext;
+ }
+
+ public Serialization<PageNavigationalState> getPageNavigationalStateSerialization()
+ {
+ return serialization;
+ }
+
+ private static class Key
+ {
+
+ /** . */
+ private final String applicationName;
+
+ /** . */
+ private final String portletName;
+
+ private Key(String applicationName, String portletName)
+ {
+ this.applicationName = applicationName;
+ this.portletName = portletName;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof Key)
+ {
+ Key that = (Key)obj;
+ return applicationName.equals(that.applicationName) && portletName.equals(that.portletName);
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return applicationName.hashCode() + portletName.hashCode();
+ }
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalPrepareResponse.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalPrepareResponse.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalPrepareResponse.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,261 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp;
+
+import org.jboss.portal.portlet.PortletInvokerException;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.ServletOutputStream;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.Locale;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalPrepareResponse extends PortalResponse
+{
+
+ /** . */
+ private String contentType;
+
+ /** . */
+ private Locale locale;
+
+ /** . */
+ private String characterEncoding;
+
+ /** . */
+ private int bufferSize;
+
+ /** . */
+ private ServletOutputStream outputStream;
+
+ /** . */
+ private PrintWriter writer;
+
+ /** . */
+ private Map<String, WindowDef> windowDefs;
+
+ /** . */
+ private Map<QName, PageParameterDef> paramDefs;
+
+ public PortalPrepareResponse(HttpServletRequest request, HttpServletResponse response) throws PortletInvokerException
+ {
+ super(request, response);
+
+ //
+ this.windowDefs = new HashMap<String, WindowDef>();
+ this.paramDefs = new HashMap<QName, PageParameterDef>();
+ }
+
+ public Set<String> getWindowIds()
+ {
+ return windowDefs.keySet();
+ }
+
+ public WindowDef getWindowDef(String windowId)
+ {
+ return windowDefs.get(windowId);
+ }
+
+ public void addWindowDef(String windowId, WindowDef portlet)
+ {
+ windowDefs.put(windowId, portlet);
+ }
+
+ public Set<QName> getPageParameterNames()
+ {
+ return paramDefs.keySet();
+ }
+
+ public PageParameterDef getPageParameterDef(QName name)
+ {
+ return paramDefs.get(name);
+ }
+
+ public void setPageParameterDef(PageParameterDef parameterDef)
+ {
+ paramDefs.put(parameterDef.getName(), parameterDef);
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ if (writer != null)
+ {
+ throw new IllegalStateException();
+ }
+ if (outputStream == null)
+ {
+ outputStream = new ServletOutputStream()
+ {
+ public void write(int b) throws IOException
+ {
+ }
+ };
+ }
+ return outputStream;
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ if (outputStream != null)
+ {
+ throw new IllegalStateException();
+ }
+ if (writer == null)
+ {
+ Writer tmp = new Writer()
+ {
+ public void write(char cbuf[], int off, int len) throws IOException
+ {
+ }
+ public void flush() throws IOException
+ {
+ }
+ public void close() throws IOException
+ {
+ }
+ };
+ writer = new PrintWriter(tmp);
+ }
+ return writer;
+ }
+
+ public void flushBuffer() throws IOException
+ {
+ }
+
+ public boolean isCommitted()
+ {
+ return false;
+ }
+
+ public void reset()
+ {
+ }
+
+ public void resetBuffer()
+ {
+ }
+
+ public void sendError(int i, String s) throws IOException
+ {
+ }
+
+ public void sendError(int i) throws IOException
+ {
+ }
+
+ public void sendRedirect(String s) throws IOException
+ {
+ }
+
+ public void addCookie(Cookie cookie)
+ {
+ }
+
+ public void setDateHeader(String s, long l)
+ {
+ }
+
+ public void addDateHeader(String s, long l)
+ {
+ }
+
+ public void setHeader(String s, String s1)
+ {
+ }
+
+ public void addHeader(String s, String s1)
+ {
+ }
+
+ public void setContentType(String contentType)
+ {
+ this.contentType = contentType;
+ }
+
+ public void setContentLength(int i)
+ {
+ }
+
+ public void setCharacterEncoding(String characterEncoding)
+ {
+ this.characterEncoding = characterEncoding;
+ }
+
+ public void setIntHeader(String s, int i)
+ {
+ }
+
+ public void addIntHeader(String s, int i)
+ {
+ }
+
+ public void setStatus(int i)
+ {
+ }
+
+ public void setStatus(int i, String s)
+ {
+ }
+
+ public void setLocale(Locale locale)
+ {
+ this.locale = locale;
+ }
+
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ public String getCharacterEncoding()
+ {
+ return characterEncoding;
+ }
+
+ public void setBufferSize(int bufferSize)
+ {
+ this.bufferSize = bufferSize;
+ }
+
+ public int getBufferSize()
+ {
+ return bufferSize;
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalRenderResponse.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalRenderResponse.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalRenderResponse.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,246 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp;
+
+import org.jboss.portal.portlet.controller.impl.AbstractPortletControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
+import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
+import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
+import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
+import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
+import org.jboss.portal.portlet.impl.spi.AbstractInstanceContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.util.ParameterMap;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.namespace.QName;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalRenderResponse extends PortalResponse
+{
+
+ /** . */
+ private PageNavigationalState pageNavigationalState;
+
+ /** . */
+ private PagePortletControllerContext portletControllerContext;
+
+ /** . */
+ private Map<String, WindowResult> windowResults;
+
+ public PortalRenderResponse(
+ HttpServletRequest request,
+ HttpServletResponse response,
+ PagePortletControllerContext portletControllerContext,
+ PageNavigationalState pageNavigationalState,
+ PortalPrepareResponse prepareResponse) throws PortletInvokerException
+ {
+ super(request, response);
+
+ //
+ Set<QName> pageParameterNames = prepareResponse.getPageParameterNames();
+ if (pageParameterNames.size() > 0)
+ {
+ if (pageNavigationalState == null)
+ {
+ pageNavigationalState = portletControllerContext.getStateControllerContext().createPageNavigationalState(true);
+ }
+ for (QName parameterName : pageParameterNames)
+ {
+ PageParameterDef parameterDef = prepareResponse.getPageParameterDef(parameterName);
+ boolean update = parameterDef.isFrozen() ? true : pageNavigationalState.getPublicNavigationalState(parameterName) == null;
+ if (update)
+ {
+ pageNavigationalState.setPublicNavigationalState(parameterName, new String[]{parameterDef.getValue()});
+ }
+ }
+ }
+
+ //
+ this.portletControllerContext = portletControllerContext;
+ this.windowResults = new HashMap<String, WindowResult>();
+ this.pageNavigationalState = pageNavigationalState;
+
+ //
+ render(prepareResponse);
+ }
+
+ /**
+ * The page state for the rendering.
+ *
+ * @return the page state
+ */
+ public PageNavigationalState getPageNavigationalState()
+ {
+ return pageNavigationalState;
+ }
+
+ public Set<String> getWindowIds()
+ {
+ return windowResults.keySet();
+ }
+
+ public WindowResult getWindowResult(String windowId)
+ {
+ return windowResults.get(windowId);
+ }
+
+ public PagePortletControllerContext getPortletControllerContext()
+ {
+ return portletControllerContext;
+ }
+
+ private PortletInvocationResponse render(Portlet portlet, String windowId) throws PortletInvokerException
+ {
+ WindowNavigationalState windowNS = null;
+ if (pageNavigationalState != null)
+ {
+ windowNS = pageNavigationalState.getWindowNavigationalState(windowId);
+ }
+
+ //
+ ParameterMap publicNS = null;
+ if (pageNavigationalState != null)
+ {
+ publicNS = pageNavigationalState.getPublicNavigationalState(windowId);
+ }
+
+ //
+ Mode mode = Mode.VIEW;
+ WindowState windowState = WindowState.NORMAL;
+ StateString portletNS = null;
+
+ //
+ if (windowNS != null)
+ {
+ if (windowNS.getMode() != null)
+ {
+ mode = windowNS.getMode();
+ }
+ if (windowNS.getWindowState() != null)
+ {
+ windowState = windowNS.getWindowState();
+ }
+ if (windowNS.getPortletNavigationalState() != null)
+ {
+ portletNS = windowNS.getPortletNavigationalState();
+ }
+ }
+
+ //
+ PortletInvocationContext renderContext = portletControllerContext.createPortletInvocationContext(windowId, pageNavigationalState);
+ RenderInvocation render = new RenderInvocation(renderContext);
+ render.setClientContext(new AbstractClientContext(portletControllerContext.getClientRequest()));
+ render.setServerContext(new AbstractServerContext(portletControllerContext.getClientRequest(), portletControllerContext.getClientResponse()));
+ render.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
+ render.setUserContext(new AbstractUserContext(portletControllerContext.getClientRequest()));
+ render.setWindowContext(new AbstractWindowContext(windowId));
+ render.setPortalContext(AbstractPortletControllerContext.PORTAL_CONTEXT);
+ render.setSecurityContext(new AbstractSecurityContext(portletControllerContext.getClientRequest()));
+ render.setTarget(portlet.getContext());
+ render.setMode(mode);
+ render.setWindowState(windowState);
+ render.setNavigationalState(portletNS);
+ render.setPublicNavigationalState(publicNS);
+
+ //
+ return portletControllerContext.invoke(render);
+ }
+
+ private void render(PortalPrepareResponse prepareResponse)
+ {
+ for (String windowId : prepareResponse.getWindowIds())
+ {
+ WindowDef windowDef = prepareResponse.getWindowDef(windowId);
+
+ //
+ try
+ {
+ Portlet portlet = portletControllerContext.getPortlet(windowId);
+
+ //
+ if (portlet != null)
+ {
+ PortletInvocationResponse portletResponse = render(portlet, windowId);
+
+ //
+ WindowResult result = new WindowResult(windowDef, portletResponse);
+
+ //
+ windowResults.put(windowId, result);
+ }
+ else
+ {
+ // log
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public boolean isMaximizedWindow(String windowId)
+ {
+ if (windowId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return windowId.equals(getMaximizedWindowId());
+ }
+
+ public String getMaximizedWindowId()
+ {
+ if (pageNavigationalState != null)
+ {
+ for (String windowId : pageNavigationalState.getWindowIds())
+ {
+ WindowNavigationalState windowNS = pageNavigationalState.getWindowNavigationalState(windowId);
+ if (WindowState.MAXIMIZED.equals(windowNS.getWindowState()))
+ {
+ return windowId;
+ }
+ }
+ }
+
+ //
+ return null;
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalResponse.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalResponse.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalResponse.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp;
+
+import org.jboss.portal.portlet.PortletInvokerException;
+
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Expose stuff common to action and render response.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalResponse extends HttpServletResponseWrapper
+{
+
+ /** . */
+ private int count = 0;
+
+ /** . */
+ private final String pageId;
+
+ public PortalResponse(HttpServletRequest request, HttpServletResponse response) throws PortletInvokerException
+ {
+ super(response);
+
+ // We don't keep a ref to the request since this will be used mainly during in a dispatch to a JSP
+ // and the info returned by a request after a dispatch are not the same than before (like the path info).
+ String pageId = request.getRequestURI();
+
+ //
+ this.pageId = pageId;
+ }
+
+ /**
+ * todo : add on JSP portlet tag a notion of 'id', because this id generation relies on the portlet
+ * rendering order on the page which could not be the same between 2 requests.
+ */
+ public String nextId()
+ {
+ return pageId + "/" + count++;
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowDef.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowDef.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowDef.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import java.util.Set;
+
+/**
+ * Combines the invocation of a portlet and the info on the portlet JSP tag. It does
+ * not need to be exposed out of this package.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class WindowDef
+{
+
+ /** . */
+ private final String portletName;
+
+ /** . */
+ private final String applicationName;
+
+ /** . */
+ private final String windowId;
+
+ /** . */
+ private final Mode initialMode;
+
+ /** . */
+ private final Set<Mode> supportedModes;
+
+ /** . */
+ private final Set<WindowState> supportedWindowStates;
+
+ public WindowDef(
+ String portletName,
+ String applicationName,
+ String windowId,
+ Mode initialMode,
+ Set<Mode> supportedModes,
+ Set<WindowState> supportedWindowStates)
+ {
+ this.portletName = portletName;
+ this.applicationName = applicationName;
+ this.windowId = windowId;
+ this.initialMode = initialMode;
+ this.supportedModes = supportedModes;
+ this.supportedWindowStates = supportedWindowStates;
+ }
+
+ public String getPortletName()
+ {
+ return portletName;
+ }
+
+ public String getApplicationName()
+ {
+ return applicationName;
+ }
+
+ public String getWindowId()
+ {
+ return windowId;
+ }
+
+ public Mode getInitialMode()
+ {
+ return initialMode;
+ }
+
+ public Set<Mode> getSupportedModes()
+ {
+ return supportedModes;
+ }
+
+ public Set<WindowState> getSupportedWindowStates()
+ {
+ return supportedWindowStates;
+ }
+}
\ No newline at end of file
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowResult.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowResult.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowResult.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp;
+
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.portal.jsp.WindowDef;
+
+/**
+ * Combines the invocation of a portlet and the info on the portlet JSP tag. It does
+ * not need to be exposed out of this package.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class WindowResult
+{
+
+ /** . */
+ private final WindowDef windowDef;
+
+ /** . */
+ private final PortletInvocationResponse response;
+
+ public WindowResult(WindowDef windowDef, PortletInvocationResponse response)
+ {
+ this.windowDef = windowDef;
+ this.response = response;
+ }
+
+ public WindowDef getWindowDef()
+ {
+ return windowDef;
+ }
+
+ public PortletInvocationResponse getResponse()
+ {
+ return response;
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/AbstractURLTag.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/AbstractURLTag.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/AbstractURLTag.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+import javax.servlet.jsp.JspException;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AbstractURLTag extends PortalBodyTagSupport
+{
+
+ /** . */
+ protected Map<String, String[]> params = new HashMap<String, String[]>();
+
+ public void setParam(String name, String value)
+ {
+ params.put(name, new String[]{value});
+ }
+
+ public void doInitBody() throws JspException
+ {
+ params.clear();
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/Constants.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/Constants.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/Constants.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+final class Constants
+{
+
+ private Constants()
+ {
+ }
+
+ /** . */
+ public static final String ERROR_STATUS = "org.jboss.portal.portlet.portal.error.status";
+
+ /** . */
+ public static final String ERROR_CAUSE = "org.jboss.portal.portlet.portal.error.cause";
+
+ /** . */
+ public static final String ERROR_MESSAGE = "org.jboss.portal.portlet.portal.error.message";
+
+ /** . */
+ public static final String ERROR_PORTLET_NAME = "org.jboss.portal.portlet.portal.error.portlet_name";
+
+ /** . */
+ public static final String ERROR_APPLICATION_NAME = "org.jboss.portal.portlet.portal.error.application_name";
+
+ /** . */
+ public static final String ERROR_WINDOW_ID = "org.jboss.portal.portlet.portal.error.window_id";
+
+ /** . */
+ public static final String NOT_FOUND = "not_found";
+
+ /** . */
+ public static final String PORTLET_ERROR = "portlet_error";
+
+ /** . */
+ public static final String INTERNAL_ERROR = "internal_error";
+
+ /** . */
+ public static final String UNAVAILABLE = "unavailable";
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/HeadersTag.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/HeadersTag.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/HeadersTag.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,105 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.WindowResult;
+import org.jboss.portal.portlet.portal.jsp.PortalPrepareResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.ResponseProperties;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
+import org.jboss.portal.common.util.MultiValuedPropertyMap;
+import org.jboss.portal.common.xml.XMLTools;
+import org.w3c.dom.Element;
+
+import javax.servlet.jsp.JspException;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class HeadersTag extends PortalSimpleTagSupport
+{
+
+ public HeadersTag()
+ {
+ super(false);
+ }
+
+ public void doTag(PortalPrepareResponse prepareResponse) throws JspException, IOException
+ {
+ }
+
+ public void doTag(PortalRenderResponse renderResponse) throws JspException, IOException
+ {
+ String maxmizedWindowId = renderResponse.getMaximizedWindowId();
+
+ //
+ for (String windowId : renderResponse.getWindowIds())
+ {
+ if (maxmizedWindowId == null || maxmizedWindowId.equals(windowId))
+ {
+ WindowResult result = renderResponse.getWindowResult(windowId);
+
+ //
+ if (result != null)
+ {
+ PortletInvocationResponse response = result.getResponse();
+
+ //
+ if (response instanceof ContentResponse)
+ {
+ ContentResponse fragmentResponse = (ContentResponse)response;
+
+ //
+ ResponseProperties properties = fragmentResponse.getProperties();
+
+ //
+ if (properties != null)
+ {
+ MultiValuedPropertyMap<Element> markupHeaders = properties.getMarkupHeaders();
+ for (String key : markupHeaders.keySet())
+ {
+ List<Element> headElement = markupHeaders.getValues(key);
+ for (Element headerValue : headElement)
+ {
+ try
+ {
+ String serializedElement = XMLTools.toString(headerValue);
+ getJspContext().getOut().print(serializedElement);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/JspWriterResponse.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/JspWriterResponse.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/JspWriterResponse.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.ServletOutputStream;
+import java.io.PrintWriter;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class JspWriterResponse extends HttpServletResponseWrapper
+{
+
+ /** . */
+ private final JspWriter delegate;
+
+ /** . */
+ private final PrintWriter writer;
+
+ public JspWriterResponse(PortalRenderResponse renderResponse, JspWriter delegate)
+ {
+ super(renderResponse);
+
+ //
+ this.delegate = delegate;
+ this.writer = new PrintWriter(delegate);
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ return writer;
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ public void resetBuffer()
+ {
+ try
+ {
+ delegate.clearBuffer();
+ }
+ catch (IOException ignore)
+ {
+ }
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageParamTag.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageParamTag.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageParamTag.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalPrepareResponse;
+import org.jboss.portal.portlet.portal.jsp.PageParameterDef;
+
+import javax.servlet.jsp.JspException;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageParamTag extends PortalSimpleTagSupport
+{
+
+ /** . */
+ private String namespaceURIAttr;
+
+ /** . */
+ private String localNameAttr;
+
+ /** . */
+ private String valueAttr;
+
+ /** . */
+ private String frozenAttr;
+
+ public String getNamespaceURI()
+ {
+ return namespaceURIAttr;
+ }
+
+ public void setNamespaceURI(String namespaceURI)
+ {
+ this.namespaceURIAttr = namespaceURI;
+ }
+
+ public String getLocalName()
+ {
+ return localNameAttr;
+ }
+
+ public void setLocalName(String localName)
+ {
+ this.localNameAttr = localName;
+ }
+
+ public String getValue()
+ {
+ return valueAttr;
+ }
+
+ public void setValue(String value)
+ {
+ this.valueAttr = value;
+ }
+
+ public String getFrozen()
+ {
+ return frozenAttr;
+ }
+
+ public void setFrozen(String frozen)
+ {
+ this.frozenAttr = frozen;
+ }
+
+ public void doTag(PortalRenderResponse renderResponse) throws JspException, IOException
+ {
+ }
+
+ public void doTag(PortalPrepareResponse prepareResponse) throws JspException, IOException
+ {
+ QName name = new QName(namespaceURIAttr, localNameAttr);
+ boolean frozen = "true".equals(frozenAttr);
+ PageParameterDef parameterDef = new PageParameterDef(name, valueAttr, frozen);
+ prepareResponse.setPageParameterDef(parameterDef);
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageTag.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageTag.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageTag.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalPrepareResponse;
+
+import javax.servlet.jsp.JspException;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageTag extends PortalBodyTagSupport
+{
+
+ enum Status
+ {
+ ACTIVE, SUSPENDED
+ }
+
+ /** . */
+ Map<QName, String> params;
+
+ /** . */
+ String maximizedId;
+
+ /** . */
+ String content;
+
+ /** . */
+ Status status = Status.ACTIVE;
+
+ public int doStartTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ maximizedId = renderResponse.getMaximizedWindowId();
+
+ //
+ if (maximizedId != null)
+ {
+ return EVAL_BODY_BUFFERED;
+ }
+ else
+ {
+ return EVAL_BODY_INCLUDE;
+ }
+ }
+
+ public int doEndTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ if (maximizedId != null)
+ {
+ try
+ {
+ pageContext.getOut().write(content);
+ }
+ catch (IOException e)
+ {
+ throw new JspException(e);
+ }
+ }
+
+ //
+ return EVAL_PAGE;
+ }
+
+ public int doStartTag(PortalPrepareResponse portalResponse) throws JspException
+ {
+ return EVAL_BODY_INCLUDE;
+ }
+
+ public int doEndTag(PortalPrepareResponse portalResponse) throws JspException
+ {
+ return EVAL_PAGE;
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/ParamTag.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/ParamTag.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/ParamTag.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import javax.servlet.jsp.JspException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ParamTag extends PortalSimpleTagSupport
+{
+
+ /** . */
+ private String name;
+
+ /** . */
+ private String value;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public void doTag(PortalRenderResponse renderResponse) throws JspException, IOException
+ {
+ AbstractURLTag urlTag = (AbstractURLTag)SimpleTagSupport.findAncestorWithClass(this, AbstractURLTag.class);
+ urlTag.setParam(name, value);
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalBodyTagSupport.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalBodyTagSupport.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalBodyTagSupport.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,133 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalPrepareResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalResponse;
+import org.jboss.portal.common.NotYetImplemented;
+
+import javax.servlet.jsp.tagext.BodyTagSupport;
+import javax.servlet.jsp.JspException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalBodyTagSupport extends BodyTagSupport
+{
+
+ private PortalResponse getPortalResponse()
+ {
+ return (PortalResponse)pageContext.getResponse();
+ }
+
+ public final int doStartTag() throws JspException
+ {
+ return doStartTag(getPortalResponse());
+ }
+
+ public final int doEndTag() throws JspException
+ {
+ return doEndTag(getPortalResponse());
+ }
+
+ public int doStartTag(PortalResponse portalResponse) throws JspException
+ {
+ PageTag pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
+
+ //
+ if (pageTag == null && this instanceof PageTag)
+ {
+ pageTag = (PageTag)this;
+
+ //
+ pageTag.status = PageTag.Status.ACTIVE;
+ }
+
+ //
+ if (pageTag == null || pageTag.status != PageTag.Status.ACTIVE)
+ {
+ return SKIP_BODY;
+ }
+ else
+ {
+ if (portalResponse instanceof PortalPrepareResponse)
+ {
+ return doStartTag((PortalPrepareResponse)portalResponse);
+ }
+ else
+ {
+ return doStartTag((PortalRenderResponse)portalResponse);
+ }
+ }
+ }
+
+ public int doEndTag(PortalResponse portalResponse) throws JspException
+ {
+ PageTag pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
+
+ //
+ if (pageTag == null && this instanceof PageTag)
+ {
+ pageTag = (PageTag)this;
+ }
+
+ //
+ if (pageTag != null && pageTag.status == PageTag.Status.ACTIVE)
+ {
+ if (portalResponse instanceof PortalPrepareResponse)
+ {
+ return doEndTag((PortalPrepareResponse)portalResponse);
+ }
+ else
+ {
+ return doEndTag((PortalRenderResponse)portalResponse);
+ }
+ }
+ else
+ {
+ return EVAL_PAGE;
+ }
+ }
+
+ public int doStartTag(PortalPrepareResponse prepareResponse) throws JspException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public int doEndTag(PortalPrepareResponse prepareResponse) throws JspException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public int doStartTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public int doEndTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ throw new NotYetImplemented();
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalSimpleTagSupport.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalSimpleTagSupport.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalSimpleTagSupport.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,107 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalPrepareResponse;
+import org.jboss.portal.common.NotYetImplemented;
+
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.JspException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalSimpleTagSupport extends SimpleTagSupport
+{
+
+ private final boolean pageScoped;
+
+ public PortalSimpleTagSupport()
+ {
+ this(true);
+ }
+
+ public PortalSimpleTagSupport(boolean pageScoped)
+ {
+ this.pageScoped = pageScoped;
+ }
+
+ public boolean isPageScoped()
+ {
+ return pageScoped;
+ }
+
+ private PortalResponse getPortalResponse()
+ {
+ PageContext pageContext = (PageContext)getJspContext();
+ return (PortalResponse)pageContext.getResponse();
+ }
+
+ protected final boolean isActive()
+ {
+ if (pageScoped)
+ {
+ PageTag pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
+
+ //
+ return pageTag != null && pageTag.status == PageTag.Status.ACTIVE;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ public final void doTag() throws JspException, IOException
+ {
+ if (isActive())
+ {
+ PortalResponse portalResponse = getPortalResponse();
+
+ //
+ if (portalResponse instanceof PortalPrepareResponse)
+ {
+ doTag((PortalPrepareResponse)portalResponse);
+ }
+ else
+ {
+ doTag((PortalRenderResponse)portalResponse);
+ }
+ }
+ }
+
+ public void doTag(PortalPrepareResponse prepareResponse) throws JspException, IOException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void doTag(PortalRenderResponse renderResponse) throws JspException, IOException
+ {
+ throw new NotYetImplemented();
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletMarkupTag.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletMarkupTag.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletMarkupTag.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,90 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
+import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.WindowState;
+
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletMarkupTag extends PortalSimpleTagSupport
+{
+ public void doTag(PortalRenderResponse renderResponse) throws JspException, IOException
+ {
+ PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
+
+ PortletInvocationResponse portletResp = portletTag.result.getResponse();
+
+ JspWriter out = getJspContext().getOut();
+
+ if (portletResp != null)
+ {
+ if (portletResp instanceof ContentResponse)
+ {
+ ContentResponse fragment = (ContentResponse)portletResp;
+ WindowNavigationalState windowNS = null;
+ if (renderResponse.getPageNavigationalState() != null)
+ {
+ windowNS = renderResponse.getPageNavigationalState().getWindowNavigationalState(portletTag.result.getWindowDef().getWindowId());
+ }
+ if (windowNS == null || !windowNS.getWindowState().equals(WindowState.MINIMIZED))
+ {
+ if (fragment.getType() != ContentResponse.TYPE_EMPTY)
+ {
+ String frag;
+ if (fragment.getType() == ContentResponse.TYPE_BYTES)
+ {
+ frag = fragment.getBytes().toString();
+ }
+ else
+ {
+ frag = fragment.getChars();
+ }
+
+ out.write(frag);
+ }
+ }
+ }
+ else
+ {
+ out.write(portletResp.getClass().getSimpleName() + "[" + portletTag.result.getWindowDef().getPortletName() + "," + portletTag.result.getWindowDef().getApplicationName() + "]");
+ out.flush();
+ }
+ }
+ else
+ {
+ out.write("Empty[" + portletTag.result.getWindowDef().getPortletName() + "," + portletTag.result.getWindowDef().getApplicationName() + "]");
+ out.flush();
+ }
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTag.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTag.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTag.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,360 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalPrepareResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalResponse;
+import org.jboss.portal.portlet.portal.jsp.WindowDef;
+import org.jboss.portal.portlet.portal.jsp.WindowResult;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.Tools;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.Collections;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletTag extends PortalBodyTagSupport
+{
+
+ /** . */
+ private static final Set<Mode> DEFAULT_MODES = Collections.unmodifiableSet(Tools.toSet(Mode.VIEW, Mode.EDIT, Mode.HELP));
+
+ /** . */
+ private static final Set<WindowState> DEFAULT_WINDOW_STATES = Collections.unmodifiableSet(Tools.toSet(WindowState.NORMAL, WindowState.MAXIMIZED, WindowState.MINIMIZED));
+
+ /** . */
+ private String nameAttr;
+
+ /** . */
+ private String applicationNameAttr;
+
+ /** . */
+ private String supportedWindowStatesAttr;
+
+ /** . */
+ private String supportedModesAttr;
+
+ /** . */
+ private String initialModeAttr;
+
+ /** . */
+ private String errorPageAttr;
+
+ private Set<WindowState> supportedWindowStates;
+ private Set<Mode> supportedModes;
+ private Mode initialMode;
+ private PageTag pageTag;
+ private String windowId;
+
+ WindowResult result;
+
+ public String getName()
+ {
+ return nameAttr;
+ }
+
+ public void setName(String name)
+ {
+ this.nameAttr = name;
+ }
+
+ public String getApplicationName()
+ {
+ return applicationNameAttr;
+ }
+
+ public void setApplicationName(String applicationName)
+ {
+ this.applicationNameAttr = applicationName;
+ }
+
+ public String getSupportedWindowStates()
+ {
+ return supportedWindowStatesAttr;
+ }
+
+ public void setSupportedWindowStates(String supportedWindowStates)
+ {
+ this.supportedWindowStatesAttr = supportedWindowStates;
+ }
+
+ public String getSupportedModes()
+ {
+ return supportedModesAttr;
+ }
+
+ public void setSupportedModes(String supportedModes)
+ {
+ this.supportedModesAttr = supportedModes;
+ }
+
+ public String getInitialMode()
+ {
+ return initialModeAttr;
+ }
+
+ public void setInitialMode(String initialMode)
+ {
+ this.initialModeAttr = initialMode;
+ }
+
+ public String getErrorPage()
+ {
+ return errorPageAttr;
+ }
+
+ public void setErrorPage(String errorPage)
+ {
+ this.errorPageAttr = errorPage;
+ }
+
+ private void initState(PortalResponse portalResponse)
+ {
+ //
+ Set<Mode> supportedModes = new LinkedHashSet<Mode>();
+ if (supportedModesAttr != null)
+ {
+ for (String supportedModeValue : supportedModesAttr.split(","))
+ {
+ Mode mode = Mode.create(supportedModeValue.trim());
+ supportedModes.add(mode);
+ }
+ }
+ else
+ {
+ supportedModes = DEFAULT_MODES;
+ }
+
+ //
+ Set<WindowState> supportedWindowStates = new LinkedHashSet<WindowState>();
+ if (supportedWindowStatesAttr != null)
+ {
+ for (String supportedWindowStateValue : supportedWindowStatesAttr.split(","))
+ {
+ WindowState windowState = WindowState.create(supportedWindowStateValue.trim());
+ supportedWindowStates.add(windowState);
+ }
+ }
+ else
+ {
+ supportedWindowStates = DEFAULT_WINDOW_STATES;
+ }
+
+ //
+ Mode initialMode = Mode.VIEW;
+ if (initialModeAttr != null)
+ {
+ initialMode = Mode.create(initialModeAttr.trim());
+ }
+
+ //
+ String windowId = portalResponse.nextId();
+
+ //
+ this.initialMode = initialMode;
+ this.supportedModes = supportedModes;
+ this.supportedWindowStates = supportedWindowStates;
+ this.pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
+ this.windowId = windowId;
+ }
+
+ private void destroyState()
+ {
+ this.initialMode = null;
+ this.supportedModes = null;
+ this.supportedWindowStates = null;
+ this.pageTag = null;
+ this.windowId = null;
+ }
+
+ public int doStartTag(PortalPrepareResponse prepareResponse) throws JspException
+ {
+ initState(prepareResponse);
+
+ //
+ WindowDef windowDef = new WindowDef(nameAttr, applicationNameAttr, windowId, initialMode, supportedModes, supportedWindowStates);
+
+ //
+ prepareResponse.addWindowDef(windowId, windowDef);
+
+ //
+ return SKIP_BODY;
+ }
+
+ public int doEndTag(PortalPrepareResponse prepareResponse) throws JspException
+ {
+ destroyState();
+
+ //
+ return EVAL_PAGE;
+ }
+
+ public int doStartTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ initState(renderResponse);
+
+ //
+ WindowResult result = renderResponse.getWindowResult(windowId);
+
+ //
+ if (result == null || result.getResponse() == null)
+ {
+ handleError(renderResponse, Constants.NOT_FOUND, null, null);
+
+ // We cannot show an absent portlet, no meta data
+ return SKIP_BODY;
+ }
+ else
+ {
+ if (pageTag.maximizedId != null)
+ {
+ if (windowId.equals(pageTag.maximizedId))
+ {
+ return render(renderResponse, result, EVAL_BODY_BUFFERED);
+ }
+ else
+ {
+ return SKIP_BODY;
+ }
+ }
+ else
+ {
+ return render(renderResponse, result, EVAL_BODY_INCLUDE);
+ }
+ }
+ }
+
+ public int doEndTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ if (bodyContent != null)
+ {
+ pageTag.content = bodyContent.getString();
+ }
+
+ //
+ destroyState();
+
+ //
+ return EVAL_PAGE;
+ }
+
+ public int render(PortalRenderResponse renderResponse, WindowResult result, int rt)
+ {
+ PortletInvocationResponse portletResponse = result.getResponse();
+
+ //
+ if (portletResponse instanceof ContentResponse)
+ {
+ this.result = result;
+ //
+ return rt;
+ }
+ else if (portletResponse instanceof ErrorResponse)
+ {
+ ErrorResponse error = (ErrorResponse)portletResponse;
+
+ //
+ handleError(renderResponse, Constants.PORTLET_ERROR, error.getCause(), error.getMessage());
+
+ //
+ return SKIP_BODY;
+ }
+ else if (portletResponse instanceof UnavailableResponse)
+ {
+ handleError(renderResponse, Constants.UNAVAILABLE, null, null);
+
+ //
+ return SKIP_BODY;
+ }
+ else
+ {
+ handleError(renderResponse, Constants.INTERNAL_ERROR, null, null);
+
+ //
+ return SKIP_BODY;
+ }
+ }
+
+ private void handleError(PortalRenderResponse renderResponse, String errorStatus, Throwable cause, String message)
+ {
+ if (errorPageAttr != null)
+ {
+ RequestDispatcher rd = pageContext.getServletContext().getRequestDispatcher(errorPageAttr);
+ if (rd != null)
+ {
+ ServletRequest request= pageContext.getRequest();
+
+ //
+ try
+ {
+ pageTag.status = PageTag.Status.SUSPENDED;
+ request.setAttribute(Constants.ERROR_STATUS, errorStatus);
+ request.setAttribute(Constants.ERROR_CAUSE, cause);
+ request.setAttribute(Constants.ERROR_MESSAGE, message);
+ request.setAttribute(Constants.ERROR_WINDOW_ID, windowId);
+ request.setAttribute(Constants.ERROR_APPLICATION_NAME, applicationNameAttr);
+ request.setAttribute(Constants.ERROR_PORTLET_NAME, nameAttr);
+
+ //
+ rd.include(pageContext.getRequest(), new JspWriterResponse(renderResponse, pageContext.getOut()));
+ }
+ catch (ServletException e)
+ {
+ // Shall we do smth else ?
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ // Shall we do smth else ?
+ e.printStackTrace();
+ }
+ finally
+ {
+ pageTag.status = PageTag.Status.ACTIVE;
+ request.removeAttribute(Constants.ERROR_STATUS);
+ request.removeAttribute(Constants.ERROR_CAUSE);
+ request.removeAttribute(Constants.ERROR_MESSAGE);
+ request.removeAttribute(Constants.ERROR_WINDOW_ID);
+ request.removeAttribute(Constants.ERROR_APPLICATION_NAME);
+ request.removeAttribute(Constants.ERROR_PORTLET_NAME);
+ }
+ }
+ }
+ }
+
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTitleTag.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTitleTag.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTitleTag.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletTitleTag extends PortalSimpleTagSupport
+{
+
+ public void doTag(PortalRenderResponse renderResponse) throws JspException, IOException
+ {
+
+ PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
+
+ PortletInvocationResponse portletResp = portletTag.result.getResponse();
+
+ JspWriter out = getJspContext().getOut();
+
+ if (portletResp instanceof FragmentResponse)
+ {
+ FragmentResponse fragment = (FragmentResponse)portletResp;
+ out.write(fragment.getTitle());
+ }
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletURLTag.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletURLTag.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletURLTag.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,145 @@
+/******************************************************************************
+ * 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.portlet.portal.jsp.taglib;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.PagePortletControllerContext;
+import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.URLFormat;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import java.util.Map;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletURLTag extends AbstractURLTag
+{
+
+ /** . */
+ private String modeValue;
+
+ /** . */
+ private String windowStateValue;
+
+ public String getMode()
+ {
+ return modeValue;
+ }
+
+ public void setMode(String mode)
+ {
+ this.modeValue = mode;
+ }
+
+ public String getWindowState()
+ {
+ return windowStateValue;
+ }
+
+ public void setWindowState(String windowState)
+ {
+ this.windowStateValue = windowState;
+ }
+
+ public int doStartTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ return EVAL_BODY_BUFFERED;
+ }
+
+ public int doEndTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ PagePortletControllerContext context = renderResponse.getPortletControllerContext();
+ PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
+
+ Mode mode = null;
+ if (modeValue != null)
+ {
+ mode = Mode.create(modeValue.trim());
+ }
+
+ //
+ WindowState windowState = null;
+ if (windowStateValue != null)
+ {
+ windowState = WindowState.create(windowStateValue.trim());
+ }
+
+ PortletURLRenderer renderer = new PortletURLRenderer(
+ renderResponse.getPageNavigationalState(),
+ context.getClientRequest(),
+ context.getClientResponse(),
+ context.getPageNavigationalStateSerialization());
+
+ final WindowState ws = windowState;
+ final Mode md = mode;
+
+ RenderURL url = new RenderURL()
+ {
+
+
+ public StateString getNavigationalState()
+ {
+ return null;
+ }
+
+ public Map<String, String[]> getPublicNavigationalStateChanges()
+ {
+ return params;
+ }
+
+ public Mode getMode()
+ {
+ return md;
+ }
+
+ public WindowState getWindowState()
+ {
+ return ws;
+ }
+ };
+
+ try
+ {
+ JspWriter out = pageContext.getOut();
+ String renderedURL = renderer.renderURL(portletTag.result.getWindowDef().getWindowId(), url, new URLFormat(null, null, true, null));
+ out.write(renderedURL);
+ }
+ catch (IOException e)
+ {
+ throw new JspException(e);
+ }
+
+ //
+ return EVAL_PAGE;
+ }
+
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,178 @@
+/******************************************************************************
+ * 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.portlet.portal.samples;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.net.URLConnection;
+
+/**
+ * A simple portlet using Google's search services to extract interesting information (weather, map, ...) from first
+ * result.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 9912 $
+ */
+public class GoogleClippingPortlet extends GenericPortlet
+{
+ protected static final String A = "<a";
+ private static final String A_TARGET_BLANK = "<a target='_blank'";
+ private static final String ZIP = "zipcode";
+ private static final String SAN_FRAN = "94102";
+ private static final String GOOGLE = "http://www.google.com/search?q=";
+
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ String zip = getZipCode(renderRequest);
+
+ String query = getQueryString(zip);
+
+ URL url = new URL(query);
+
+ URLConnection connection = url.openConnection();
+ connection.setRequestProperty("User-Agent", "Mozilla/5.0");
+
+ BufferedInputStream in = new BufferedInputStream(connection.getInputStream());
+ String html = new String(getBytes(in, 16384), "UTF-8");
+ in.close();
+
+ String beg = "<div class=e>";
+ String end = "</table>";
+ int begIndex = html.indexOf(beg);
+ if (begIndex != -1)
+ {
+ // extract table containing specific first result
+ int endIndex = html.indexOf(end, begIndex);
+ html = html.substring(begIndex + beg.length(), endIndex + end.length());
+
+ html = postProcessHTML(html);
+
+ renderResponse.setContentType("text/html");
+ PrintWriter printWriter = renderResponse.getWriter();
+ printWriter.print(html);
+ }
+ }
+
+ protected String getZipCode(RenderRequest renderRequest)
+ {
+ String zip = renderRequest.getParameter(ZIP);
+ if (zip == null)
+ {
+ zip = renderRequest.getPreferences().getValue(ZIP, SAN_FRAN);
+ }
+ return zip;
+ }
+
+ @Override
+ protected void doEdit(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ renderResponse.getWriter().print(
+ "<div align='center'>\n" +
+ " <br/>\n" +
+ " <font class='portlet-font'>Change Location:</font>\n" +
+ "\n" +
+ " <form method='post' action='" + renderResponse.createActionURL() + "'\n" +
+ " <font class='portlet-font'>Zip Code:</font><br/>\n" +
+ " <input class='portlet-form-input-field' type='text' value='' size='12' name='" + ZIP + "'/>\n" +
+ " <br/>\n" +
+ " <input class='portlet-form-input-field' type='submit' name='submit' value='submit'>\n" +
+ " </form>\n" +
+ "</div>");
+ }
+
+ @Override
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
+ {
+ String zip = actionRequest.getParameter(ZIP);
+
+ if (null != zip)
+ {
+ PortletPreferences prefs = actionRequest.getPreferences();
+ prefs.setValue(ZIP, zip);
+ prefs.store();
+ }
+
+ // set zip as render parameter
+ actionResponse.setRenderParameter(ZIP, zip);
+
+ // request view
+ actionResponse.setPortletMode(PortletMode.VIEW);
+ }
+
+ protected String postProcessHTML(String html)
+ {
+ // links should open in new windows
+ html = html.replaceAll(A, A_TARGET_BLANK);
+
+ // src attributes should be absolute
+ html = html.replaceAll("src=/", "src=http://google.com/");
+ html = html.replaceAll("src=\"/", "src=\"http://google.com/");
+
+ // forms should open in new windows and have an absolute action URL
+ html = html.replaceAll("action=\"/", "target='_blank' action=\"http://google.com/");
+
+ return html;
+ }
+
+ protected String getQueryString(String zip)
+ {
+ return GOOGLE + zip;
+ }
+
+ private byte[] getBytes(InputStream in, int bufferSize) throws IOException, IllegalArgumentException
+ {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ byte[] buffer = new byte[bufferSize];
+ while (true)
+ {
+ int i = in.read(buffer);
+ if (i == 0)
+ {
+ continue;
+ }
+ if (i == -1)
+ {
+ break;
+ }
+ out.write(buffer, 0, i);
+ }
+ return out.toByteArray();
+ }
+
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.portlet.portal.samples;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 9912 $
+ */
+public class GoogleWeatherClippingPortlet extends GoogleClippingPortlet
+{
+ private final static String WEATHER_URL = "http://www.google.com/search?q=weather+";
+ private static final String A_END = "</a>";
+
+ protected String getQueryString(String zip)
+ {
+ return WEATHER_URL + zip;
+ }
+
+ protected String postProcessHTML(String html)
+ {
+ int begIndex;
+ int endIndex;
+
+ // remove add to iGoogle link
+ begIndex = html.indexOf(A);
+ if (begIndex != -1)
+ {
+ endIndex = html.indexOf(A_END, begIndex);
+ html = html.substring(0, begIndex) + html.substring(endIndex + A_END.length());
+ }
+
+ return super.postProcessHTML(html);
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2008, Your Corporation. All Rights Reserved.
+ */
+
+package org.jboss.portal.portlet.portal.samples;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceURL;
+import javax.portlet.WindowState;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 9979 $
+ */
+public class RemoteControlResourcePortlet extends GenericPortlet
+{
+ private static final String ZIPCODE = "zipcode";
+
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ PrintWriter printWriter = renderResponse.getWriter();
+ String namespace = renderResponse.getNamespace();
+ printWriter.print("<script type='text/javascript'>function " + namespace
+ + "_openRemote(url){window.name='" + namespace + "_parent';window.open(url, '" + namespace
+ + "_remote', 'width=400,height=200,scrollable=yes')}</script>");
+ printWriter.print("<p><a href='#' onclick=\"" + namespace + "_openRemote('");
+ ResourceURL resource = renderResponse.createResourceURL();
+ printWriter.print(resource);
+ printWriter.print("')\">Open remote control!</a></p>");
+ }
+
+ @Override
+ public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws PortletException, IOException
+ {
+ resourceResponse.setContentType("text/html");
+ PrintWriter writer = resourceResponse.getWriter();
+ String namespace = resourceResponse.getNamespace();
+ writer.print("<html><head><script type='text/javascript'>function openLinkInParent(url){window.open(url,'"
+ + namespace + "_parent');}</script>\n<link rel=\"stylesheet\" href='/simple-portal/css/master.css' type=\"text/css\"/></head><body>");
+ PortletURL url = resourceResponse.createRenderURL();
+ url.setWindowState(WindowState.MINIMIZED);
+ writer.print("<div class=\"remote-container\"><ul><li><a href='#' onclick=\"" + createParentURL(url) + "\"><img\n" +
+ " src=\"/simple-portal/images/icon-minimize.gif\" alt=\"\"/> minimize parent portlet</a></li>");
+ url.setWindowState(WindowState.MAXIMIZED);
+ writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\"><img\n" +
+ " src=\"/simple-portal/images/icon-maximize.gif\" alt=\"\"/> maximize parent portlet</a></li>");
+ url.setWindowState(WindowState.NORMAL);
+ writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\"><img\n" +
+ " src=\"/simple-portal/images/icon-normal.gif\" alt=\"\"/> make parent portlet normal</a></li></ul>");
+ writer.print("<br/><ul><li><b>'zipcode'</b> public render parameter value: " + resourceRequest.getParameter(ZIPCODE) + "<br/>");
+ writer.print("Set value of <b>'zipcode'</b> public render parameter to:</li>");
+ url.setParameter(ZIPCODE, "80201");
+ writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">Denver, CO</a>");
+ url.setParameter(ZIPCODE, "94102");
+ writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">San Francisco, CA</a>");
+ url.setParameter(ZIPCODE, "20001");
+ writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">Washington, DC</a>");
+ writer.print("</ul></div></body></html>");
+ }
+
+ private String createParentURL(PortletURL url)
+ {
+ return "openLinkInParent('" + url + "')";
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ExceptionPortlet.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ExceptionPortlet.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ExceptionPortlet.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * 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.portlet.portal.samples.basic;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletRequest;
+import javax.portlet.ActionRequest;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.ActionResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ExceptionPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ throwException(req);
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ throwException(req);
+
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ PortletURL renderURL = resp.createRenderURL();
+ PortletURL actionURL = resp.createActionURL();
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Throw :</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ renderURL.setParameter("op", "portletexception");
+ writer.write("<div><a href=\"" + renderURL + "\">render PortletException</a></div>");
+ renderURL.setParameter("op", "portletsecurityexception");
+ writer.write("<div><a href=\"" + renderURL + "\">render PortletSecurityException</a></div>");
+ renderURL.setParameter("op", "ioexception");
+ writer.write("<div><a href=\"" + renderURL + "\">render IOException</a></div>");
+ renderURL.setParameter("op", "runtimeexception");
+ writer.write("<div><a href=\"" + renderURL + "\">render RuntimeException</a></div>");
+ actionURL.setParameter("op", "error");
+ writer.write("<div><a href=\"" + renderURL + "\">render Error</a></div>");
+ actionURL.setParameter("op", "portletexception");
+ writer.write("<div><a href=\"" + actionURL + "\">action PortletException</a></div>");
+ actionURL.setParameter("op", "portletsecurityexception");
+ writer.write("<div><a href=\"" + actionURL + "\">action PortletSecurityException</a></div>");
+ actionURL.setParameter("op", "ioexception");
+ writer.write("<div><a href=\"" + actionURL + "\">action IOException</a></div>");
+ actionURL.setParameter("op", "runtimeexception");
+ writer.write("<div><a href=\"" + actionURL + "\">action RuntimeException</a></div>");
+ actionURL.setParameter("op", "error");
+ writer.write("<div><a href=\"" + actionURL + "\">action Error</a></div>");
+ writer.write("</div>");
+ writer.write("</p>");
+ }
+
+ private void throwException(PortletRequest req) throws PortletException, IOException
+ {
+ String op = req.getParameter("op");
+
+ // Throw any required exception
+ if ("portletexception".equals(op))
+ {
+ throw new PortletException();
+ }
+ if ("portletsecurityexception".equals(op))
+ {
+ throw new PortletSecurityException("");
+ }
+ if ("ioexception".equals(op))
+ {
+ throw new IOException();
+ }
+ if ("runtimeexception".equals(op))
+ {
+ throw new RuntimeException();
+ }
+ if ("error".equals(op))
+ {
+ throw new Error();
+ }
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/FailDuringInitPortlet.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/FailDuringInitPortlet.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/FailDuringInitPortlet.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * 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.portlet.portal.samples.basic;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * A portlet that will fail only one time during startup (so it is possible to restart it).
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class FailDuringInitPortlet extends GenericPortlet
+{
+
+ private static int initCount = 0;
+
+ public void init() throws PortletException
+ {
+ if (initCount == 0)
+ {
+ initCount = 1;
+
+ //
+ throw new PortletException();
+ }
+ else
+ {
+ // Nothing
+ }
+ }
+
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ PrintWriter writer = renderResponse.getWriter();
+ writer.print("A portlet that may fail during init");
+ writer.close();
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/HeaderPortlet.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/HeaderPortlet.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/HeaderPortlet.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,189 @@
+/******************************************************************************
+ * 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.portlet.portal.samples.basic;
+
+import org.w3c.dom.Element;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.RenderURL;
+
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceURL;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletMode;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class HeaderPortlet extends GenericPortlet
+{
+ public final static int TITANIUM = 0;
+ public final static int PLATINUM = 1;
+ public final static int GOLD = 2;
+ public final static int SILVER = 3;
+ public final static int TIN = 4;
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+
+ String repeatText = req.getParameter("repeat");
+ // set zip as render parameter
+ if (repeatText != null){
+ resp.setRenderParameter("repeat", repeatText);
+ }
+ // request view
+ resp.setPortletMode(PortletMode.VIEW);
+
+ }
+ public void render(RenderRequest req, RenderResponse resp) throws PortletException, IOException
+ {
+ ResourceURL resourceURL = resp.createResourceURL();
+ PortletURL actionURL = resp.createActionURL();
+ //
+// Element elt = resp.createElement("script");
+// elt.setAttribute("type", "text/javascript");
+// elt.setAttribute("src", resourceURL.toString());
+// elt.appendChild(elt.getOwnerDocument().createTextNode(""));
+// resp.addProperty("script", elt);
+
+ //
+
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ writer.print("" +
+ "<script type=\"text/javascript\">" +
+ "" +
+ // "function init(){\n" +
+ //" Event.observe('repeat', 'keyup', repeat(), false);\n" +
+ // "}" +
+ "" +
+ "function browse(id) {" +
+ "var url = id;\n" +
+ "var pars = 'foo=bar';\n" +
+ "var target = 'output-div';\n" +
+ "var myAjax = new Ajax.Updater(target, url, {method: 'GET', parameters: pars});" +
+ "}" +
+
+ "</script>");
+
+ writer.print("" +
+ "<div class='full-width' style='padding:5px'>" +
+ "<h4>Partial Refresh Repeater Demo</h4>");
+ writer.print("" +
+ " <div class='half-width float-left'>" +
+ " <form method='post' id=\"testrepeatform\" name=\"testrepeatform\" action=\"" + actionURL + "\" onsubmit=\"new Ajax.Updater('repeat-div', '" + resourceURL + "', {asynchronous:true, parameters:Form.serialize(this)}); return false;\">\n" +
+ " <font class='portlet-font'>Repeat Demo:</font><br/>\n" +
+ " <input class='portlet-form-input-field' type='text' value='' size='12' name=\"repeat\" id=\"repeat\" onkeyup=\"this.form.submit2.click();new Effect.Highlight(document.getElementById('repeat-div'));\"/>\n" +
+ " <input class='portlet-form-input-field hidden' type='submit' name='submit2' value='submit' style=\"display:hidden;\">\n" +
+ " </form>\n" +
+ "</div>" +
+ "");
+ writer.print("<div id=\"repeat-container\"><div id=\"repeat-div\" class='half-width float-left' style='height:50px'></div></div>");
+// "<input type=\"text\" id=\"hidden-input\" value=\"" + resourceURL.toString() + "\" />" +
+// "<a href='javascript:" + resp.getNamespace() + "_handle()'>Click me to trigger script</a>" +
+ writer.print("<br class='clear'/><br class='clear'/><hr/>" +
+ "<h4>Partial Refresh Product Catalog</h4>" +
+ "<div class='full-width'>" +
+ "");
+ writer.print("<div class='float-left third-width'>");
+ resourceURL.setParameter("prodId","1");
+ writer.print("<a href=\"javascript: browse(\'" + resourceURL + "\');\">Product 1</a><br/>");
+
+ resourceURL.setParameter("prodId","2");
+ writer.print("<a href=\"javascript: browse(\'" + resourceURL + "\');\">Product 2</a><br/>");
+
+ resourceURL.setParameter("prodId","3");
+ writer.print("<a href=\"javascript: browse(\'" + resourceURL + "\');\">Product 3</a><br/>");
+
+ writer.print("<br class='clear'/></div>");
+ writer.print("<div class='float-left two-third-width'>" +
+ "<h4 class='zero'>Product Details</h4>" +
+ "<div id=\"output-div\"></div>" +
+ "");
+ writer.print("<br class='clear'/></div>");
+ writer.print("<br class='clear'/></div>");
+ writer.print("<br class='clear'/></div>");
+
+
+
+ // writer.print("</div>");
+ }
+
+ public void serveResource(ResourceRequest req, ResourceResponse resp) throws PortletException, IOException
+ {
+ String repeatText = req.getParameter("repeat");
+ String prodId = req.getParameter("prodId");
+
+ String namespace =resp.getNamespace();
+ //resp.setContentType("application/json");
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ if (repeatText != null){
+ writer.print("<div id=\"repeat-text\">"+ req.getPrivateParameterMap().get("repeat")[0] +"</div>");
+ }
+ if (prodId != null){
+ if (prodId.equals("1")){
+ writer.print("<div id=\"product-text\">Product ID: "+ prodId +"" +
+ "<br/>" +
+ " B BY BURTON ALPHA<br/>" +
+ "Sale Price: $314.96 " +
+ "</div>");
+ }
+ if (prodId.equals("2")){
+ writer.print("<div id=\"product-text\">Product ID: "+ prodId +"" +
+ "<br/>" +
+ "FORUM DESTROYER LTD<br/>" +
+ "$319.99 " +
+ "</div>");
+ }
+ if (prodId.equals("3")){
+ writer.print("<div id=\"product-text\">Product ID: "+ prodId +"" +
+ "<br/>" +
+ "\n" +
+ "SANTA CRUZ ALLSTAR<br/>" +
+ "$256.00 " +
+ "</div>");
+ }
+
+ }
+
+
+
+
+ writer.close();
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/NullFilter.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/NullFilter.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/NullFilter.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * 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.portlet.portal.samples.basic;
+
+import javax.portlet.filter.RenderFilter;
+import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.EventFilter;
+import javax.portlet.filter.ResourceFilter;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.filter.FilterConfig;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class NullFilter implements RenderFilter, ActionFilter, EventFilter, ResourceFilter
+{
+ public void init(FilterConfig config) throws PortletException
+ {
+ }
+
+ public void doFilter(RenderRequest req, RenderResponse resp, FilterChain chain) throws IOException, PortletException
+ {
+ chain.doFilter(req, resp);
+ }
+
+ public void doFilter(ActionRequest req, ActionResponse resp, FilterChain chain) throws IOException, PortletException
+ {
+ chain.doFilter(req, resp);
+ }
+
+ public void doFilter(EventRequest req, EventResponse resp, FilterChain chain) throws IOException, PortletException
+ {
+ chain.doFilter(req, resp);
+ }
+
+ public void doFilter(ResourceRequest req, ResourceResponse resp, FilterChain chain) throws IOException, PortletException
+ {
+ chain.doFilter(req, resp);
+ }
+
+ public void destroy()
+ {
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * 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.portlet.portal.samples.event;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 9912 $
+ */
+@XmlRootElement
+public class CartEvent implements Serializable
+{
+ private String id;
+
+ public static final QName QNAME = new QName("urn:jboss:portal:samples:event", "CartEvent");
+
+ public CartEvent(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * 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.portlet.portal.samples.event;
+
+import javax.portlet.Event;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 9932 $
+ */
+public class CartPortlet extends GenericPortlet
+{
+ List<CatalogItem> items = new ArrayList<CatalogItem>(7);
+
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ Writer writer = renderResponse.getWriter();
+
+
+ if (!items.isEmpty())
+ {
+ writer.append("<table width='95%' id=\"cart-table\"><thead><tr align='left'><th width='66%'>Description</th><th align='right'>Price</th></tr></thead><tbody>");
+ int total = 0;
+ for (CatalogItem item : items)
+ {
+ int price = item.getPrice();
+ total += price;
+ writer.append("<tr><td>").append(item.getDescription()).append("</td><td align='right'>$").append("" + price)
+ .append("</td></tr>");
+ }
+ writer.append("<tr><td><b>Total:</b></td><td align='right' style='border-top: 2px solid #000;'>")
+ .append("$" + total).append("</td></tr></tbody></table>");
+ }
+ else
+ {
+ writer.append("Cart is empty.");
+ }
+ }
+
+ @Override
+ public void processEvent(EventRequest eventRequest, EventResponse eventResponse) throws PortletException, IOException
+ {
+ Event event = eventRequest.getEvent();
+ if (event.getName().equals("CartEvent"))
+ {
+ CartEvent cartEvent = (CartEvent)event.getValue();
+ items.add(Catalog.get(cartEvent.getId()));
+ }
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.portlet.portal.samples.event;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 9912 $
+ */
+public class Catalog
+{
+ private static Map<String, CatalogItem> items;
+
+ static
+ {
+ items = new HashMap<String, CatalogItem>(7);
+ items.put("1", new CatalogItem("1", 800, "Bike"));
+ items.put("2", new CatalogItem("2", 450, "Snowboard"));
+ items.put("3", new CatalogItem("3", 225, "Tent"));
+ items.put("4", new CatalogItem("4", 75, "Backpack"));
+ items.put("5", new CatalogItem("5", 119, "Skateboard"));
+ items.put("6", new CatalogItem("6", 333, "Surfboard"));
+ items.put("7", new CatalogItem("7", 90, "Sneakers"));
+ }
+
+ private Catalog()
+ {
+ }
+
+ public static CatalogItem get(String id)
+ {
+ return items.get(id);
+ }
+
+ public static Collection<CatalogItem> getAll()
+ {
+ return items.values();
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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.portlet.portal.samples.event;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 9912 $
+ */
+public class CatalogItem
+{
+ private String id;
+ private int price;
+ private String description;
+
+ public CatalogItem(String id, int price, String description)
+ {
+ this.id = id;
+ this.price = price;
+ this.description = description;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public int getPrice()
+ {
+ return price;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+}
Added: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java (rev 0)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * 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.portlet.portal.samples.event;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 9932 $
+ */
+public class CatalogPortlet extends GenericPortlet
+{
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ Writer writer = renderResponse.getWriter();
+
+ writer.append("<table width='95%'><thead><tr align='left'><th width='50%'>Description</th><th width='25%'>Price</th><th>Actions</th></tr></thead><tbody>");
+
+ PortletURL addURL = renderResponse.createActionURL();
+ addURL.setParameter("op", "add");
+
+ Collection<CatalogItem> items = Catalog.getAll();
+ for (CatalogItem item : items)
+ {
+ addURL.setParameter("id", item.getId());
+ writer.append("<tr><td>").append(item.getDescription()).append("</td><td>$").append("" + item.getPrice())
+ .append("</td><td><a href='").append(addURL.toString()).append("' onclick=\"new Effect.Highlight(document.getElementById('cart-table'))\">Add to cart</a></td></tr>");
+ }
+
+ writer.append("</tbody></table>");
+ }
+
+ @Override
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
+ {
+ String value = actionRequest.getParameter("id");
+ actionResponse.setEvent(CartEvent.QNAME, new CartEvent(value));
+ }
+}
Copied: modules/portlet/trunk/portal/src/main/resources/samples (from rev 10138, modules/portlet/trunk/test/src/test/resources/portal/samples)
Copied: modules/portlet/trunk/portal/src/main/resources/samples/basic-war (from rev 10160, modules/portlet/trunk/test/src/test/resources/portal/samples/basic-war)
Copied: modules/portlet/trunk/portal/src/main/resources/samples/cart-event-portlet-war (from rev 10160, modules/portlet/trunk/test/src/test/resources/portal/samples/cart-event-portlet-war)
Copied: modules/portlet/trunk/portal/src/main/resources/samples/google-map-portlet-war (from rev 10160, modules/portlet/trunk/test/src/test/resources/portal/samples/google-map-portlet-war)
Copied: modules/portlet/trunk/portal/src/main/resources/samples/google-weather-portlet-war (from rev 10160, modules/portlet/trunk/test/src/test/resources/portal/samples/google-weather-portlet-war)
Copied: modules/portlet/trunk/portal/src/main/resources/samples/remotecontrol-portlet-war (from rev 10160, modules/portlet/trunk/test/src/test/resources/portal/samples/remotecontrol-portlet-war)
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war (from rev 10138, modules/portlet/trunk/test/src/test/resources/simple-portal-war)
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/META-INF (from rev 10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/META-INF)
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF (from rev 10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF)
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-29 17:41:05 UTC (rev 10160)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -45,7 +45,7 @@
</bean>
<bean name="PortletCustomizationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.PortletCustomizationInterceptor">
</bean>
- <bean name="ConsumerStackFactory" class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
+ <bean name="ConsumerStackFactory" class="org.jboss.portal.portlet.portal.InterceptorStackFactoryImpl">
<property name="interceptors">
<array>
<inject bean="ConsumerCacheInterceptor"/>
@@ -55,7 +55,7 @@
</bean>
<!-- The consumer portlet invoker -->
- <bean name="ConsumerPortletInvoker" class="org.jboss.portal.portlet.test.controller.TestPortletInvoker">
+ <bean name="ConsumerPortletInvoker" class="org.jboss.portal.portlet.portal.TestPortletInvoker">
<property name="producer"><inject bean="ProducerPortletInvoker"/></property>
<property name="stackFactory"><inject bean="ConsumerStackFactory"/></property>
</bean>
@@ -70,7 +70,7 @@
<bean name="ProducerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor"/>
<bean name="CCPPInterceptor" class="org.jboss.portal.portlet.aspects.portlet.CCPPInterceptor"/>
<bean name="RequestAttributeConversationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor"/>
- <bean name="ContainerStackFactory" class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
+ <bean name="ContainerStackFactory" class="org.jboss.portal.portlet.portal.InterceptorStackFactoryImpl">
<property name="interceptors">
<array>
<inject bean="ValveInterceptor"/>
Added: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-web.xml
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-web.xml (rev 0)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-web.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!DOCTYPE jboss-web PUBLIC
+ "-//JBoss//DTD Web Application 4.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
+<jboss-web>
+ <class-loading java2ClassLoadingCompliance="false">
+ <loader-repository>test:loader=portlet</loader-repository>
+ </class-loading>
+</jboss-web>
\ No newline at end of file
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/portal.tld
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld 2008-02-29 17:41:05 UTC (rev 10160)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/portal.tld 2008-02-29 23:47:01 UTC (rev 10161)
@@ -10,13 +10,13 @@
<tag>
<name>page</name>
- <tag-class>org.jboss.portal.portlet.test.jsp.taglib.PageTag</tag-class>
+ <tag-class>org.jboss.portal.portlet.portal.jsp.taglib.PageTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<name>portlet</name>
- <tag-class>org.jboss.portal.portlet.test.jsp.taglib.PortletTag</tag-class>
+ <tag-class>org.jboss.portal.portlet.portal.jsp.taglib.PortletTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>name</name>
@@ -54,19 +54,19 @@
<tag>
<name>portletmarkup</name>
- <tag-class>org.jboss.portal.portlet.test.jsp.taglib.PortletMarkupTag</tag-class>
+ <tag-class>org.jboss.portal.portlet.portal.jsp.taglib.PortletMarkupTag</tag-class>
<body-content>empty</body-content>
</tag>
<tag>
<name>portlettitle</name>
- <tag-class>org.jboss.portal.portlet.test.jsp.taglib.PortletTitleTag</tag-class>
+ <tag-class>org.jboss.portal.portlet.portal.jsp.taglib.PortletTitleTag</tag-class>
<body-content>empty</body-content>
</tag>
<tag>
<name>portleturl</name>
- <tag-class>org.jboss.portal.portlet.test.jsp.taglib.PortletURLTag</tag-class>
+ <tag-class>org.jboss.portal.portlet.portal.jsp.taglib.PortletURLTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>mode</name>
@@ -82,7 +82,7 @@
<tag>
<name>param</name>
- <tag-class>org.jboss.portal.portlet.test.jsp.taglib.ParamTag</tag-class>
+ <tag-class>org.jboss.portal.portlet.portal.jsp.taglib.ParamTag</tag-class>
<body-content>empty</body-content>
<attribute>
<name>name</name>
@@ -100,7 +100,7 @@
<tag>
<name>pageparam</name>
- <tag-class>org.jboss.portal.portlet.test.jsp.taglib.PageParamTag</tag-class>
+ <tag-class>org.jboss.portal.portlet.portal.jsp.taglib.PageParamTag</tag-class>
<body-content>empty</body-content>
<attribute>
<name>namespaceURI</name>
@@ -129,7 +129,7 @@
<tag>
<name>headers</name>
- <tag-class>org.jboss.portal.portlet.test.jsp.taglib.HeadersTag</tag-class>
+ <tag-class>org.jboss.portal.portlet.portal.jsp.taglib.HeadersTag</tag-class>
<body-content>empty</body-content>
</tag>
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/web.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/web.xml 2008-02-29 17:41:05 UTC (rev 10160)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/web.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -28,7 +28,7 @@
version="2.5">
<filter>
<filter-name>ControllerFilter</filter-name>
- <filter-class>org.jboss.portal.portlet.test.jsp.ControllerFilter</filter-class>
+ <filter-class>org.jboss.portal.portlet.portal.jsp.ControllerFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ControllerFilter</filter-name>
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css (from rev 10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/css)
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo (from rev 10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo)
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/images (from rev 10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/images)
Deleted: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp 2008-02-27 20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp 2008-02-29 23:47:01 UTC (rev 10161)
@@ -1,8 +0,0 @@
-<%@ page language="java" %>
-<%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
-<%@ page isELIgnored="false" %>
-<html>
-<body>
-<jsp:forward page="demo/home.jsp"/>
-</body>
-</html>
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp (from rev 10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp)
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp (rev 0)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,8 @@
+<%@ page language="java" %>
+<%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
+<%@ page isELIgnored="false" %>
+<html>
+<body>
+<jsp:forward page="demo/home.jsp"/>
+</body>
+</html>
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js (from rev 10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/js)
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/layouts (from rev 10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/layouts)
Modified: modules/portlet/trunk/test/pom.xml
===================================================================
--- modules/portlet/trunk/test/pom.xml 2008-02-29 17:41:05 UTC (rev 10160)
+++ modules/portlet/trunk/test/pom.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -367,7 +367,6 @@
<ant antfile="${basedir}/src/test/build.xml">
<target name="tests"/>
- <target name="package-simple-portal"/>
<target name="package-tck-portal"/>
</ant>
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-29 17:41:05 UTC (rev 10160)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -699,29 +699,6 @@
</target>
-
- <macrodef name="generic-package-simple-portal">
- <attribute name="server"/>
- <sequential>
- <copy todir="@{server}/simple-portal" flatten="true">
- <path>
- <path location="${dependency.portal-common.jar}"/>
- <path location="${dependency.portal-common-portal.jar}"/>
- <path location="${dependency.portal-portlet.jar}"/>
- <path location="${dependency.portal-web.jar}"/>
- <path location="${dependency.jsr168api.jar}"/>
- <path location="${dependency.ccpp.jar}"/>
- <path refid="mc.portal-portlet-controller"/>
- <path refid="mc.portal-portlet-mc"/>
- </path>
- </copy>
-
- <copy todir="@{server}/simple-portal/simple-portal.war">
- <fileset dir="${test.temp.dir}/simple-portal-war"/>
- </copy>
- </sequential>
- </macrodef>
-
<target name="package-tck-portal" depends="prepare_env">
<property name="tck" value="${target}/tck"/>
@@ -871,83 +848,7 @@
</target>
- <target name="package-simple-portal" depends="prepare_env">
- <property name="portal.dir" value="${target}/portal"/>
- <property name="simple.tomcat.dir" value="${portal.dir}/tomcat"/>
- <property name="simple.as42.dir" value="${portal.dir}/as42"/>
- <!--<property name="simple.as5.dir" value="${portal.dir}/as5"/>-->
-
- <delete dir="${portal.dir}"/>
-
- <mkdir dir="${portal.dir}"/>
- <mkdir dir="${simple.tomcat.dir}"/>
- <mkdir dir="${simple.as42.dir}"/>
- <!--<mkdir dir="${simple.as5.dir}"/>-->
-
-
- <jar jarfile="${target}/portlet-test-lib.jar">
- <fileset dir="${target}/classes" excludes="org/jboss/portal/portlet/portal/samples/**"/>
- </jar>
-
- <copy todir="${test.temp.dir}/simple-portal-war">
- <fileset dir="src/test/resources/simple-portal-war"/>
- </copy>
-
- <!-- simple-portal.war -->
- <copy todir="${test.temp.dir}/simple-portal-war/WEB-INF/lib" flatten="true">
-
- <!-- -->
- <fileset dir="${target}" includes="portlet-test-lib.jar"/>
-
-
- <path refid="mc.portal-common"/>
-
- <!-- MC 2.0.0.Beta4 -->
- <path refid="mc.trove"/>
- <path refid="mc.xerces"/>
- <path refid="mc.javassist"/>
- <path refid="mc.jboss_common_logging_spi"/>
- <path refid="mc.jboss_common_logging_jdk"/>
- <path refid="mc.jboss_common_logging_log4j"/>
- <path refid="mc.jboss_common_core"/>
- <path refid="mc.jboss_vfs"/>
- <path refid="mc.jboss_xb"/>
- <path refid="mc.jboss_aop"/>
- <path refid="mc.jboss_microcontainer"/>
- </copy>
-
- <!-- AS 4.2 -->
- <generic-package-simple-portal server="${simple.as42.dir}"/>
-
- <!-- Tomcat -->
- <generic-package-simple-portal server="${simple.tomcat.dir}"/>
- <copy todir="${simple.tomcat.dir}/simple-portal" flatten="true">
- <path>
- <pathelement path="${dependency.log4j.jar}"/>
- <pathelement path="${dependency.activation.jar}"/>
- <pathelement path="${dependency.apache-jstl.jar}"/>
- <pathelement path="${dependency.apache-standard.jar}"/>
- <pathelement path="${dependency.concurrent.jar}"/>
- <path refid="mc.jboss_common_logging_spi"/>
- <path refid="mc.jaxb-api"/>
- </path>
- </copy>
- <jar jarfile="${simple.tomcat.dir}/simple-portal.war">
- <fileset dir="${simple.tomcat.dir}/simple-portal/simple-portal.war"/>
- </jar>
- <delete dir="${simple.tomcat.dir}/simple-portal/simple-portal.war"/>
- <move todir="${simple.tomcat.dir}/copy-to-tomcat-lib">
- <fileset dir="${simple.tomcat.dir}/simple-portal/"/>
- </move>
-
- <!-- AS 5 -->
- <!--<generic-package-simple-portal server="${simple.as5.dir}"/>-->
-
- <delete file="${target}/portlet-test-lib.jar"/>
-
- <antcall target="__package-demo-portlets"/>
- </target>
-
+<!--
<target name="__package-demo-portlets" depends="prepare_env">
<property name="samples.target.dir" value="${portal.dir}/samples"/>
@@ -1010,5 +911,6 @@
</jar>
</target>
+-->
</project>
\ No newline at end of file
16 years, 1 month
JBoss Portal SVN: r10160 - modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-29 12:41:05 -0500 (Fri, 29 Feb 2008)
New Revision: 10160
Added:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerPortletInvocationContext.java
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/AbstractPortletControllerContext.java
Log:
rename of TestPortletInvocationContext to ControllerPortletInvocationContext
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/AbstractPortletControllerContext.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/AbstractPortletControllerContext.java 2008-02-29 17:35:48 UTC (rev 10159)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/AbstractPortletControllerContext.java 2008-02-29 17:41:05 UTC (rev 10160)
@@ -43,7 +43,6 @@
import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.ResourceInvocation;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.spi.PortalContext;
@@ -126,12 +125,13 @@
public PortletInvocationResponse invoke(ActionInvocation actionInvocation) throws PortletInvokerException
{
+ ControllerPortletInvocationContext context = (ControllerPortletInvocationContext)actionInvocation.getContext();
- TestPortletInvocationContext context = (TestPortletInvocationContext)actionInvocation.getContext();
+ //
String windowId = context.getWindowId();
-
Portlet portlet = getPortlet(windowId);
+ //
actionInvocation.setClientContext(new AbstractClientContext(req));
actionInvocation.setServerContext(new AbstractServerContext(req, resp));
actionInvocation.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
@@ -142,16 +142,19 @@
actionInvocation.setRequestContext(new AbstractRequestContext(req));
actionInvocation.setTarget(portlet.getContext());
+ //
return invoke((PortletInvocation)actionInvocation);
}
public PortletInvocationResponse invoke(List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException
{
- TestPortletInvocationContext context = (TestPortletInvocationContext)eventInvocation.getContext();
+ ControllerPortletInvocationContext context = (ControllerPortletInvocationContext)eventInvocation.getContext();
+
+ //
String windowId = context.getWindowId();
-
Portlet portlet = getPortlet(windowId);
+ //
eventInvocation.setClientContext(new AbstractClientContext(req, requestCookies));
eventInvocation.setServerContext(new AbstractServerContext(req, resp));
eventInvocation.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
@@ -161,16 +164,19 @@
eventInvocation.setSecurityContext(new AbstractSecurityContext(req));
eventInvocation.setTarget(portlet.getContext());
+ //
return invoke(eventInvocation);
}
public PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws PortletInvokerException
{
- TestPortletInvocationContext context = (TestPortletInvocationContext)resourceInvocation.getContext();
+ ControllerPortletInvocationContext context = (ControllerPortletInvocationContext)resourceInvocation.getContext();
+
+ //
String windowId = context.getWindowId();
-
Portlet portlet = getPortlet(windowId);
+ //
resourceInvocation.setClientContext(new AbstractClientContext(req));
resourceInvocation.setServerContext(new AbstractServerContext(req, resp));
resourceInvocation.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
@@ -185,8 +191,10 @@
return invoke((PortletInvocation)resourceInvocation);
}
- public PortletInvocationContext createPortletInvocationContext(String windowId, PageNavigationalState pageNavigationalState)
+ public PortletInvocationContext createPortletInvocationContext(
+ String windowId,
+ PageNavigationalState pageNavigationalState)
{
- return new TestPortletInvocationContext(getPageNavigationalStateSerialization(), req, resp, windowId, pageNavigationalState, MARKUP_INFO);
+ return new ControllerPortletInvocationContext(getPageNavigationalStateSerialization(), req, resp, windowId, pageNavigationalState, MARKUP_INFO);
}
}
\ No newline at end of file
Copied: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerPortletInvocationContext.java (from rev 10159, modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java)
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerPortletInvocationContext.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerPortletInvocationContext.java 2008-02-29 17:41:05 UTC (rev 10160)
@@ -0,0 +1,104 @@
+/******************************************************************************
+ * 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.portlet.controller.impl;
+
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.io.Serialization;
+import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.URLFormat;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * An implementation of the <code>PortletInvocationContext</code> interface that is related to a specific
+ * window.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ControllerPortletInvocationContext extends AbstractPortletInvocationContext
+{
+
+ /** . */
+ private final PortletURLRenderer urlRenderer;
+
+ /** . */
+ private final String windowId;
+
+ /** . */
+ private final HttpServletRequest clientRequest;
+
+ /** . */
+ private final HttpServletResponse clientResponse;
+
+ public ControllerPortletInvocationContext(
+ Serialization<PageNavigationalState> serialization,
+ HttpServletRequest clientRequest,
+ HttpServletResponse clientResponse,
+ String windowId,
+ PageNavigationalState pageNavigationalState,
+ MarkupInfo markupInfo)
+ {
+ super(markupInfo);
+
+ //
+ this.clientRequest = clientRequest;
+ this.clientResponse = clientResponse;
+ this.windowId = windowId;
+ this.urlRenderer = new PortletURLRenderer(pageNavigationalState, clientRequest, clientResponse, serialization);
+
+ //
+ addResolver(PortletInvocation.PRINCIPAL_SCOPE, new PrincipalAttributeResolver(clientRequest));
+ addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(clientRequest));
+ }
+
+ public String getWindowId()
+ {
+ return windowId;
+ }
+
+ public HttpServletRequest getClientRequest() throws IllegalStateException
+ {
+ return clientRequest;
+ }
+
+ public HttpServletResponse getClientResponse() throws IllegalStateException
+ {
+ return clientResponse;
+ }
+
+ public String renderURL(ContainerURL containerURL, URLFormat format)
+ {
+ return urlRenderer.renderURL(windowId, containerURL, format);
+ }
+}
16 years, 1 month
JBoss Portal SVN: r10159 - in modules/portlet/trunk: test/src/main/java/org/jboss/portal/portlet/test and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-29 12:35:48 -0500 (Fri, 29 Feb 2008)
New Revision: 10159
Added:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/AbstractPortletControllerContext.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/PortletURLRenderer.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/URLParameterConstants.java
Removed:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/URLParameterConstants.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortalContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractRendererContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RendererContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKRendererContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java
Log:
moved a couple of class to the controller module that will make them easier to reuse
Copied: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/AbstractPortletControllerContext.java (from rev 10156, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java)
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/AbstractPortletControllerContext.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/AbstractPortletControllerContext.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -0,0 +1,192 @@
+/******************************************************************************
+ * 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.portlet.controller.impl;
+
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.io.Serialization;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.controller.PortletControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
+import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
+import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
+import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
+import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
+import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
+import org.jboss.portal.portlet.impl.spi.AbstractInstanceContext;
+import org.jboss.portal.portlet.impl.spi.AbstractPortalContext;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.ResourceInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.web.IllegalRequestException;
+import org.apache.log4j.Logger;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractPortletControllerContext implements PortletControllerContext
+{
+
+ /** . */
+ private static Logger log = Logger.getLogger(AbstractPortletControllerContext.class);
+
+ /** . */
+ public static final PortalContext PORTAL_CONTEXT = new AbstractPortalContext(Collections.singletonMap("javax.portlet.markup.head.element.support", "true"));
+
+ /** . */
+ public static final MarkupInfo MARKUP_INFO = new MarkupInfo(MediaType.HTML, "UTF8");
+
+ /** . */
+ public static final int NAV_SCOPE = 0;
+
+ /** . */
+ public static final int SESSION_SCOPE = 1;
+
+ /** . */
+ private final HttpServletRequest req;
+
+ /** . */
+ private final HttpServletResponse resp;
+
+ public AbstractPortletControllerContext(HttpServletRequest req, HttpServletResponse resp
+ )
+ throws IllegalRequestException, IOException
+ {
+ this.req = req;
+ this.resp = resp;
+ }
+
+ public HttpServletRequest getClientRequest()
+ {
+ return req;
+ }
+
+ public HttpServletResponse getClientResponse()
+ {
+ return resp;
+ }
+
+ public PortletInfo getPortletInfo(String windowId)
+ {
+ try
+ {
+ return getPortlet(windowId).getInfo();
+ }
+ catch (PortletInvokerException e)
+ {
+ log.error("Could not access portlet invoker for locating window " + windowId, e);
+
+ //
+ return null;
+ }
+ }
+
+ protected abstract Portlet getPortlet(String windowId) throws PortletInvokerException;
+
+ protected abstract PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException;
+
+ protected abstract Serialization<PageNavigationalState> getPageNavigationalStateSerialization();
+
+ public PortletInvocationResponse invoke(ActionInvocation actionInvocation) throws PortletInvokerException
+ {
+
+ TestPortletInvocationContext context = (TestPortletInvocationContext)actionInvocation.getContext();
+ String windowId = context.getWindowId();
+
+ Portlet portlet = getPortlet(windowId);
+
+ actionInvocation.setClientContext(new AbstractClientContext(req));
+ actionInvocation.setServerContext(new AbstractServerContext(req, resp));
+ actionInvocation.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
+ actionInvocation.setUserContext(new AbstractUserContext(req));
+ actionInvocation.setWindowContext(new AbstractWindowContext(windowId));
+ actionInvocation.setPortalContext(PORTAL_CONTEXT);
+ actionInvocation.setSecurityContext(new AbstractSecurityContext(req));
+ actionInvocation.setRequestContext(new AbstractRequestContext(req));
+ actionInvocation.setTarget(portlet.getContext());
+
+ return invoke((PortletInvocation)actionInvocation);
+ }
+
+ public PortletInvocationResponse invoke(List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException
+ {
+ TestPortletInvocationContext context = (TestPortletInvocationContext)eventInvocation.getContext();
+ String windowId = context.getWindowId();
+
+ Portlet portlet = getPortlet(windowId);
+
+ eventInvocation.setClientContext(new AbstractClientContext(req, requestCookies));
+ eventInvocation.setServerContext(new AbstractServerContext(req, resp));
+ eventInvocation.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
+ eventInvocation.setUserContext(new AbstractUserContext(req));
+ eventInvocation.setWindowContext(new AbstractWindowContext(windowId));
+ eventInvocation.setPortalContext(PORTAL_CONTEXT);
+ eventInvocation.setSecurityContext(new AbstractSecurityContext(req));
+ eventInvocation.setTarget(portlet.getContext());
+
+ return invoke(eventInvocation);
+ }
+
+ public PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws PortletInvokerException
+ {
+ TestPortletInvocationContext context = (TestPortletInvocationContext)resourceInvocation.getContext();
+ String windowId = context.getWindowId();
+
+ Portlet portlet = getPortlet(windowId);
+
+ resourceInvocation.setClientContext(new AbstractClientContext(req));
+ resourceInvocation.setServerContext(new AbstractServerContext(req, resp));
+ resourceInvocation.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
+ resourceInvocation.setUserContext(new AbstractUserContext(req));
+ resourceInvocation.setWindowContext(new AbstractWindowContext(windowId));
+ resourceInvocation.setPortalContext(PORTAL_CONTEXT);
+ resourceInvocation.setSecurityContext(new AbstractSecurityContext(req));
+ resourceInvocation.setRequestContext(new AbstractRequestContext(req));
+ resourceInvocation.setTarget(portlet.getContext());
+
+ //
+ return invoke((PortletInvocation)resourceInvocation);
+ }
+
+ public PortletInvocationContext createPortletInvocationContext(String windowId, PageNavigationalState pageNavigationalState)
+ {
+ return new TestPortletInvocationContext(getPageNavigationalStateSerialization(), req, resp, windowId, pageNavigationalState, MARKUP_INFO);
+ }
+}
\ No newline at end of file
Copied: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/PortletURLRenderer.java (from rev 10146, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java)
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/PortletURLRenderer.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/PortletURLRenderer.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -0,0 +1,152 @@
+/******************************************************************************
+ * 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.portlet.controller.impl;
+
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.common.io.Serialization;
+import org.jboss.portal.common.text.CharBuffer;
+import org.jboss.portal.common.text.FastURLEncoder;
+import org.jboss.portal.common.util.Base64;
+import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.URLFormat;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterNames;
+import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterMapFactory;
+import static org.jboss.portal.portlet.controller.impl.URLParameterConstants.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+import java.util.Collections;
+
+/**
+ * A class that is able to create portlet URL
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletURLRenderer
+{
+
+ /** . */
+ final Serialization<PageNavigationalState> serialization;
+
+ /** . */
+ final HttpServletRequest clientReq;
+
+ /** . */
+ final HttpServletResponse clientResp;
+
+ /** . */
+ final PageNavigationalState pageNS;
+
+ public PortletURLRenderer(
+ PageNavigationalState pageNS,
+ HttpServletRequest clientReq,
+ HttpServletResponse clientResp,
+ Serialization<PageNavigationalState> serialization)
+ {
+ this.pageNS = pageNS;
+ this.clientReq = clientReq;
+ this.clientResp = clientResp;
+ this.serialization = serialization;
+ }
+
+ private String renderURL(Map<String, String> parameters, URLFormat format)
+ {
+ CharBuffer buffer = new CharBuffer();
+ buffer.append(clientReq.getScheme());
+ buffer.append("://");
+ buffer.append(clientReq.getServerName());
+ buffer.append(':');
+ buffer.append(Integer.toString(clientReq.getServerPort()));
+ buffer.append(clientReq.getContextPath());
+ buffer.append(clientReq.getServletPath());
+
+ //
+ if (clientReq.getPathInfo() != null)
+ {
+ buffer.append(clientReq.getPathInfo());
+ }
+
+ //
+ String parameterSeparator = format.getWantEscapeXML() == Boolean.TRUE ? "&" : "&";
+
+ //
+ boolean first = true;
+ for (Map.Entry<String, String> entry : parameters.entrySet())
+ {
+ String name = entry.getKey();
+ String value = entry.getValue();
+ buffer.append(first ? "?" : parameterSeparator);
+ buffer.append(name, FastURLEncoder.getUTF8Instance());
+ buffer.append('=');
+ buffer.append(value, FastURLEncoder.getUTF8Instance());
+ first = false;
+ }
+
+ //
+ String url = buffer.asString();
+ return clientResp.encodeURL(url);
+ }
+
+ public String renderURL(URLFormat format)
+ {
+ String pageNavigationalState = null;
+ if (pageNS != null)
+ {
+ byte[] bytes = IOTools.serialize(serialization, SerializationFilter.COMPRESSOR, pageNS);
+ pageNavigationalState = Base64.encodeBytes(bytes, true);
+ }
+
+ //
+ Map<String, String> parameters;
+ if (pageNavigationalState != null)
+ {
+ parameters = Collections.singletonMap(ControllerRequestParameterNames.PAGE_NAVIGATIONAL_STATE, pageNavigationalState);
+ }
+ else
+ {
+ parameters = Collections.emptyMap();
+ }
+
+ //
+ return renderURL(parameters, format);
+ }
+
+ public String renderURL(String windowId, ContainerURL containerURL, URLFormat format)
+ {
+ ControllerRequestParameterMapFactory factory = new ControllerRequestParameterMapFactory(serialization);
+
+ //
+ Map<String, String> parameters = factory.blah(pageNS, windowId, containerURL);
+
+ //
+ parameters.put(TYPE, PORTLET_TYPE);
+
+ //
+ return renderURL(parameters, format);
+ }
+}
Copied: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java (from rev 10146, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java)
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * 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.portlet.controller.impl;
+
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.io.Serialization;
+import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.URLFormat;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestPortletInvocationContext extends AbstractPortletInvocationContext
+{
+
+ /** . */
+ private final PortletURLRenderer urlRenderer;
+
+ /** . */
+ private final String windowId;
+
+ /** . */
+ private final HttpServletRequest clientRequest;
+
+ /** . */
+ private final HttpServletResponse clientResponse;
+
+ public TestPortletInvocationContext(
+ Serialization<PageNavigationalState> serialization,
+ HttpServletRequest clientRequest,
+ HttpServletResponse clientResponse,
+ String windowId,
+ PageNavigationalState pageNavigationalState,
+ MarkupInfo markupInfo)
+ {
+ super(markupInfo);
+
+ //
+ this.clientRequest = clientRequest;
+ this.clientResponse = clientResponse;
+ this.windowId = windowId;
+ this.urlRenderer = new PortletURLRenderer(pageNavigationalState, clientRequest, clientResponse, serialization);
+
+ //
+ addResolver(PortletInvocation.PRINCIPAL_SCOPE, new PrincipalAttributeResolver(clientRequest));
+ addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(clientRequest));
+ }
+
+ public String getWindowId()
+ {
+ return windowId;
+ }
+
+ public HttpServletRequest getClientRequest() throws IllegalStateException
+ {
+ return clientRequest;
+ }
+
+ public HttpServletResponse getClientResponse() throws IllegalStateException
+ {
+ return clientResponse;
+ }
+
+ public String renderURL(ContainerURL containerURL, URLFormat format)
+ {
+ return urlRenderer.renderURL(windowId, containerURL, format);
+ }
+}
Copied: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/URLParameterConstants.java (from rev 10138, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/URLParameterConstants.java)
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/URLParameterConstants.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/URLParameterConstants.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.portlet.controller.impl;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public final class URLParameterConstants
+{
+
+ private URLParameterConstants()
+ {
+ }
+
+ /**
+ * The type of request. The goal is to allow other types of invocation to be used by the controller context.
+ * The controller context itself only works on the portlet type.
+ */
+ public static final String TYPE = "type";
+
+ /**
+ * The portlet type.
+ */
+ public static final String PORTLET_TYPE = "portlet";
+
+}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -24,6 +24,7 @@
import org.jboss.portal.portlet.controller.PortletController;
import org.jboss.portal.portlet.controller.impl.request.ControllerRequestFactory;
+import org.jboss.portal.portlet.controller.impl.URLParameterConstants;
import org.jboss.portal.portlet.controller.request.ControllerRequest;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.invocation.response.ResponseProperties;
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/URLParameterConstants.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/URLParameterConstants.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/URLParameterConstants.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -1,47 +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.portlet.test;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public final class URLParameterConstants
-{
-
- private URLParameterConstants()
- {
- }
-
- /**
- * The type of request. The goal is to allow other types of invocation to be used by the controller context.
- * The controller context itself only works on the portlet type.
- */
- public static final String TYPE = "type";
-
- /**
- * The portlet type.
- */
- public static final String PORTLET_TYPE = "portlet";
-
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -1,188 +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.portlet.test.controller;
-
-import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.MediaType;
-import org.jboss.portal.common.io.Serialization;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.controller.PortletControllerContext;
-import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
-import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
-import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
-import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
-import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
-import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
-import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
-import org.jboss.portal.portlet.impl.spi.AbstractInstanceContext;
-import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.EventInvocation;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.ResourceInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.web.IllegalRequestException;
-import org.apache.log4j.Logger;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractPortletControllerContext implements PortletControllerContext
-{
-
- /** . */
- private static Logger log = Logger.getLogger(AbstractPortletControllerContext.class);
-
- /** . */
- public static final MarkupInfo MARKUP_INFO = new MarkupInfo(MediaType.HTML, "UTF8");
-
- /** . */
- public static final int NAV_SCOPE = 0;
-
- /** . */
- public static final int SESSION_SCOPE = 1;
-
- /** . */
- private final HttpServletRequest req;
-
- /** . */
- private final HttpServletResponse resp;
-
- public AbstractPortletControllerContext(HttpServletRequest req, HttpServletResponse resp
- )
- throws IllegalRequestException, IOException
- {
- this.req = req;
- this.resp = resp;
- }
-
- public HttpServletRequest getClientRequest()
- {
- return req;
- }
-
- public HttpServletResponse getClientResponse()
- {
- return resp;
- }
-
- public PortletInfo getPortletInfo(String windowId)
- {
- try
- {
- return getPortlet(windowId).getInfo();
- }
- catch (PortletInvokerException e)
- {
- log.error("Could not access portlet invoker for locating window " + windowId, e);
-
- //
- return null;
- }
- }
-
- protected abstract Portlet getPortlet(String windowId) throws PortletInvokerException;
-
- protected abstract PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException;
-
- protected abstract Serialization<PageNavigationalState> getPageNavigationalStateSerialization();
-
- public PortletInvocationResponse invoke(ActionInvocation actionInvocation) throws PortletInvokerException
- {
-
- TestPortletInvocationContext context = (TestPortletInvocationContext)actionInvocation.getContext();
- String windowId = context.getWindowId();
-
- Portlet portlet = getPortlet(windowId);
-
- actionInvocation.setClientContext(new AbstractClientContext(req));
- actionInvocation.setServerContext(new AbstractServerContext(req, resp));
- actionInvocation.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
- actionInvocation.setUserContext(new AbstractUserContext(req));
- actionInvocation.setWindowContext(new AbstractWindowContext(windowId));
- actionInvocation.setPortalContext(new TestPortalContext());
- actionInvocation.setSecurityContext(new AbstractSecurityContext(req));
- actionInvocation.setRequestContext(new AbstractRequestContext(req));
- actionInvocation.setTarget(portlet.getContext());
-
- return invoke((PortletInvocation)actionInvocation);
- }
-
- public PortletInvocationResponse invoke(List<Cookie> requestCookies, EventInvocation eventInvocation) throws PortletInvokerException
- {
- TestPortletInvocationContext context = (TestPortletInvocationContext)eventInvocation.getContext();
- String windowId = context.getWindowId();
-
- Portlet portlet = getPortlet(windowId);
-
-// TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
-
- eventInvocation.setClientContext(new AbstractClientContext(req, requestCookies));
- eventInvocation.setServerContext(new AbstractServerContext(req, resp));
- eventInvocation.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
- eventInvocation.setUserContext(new AbstractUserContext(req));
- eventInvocation.setWindowContext(new AbstractWindowContext(windowId));
- eventInvocation.setPortalContext(new TestPortalContext());
- eventInvocation.setSecurityContext(new AbstractSecurityContext(req));
- eventInvocation.setTarget(portlet.getContext());
-
- return invoke(eventInvocation);
- }
-
- public PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws PortletInvokerException
- {
- TestPortletInvocationContext context = (TestPortletInvocationContext)resourceInvocation.getContext();
- String windowId = context.getWindowId();
-
- Portlet portlet = getPortlet(windowId);
-
- resourceInvocation.setClientContext(new AbstractClientContext(req));
- resourceInvocation.setServerContext(new AbstractServerContext(req, resp));
- resourceInvocation.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
- resourceInvocation.setUserContext(new AbstractUserContext(req));
- resourceInvocation.setWindowContext(new AbstractWindowContext(windowId));
- resourceInvocation.setPortalContext(new TestPortalContext());
- resourceInvocation.setSecurityContext(new AbstractSecurityContext(req));
- resourceInvocation.setRequestContext(new AbstractRequestContext(req));
- resourceInvocation.setTarget(portlet.getContext());
-
- //
- return invoke((PortletInvocation)resourceInvocation);
- }
-
- public PortletInvocationContext createPortletInvocationContext(String windowId, PageNavigationalState pageNavigationalState)
- {
- return new TestPortletInvocationContext(getPageNavigationalStateSerialization(), req, resp, windowId, pageNavigationalState, MARKUP_INFO);
- }
-}
\ No newline at end of file
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractRendererContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractRendererContext.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractRendererContext.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -23,9 +23,11 @@
package org.jboss.portal.portlet.test.controller;
import org.jboss.portal.portlet.controller.PortletControllerContext;
+import org.jboss.portal.portlet.controller.impl.AbstractPortletControllerContext;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvoker;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -40,9 +42,13 @@
/** . */
private final AbstractPortletControllerContext portletControllerContext;
- public AbstractRendererContext(AbstractPortletControllerContext portletControllerContext)
+ /** . */
+ private final PortletInvoker portletInvoker;
+
+ protected AbstractRendererContext(AbstractPortletControllerContext portletControllerContext, PortletInvoker portletInvoker)
{
this.portletControllerContext = portletControllerContext;
+ this.portletInvoker = portletInvoker;
}
public HttpServletRequest getClientRequest()
@@ -62,6 +68,6 @@
public PortletInvocationResponse render(RenderInvocation render) throws PortletInvokerException
{
- return portletControllerContext.invoke(render);
+ return portletInvoker.invoke(render);
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -45,6 +45,7 @@
import org.jboss.portal.portlet.invocation.response.ContentResponse;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.impl.AbstractPortletControllerContext;
import org.w3c.dom.Element;
import javax.servlet.http.HttpServletRequest;
@@ -230,7 +231,7 @@
render.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
render.setUserContext(new AbstractUserContext(req));
render.setWindowContext(new AbstractWindowContext(portlet.getContext().getId()));
- render.setPortalContext(new TestPortalContext());
+ render.setPortalContext(AbstractPortletControllerContext.PORTAL_CONTEXT);
render.setSecurityContext(new AbstractSecurityContext(req));
render.setTarget(portlet.getContext());
render.setMode(mode);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -30,6 +30,7 @@
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.impl.event.EventControllerContextImpl;
import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
+import org.jboss.portal.portlet.controller.impl.AbstractPortletControllerContext;
import org.jboss.portal.portlet.controller.state.StateControllerContext;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
@@ -52,7 +53,7 @@
{
/** . */
- private final PortletInvoker invoker;
+ private final PortletInvoker portletInvoker;
/** . */
private final EventControllerContext eventControllerContext;
@@ -69,15 +70,20 @@
super(req, resp);
//
- this.invoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
- this.eventControllerContext = new EventControllerContextImpl(invoker);
+ this.portletInvoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
+ this.eventControllerContext = new EventControllerContextImpl(portletInvoker);
this.stateControllerContext = new StateControllerContextImpl(this);
this.serialization = new PageNavigationalStateSerialization(stateControllerContext);
}
+ public PortletInvoker getPortletInvoker()
+ {
+ return portletInvoker;
+ }
+
protected Portlet getPortlet(String windowId) throws PortletInvokerException
{
- return invoker.getPortlet(PortletContext.createPortletContext(windowId));
+ return portletInvoker.getPortlet(PortletContext.createPortletContext(windowId));
}
public StateControllerContext getStateControllerContext()
@@ -87,7 +93,7 @@
public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
{
- return invoker.invoke(invocation);
+ return portletInvoker.invoke(invocation);
}
public EventControllerContext getEventControllerContext()
@@ -97,7 +103,7 @@
public Collection<Portlet> getPortlets() throws PortletInvokerException
{
- return invoker.getPortlets();
+ return portletInvoker.getPortlets();
}
public Serialization<PageNavigationalState> getPageNavigationalStateSerialization()
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -1,150 +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.portlet.test.controller;
-
-import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.common.io.SerializationFilter;
-import org.jboss.portal.common.io.Serialization;
-import org.jboss.portal.common.text.CharBuffer;
-import org.jboss.portal.common.text.FastURLEncoder;
-import org.jboss.portal.common.util.Base64;
-import org.jboss.portal.portlet.ContainerURL;
-import org.jboss.portal.portlet.URLFormat;
-import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterNames;
-import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterMapFactory;
-import static org.jboss.portal.portlet.test.URLParameterConstants.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Map;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortletURLRenderer
-{
-
- /** . */
- final Serialization<PageNavigationalState> serialization;
-
- /** . */
- final HttpServletRequest clientReq;
-
- /** . */
- final HttpServletResponse clientResp;
-
- /** . */
- final PageNavigationalState pageNS;
-
- public PortletURLRenderer(
- PageNavigationalState pageNS,
- HttpServletRequest clientReq,
- HttpServletResponse clientResp,
- Serialization<PageNavigationalState> serialization)
- {
- this.pageNS = pageNS;
- this.clientReq = clientReq;
- this.clientResp = clientResp;
- this.serialization = serialization;
- }
-
- private String renderURL(Map<String, String> parameters, URLFormat format)
- {
- CharBuffer buffer = new CharBuffer();
- buffer.append(clientReq.getScheme());
- buffer.append("://");
- buffer.append(clientReq.getServerName());
- buffer.append(':');
- buffer.append(Integer.toString(clientReq.getServerPort()));
- buffer.append(clientReq.getContextPath());
- buffer.append(clientReq.getServletPath());
-
- //
- if (clientReq.getPathInfo() != null)
- {
- buffer.append(clientReq.getPathInfo());
- }
-
- //
- String parameterSeparator = format.getWantEscapeXML() == Boolean.TRUE ? "&" : "&";
-
- //
- boolean first = true;
- for (Map.Entry<String, String> entry : parameters.entrySet())
- {
- String name = entry.getKey();
- String value = entry.getValue();
- buffer.append(first ? "?" : parameterSeparator);
- buffer.append(name, FastURLEncoder.getUTF8Instance());
- buffer.append('=');
- buffer.append(value, FastURLEncoder.getUTF8Instance());
- first = false;
- }
-
- //
- String url = buffer.asString();
- return clientResp.encodeURL(url);
- }
-
- public String renderURL(URLFormat format)
- {
- String pageNavigationalState = null;
- if (pageNS != null)
- {
- byte[] bytes = IOTools.serialize(serialization, SerializationFilter.COMPRESSOR, pageNS);
- pageNavigationalState = Base64.encodeBytes(bytes, true);
- }
-
- //
- Map<String, String> parameters;
- if (pageNavigationalState != null)
- {
- parameters = Collections.singletonMap(ControllerRequestParameterNames.PAGE_NAVIGATIONAL_STATE, pageNavigationalState);
- }
- else
- {
- parameters = Collections.emptyMap();
- }
-
- //
- return renderURL(parameters, format);
- }
-
- public String renderURL(String windowId, ContainerURL containerURL, URLFormat format)
- {
- ControllerRequestParameterMapFactory factory = new ControllerRequestParameterMapFactory(serialization);
-
- //
- Map<String, String> parameters = factory.blah(pageNS, windowId, containerURL);
-
- //
- parameters.put(TYPE, PORTLET_TYPE);
-
- //
- return renderURL(parameters, format);
- }
-}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RendererContextImpl.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RendererContextImpl.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RendererContextImpl.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -39,7 +39,7 @@
public RendererContextImpl(PortletControllerContextImpl portletControllerContext) throws PortletInvokerException
{
- super(portletControllerContext);
+ super(portletControllerContext, portletControllerContext.getPortletInvoker());
//
this.portlets = portletControllerContext.getPortlets();
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortalContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortalContext.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortalContext.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -1,40 +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.portlet.test.controller;
-
-import org.jboss.portal.portlet.impl.spi.AbstractPortalContext;
-
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class TestPortalContext extends AbstractPortalContext
-{
- public TestPortalContext()
- {
- super(Collections.singletonMap("javax.portlet.markup.head.element.support", "true"));
- }
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -1,100 +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.portlet.test.controller;
-
-import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
-import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
-import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
-import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.io.Serialization;
-import org.jboss.portal.portlet.ContainerURL;
-import org.jboss.portal.portlet.URLFormat;
-import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class TestPortletInvocationContext extends AbstractPortletInvocationContext
-{
-
- /** . */
- private final PortletURLRenderer urlRenderer;
-
- /** . */
- private final String windowId;
-
- /** . */
- private final HttpServletRequest clientRequest;
-
- /** . */
- private final HttpServletResponse clientResponse;
-
- public TestPortletInvocationContext(
- Serialization<PageNavigationalState> serialization,
- HttpServletRequest clientRequest,
- HttpServletResponse clientResponse,
- String windowId,
- PageNavigationalState pageNavigationalState,
- MarkupInfo markupInfo)
- {
- super(markupInfo);
-
- //
- this.clientRequest = clientRequest;
- this.clientResponse = clientResponse;
- this.windowId = windowId;
- this.urlRenderer = new PortletURLRenderer(pageNavigationalState, clientRequest, clientResponse, serialization);
-
- //
- addResolver(PortletInvocation.PRINCIPAL_SCOPE, new PrincipalAttributeResolver(clientRequest));
- addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(clientRequest));
- }
-
- public String getWindowId()
- {
- return windowId;
- }
-
- public HttpServletRequest getClientRequest() throws IllegalStateException
- {
- return clientRequest;
- }
-
- public HttpServletResponse getClientResponse() throws IllegalStateException
- {
- return clientResponse;
- }
-
- public String renderURL(ContainerURL containerURL, URLFormat format)
- {
- return urlRenderer.renderURL(windowId, containerURL, format);
- }
-}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp;
-import org.jboss.portal.portlet.test.controller.PortletURLRenderer;
-import org.jboss.portal.portlet.test.URLParameterConstants;
+import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
+import org.jboss.portal.portlet.controller.impl.URLParameterConstants;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.URLFormat;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -32,7 +32,7 @@
import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.test.controller.AbstractPortletControllerContext;
+import org.jboss.portal.portlet.controller.impl.AbstractPortletControllerContext;
import org.jboss.portal.web.IllegalRequestException;
import org.jboss.portal.common.io.Serialization;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp;
-import org.jboss.portal.portlet.test.controller.TestPortalContext;
+import org.jboss.portal.portlet.controller.impl.AbstractPortletControllerContext;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -171,7 +171,7 @@
render.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
render.setUserContext(new AbstractUserContext(portletControllerContext.getClientRequest()));
render.setWindowContext(new AbstractWindowContext(windowId));
- render.setPortalContext(new TestPortalContext());
+ render.setPortalContext(AbstractPortletControllerContext.PORTAL_CONTEXT);
render.setSecurityContext(new AbstractSecurityContext(portletControllerContext.getClientRequest()));
render.setTarget(portlet.getContext());
render.setMode(mode);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -26,7 +26,7 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
-import org.jboss.portal.portlet.test.controller.PortletURLRenderer;
+import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
import org.jboss.portal.portlet.RenderURL;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.URLFormat;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPortletControllerContext.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPortletControllerContext.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.tck;
-import org.jboss.portal.portlet.test.controller.AbstractPortletControllerContext;
+import org.jboss.portal.portlet.controller.impl.AbstractPortletControllerContext;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.PortletInvoker;
@@ -41,7 +41,6 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletContext;
import java.io.IOException;
-import java.util.Map;
import java.util.Set;
/**
@@ -52,7 +51,7 @@
{
/** . */
- private final PortletInvoker invoker;
+ private final PortletInvoker portletInvoker;
/** . */
private final TCKStateControllerContext stateControllerContext;
@@ -71,25 +70,30 @@
super(req, resp);
//
- this.invoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
+ this.portletInvoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
this.stateControllerContext = new TCKStateControllerContext(new StateControllerContextImpl(this));
- this.eventControllerContext = new EventControllerContextImpl(invoker);
+ this.eventControllerContext = new EventControllerContextImpl(portletInvoker);
this.serialization = new TCKPageNavigationalStateSerialization(stateControllerContext);
}
+ public PortletInvoker getPortletInvoker()
+ {
+ return portletInvoker;
+ }
+
public Set<Portlet> getPortlets() throws PortletInvokerException
{
- return invoker.getPortlets();
+ return portletInvoker.getPortlets();
}
protected Portlet getPortlet(String windowId) throws PortletInvokerException
{
- return invoker.getPortlet(PortletContext.createPortletContext(windowId));
+ return portletInvoker.getPortlet(PortletContext.createPortletContext(windowId));
}
protected PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
{
- return invoker.invoke(invocation);
+ return portletInvoker.invoke(invocation);
}
protected Serialization<PageNavigationalState> getPageNavigationalStateSerialization()
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKRendererContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKRendererContext.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKRendererContext.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -26,6 +26,7 @@
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.PortletInvoker;
import java.util.Collection;
import java.util.ArrayList;
@@ -44,7 +45,7 @@
TCKPortletControllerContext portletControllerContext,
TCKPageNavigationalState tckPageNavigationalState) throws PortletInvokerException
{
- super(portletControllerContext);
+ super(portletControllerContext, portletControllerContext.getPortletInvoker());
//
Collection<Portlet> involvedPortlets = new ArrayList<Portlet>();
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java 2008-02-29 17:00:22 UTC (rev 10158)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java 2008-02-29 17:35:48 UTC (rev 10159)
@@ -25,7 +25,7 @@
import org.jboss.portal.portlet.test.controller.Renderer;
import org.jboss.portal.portlet.test.controller.ControllerResponseRendererFactory;
import org.jboss.portal.portlet.test.controller.PageRenderer;
-import org.jboss.portal.portlet.test.URLParameterConstants;
+import org.jboss.portal.portlet.controller.impl.URLParameterConstants;
import org.jboss.portal.portlet.controller.PortletController;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.request.ControllerRequest;
16 years, 1 month
JBoss Portal SVN: r10158 - in modules/portlet/trunk: mc and 37 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-29 12:00:22 -0500 (Fri, 29 Feb 2008)
New Revision: 10158
Added:
modules/portlet/trunk/mc/
modules/portlet/trunk/mc/pom.xml
modules/portlet/trunk/mc/src/
modules/portlet/trunk/mc/src/main/
modules/portlet/trunk/mc/src/main/java/
modules/portlet/trunk/mc/src/main/java/org/
modules/portlet/trunk/mc/src/main/java/org/jboss/
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationContextImpl.java
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationDeployer.java
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationDeployment.java
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletContainerContextImpl.java
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletFilterContextImpl.java
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/factory/
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/factory/LocalizedStringBuilder.java
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/factory/PortletApplicationModelFactory.java
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/AnnotationPortletApplication10MetaData.java
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/AnnotationPortletApplication20MetaData.java
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/PortletApplicationMetaDataException.java
modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/ValueTrimmingFilter.java
modules/portlet/trunk/mc/src/test/
modules/portlet/trunk/mc/src/test/java/
modules/portlet/trunk/mc/src/test/java/org/
modules/portlet/trunk/mc/src/test/java/org/jboss/
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/AbstractMetaDataTestCase.java
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/CustomPortletModeTestEverythingTestCase.java
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/CustomWindowStateTestEverythingTestCase.java
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/EventTestEverythingTestCase.java
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/FilterTestEverythingTestCase.java
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/GeneralMetaDataTestCase.java
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/PortletTestEverythingTestCase.java
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/RenderParameterTestEverythingTestCase.java
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/SecurityConstraintTestEverythingTestCase.java
modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/UserAttributeTestEverythingTestCase.java
modules/portlet/trunk/mc/src/test/resources/
modules/portlet/trunk/mc/src/test/resources/local-jboss-unit.xml
modules/portlet/trunk/mc/src/test/resources/metadata/
modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/
modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/portlet1-fail.xml
modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/portlet1.xml
modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/portlet2.xml
modules/portlet/trunk/mc/src/test/resources/metadata/customWindowState/
modules/portlet/trunk/mc/src/test/resources/metadata/customWindowState/portlet1.xml
modules/portlet/trunk/mc/src/test/resources/metadata/customWindowState/portlet2.xml
modules/portlet/trunk/mc/src/test/resources/metadata/event/
modules/portlet/trunk/mc/src/test/resources/metadata/event/portlet-event1.xml
modules/portlet/trunk/mc/src/test/resources/metadata/event/portlet-event2-fail.xml
modules/portlet/trunk/mc/src/test/resources/metadata/event/portlet-event2.xml
modules/portlet/trunk/mc/src/test/resources/metadata/filter/
modules/portlet/trunk/mc/src/test/resources/metadata/filter/portlet-filter1.xml
modules/portlet/trunk/mc/src/test/resources/metadata/filter/portlet-filter2.xml
modules/portlet/trunk/mc/src/test/resources/metadata/general/
modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet-app_1_0.xml
modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet-app_2_0.xml
modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet1.xml
modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet2-jsr286.xml
modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet2.xml
modules/portlet/trunk/mc/src/test/resources/metadata/portlet-app_1_0.xsd
modules/portlet/trunk/mc/src/test/resources/metadata/portlet-app_2_0.xsd
modules/portlet/trunk/mc/src/test/resources/metadata/portlet/
modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet1-simple.xml
modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet1.xml
modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet2-jsr286.xml
modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet2.xml
modules/portlet/trunk/mc/src/test/resources/metadata/renderParameter/
modules/portlet/trunk/mc/src/test/resources/metadata/renderParameter/portlet2.xml
modules/portlet/trunk/mc/src/test/resources/metadata/security/
modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet1-fail1.xml
modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet1-fail2.xml
modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet1.xml
modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet2-fail1.xml
modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet2-fail2.xml
modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet2.xml
modules/portlet/trunk/mc/src/test/resources/metadata/userAttribute/
modules/portlet/trunk/mc/src/test/resources/metadata/userAttribute/portlet1.xml
modules/portlet/trunk/mc/src/test/resources/metadata/userAttribute/portlet2.xml
Removed:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployment.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletContainerContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletFilterContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/metadata/
modules/portlet/trunk/test/src/test/java/org/jboss/portal/portlet/test/metadata/
modules/portlet/trunk/test/src/test/resources/metadata/
Modified:
modules/portlet/trunk/pom.xml
modules/portlet/trunk/test/pom.xml
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestPortletApplicationDeployer.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/test/src/test/resources/test/local-jboss-unit.xml
Log:
create a portlet-mc module for holding integration with JBoss MC
Added: modules/portlet/trunk/mc/pom.xml
===================================================================
--- modules/portlet/trunk/mc/pom.xml (rev 0)
+++ modules/portlet/trunk/mc/pom.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,58 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>portlet-mc</artifactId>
+ <packaging>jar</packaging>
+ <name>Portlet Container / JBoss MC integration</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portlet</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-maven2</artifactId>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <testsuites>
+ <testsuite>
+ <config>local-jboss-unit.xml</config>
+ </testsuite>
+ </testsuites>
+ <reports>
+ <xml>target/tests/reports/xml/local</xml>
+ <html>target/tests/reports/html/local</html>
+ </reports>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationContextImpl.java
===================================================================
--- modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationContextImpl.java (rev 0)
+++ modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationContextImpl.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * 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.portlet.mc;
+
+import org.jboss.portal.portlet.container.PortletApplicationContext;
+import org.jboss.portal.portlet.container.managed.ManagedPortletApplication;
+import org.jboss.portal.web.WebApp;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletApplicationContextImpl implements PortletApplicationContext
+{
+
+ /** . */
+ private final WebApp webApp;
+
+ ManagedPortletApplication managedPortletApplication;
+
+ public PortletApplicationContextImpl(WebApp webApp)
+ {
+ this.webApp = webApp;
+ }
+
+ public ServletContext getServletContext()
+ {
+ return webApp.getServletContext();
+ }
+
+ public String getContextPath()
+ {
+ return webApp.getContextPath();
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return webApp.getClassLoader();
+ }
+
+ public void managedStart()
+ {
+ managedPortletApplication.managedStart();
+ }
+
+ public void managedStop()
+ {
+ managedPortletApplication.managedStop();
+ }
+}
Added: modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationDeployer.java
===================================================================
--- modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationDeployer.java (rev 0)
+++ modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationDeployer.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,346 @@
+/******************************************************************************
+ * 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.portlet.mc;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.portlet.container.managed.PortletApplicationRegistry;
+import org.jboss.portal.portlet.container.managed.ManagedPortletApplication;
+import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEventBroadcaster;
+import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEventListener;
+import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEvent;
+import org.jboss.portal.portlet.container.managed.ManagedObjectEvent;
+import org.jboss.portal.portlet.container.managed.ManagedObject;
+import org.jboss.portal.portlet.container.managed.ManagedObjectLifeCycleEvent;
+import org.jboss.portal.portlet.container.managed.LifeCycleStatus;
+import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import static org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.PORTLET_JSR_168_NS;
+import static org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.PORTLET_JSR_286_NS;
+import org.jboss.portal.portlet.impl.container.PortletApplicationLifeCycle;
+import org.jboss.portal.portlet.impl.container.PortletContainerLifeCycle;
+import org.jboss.portal.portlet.mc.metadata.factory.PortletApplicationModelFactory;
+import org.jboss.portal.portlet.mc.metadata.impl.AnnotationPortletApplication10MetaData;
+import org.jboss.portal.portlet.mc.metadata.impl.AnnotationPortletApplication20MetaData;
+import org.jboss.portal.portlet.mc.metadata.impl.ValueTrimmingFilter;
+import org.jboss.portal.web.ServletContainer;
+import org.jboss.portal.web.WebApp;
+import org.jboss.portal.web.WebAppEvent;
+import org.jboss.portal.web.WebAppLifeCycleEvent;
+import org.jboss.portal.web.WebAppListener;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletApplicationDeployer implements WebAppListener, PortletApplicationRegistry
+{
+
+ static
+ {
+ try
+ {
+ SingletonSchemaResolverFactory factory = SingletonSchemaResolverFactory.getInstance();
+ DefaultSchemaResolver resolver = (DefaultSchemaResolver)factory.getSchemaBindingResolver();
+
+ /** SchemaResolver */
+ resolver.addSchemaLocation(PORTLET_JSR_168_NS, "portlet-app_1_0.xsd");
+ resolver.addSchemaLocation(PORTLET_JSR_286_NS, "portlet-app_2_0.xsd");
+ resolver.addClassBinding(PORTLET_JSR_286_NS, AnnotationPortletApplication20MetaData.class);
+ resolver.addClassBinding(PORTLET_JSR_168_NS, AnnotationPortletApplication10MetaData.class);
+ }
+ catch (Exception e)
+ {
+ throw new Error(e);
+ }
+ }
+
+ /** . */
+ private Logger log = Logger.getLogger(PortletApplicationDeployer.class);
+
+ /** . */
+ private PortletApplicationRegistry registry;
+
+ /** . */
+ private ServletContainer servletContainer;
+
+ /** . */
+ private Map<String, PortletApplicationDeployment> deploymentMap = new HashMap<String, PortletApplicationDeployment>();
+
+ /** . */
+ private ClassLoader classLoader;
+
+ /** . */
+ private final Map<String, PortletApplicationLifeCycle> applications = new HashMap<String, PortletApplicationLifeCycle>();
+
+ /** . */
+ private PortletContainerInvoker portletContainerInvoker;
+
+ /** . */
+ private ManagedObjectRegistryEventBroadcaster broadcaster;
+
+ public PortletApplicationRegistry getRegistry()
+ {
+ return registry;
+ }
+
+ public void setRegistry(PortletApplicationRegistry registry)
+ {
+ this.registry = registry;
+ }
+
+ public ServletContainer getServletContainer()
+ {
+ return servletContainer;
+ }
+
+ public void setServletContainer(ServletContainer servletContainer)
+ {
+ this.servletContainer = servletContainer;
+ }
+
+ public PortletContainerInvoker getPortletContainerInvoker()
+ {
+ return portletContainerInvoker;
+ }
+
+ public void setPortletContainerInvoker(PortletContainerInvoker portletContainerInvoker)
+ {
+ this.portletContainerInvoker = portletContainerInvoker;
+ }
+
+ public void onEvent(WebAppEvent event)
+ {
+ if (event instanceof WebAppLifeCycleEvent)
+ {
+ WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent)event;
+ String cp = event.getWebApp().getContextPath();
+ switch (lifeCycleEvent.getType())
+ {
+ case WebAppLifeCycleEvent.ADDED:
+ log.debug("Going to install war file" + cp);
+ add(event.getWebApp());
+ log.debug("Installed war file" + cp);
+ break;
+ case WebAppLifeCycleEvent.REMOVED:
+ try
+ {
+ log.debug("Going to uninstall war file" + cp);
+ remove(event.getWebApp());
+ log.debug("Uninstalled war file" + cp);
+ }
+ catch (Throwable e)
+ {
+ log.error("Uninstalled war file " + cp + " with an error", e);
+ }
+ break;
+ }
+ }
+ }
+
+ protected void add(WebApp webApp)
+ {
+ //
+ PortletApplication10MetaData metaData = buildPortletApplicationMetaData(webApp);
+ if (metaData != null)
+ {
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ PortletApplicationDeployment deployment = new PortletApplicationDeployment(broadcaster, webApp, metaData);
+ deploymentMap.put(webApp.getContextPath(), deployment);
+ deployment.install();
+
+ //
+ PortletApplicationLifeCycle portletApplicationLifeCycle = deployment.getPortletApplicationLifeCycle();
+ applications.put(portletApplicationLifeCycle.getId(), portletApplicationLifeCycle);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ }
+ }
+ }
+
+ private void remove(WebApp webApp)
+ {
+ PortletApplicationDeployment deployment = deploymentMap.remove(webApp.getContextPath());
+ if (deployment != null)
+ {
+ PortletApplicationLifeCycle portletApplicationLifeCycle = deployment.getPortletApplicationLifeCycle();
+ applications.remove(portletApplicationLifeCycle.getId());
+
+ //
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ deployment.uninstall();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ }
+ }
+ }
+
+ public void start()
+ {
+ broadcaster = new ManagedObjectRegistryEventBroadcaster();
+ classLoader = Thread.currentThread().getContextClassLoader();
+
+ //
+ broadcaster.addListener(bridgeToInvoker);
+ servletContainer.addWebAppListener(this);
+ }
+
+ public void stop()
+ {
+ // This should generate remove web app event and in cascade clear the registry
+ // as well as the portlet container invoker
+ servletContainer.removeWebAppListener(this);
+
+ //
+ classLoader = null;
+ broadcaster = null;
+ }
+
+ private PortletApplication10MetaData buildPortletApplicationMetaData(WebApp webApp)
+ {
+ try
+ {
+ URL url = webApp.getServletContext().getResource("/WEB-INF/portlet.xml");
+ if (url != null)
+ {
+ InputStream in = null;
+ try
+ {
+ in = IOTools.safeBufferedWrapper(url.openStream());
+
+ // Validate
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ unmarshaller.setNamespaceAware(true);
+ unmarshaller.setSchemaValidation(false);
+ unmarshaller.setValidation(false);
+
+ //
+ PortletApplicationModelFactory factory = new PortletApplicationModelFactory();
+
+ // Unmarshal
+ PortletApplication10MetaData portletApplicationMD = (PortletApplication10MetaData)unmarshaller.unmarshal(in, new ValueTrimmingFilter(factory), null);
+
+ //
+ return portletApplicationMD;
+ }
+ finally
+ {
+ IOTools.safeClose(in);
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ log.error("Cannot read portlet.xml", e);
+ }
+ catch (JBossXBException e)
+ {
+ log.error("Cannot parse portlet.xml", e);
+ }
+ return null;
+ }
+
+ public Collection<? extends ManagedPortletApplication> getManagedPortletApplications()
+ {
+ return applications.values();
+ }
+
+ public ManagedPortletApplication getManagedPortletApplication(String id)
+ {
+ return applications.get(id);
+ }
+
+ public void addListener(ManagedObjectRegistryEventListener listener)
+ {
+ broadcaster.addListener(listener);
+ }
+
+ public void removeListener(ManagedObjectRegistryEventListener listener)
+ {
+ broadcaster.addListener(listener);
+ }
+
+ /**
+ * Bridge managed object event to add/remove portlet container in portlet container invoker.
+ */
+ private final ManagedObjectRegistryEventListener bridgeToInvoker = new ManagedObjectRegistryEventListener()
+ {
+ public void onEvent(ManagedObjectRegistryEvent event)
+ {
+ if (event instanceof ManagedObjectEvent)
+ {
+ ManagedObjectEvent managedObjectEvent = (ManagedObjectEvent)event;
+ ManagedObject managedObject = managedObjectEvent.getManagedObject();
+
+ //
+ if (managedObject instanceof PortletContainerLifeCycle)
+ {
+ PortletContainerLifeCycle portletContainerLifeCycle = (PortletContainerLifeCycle)managedObject;
+ PortletContainer portletContainer = portletContainerLifeCycle.getPortletContainer();
+
+ //
+ if (managedObjectEvent instanceof ManagedObjectLifeCycleEvent)
+ {
+ ManagedObjectLifeCycleEvent lifeCycleEvent = (ManagedObjectLifeCycleEvent)managedObjectEvent;
+
+ //
+ LifeCycleStatus status = lifeCycleEvent.getStatus();
+
+ //
+ if (status == LifeCycleStatus.STARTED)
+ {
+ portletContainerInvoker.addPortletContainer(portletContainer);
+ }
+ else
+ {
+ portletContainerInvoker.removePortletContainer(portletContainer);
+ }
+ }
+ }
+ }
+ }
+ };
+}
Added: modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationDeployment.java
===================================================================
--- modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationDeployment.java (rev 0)
+++ modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletApplicationDeployment.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,168 @@
+/******************************************************************************
+ * 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.portlet.mc;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.portlet.impl.info.ContainerInfoBuilder;
+import org.jboss.portal.portlet.impl.info.ContainerInfoBuilderContext;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.info.ContainerFilterInfo;
+import org.jboss.portal.portlet.impl.jsr168.ContainerInfoBuilderContextImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletFilterImpl;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.container.PortletApplicationLifeCycle;
+import org.jboss.portal.portlet.impl.container.PortletFilterLifeCycle;
+import org.jboss.portal.portlet.impl.container.PortletContainerLifeCycle;
+import org.jboss.portal.portlet.container.object.PortletApplicationObject;
+import org.jboss.portal.portlet.container.object.PortletContainerObject;
+import org.jboss.portal.portlet.container.object.PortletFilterObject;
+import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEventListener;
+import org.jboss.portal.web.WebApp;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletApplicationDeployment
+{
+
+ /** . */
+ private final Logger log;
+
+ /** . */
+ private final WebApp webApp;
+
+ /** . */
+ private final PortletApplication10MetaData metaData;
+
+ /** . */
+ private final ManagedObjectRegistryEventListener listener;
+
+ /** . */
+ private PortletApplicationLifeCycle portletApplicationLifeCycle;
+
+ public PortletApplicationDeployment(
+ ManagedObjectRegistryEventListener listener,
+ WebApp webApp,
+ PortletApplication10MetaData metaData)
+ {
+ this.listener = listener;
+ this.webApp = webApp;
+ this.metaData = metaData;
+ this.log = Logger.getLogger(PortletApplicationDeployment.class + "." + webApp.getContextPath().replace('.', '_'));
+ }
+
+ public PortletApplicationLifeCycle getPortletApplicationLifeCycle()
+ {
+ return portletApplicationLifeCycle;
+ }
+
+ void install()
+ {
+
+ log.debug("Starting installation");
+
+ //
+ ContainerInfoBuilderContext builderContext = new ContainerInfoBuilderContextImpl(metaData, webApp);
+ ContainerInfoBuilder builder = new ContainerInfoBuilder(webApp.getContextPath(), metaData, builderContext);
+ builder.build();
+
+ //
+ PortletApplicationObject portletApplicationObject = new PortletApplicationImpl(builder.getApplication());
+ PortletApplicationContextImpl portletApplicationContext = new PortletApplicationContextImpl(webApp);
+
+
+ //
+ portletApplicationLifeCycle = new PortletApplicationLifeCycle(
+ listener,
+ portletApplicationContext,
+ portletApplicationObject);
+
+ // Needed for the managed callbacks
+ portletApplicationContext.managedPortletApplication = portletApplicationLifeCycle;
+
+ //
+ for (ContainerFilterInfo filterInfo : builder.getApplication().getFilters().values())
+ {
+ PortletFilterObject portletFilterObject = new PortletFilterImpl(filterInfo);
+ PortletFilterContextImpl portletFilterContext = new PortletFilterContextImpl();
+
+ //
+ PortletFilterLifeCycle portletFilterLifeCycle = portletApplicationLifeCycle.addPortletFilter(portletFilterContext, portletFilterObject);
+
+ // Needed for the managed callbacks
+ portletFilterContext.managedPortletFilter = portletFilterLifeCycle;
+ }
+
+ //
+ for (ContainerPortletInfo containerInfo : builder.getPortlets())
+ {
+ PortletContainerObject portletContainerObject = new PortletContainerImpl(containerInfo);
+ PortletContainerContextImpl portletContainerContext = new PortletContainerContextImpl();
+
+ //
+ PortletContainerLifeCycle portletContainerLifeCycle = portletApplicationLifeCycle.addPortletContainer(portletContainerContext, portletContainerObject);
+
+ // Needed for the managed callbacks
+ portletContainerContext.managedPortletContainer = portletContainerLifeCycle;
+
+ // Now create deps
+ for (String filterRef : containerInfo.getFilterRefs())
+ {
+ PortletFilterLifeCycle portletFilterLifeCycle = portletApplicationLifeCycle.getManagedPortletFilter(filterRef);
+
+ //
+ if (portletFilterLifeCycle != null)
+ {
+ portletApplicationLifeCycle.addDependency(portletFilterLifeCycle, portletContainerLifeCycle);
+ }
+ else
+ {
+ // todo
+ }
+ }
+ }
+
+ //
+ portletApplicationLifeCycle.create();
+
+ //
+ portletApplicationLifeCycle.managedStart();
+
+ //
+
+ }
+
+ void uninstall()
+ {
+ log.debug("Uninstalling");
+
+ //
+ portletApplicationLifeCycle.managedStop();
+
+ //
+ log.debug("Uninstalled");
+ }
+}
Added: modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletContainerContextImpl.java
===================================================================
--- modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletContainerContextImpl.java (rev 0)
+++ modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletContainerContextImpl.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.portlet.mc;
+
+import org.jboss.portal.portlet.container.PortletContainerContext;
+import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletContainerContextImpl implements PortletContainerContext
+{
+
+ /** . */
+ ManagedPortletContainer managedPortletContainer;
+
+ public void managedStart()
+ {
+ managedPortletContainer.managedStart();
+ }
+
+ public void managedStop()
+ {
+ managedPortletContainer.managedStop();
+ }
+}
Added: modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletFilterContextImpl.java
===================================================================
--- modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletFilterContextImpl.java (rev 0)
+++ modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/PortletFilterContextImpl.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.portlet.mc;
+
+import org.jboss.portal.portlet.container.PortletFilterContext;
+import org.jboss.portal.portlet.container.managed.ManagedPortletFilter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletFilterContextImpl implements PortletFilterContext
+{
+
+ ManagedPortletFilter managedPortletFilter;
+
+ public void managedStart()
+ {
+ managedPortletFilter.managedStart();
+ }
+
+ public void managedStop()
+ {
+ managedPortletFilter.managedStop();
+ }
+}
Added: modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/factory/LocalizedStringBuilder.java
===================================================================
--- modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/factory/LocalizedStringBuilder.java (rev 0)
+++ modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/factory/LocalizedStringBuilder.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata.factory;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.portlet.impl.metadata.adapter.LocalizedStringAdapter;
+import org.jboss.portal.portlet.impl.metadata.common.LocalizedDescriptionMetaData;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class LocalizedStringBuilder
+{
+
+ /** The object to localized meta data. */
+ private Map<Object, LocalizedMetaDataContainer> map = new LinkedHashMap<Object, LocalizedMetaDataContainer>();
+
+ /** The logger. */
+ private static final Logger log = Logger.getLogger(LocalizedStringBuilder.class);
+
+ public void put(Object object, LocalizedDescriptionMetaData description)
+ {
+ LocalizedMetaDataContainer container = map.get(object);
+ if (container == null)
+ {
+ container = new LocalizedMetaDataContainer();
+ map.put(object, container);
+ }
+ container.addLocalizedDescription(description);
+ }
+
+ public LocalizedString getLocalizedString(Object key)
+ {
+ try
+ {
+ return this.map.get(key) != null ? this.map.get(key).getLocalizedString() : null;
+ }
+ catch (Exception e)
+ {
+ log.error("could not generate localized string.", e);
+ return null;
+ }
+ }
+
+ private static class LocalizedMetaDataContainer
+ {
+ /** The list of localiezd meta data */
+ private List<LocalizedDescriptionMetaData> list = new ArrayList<LocalizedDescriptionMetaData>();
+
+ public void addLocalizedDescription(LocalizedDescriptionMetaData description)
+ {
+ this.list.add(description);
+ }
+
+ public LocalizedString getLocalizedString() throws Exception
+ {
+ LocalizedStringAdapter adapter = new LocalizedStringAdapter();
+ return adapter.unmarshal(list);
+ }
+ }
+}
Added: modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/factory/PortletApplicationModelFactory.java
===================================================================
--- modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/factory/PortletApplicationModelFactory.java (rev 0)
+++ modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/factory/PortletApplicationModelFactory.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,850 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata.factory;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.portlet.LifeCyclePhase;
+import org.jboss.portal.portlet.TransportGuarantee;
+import org.jboss.portal.portlet.impl.metadata.CustomPortletModeMetaData;
+import org.jboss.portal.portlet.impl.metadata.CustomWindowStateMetaData;
+import org.jboss.portal.portlet.impl.metadata.ListenerMetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import static org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.DEFAULT_LOCALE;
+import static org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.PORTLET_JSR_286_NS;
+import org.jboss.portal.portlet.impl.metadata.PublicRenderParameterMetaData;
+import org.jboss.portal.portlet.impl.metadata.UserAttributeMetaData;
+import org.jboss.portal.portlet.impl.metadata.common.ContainerRuntimeMetaData;
+import org.jboss.portal.portlet.impl.metadata.common.DescribableMetaData;
+import org.jboss.portal.portlet.impl.metadata.common.InitParamMetaData;
+import org.jboss.portal.portlet.impl.metadata.common.LocalizedDescriptionMetaData;
+import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionMetaData;
+import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionReferenceMetaData;
+import org.jboss.portal.portlet.impl.metadata.filter.FilterMappingMetaData;
+import org.jboss.portal.portlet.impl.metadata.filter.FilterMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletCacheScopeEnum;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletInfoMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletModeMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferenceMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferencesMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SecurityRoleRefMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SupportedLocaleMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SupportsMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.WindowStateMetaData;
+import org.jboss.portal.portlet.impl.metadata.security.PortletCollectionMetaData;
+import org.jboss.portal.portlet.impl.metadata.security.SecurityConstraintMetaData;
+import org.jboss.portal.portlet.impl.metadata.security.UserDataConstraintMetaData;
+import org.jboss.portal.portlet.mc.metadata.impl.AnnotationPortletApplication10MetaData;
+import org.jboss.portal.portlet.mc.metadata.impl.AnnotationPortletApplication20MetaData;
+import org.jboss.xb.binding.GenericObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PortletApplicationModelFactory implements GenericObjectModelFactory
+{
+
+ /** LocalizedDescriptionMetaData container for descriptions */
+ private LocalizedStringBuilder descriptions = new LocalizedStringBuilder();
+
+ /** LocalizedDescriptionMetaData container for displayNames */
+ private LocalizedStringBuilder displayNames = new LocalizedStringBuilder();
+
+ /** Guess what? The logger. */
+ private static final Logger log = Logger.getLogger(PortletApplicationModelFactory.class);
+
+ public Object newRoot(Object root, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
+ {
+
+ String version = attrs.getValue("version");
+ String id = attrs.getValue("id");
+
+ // portlet-app 2.0 or 1.0
+ PortletApplication10MetaData md = PORTLET_JSR_286_NS.equals(nsURI)
+ ? new AnnotationPortletApplication20MetaData()
+ : new AnnotationPortletApplication10MetaData();
+
+ // Set portlet-app id
+ md.setId(id);
+ // Set portlet-app version
+ md.setVersion(version);
+ // return
+ return md;
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx, String nsURI, String name)
+ {
+ return root;
+ }
+
+ public Object newChild(Object object, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
+ {
+ String id = attrs.getValue("id");
+ if (object instanceof DescribableMetaData)
+ {
+
+ if ("description".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ? attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new LocalizedDescriptionMetaData(locale);
+ this.descriptions.put(object, localized);
+ return localized;
+ }
+ }
+
+ // portlet-app
+ if (object instanceof PortletApplication10MetaData)
+ {
+ if ("portlet".equals(localName))
+ {
+ return new PortletMetaData(id);
+ }
+ else if ("custom-portlet-mode".equals(localName))
+ {
+ return new CustomPortletModeMetaData(id);
+ }
+ else if ("custom-window-state".equals(localName))
+ {
+ return new CustomWindowStateMetaData(id);
+ }
+ else if ("user-attribute".equals(localName))
+ {
+ return new UserAttributeMetaData(id);
+ }
+ else if ("security-constraint".equals(localName))
+ {
+ return new SecurityConstraintMetaData(id);
+ }
+ }
+
+ // portlet-app 2.0
+ if (object instanceof PortletApplication20MetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ if ("public-render-parameter".equals(localName))
+ {
+ return new PublicRenderParameterMetaData(id);
+ }
+ else if ("event-definition".equals(localName))
+ {
+ return new EventDefinitionMetaData(id);
+ }
+ else if ("filter".equals(localName))
+ {
+ return new FilterMetaData();
+ }
+ else if ("filter-mapping".equals(localName))
+ {
+ return new FilterMappingMetaData();
+ }
+ else if ("listener".equals(localName))
+ {
+ return new ListenerMetaData(id);
+ }
+ else if ("container-runtime-option".equals(localName))
+ {
+ return new ContainerRuntimeMetaData();
+ }
+ }
+
+ // portlet
+ if (object instanceof PortletMetaData)
+ {
+ if ("init-param".equals(localName))
+ {
+ return new InitParamMetaData(id);
+ }
+ else if ("display-name".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ? attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new LocalizedDescriptionMetaData(locale);
+ this.displayNames.put(object, localized);
+ return localized;
+ }
+ else if ("supports".equals(localName))
+ {
+ return new SupportsMetaData(id);
+ }
+ else if ("supported-locale".equals(localName))
+ {
+ return new SupportedLocaleMetaData();
+ }
+ else if ("portlet-info".equals(localName))
+ {
+ return new PortletInfoMetaData(id);
+ }
+ else if ("portlet-preferences".equals(localName))
+ {
+ return new PortletPreferencesMetaData(id);
+ }
+ else if ("security-role-ref".equals(localName))
+ {
+ return new SecurityRoleRefMetaData(id);
+ }
+ else if ("supported-processing-event".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ return new EventDefinitionReferenceMetaData(id);
+ }
+ else if ("supported-publishing-event".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ return new EventDefinitionReferenceMetaData(id);
+ }
+ else if ("container-runtime-option".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ return new ContainerRuntimeMetaData();
+ }
+ }
+
+ // security-constraint
+ if (object instanceof SecurityConstraintMetaData)
+ {
+ if ("portlet-collection".equals(localName))
+ {
+ return new PortletCollectionMetaData();
+ }
+ else if ("user-data-constraint".equals(localName))
+ {
+ return new UserDataConstraintMetaData(id);
+ }
+ else if ("display-name".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ? attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new LocalizedDescriptionMetaData(locale);
+ this.displayNames.put(object, localized);
+ return localized;
+ }
+ }
+
+ // supports
+ if (object instanceof SupportsMetaData)
+ {
+ if ("portlet-mode".equals(localName))
+ {
+ return new PortletModeMetaData();
+ }
+ else if ("window-state".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ return new WindowStateMetaData();
+ }
+ }
+
+ // preference (in portlet-preferences)
+ if (object instanceof PortletPreferencesMetaData)
+ {
+ if ("preference".equals(localName))
+ {
+ return new PortletPreferenceMetaData(id);
+ }
+ }
+
+ // filter
+ if (object instanceof FilterMetaData)
+ {
+ if ("init-param".equals(localName))
+ {
+ return new InitParamMetaData(id);
+ }
+ else if ("display-name".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ? attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new LocalizedDescriptionMetaData(locale);
+ this.displayNames.put(object, localized);
+ return localized;
+ }
+ }
+
+ // listener
+ if (object instanceof ListenerMetaData)
+ {
+ if ("display-name".equals(localName))
+ {
+ String locale = attrs.getValue("xml:lang") != null ? attrs.getValue("xml:lang") : DEFAULT_LOCALE;
+ LocalizedDescriptionMetaData localized = new LocalizedDescriptionMetaData(locale);
+ this.displayNames.put(object, localized);
+ return localized;
+ }
+ }
+
+ return null;
+ }
+
+ public void addChild(Object parent, Object child, UnmarshallingContext nav, String nsURI, String localName)
+ {
+
+ if (child instanceof DescribableMetaData)
+ {
+ DescribableMetaData md = (DescribableMetaData)child;
+ LocalizedString d = this.descriptions.getLocalizedString(md);
+ md.setDescription(d);
+ }
+
+ // portlet app
+ if (parent instanceof PortletApplication10MetaData)
+ {
+ PortletApplication10MetaData md = (PortletApplication10MetaData)parent;
+ // add portlet
+ if (child instanceof PortletMetaData)
+ {
+ PortletMetaData portlet = (PortletMetaData)child;
+ portlet.setDisplayName(this.displayNames.getLocalizedString(portlet));
+ md.addPortlet(portlet);
+ }
+ // add custom-portlet-mode
+ else if (child instanceof CustomPortletModeMetaData)
+ {
+ md.addCustomPortletMode((CustomPortletModeMetaData)child);
+ }
+ // add custom window state
+ else if (child instanceof CustomWindowStateMetaData)
+ {
+ md.addCustomWindowState((CustomWindowStateMetaData)child);
+ }
+ // add user-attribute
+ else if (child instanceof UserAttributeMetaData)
+ {
+ md.addUserAttribute((UserAttributeMetaData)child);
+ }
+ // add security-constraint
+ else if (child instanceof SecurityConstraintMetaData)
+ {
+ SecurityConstraintMetaData security = (SecurityConstraintMetaData)child;
+ // display-name
+ security.setDisplayName(this.displayNames.getLocalizedString(security));
+ md.addSecurityConstraint(security);
+ }
+ }
+
+ // portlet-app 2.0
+ if (parent instanceof PortletApplication20MetaData)
+ {
+ PortletApplication20MetaData md = (PortletApplication20MetaData)parent;
+ // add public-render-parameter
+ if (child instanceof PublicRenderParameterMetaData)
+ {
+ md.addPublicRenderParameter((PublicRenderParameterMetaData)child);
+ }
+ // add event-defintion
+ else if (child instanceof EventDefinitionMetaData)
+ {
+ md.addEventDefinition((EventDefinitionMetaData)child);
+ }
+ // add filter
+ else if (child instanceof FilterMetaData)
+ {
+ FilterMetaData filter = (FilterMetaData)child;
+ filter.setDisplayName(this.displayNames.getLocalizedString(filter));
+ md.addFilter(filter);
+ }
+ // add filter-mapping
+ else if (child instanceof FilterMappingMetaData)
+ {
+ md.addFilterMapping((FilterMappingMetaData)child);
+ }
+ // add container-runtime-option
+ else if (child instanceof ContainerRuntimeMetaData)
+ {
+ md.addContainerRuntime((ContainerRuntimeMetaData)child);
+ }
+ // add listener
+ else if (child instanceof ListenerMetaData)
+ {
+ ListenerMetaData listener = (ListenerMetaData)child;
+ listener.setDisplayName(this.displayNames.getLocalizedString(listener));
+ md.addListener(listener);
+ }
+ }
+
+ // portlet
+ if (parent instanceof PortletMetaData)
+ {
+ PortletMetaData md = (PortletMetaData)parent;
+ // init-param
+ if (child instanceof InitParamMetaData)
+ {
+ md.addInitParam((InitParamMetaData)child);
+ }
+ // supports
+ else if (child instanceof SupportsMetaData)
+ {
+ md.addSupport((SupportsMetaData)child);
+ }
+ // supported-locale
+ else if (child instanceof SupportedLocaleMetaData)
+ {
+ md.addSupportedLocale((SupportedLocaleMetaData)child);
+ }
+ // portlet-info
+ else if (child instanceof PortletInfoMetaData)
+ {
+ md.setPortletInfo((PortletInfoMetaData)child);
+ }
+ // portlet-preferences
+ else if (child instanceof PortletPreferencesMetaData)
+ {
+ md.setPortletPreferences((PortletPreferencesMetaData)child);
+ }
+ // security-role-ref
+ else if (child instanceof SecurityRoleRefMetaData)
+ {
+ md.addSecurityRoleRef((SecurityRoleRefMetaData)child);
+ }
+ // supported-events
+ else if (child instanceof EventDefinitionReferenceMetaData)
+ {
+ if ("supported-processing-event".equals(localName))
+ {
+ md.addSupportedProcessingEvent((EventDefinitionReferenceMetaData)child);
+ }
+ else if ("supported-publishing-event".equals(localName))
+ {
+ md.addSupportedPublishingEvent((EventDefinitionReferenceMetaData)child);
+ }
+ }
+ // container-runtime-option
+ else if (child instanceof ContainerRuntimeMetaData)
+ {
+ md.addContainerRuntime((ContainerRuntimeMetaData)child);
+ }
+ }
+
+ // adding user-data-constraint and portlet-name(s) to security-constraint
+ if (parent instanceof SecurityConstraintMetaData)
+ {
+ SecurityConstraintMetaData md = (SecurityConstraintMetaData)parent;
+ // add user-data-constraint
+ if (child instanceof UserDataConstraintMetaData)
+ {
+ md.setUserDataConstraint((UserDataConstraintMetaData)child);
+ }
+ // add portlet-collection
+ else if (child instanceof PortletCollectionMetaData)
+ {
+ md.setPortletList((PortletCollectionMetaData)child);
+ }
+ }
+
+ // filter
+ if (parent instanceof FilterMetaData)
+ {
+ FilterMetaData md = (FilterMetaData)parent;
+ // add init-param
+ if (child instanceof InitParamMetaData)
+ {
+ md.addInitParam((InitParamMetaData)child);
+ }
+ }
+
+ // add portlet-mode and window-state
+ if (parent instanceof SupportsMetaData)
+ {
+ SupportsMetaData md = (SupportsMetaData)parent;
+ if (child instanceof PortletModeMetaData)
+ {
+ md.addPortletMode((PortletModeMetaData)child);
+ }
+ else if (child instanceof WindowStateMetaData)
+ {
+ md.addWindowState((WindowStateMetaData)child);
+ }
+ }
+
+ // add preference
+ if (parent instanceof PortletPreferencesMetaData)
+ {
+ PortletPreferencesMetaData md = (PortletPreferencesMetaData)parent;
+ if (child instanceof PortletPreferenceMetaData)
+ {
+ md.addPortletPreference((PortletPreferenceMetaData)child);
+ }
+ }
+ }
+
+ public void setValue(Object object, UnmarshallingContext nav, String nsURI, String localName, String value)
+ {
+
+ // JSR 286 portlet-app attributes - default-namespace and resource-bundle.
+ if (object instanceof PortletApplication20MetaData)
+ {
+ PortletApplication20MetaData md = (PortletApplication20MetaData)object;
+ if ("resource-bundle".equals(localName))
+ {
+ md.setResourceBundle(value);
+ }
+ else if ("default-namespace".equals(localName))
+ {
+ try
+ {
+ md.setDefaultNamespace(new URI(value));
+ }
+ catch (URISyntaxException e)
+ {
+ log.error("Invalid syntax for default-namespace: " + value);
+ }
+ }
+ }
+
+ // portlet
+ if (object instanceof PortletMetaData)
+ {
+ PortletMetaData md = (PortletMetaData)object;
+ if ("portlet-name".equals(localName))
+ {
+ md.setPortletName(value);
+ }
+ else if ("portlet-class".equals(localName))
+ {
+ md.setPortletClass(value);
+ }
+ else if ("cache-scope".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ md.setCacheScope(PortletCacheScopeEnum.valueOf(value));
+ }
+ else if ("expiration-cache".equals(localName))
+ {
+ md.setExpirationCache(Integer.valueOf(value));
+ }
+ else if ("resource-bundle".equals(localName))
+ {
+ md.setResourceBundle(value);
+ }
+ else if ("supported-public-render-parameter".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ md.addSupportedPublicRenderParameter(value);
+ }
+ }
+
+ if (object instanceof LocalizedDescriptionMetaData)
+ {
+ LocalizedDescriptionMetaData localized = (LocalizedDescriptionMetaData)object;
+ if ("description".equals(localName))
+ {
+ localized.setDescription(value);
+ }
+ else if ("display-name".equals(localName))
+ {
+ localized.setDescription(value);
+ }
+ }
+
+ // init-param
+ if (object instanceof InitParamMetaData)
+ {
+ InitParamMetaData md = (InitParamMetaData)object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ md.setValue(value);
+ }
+ }
+
+ // supports
+ if (object instanceof SupportsMetaData)
+ {
+ SupportsMetaData md = (SupportsMetaData)object;
+ if ("mime-type".equals(localName))
+ {
+ md.setMimeType(value);
+ }
+ }
+
+ // supports --- portlet-mode
+ if (object instanceof PortletModeMetaData)
+ {
+ PortletModeMetaData md = (PortletModeMetaData)object;
+ if ("portlet-mode".equals(localName))
+ {
+ md.setPortletMode(Mode.create(value));
+ }
+ }
+
+ // supports --- window-state
+ if (object instanceof WindowStateMetaData)
+ {
+ WindowStateMetaData md = (WindowStateMetaData)object;
+ if ("window-state".equals(localName))
+ {
+ md.setWindowState(WindowState.create(value));
+ }
+ }
+
+ // supported-locale
+ if (object instanceof SupportedLocaleMetaData)
+ {
+ SupportedLocaleMetaData md = (SupportedLocaleMetaData)object;
+ if ("supported-locale".equals(localName))
+ {
+ md.setLocale(value);
+ }
+ }
+
+ // portlet-info
+ if (object instanceof PortletInfoMetaData)
+ {
+ PortletInfoMetaData md = (PortletInfoMetaData)object;
+ if ("title".equals(localName))
+ {
+ md.setTitle(value);
+ }
+ else if ("short-title".equals(localName))
+ {
+ md.setShortTitle(value);
+ }
+ else if ("keywords".equals(localName))
+ {
+ md.setKeywords(value);
+ }
+ }
+
+ // portlet-preferences
+ if (object instanceof PortletPreferencesMetaData)
+ {
+ PortletPreferencesMetaData md = (PortletPreferencesMetaData)object;
+ if ("preferences-validator".equals(localName))
+ {
+ md.setPreferenceValidator(value);
+ }
+ }
+
+ // preference
+ if (object instanceof PortletPreferenceMetaData)
+ {
+ PortletPreferenceMetaData md = (PortletPreferenceMetaData)object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ md.addValue(value);
+ }
+ else if ("read-only".equals(localName))
+ {
+ md.setReadOnly(Boolean.valueOf(value));
+ }
+ }
+
+ // security-role-ref
+ if (object instanceof SecurityRoleRefMetaData)
+ {
+ SecurityRoleRefMetaData md = (SecurityRoleRefMetaData)object;
+ if ("role-name".equals(localName))
+ {
+ md.setRoleName(value);
+ }
+ else if ("role-link".equals(localName))
+ {
+ md.setRoleLink(value);
+ }
+ }
+
+ // supported events
+ if (object instanceof EventDefinitionReferenceMetaData)
+ {
+ EventDefinitionReferenceMetaData md = (EventDefinitionReferenceMetaData)object;
+ if ("qname".equals(localName))
+ {
+ md.setQname(nav.resolveQName(value));
+ }
+ else if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ }
+
+ // custom-portlet-mode
+ if (object instanceof CustomPortletModeMetaData)
+ {
+ CustomPortletModeMetaData mode = (CustomPortletModeMetaData)object;
+ if ("portlet-mode".equals(localName))
+ {
+ mode.setPortletMode(value);
+ }
+ else if ("portal-managed".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ mode.setPortalManaged(Boolean.parseBoolean(value));
+ }
+ }
+
+ // custom-window-state
+ if (object instanceof CustomWindowStateMetaData)
+ {
+ CustomWindowStateMetaData md = (CustomWindowStateMetaData)object;
+ if ("window-state".equals(localName))
+ {
+ md.setWindowState(value);
+ }
+ }
+
+ // user-attribute
+ if (object instanceof UserAttributeMetaData)
+ {
+ UserAttributeMetaData md = (UserAttributeMetaData)object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ }
+
+ // user-data-constraint
+ if (object instanceof UserDataConstraintMetaData)
+ {
+ UserDataConstraintMetaData md = (UserDataConstraintMetaData)object;
+ if ("transport-guarantee".equals(localName))
+ {
+ md.setTransportQuarantee(TransportGuarantee.valueOf(value));
+ }
+ }
+
+ // portlet-collection in security-constraint
+ if (object instanceof PortletCollectionMetaData)
+ {
+ PortletCollectionMetaData md = (PortletCollectionMetaData)object;
+ if ("portlet-name".equals(localName))
+ {
+ md.addPortletname(value);
+ }
+ }
+
+ // filter
+ if (object instanceof FilterMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ FilterMetaData md = (FilterMetaData)object;
+ if ("filter-class".equals(localName))
+ {
+ md.setFilterClass(value);
+ }
+ else if ("filter-name".equals(localName))
+ {
+ md.setFilterName(value);
+ }
+ else if ("lifecycle".equals(localName))
+ {
+ int end = value.length() - "_PHASE".length();
+ String lifeCycle = value.substring(0, end > 0 ? end : 0);
+ try
+ {
+ md.addLifecycle(LifeCyclePhase.valueOf(lifeCycle));
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new IllegalArgumentException("Invalid value for lifecycle. Valid values are [RENDER_PHASE, RESOURCE_PHASE, ACTION_PHASE, EVENT_PHASE]");
+ }
+ }
+ }
+
+ // filter-mapping
+ if (object instanceof FilterMappingMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ FilterMappingMetaData md = (FilterMappingMetaData)object;
+ if ("filter-name".equals(localName))
+ {
+ md.setName(value);
+ }
+ if ("portlet-name".equals(localName))
+ {
+ md.addPortletName(value);
+ }
+ }
+
+ // event-defintion
+ if (object instanceof EventDefinitionMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ EventDefinitionMetaData md = (EventDefinitionMetaData)object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("qname".equals(localName))
+ {
+ md.setQname(nav.resolveQName(value));
+ }
+ else if ("value-type".equals(localName))
+ {
+ md.setValueType(value);
+ }
+ else if ("alias".equals(localName))
+ {
+ md.addAlias(nav.resolveQName(value));
+ }
+ }
+
+ // public-render-parameter
+ if (object instanceof PublicRenderParameterMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ PublicRenderParameterMetaData md = (PublicRenderParameterMetaData)object;
+ if ("identifier".equals(localName))
+ {
+ md.setIdentifier(value);
+ }
+ else if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("qname".equals(localName))
+ {
+ md.setQname(nav.resolveQName(value));
+ }
+ else if ("alias".equals(localName))
+ {
+ md.addAlias(nav.resolveQName(value));
+ }
+ }
+
+ // container-runtime-option
+ if (object instanceof ContainerRuntimeMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ ContainerRuntimeMetaData md = (ContainerRuntimeMetaData)object;
+ if ("name".equals(localName))
+ {
+ md.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ md.addValue(value);
+ }
+ }
+
+ // listener
+ if (object instanceof ListenerMetaData && PORTLET_JSR_286_NS.equals(nsURI))
+ {
+ ListenerMetaData md = (ListenerMetaData)object;
+ if ("listener-class".equals(localName))
+ {
+ md.setListenerClass(value);
+ }
+ }
+ }
+}
Added: modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/AnnotationPortletApplication10MetaData.java
===================================================================
--- modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/AnnotationPortletApplication10MetaData.java (rev 0)
+++ modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/AnnotationPortletApplication10MetaData.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata.impl;
+
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+@XmlRootElement(name = "portlet-app")
+@XmlType(name = "portlet-appType")
+@JBossXmlSchema(xmlns = {@XmlNs(namespaceURI = PortletMetaDataConstants.PORTLET_JSR_168_NS, prefix = "portlet")},
+ ignoreUnresolvedFieldOrClass = false,
+ namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS,
+ elementFormDefault = XmlNsForm.QUALIFIED)
+public class AnnotationPortletApplication10MetaData extends PortletApplication10MetaData
+{
+}
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/AnnotationPortletApplication20MetaData.java
===================================================================
--- modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/AnnotationPortletApplication20MetaData.java (rev 0)
+++ modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/AnnotationPortletApplication20MetaData.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata.impl;
+
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+
+@XmlRootElement(name = "portlet-app")
+@XmlType(name = "portlet-appType")
+@JBossXmlSchema(xmlns = {@XmlNs(namespaceURI = PortletMetaDataConstants.PORTLET_JSR_286_NS, prefix = "portlet")},
+ ignoreUnresolvedFieldOrClass = false,
+ namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS,
+ elementFormDefault = XmlNsForm.QUALIFIED)
+public class AnnotationPortletApplication20MetaData extends PortletApplication20MetaData
+{
+}
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/PortletApplicationMetaDataException.java
===================================================================
--- modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/PortletApplicationMetaDataException.java (rev 0)
+++ modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/PortletApplicationMetaDataException.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,51 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata.impl;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PortletApplicationMetaDataException extends Exception
+{
+ public PortletApplicationMetaDataException()
+ {
+ super();
+ }
+
+ public PortletApplicationMetaDataException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public PortletApplicationMetaDataException(String message)
+ {
+ super(message);
+ }
+
+ public PortletApplicationMetaDataException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Added: modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/ValueTrimmingFilter.java
===================================================================
--- modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/ValueTrimmingFilter.java (rev 0)
+++ modules/portlet/trunk/mc/src/main/java/org/jboss/portal/portlet/mc/metadata/impl/ValueTrimmingFilter.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata.impl;
+
+import org.jboss.xb.binding.GenericObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * Filter <code>setValue</code> method by doing a trimming before calling the next model.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ValueTrimmingFilter implements GenericObjectModelFactory
+{
+
+ private final GenericObjectModelFactory next;
+
+ public ValueTrimmingFilter(GenericObjectModelFactory next) throws IllegalArgumentException
+ {
+ if (next == null)
+ {
+ throw new IllegalArgumentException("Cannot be null");
+ }
+ this.next = next;
+ }
+
+ public Object newChild(Object object, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
+ {
+ return next.newChild(object, nav, nsURI, localName, attrs);
+ }
+
+ public void addChild(Object parent, Object child, UnmarshallingContext nav, String nsURI, String localName)
+ {
+ next.addChild(parent, child, nav, nsURI, localName);
+ }
+
+ public void setValue(Object object, UnmarshallingContext nav, String nsURI, String localName, String value)
+ {
+ value = value.trim();
+ next.setValue(object, nav, nsURI, localName, value);
+ }
+
+ public Object newRoot(Object root, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
+ {
+ return next.newRoot(root, nav, nsURI, localName, attrs);
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext nav, String nsURI, String localName)
+ {
+ return next.completeRoot(root, nav, nsURI, localName);
+ }
+
+}
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/AbstractMetaDataTestCase.java
===================================================================
--- modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/AbstractMetaDataTestCase.java (rev 0)
+++ modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/AbstractMetaDataTestCase.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,171 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.jboss.portal.portlet.mc.metadata.factory.PortletApplicationModelFactory;
+import org.jboss.portal.portlet.mc.metadata.impl.AnnotationPortletApplication10MetaData;
+import org.jboss.portal.portlet.mc.metadata.impl.AnnotationPortletApplication20MetaData;
+import org.jboss.portal.portlet.mc.metadata.impl.ValueTrimmingFilter;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+
+import static org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.*;
+
+import org.jboss.unit.api.pojo.annotations.Parameter;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
+import org.xml.sax.SAXException;
+import static org.jboss.unit.api.Assert.*;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractMetaDataTestCase
+{
+
+ /** Test parameter for using xml binding annotation. */
+ public static final String ANNOTATION_BINDING = "annotation";
+
+ /** Test parameter for using the ObjectModelFactory. */
+ public static final String FACTORY_BINDING = "factory";
+
+ /** The schema resolver factory. */
+ protected static SingletonSchemaResolverFactory factory;
+
+ /** The schema resolver. */
+ protected static DefaultSchemaResolver resolver;
+
+ /** The unmarshaller. */
+ protected Unmarshaller unmarshaller = null;
+
+ /** Annotation or ObjectModelFactory parsing. */
+ private String parser;
+
+ @Parameter(name = "parser")
+ public void setParser(String parser)
+ {
+ this.parser = parser;
+ }
+
+ static
+ {
+ try
+ {
+ factory = SingletonSchemaResolverFactory.getInstance();
+ resolver = (DefaultSchemaResolver) factory.getSchemaBindingResolver();
+
+ /** SchemaResolver */
+ resolver.addSchemaLocation(PORTLET_JSR_168_NS, "portlet-app_1_0.xsd");
+ resolver.addSchemaLocation(PORTLET_JSR_286_NS, "portlet-app_2_0.xsd");
+ resolver.addClassBinding(PORTLET_JSR_286_NS, AnnotationPortletApplication20MetaData.class);
+ resolver.addClassBinding(PORTLET_JSR_168_NS, AnnotationPortletApplication10MetaData.class);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ protected PortletApplication10MetaData unmarshall10(String file) throws JBossXBException, SAXException, IOException
+ {
+ if (ANNOTATION_BINDING.equals(parser))
+ {
+ return this.unmarshallAnnotation(file);
+ }
+ else if (FACTORY_BINDING.equals(parser))
+ {
+ return this.unmarshallWithFactory(file);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Wrong parameter for parser.");
+ }
+ }
+
+ protected PortletApplication20MetaData unmarshall20(String file) throws JBossXBException, SAXException, IOException
+ {
+ if (ANNOTATION_BINDING.equals(parser))
+ {
+ return (PortletApplication20MetaData)this.unmarshallAnnotation(file);
+ }
+ else if (FACTORY_BINDING.equals(parser))
+ {
+ return (PortletApplication20MetaData)this.unmarshallWithFactory(file);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Wrong parameter for parser.");
+ }
+ }
+
+ private PortletApplication10MetaData unmarshallAnnotation(String file) throws JBossXBException, SAXException,
+ IOException
+ {
+ /** validate */
+ unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ unmarshaller.setNamespaceAware(true);
+ unmarshaller.setSchemaValidation(true);
+ unmarshaller.setValidation(true);
+
+ /** unmarshal */
+ return (PortletApplication10MetaData) unmarshaller.unmarshal(getPath(file), resolver);
+ }
+
+ private PortletApplication10MetaData unmarshallWithFactory(String file) throws JBossXBException
+ {
+ /** validate */
+ unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ unmarshaller.setNamespaceAware(true);
+ unmarshaller.setSchemaValidation(true);
+ unmarshaller.setValidation(true);
+
+ PortletApplicationModelFactory factory = new PortletApplicationModelFactory();
+ /** unmarshal */
+ return (PortletApplication10MetaData) unmarshaller.unmarshal(getStream(file), new ValueTrimmingFilter(factory),
+ null);
+ }
+
+ protected String getPath(String file)
+ {
+ URL url = Thread.currentThread().getContextClassLoader().getResource(file);
+ if (url == null)
+ {
+ fail(file + " not found.");
+ }
+ return url.toString();
+ }
+
+ protected InputStream getStream(String file)
+ {
+ return Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
+ }
+
+}
Added: modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/CustomPortletModeTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/CustomPortletModeTestEverythingTestCase.java (rev 0)
+++ modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/CustomPortletModeTestEverythingTestCase.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,131 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata;
+
+import java.util.Locale;
+
+import org.jboss.portal.portlet.impl.metadata.CustomPortletModeMetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import static org.jboss.unit.api.Assert.*;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class CustomPortletModeTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+
+ @Test
+ public void test01()
+ {
+ try
+ {
+ String xmlFile = "metadata/customPortletMode/portlet1.xml";
+
+ PortletApplication10MetaData md = unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+ assertNotNull(md.getCustomPortletModes());
+
+ CustomPortletModeMetaData cmd1 = md.getCustomPortletModes().get("Custom");
+ assertNotNull(cmd1);
+ assertEquals("mode1", cmd1.getId());
+ assertEquals("Custom", cmd1.getPortletMode());
+ assertEquals("portletMode1", cmd1.getDescription().getDefaultString());
+ assertEquals("eigener portlet modus", cmd1.getDescription().getString(new Locale("de"), false));
+
+ assertNotNull(md.getCustomPortletModes().get("Custom2"));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void test02()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/customPortletMode/portlet2.xml";
+
+ PortletApplication10MetaData md = unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ CustomPortletModeMetaData cmd1 = md.getCustomPortletModes().get("Custom");
+ assertNotNull(cmd1);
+ assertEquals("Custom", cmd1.getPortletMode());
+ assertEquals("portletMode1", cmd1.getDescription().getDefaultString());
+ assertEquals(true, cmd1.isPortalManaged());
+ assertEquals("cmode1", cmd1.getId());
+
+ CustomPortletModeMetaData cmd2 = md.getCustomPortletModes().get("Custom2");
+ assertNotNull(cmd2);
+ assertEquals("Custom2", cmd2.getPortletMode());
+ assertEquals(false, cmd2.isPortalManaged());
+
+ CustomPortletModeMetaData cmd3 = md.getCustomPortletModes().get("Custom3");
+ assertNotNull(cmd3);
+ assertEquals("Custom3", cmd3.getPortletMode());
+
+ // default value
+ assertEquals(true, cmd3.isPortalManaged());
+ assertEquals("eigener portlet modus", cmd1.getDescription().getString(new Locale("de"), false));
+ assertEquals("Portlet Mode Three", cmd3.getDescription().getDefaultString());
+
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void test03()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/customPortletMode/portlet1-fail.xml";
+
+ PortletApplication10MetaData md = unmarshall10(xmlFile);
+ fail("portlet 2.0 properties are not allowed");
+ }
+ catch (Exception e)
+ {
+ // OK
+ }
+ }
+
+}
Added: modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/CustomWindowStateTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/CustomWindowStateTestEverythingTestCase.java (rev 0)
+++ modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/CustomWindowStateTestEverythingTestCase.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata;
+
+import java.util.Locale;
+
+import org.jboss.portal.portlet.impl.metadata.CustomWindowStateMetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import static org.jboss.unit.api.Assert.*;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class CustomWindowStateTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+ @Test
+ public void test01()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/customWindowState/portlet1.xml";
+
+ PortletApplication10MetaData md = unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+
+ CustomWindowStateMetaData cws1 = md.getCustomWindowStates().get("windowState1");
+ assertEquals("WindowState", cws1.getDescription().getDefaultString());
+ assertEquals("windowState1", cws1.getWindowState());
+ assertEquals("Offenes Fenster", cws1.getDescription().getString(new Locale("de"), false));
+ assertEquals("foo", cws1.getId());
+ CustomWindowStateMetaData cws2 = md.getCustomWindowStates().get("windowState2");
+ assertNotNull(cws2);
+
+ CustomWindowStateMetaData cws3 = md.getCustomWindowStates().get("windowState3");
+ assertEquals("drei", cws3.getId());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void test02()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/customWindowState/portlet2.xml";
+
+ PortletApplication10MetaData md = unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ CustomWindowStateMetaData cws1 = md.getCustomWindowStates().get("windowState1");
+ assertEquals("WindowState", cws1.getDescription().getDefaultString());
+ assertEquals("windowState1", cws1.getWindowState());
+ assertEquals("Offenes Fenster", cws1.getDescription().getString(new Locale("de"), false));
+ assertEquals("foo", cws1.getId());
+
+ CustomWindowStateMetaData cws2 = md.getCustomWindowStates().get("windowState2");
+ assertNotNull(cws2);
+
+ CustomWindowStateMetaData cws3 = md.getCustomWindowStates().get("windowState3");
+ assertEquals("drei", cws3.getId());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
Added: modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/EventTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/EventTestEverythingTestCase.java (rev 0)
+++ modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/EventTestEverythingTestCase.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,145 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata;
+
+import java.util.Locale;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionMetaData;
+import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionReferenceMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import static org.jboss.unit.api.Assert.*;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class EventTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+ @Test
+ public void test01()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/event/portlet-event1.xml";
+
+ unmarshall10(xmlFile);
+ fail();
+ }
+ catch (Exception e)
+ {
+ // ok
+ }
+ }
+
+ @Test
+ public void test02()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/event/portlet-event2.xml";
+
+ PortletApplication20MetaData md = unmarshall20(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ EventDefinitionMetaData emd = md.getEvents().get(0);
+ QName qname = emd.getQname();
+ assertEquals("eventID", emd.getId());
+ assertEquals("http://example.com/testEvents", qname.getNamespaceURI());
+ assertEquals("portletEvent", qname.getLocalPart());
+ assertEquals("x", qname.getPrefix());
+ assertEquals("org.jboss.portal.event.invoke.refill.beer", emd.getValueType());
+ assertEquals("descriptionDefaultLanguage", emd.getDescription().getDefaultString());
+ assertEquals("descriptionDefaultLanguage", emd.getDescription().getString(new Locale("en"), false));
+ assertEquals("Beschreibung in Deutsch", emd.getDescription().getString(new Locale("de"), false));
+
+ EventDefinitionMetaData emd2 = md.getEvents().get(1);
+
+ assertNull(emd2.getQname());
+ assertEquals("hellouh", emd2.getName());
+ assertEquals("hello", emd2.getAlias().get(0).getLocalPart());
+
+ // portlet event reference testing
+ PortletMetaData p1 = md.getPortlet("Portlet2");
+ QName referenceQName = new QName("http://example.com/testEvents", "portletEvent");
+ assertNotNull(p1);
+ assertEquals("org.jboss.portal.test.portlet.TestSessionPortlet", p1.getPortletClass());
+
+ EventDefinitionReferenceMetaData ermd1 = p1.getSupportedProcessingEvent().get(0);
+ assertNotNull(ermd1);
+ assertEquals(referenceQName, ermd1.getQname());
+
+ EventDefinitionReferenceMetaData ermd2 = p1.getSupportedProcessingEvent().get(1);
+ assertNotNull(ermd2);
+ assertEquals("hellouh", ermd2.getName());
+
+ EventDefinitionReferenceMetaData ermd3 = p1.getSupportedPublishingEvent().get(0);
+ assertNotNull(ermd3);
+ assertEquals(referenceQName, ermd3.getQname());
+
+ EventDefinitionReferenceMetaData ermd4 = p1.getSupportedPublishingEvent().get(1);
+ assertNotNull(ermd4);
+ assertEquals("hellouh", ermd4.getName());
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void test021()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/event/portlet-event2-fail.xml";
+
+ PortletApplication10MetaData md = unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertEquals("2.0", md.getVersion());
+
+// EventDefinitionMetaData edm = md.getEvents().get(0);
+
+ fail("Should fail: choice and qname defined!");
+ }
+ catch (Exception e)
+ {
+ // ok
+ }
+ }
+
+
+}
Added: modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/FilterTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/FilterTestEverythingTestCase.java (rev 0)
+++ modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/FilterTestEverythingTestCase.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata;
+
+import java.util.Locale;
+
+import org.jboss.portal.portlet.LifeCyclePhase;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.portlet.impl.metadata.common.InitParamMetaData;
+import org.jboss.portal.portlet.impl.metadata.filter.FilterMetaData;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import static org.jboss.unit.api.Assert.*;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class FilterTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+ @Test
+ public void test01()
+ {
+ try
+ {
+ unmarshall10("metadata/filter/portlet-filter1.xml");
+ // no filters in jsr 168
+ fail();
+ }
+ catch (Exception e)
+ {
+ // ok
+ }
+ }
+
+ @Test
+ public void test02()
+ {
+ try
+ {
+ String xmlFile = "metadata/filter/portlet-filter2.xml";
+
+ PortletApplication20MetaData md = unmarshall20(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+
+ FilterMetaData filter = md.getFilter("testFilter");
+ assertNotNull(filter);
+ assertEquals("org.jboss.portal.meta.NoExistingClass", filter.getFilterClass());
+ assertEquals("testFilter", filter.getFilterName());
+ assertEquals(LifeCyclePhase.ACTION, filter.getLifecycle().get(0));
+ assertEquals(LifeCyclePhase.RENDER, filter.getLifecycle().get(1));
+
+ assertEquals("test", filter.getDescription().getDefaultString());
+ assertEquals("bla", filter.getDescription().getString(new Locale("de"), false));
+
+ assertEquals("foo", filter.getDisplayName().getString(new Locale("fr"), false));
+ assertEquals("foobar", filter.getDisplayName().getDefaultString());
+
+ InitParamMetaData ip = filter.getInitParams().get(0);
+ assertEquals("eins", ip.getId());
+ assertEquals("foo", ip.getName());
+ assertEquals("bar", ip.getValue());
+ assertNotNull(ip.getDescription());
+
+ InitParamMetaData ip2 = filter.getInitParams().get(1);
+ assertEquals("test", ip2.getName());
+ assertEquals("testing", ip2.getValue());
+ assertNull(ip2.getId());
+
+ //
+ FilterMetaData filter2 = md.getFilter("testFilterZwei");
+ assertEquals("testFilterZwei", filter2.getFilterName());
+ assertEquals(LifeCyclePhase.ACTION, filter2.getLifecycle().get(0));
+
+ // Filter mapping
+ assertTrue(md.getFilterMapping().containsKey("testFilter"));
+ assertEquals("Portlet1", md.getFilterMapping().get("testFilter").getPortletNames().get(0));
+ assertEquals("Portlet2", md.getFilterMapping().get("testFilter").getPortletNames().get(1));
+
+ assertTrue(md.getFilterMapping().containsKey("testFilterZwei"));
+ assertEquals("Portlet2", md.getFilterMapping().get("testFilterZwei").getPortletNames().get(0));
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
Added: modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/GeneralMetaDataTestCase.java
===================================================================
--- modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/GeneralMetaDataTestCase.java (rev 0)
+++ modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/GeneralMetaDataTestCase.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,151 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata;
+
+import java.net.URI;
+import java.util.Locale;
+
+import org.jboss.portal.portlet.impl.metadata.ListenerMetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.portlet.impl.metadata.PublicRenderParameterMetaData;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import static org.jboss.unit.api.Assert.*;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class GeneralMetaDataTestCase extends AbstractMetaDataTestCase
+{
+
+ @Test
+ public void test01()
+ {
+ try
+ {
+ PortletApplication10MetaData md = this.unmarshall10("metadata/general/portlet1.xml");
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail("No exception expected");
+ }
+ }
+
+ @Test
+ public void test02()
+ {
+ try
+ {
+ PortletApplication10MetaData md = this.unmarshall10("metadata/general/portlet2.xml");
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void test021()
+ {
+ try
+ {
+ PortletApplication20MetaData md = unmarshall20("metadata/general/portlet2-jsr286.xml");
+ assertEquals("2.0", md.getVersion());
+ assertTrue(md instanceof PortletApplication20MetaData);
+
+ assertEquals("MyResourceBundle", md.getResourceBundle());
+ assertEquals(new URI("foobar"), md.getDefaultNamespace());
+
+ PublicRenderParameterMetaData prp1 = md.getPublicRenderParameters().get(0);
+
+ assertEquals("Public render parameter one", prp1.getDescription().getDefaultString());
+ assertEquals("param1", prp1.getId());
+ assertEquals("param1", prp1.getName());
+ assertEquals("Parameter1", prp1.getAlias().get(0).getLocalPart());
+ assertEquals("Parameter2", prp1.getAlias().get(1).getLocalPart());
+ assertEquals("blub", prp1.getIdentifier());
+
+ assertEquals("foobar", md.getContainerRuntimeOption("foo").getValues().get(0));
+ assertEquals("foobar2", md.getContainerRuntimeOption("foo").getValues().get(1));
+
+ ListenerMetaData listener1 = md.getListeners().get(0);
+ assertNotNull(listener1);
+ assertEquals("org.jboss.portal.portlet.test.listener.MyListener", listener1.getListenerClass());
+ assertEquals("Mein Zuh\u00f6rer Eins", listener1.getDisplayName().getString(new Locale("de"), false));
+ assertEquals("Beschreibung", listener1.getDescription().getString(new Locale("de"), false));
+
+ assertNotNull(md.getListeners().get(1));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void test01_generated()
+ {
+ try
+ {
+ PortletApplication10MetaData md = unmarshall10("metadata/general/portlet-app_1_0.xml");
+
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+ assertNotNull(md.getCustomPortletModes());
+
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void test02_generated()
+ {
+ try
+ {
+ PortletApplication10MetaData md = this.unmarshall10("metadata/general/portlet-app_2_0.xml");
+ assertEquals("2.0", md.getVersion());
+ assertTrue(md instanceof PortletApplication20MetaData);
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+}
Added: modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/PortletTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/PortletTestEverythingTestCase.java (rev 0)
+++ modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/PortletTestEverythingTestCase.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,506 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata;
+
+import java.util.List;
+import java.util.Locale;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants;
+import org.jboss.portal.portlet.impl.metadata.common.InitParamMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletCacheScopeEnum;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletInfoMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferencesMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SecurityRoleRefMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SupportedLocaleMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SupportsMetaData;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import static org.jboss.unit.api.Assert.*;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PortletTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+ @Test
+ public void test01()
+ {
+ try
+ {
+ String xmlFile = "metadata/portlet/portlet1.xml";
+
+ PortletApplication10MetaData md = unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+
+ Locale fr = new Locale("fr");
+ Locale default_locale = new Locale(PortletMetaDataConstants.DEFAULT_LOCALE);
+
+ PortletMetaData p1 = md.getPortlet("Portlet1");
+ assertNotNull(p1);
+ assertEquals(md, p1.getPortletApplication());
+ assertEquals("fragmichnicht", p1.getId());
+ assertEquals("Portlet1", p1.getPortletName());
+ assertEquals(default_locale, p1.getDescription().getDefaultLocale());
+ assertEquals("default", p1.getDescription().getDefaultString());
+ assertEquals("defaut", p1.getDescription().getString(fr, false));
+ assertEquals(default_locale, p1.getDisplayName().getDefaultLocale());
+ assertEquals("display", p1.getDisplayName().getDefaultString());
+ assertEquals("affichage", p1.getDisplayName().getString(fr, false));
+ assertEquals("org.jboss.portal.test.portlet.TestPortlet", p1.getPortletClass());
+
+ InitParamMetaData ip1 = p1.getInitParams().get(0);
+ assertEquals(default_locale, ip1.getDescription().getDefaultLocale());
+ assertEquals("first parameter", ip1.getDescription().getDefaultString());
+ assertEquals("premier parametre", ip1.getDescription().getString(fr, false));
+ assertEquals("one", ip1.getName());
+ assertEquals("1", ip1.getValue());
+
+ InitParamMetaData ip2 = p1.getInitParams().get(1);
+ assertNotNull(ip2);
+ assertEquals("second parameter", ip2.getDescription().getDefaultString());
+ assertEquals("deuxieme parametre", ip2.getDescription().getString(fr, false));
+ assertEquals("two", ip2.getName());
+ assertEquals("2", ip2.getValue());
+
+ // Expiration cache
+ assertEquals(0, p1.getExpirationCache());
+
+ SupportsMetaData smd1 = p1.getSupports().get(0);
+ assertEquals("text/html", smd1.getMimeType());
+ assertEquals(Mode.create("VIEW"), smd1.getPortletModes().get(0).getPortletMode());
+ assertEquals(Mode.create("EDIT"), smd1.getPortletModes().get(1).getPortletMode());
+ assertEquals(Mode.create("HELP"), smd1.getPortletModes().get(2).getPortletMode());
+
+ SupportsMetaData smd2 = p1.getSupports().get(1);
+ assertEquals("text/wml", smd2.getMimeType());
+ assertEquals(Mode.create("VIEW"), smd2.getPortletModes().get(0).getPortletMode());
+ assertEquals(Mode.create("HELP"), smd2.getPortletModes().get(1).getPortletMode());
+
+ assertEquals("MyResourceBundle", p1.getResourceBundle());
+
+ List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
+ assertEquals(3, localeList.size());
+ assertEquals("en", localeList.get(0).getLocale());
+ assertEquals("fr", localeList.get(1).getLocale());
+ assertEquals("fr_FR", localeList.get(2).getLocale());
+
+ PortletInfoMetaData pimd = p1.getPortletInfo();
+ assertNotNull(pimd);
+ assertEquals("very long portlet title", pimd.getTitle());
+ assertEquals("short portlet title", pimd.getShortTitle());
+ assertEquals("a,b,c,d,e,f", pimd.getKeywords());
+
+ PortletPreferencesMetaData ppmd = p1.getPortletPreferences();
+ assertNotNull(ppmd);
+
+ assertEquals("MyValidator", ppmd.getPreferenceValidator());
+ assertEquals("1", ppmd.getPortletPreferences().get("one").getValue().get(0));
+ assertEquals("2", ppmd.getPortletPreferences().get("two").getValue().get(0));
+ assertEquals(false, ppmd.getPortletPreferences().get("two").isReadOnly());
+ assertEquals("3", ppmd.getPortletPreferences().get("three").getValue().get(0));
+ assertEquals(true, ppmd.getPortletPreferences().get("three").isReadOnly());
+ assertEquals("1", ppmd.getPortletPreferences().get("all").getValue().get(0));
+ assertEquals("2", ppmd.getPortletPreferences().get("all").getValue().get(1));
+ assertEquals("3", ppmd.getPortletPreferences().get("all").getValue().get(2));
+
+ SecurityRoleRefMetaData srrmd1 = p1.getSecurityRoleRef().get(0);
+ assertNotNull(srrmd1);
+ assertEquals("role with no link", srrmd1.getDescription().getDefaultString());
+ assertEquals("role sans link", srrmd1.getDescription().getString(fr, false));
+ assertEquals("ROLE_NAME_WITHOUT_LINK", srrmd1.getRoleName());
+
+ SecurityRoleRefMetaData srrmd2 = p1.getSecurityRoleRef().get(1);
+ assertNotNull(srrmd2);
+ assertEquals("role with link", srrmd2.getDescription().getDefaultString());
+ assertEquals("role avec link", srrmd2.getDescription().getString(fr, false));
+ assertEquals("ROLE_NAME_WITH_LINK", srrmd2.getRoleName());
+ assertEquals("ROLE_LINK", srrmd2.getRoleLink());
+
+ // Portlet 2
+
+ PortletMetaData p2 = md.getPortlet("Portlet2");
+ assertNotNull(p2);
+ assertEquals(md, p2.getPortletApplication());
+ assertEquals("org.jboss.portal.test.portlet.TestSessionPortlet", p2.getPortletClass());
+ assertEquals("text/html", p2.getSupports().get(0).getMimeType());
+ assertEquals("test the portlet session", p2.getPortletInfo().getTitle());
+
+ // default value should be 0
+ assertEquals(0, p2.getExpirationCache());
+
+ PortletMetaData p3 = md.getPortlet("Portlet3");
+ assertNotNull(p3);
+ assertEquals(md, p3.getPortletApplication());
+
+ PortletMetaData p4 = md.getPortlet("Portlet4");
+ assertNotNull(p4);
+ assertEquals(md, p4.getPortletApplication());
+
+ PortletMetaData p5 = md.getPortlet("Portlet5");
+ assertNotNull(p5);
+ assertEquals(md, p5.getPortletApplication());
+ PortletPreferencesMetaData ppmd5 = p5.getPortletPreferences();
+ assertEquals("1", ppmd5.getPortletPreferences().get("one").getValue().get(0));
+ assertEquals("2", ppmd5.getPortletPreferences().get("two").getValue().get(0));
+ assertEquals(false, ppmd5.getPortletPreferences().get("two").isReadOnly());
+ assertEquals("3", ppmd5.getPortletPreferences().get("three").getValue().get(0));
+ assertEquals(true, ppmd5.getPortletPreferences().get("three").isReadOnly());
+ assertEquals("1", ppmd5.getPortletPreferences().get("all").getValue().get(0));
+ assertEquals("2", ppmd5.getPortletPreferences().get("all").getValue().get(1));
+ assertEquals("3", ppmd5.getPortletPreferences().get("all").getValue().get(2));
+
+ PortletMetaData p6 = md.getPortlet("Portlet6");
+ assertNotNull(p6);
+ assertEquals(md, p6.getPortletApplication());
+ assertEquals("Portlet6", p6.getResourceBundle());
+ assertEquals(3, p6.getSupportedLocale().size());
+ assertEquals("en", p6.getSupportedLocale().get(0).getLocale());
+ assertEquals("fr", p6.getSupportedLocale().get(1).getLocale());
+ assertEquals("fr_FR", p6.getSupportedLocale().get(2).getLocale());
+
+ PortletMetaData p7 = md.getPortlet("Portlet7");
+ assertNotNull(p7);
+
+ PortletMetaData p8 = md.getPortlet("Portlet8");
+ assertNotNull(p8);
+
+ PortletMetaData p9 = md.getPortlet("Portlet9");
+ assertNotNull(p9);
+
+ PortletMetaData p10 = md.getPortlet("Portlet10");
+ assertNotNull(p10);
+
+ PortletMetaData p11 = md.getPortlet("Portlet11");
+ assertNotNull(p11);
+
+ PortletMetaData p12 = md.getPortlet("Portlet12");
+ assertNotNull(p12);
+ assertEquals(60, p12.getExpirationCache());
+
+ PortletMetaData p13 = md.getPortlet("Portlet13");
+ assertNotNull(p13);
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void test02()
+ {
+ try
+ {
+ String xmlFile = "metadata/portlet/portlet2.xml";
+
+ PortletApplication10MetaData md = unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ Locale fr = new Locale("fr");
+ Locale default_locale = new Locale(PortletMetaDataConstants.DEFAULT_LOCALE);
+
+ PortletMetaData p1 = md.getPortlet("Portlet1");
+ assertNotNull(p1);
+ assertEquals("fragmichnicht2", p1.getId());
+ assertEquals("Portlet1", p1.getPortletName());
+ assertEquals(default_locale, p1.getDescription().getDefaultLocale());
+ assertEquals("default", p1.getDescription().getDefaultString());
+ assertEquals("defaut", p1.getDescription().getString(fr, false));
+ assertEquals(default_locale, p1.getDisplayName().getDefaultLocale());
+ assertEquals("display", p1.getDisplayName().getDefaultString());
+ assertEquals("affichage", p1.getDisplayName().getString(fr, false));
+ assertEquals("org.jboss.portal.test.portlet.TestPortlet", p1.getPortletClass());
+
+ InitParamMetaData ip1 = p1.getInitParams().get(0);
+ assertEquals(default_locale, ip1.getDescription().getDefaultLocale());
+ assertEquals("first parameter", ip1.getDescription().getDefaultString());
+ assertEquals("premier parametre", ip1.getDescription().getString(fr, false));
+ assertEquals("one", ip1.getName());
+ assertEquals("1", ip1.getValue());
+
+ InitParamMetaData ip2 = p1.getInitParams().get(1);
+ assertNotNull(ip2);
+ assertEquals("second parameter", ip2.getDescription().getDefaultString());
+ assertEquals("deuxieme parametre", ip2.getDescription().getString(fr, false));
+ assertEquals("two", ip2.getName());
+ assertEquals("2", ip2.getValue());
+
+ // Expiration cache
+ assertEquals(0, p1.getExpirationCache());
+
+ // cache Scope - JSR 286
+ assertEquals(PortletCacheScopeEnum.PUBLIC, p1.getCacheScope());
+
+ SupportsMetaData smd1 = p1.getSupports().get(0);
+ assertEquals("text/html", smd1.getMimeType());
+ assertEquals(Mode.create("VIEW"), smd1.getPortletModes().get(0).getPortletMode());
+ assertEquals(Mode.create("EDIT"), smd1.getPortletModes().get(1).getPortletMode());
+ assertEquals(Mode.create("HELP"), smd1.getPortletModes().get(2).getPortletMode());
+
+ SupportsMetaData smd2 = p1.getSupports().get(1);
+ assertEquals("text/wml", smd2.getMimeType());
+ assertEquals(Mode.create("VIEW"), smd2.getPortletModes().get(0).getPortletMode());
+ assertEquals(Mode.create("HELP"), smd2.getPortletModes().get(1).getPortletMode());
+
+ List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
+ assertEquals(3, localeList.size());
+ assertEquals("en", localeList.get(0).getLocale());
+ assertEquals("fr", localeList.get(1).getLocale());
+ assertEquals("fr_FR", localeList.get(2).getLocale());
+
+ assertEquals("MyResourceBundle", p1.getResourceBundle());
+
+ PortletInfoMetaData pimd = p1.getPortletInfo();
+ assertNotNull(pimd);
+ assertEquals("very long portlet title", pimd.getTitle());
+ assertEquals("short portlet title", pimd.getShortTitle());
+ assertEquals("a,b,c,d,e,f", pimd.getKeywords());
+
+ PortletPreferencesMetaData ppmd = p1.getPortletPreferences();
+ assertNotNull(ppmd);
+ assertEquals("MyValidator", ppmd.getPreferenceValidator());
+ assertEquals("1", ppmd.getPortletPreferences().get("one").getValue().get(0));
+ assertEquals("2", ppmd.getPortletPreferences().get("two").getValue().get(0));
+ assertEquals(false, ppmd.getPortletPreferences().get("two").isReadOnly());
+ assertEquals("3", ppmd.getPortletPreferences().get("three").getValue().get(0));
+ assertEquals(true, ppmd.getPortletPreferences().get("three").isReadOnly());
+ assertEquals("1", ppmd.getPortletPreferences().get("all").getValue().get(0));
+ assertEquals("2", ppmd.getPortletPreferences().get("all").getValue().get(1));
+ assertEquals("3", ppmd.getPortletPreferences().get("all").getValue().get(2));
+
+ SecurityRoleRefMetaData srrmd1 = p1.getSecurityRoleRef().get(0);
+ assertNotNull(srrmd1);
+ assertEquals("role with no link", srrmd1.getDescription().getDefaultString());
+ assertEquals("role sans link", srrmd1.getDescription().getString(fr, false));
+ assertEquals("ROLE_NAME_WITHOUT_LINK", srrmd1.getRoleName());
+
+ SecurityRoleRefMetaData srrmd2 = p1.getSecurityRoleRef().get(1);
+ assertNotNull(srrmd2);
+ assertEquals("role with link", srrmd2.getDescription().getDefaultString());
+ assertEquals("role avec link", srrmd2.getDescription().getString(fr, false));
+ assertEquals("ROLE_NAME_WITH_LINK", srrmd2.getRoleName());
+ assertEquals("ROLE_LINK", srrmd2.getRoleLink());
+
+ // Portlet2
+
+ PortletMetaData p2 = md.getPortlet("Portlet2");
+ assertNotNull(p2);
+ assertEquals("org.jboss.portal.test.portlet.TestSessionPortlet", p2.getPortletClass());
+ assertEquals("text/html", p2.getSupports().get(0).getMimeType());
+ assertEquals("test the portlet session", p2.getPortletInfo().getTitle());
+
+ PortletMetaData p3 = md.getPortlet("Portlet3");
+ assertNotNull(p3);
+
+ PortletMetaData p4 = md.getPortlet("Portlet4");
+ assertNotNull(p4);
+
+ PortletMetaData p5 = md.getPortlet("Portlet5");
+ assertNotNull(p5);
+ PortletPreferencesMetaData ppmd5 = p5.getPortletPreferences();
+ assertEquals("1", ppmd5.getPortletPreferences().get("one").getValue().get(0));
+ assertEquals("2", ppmd5.getPortletPreferences().get("two").getValue().get(0));
+ assertEquals(false, ppmd5.getPortletPreferences().get("two").isReadOnly());
+ assertEquals("3", ppmd5.getPortletPreferences().get("three").getValue().get(0));
+ assertEquals(true, ppmd5.getPortletPreferences().get("three").isReadOnly());
+ assertEquals("1", ppmd5.getPortletPreferences().get("all").getValue().get(0));
+ assertEquals("2", ppmd5.getPortletPreferences().get("all").getValue().get(1));
+ assertEquals("3", ppmd5.getPortletPreferences().get("all").getValue().get(2));
+
+ PortletMetaData p6 = md.getPortlet("Portlet6");
+ assertNotNull(p6);
+ assertEquals("Portlet6", p6.getResourceBundle());
+ assertEquals(3, p6.getSupportedLocale().size());
+ assertEquals("en", p6.getSupportedLocale().get(0).getLocale());
+ assertEquals("fr", p6.getSupportedLocale().get(1).getLocale());
+ assertEquals("fr_FR", p6.getSupportedLocale().get(2).getLocale());
+
+ PortletMetaData p7 = md.getPortlet("Portlet7");
+ assertNotNull(p7);
+
+ PortletMetaData p8 = md.getPortlet("Portlet8");
+ assertNotNull(p8);
+
+ PortletMetaData p9 = md.getPortlet("Portlet9");
+ assertNotNull(p9);
+
+ PortletMetaData p10 = md.getPortlet("Portlet10");
+ assertNotNull(p10);
+
+ PortletMetaData p11 = md.getPortlet("Portlet11");
+ assertNotNull(p11);
+
+ PortletMetaData p12 = md.getPortlet("Portlet12");
+ assertNotNull(p12);
+ assertEquals(60, p12.getExpirationCache());
+
+ PortletMetaData p13 = md.getPortlet("Portlet13");
+ assertNotNull(p13);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void test021()
+ {
+ try
+ {
+ String xmlFile = "metadata/portlet/portlet2-jsr286.xml";
+
+ PortletApplication10MetaData md = unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ Locale fr = new Locale("fr");
+ Locale default_locale = new Locale(PortletMetaDataConstants.DEFAULT_LOCALE);
+
+ PortletMetaData p1 = md.getPortlet("Portlet1");
+ assertNotNull(p1);
+ assertEquals("fragmichnicht2", p1.getId());
+ assertEquals("Portlet1", p1.getPortletName());
+ assertEquals(default_locale, p1.getDescription().getDefaultLocale());
+ assertEquals("default", p1.getDescription().getDefaultString());
+ assertEquals("defaut", p1.getDescription().getString(fr, false));
+ assertEquals(default_locale, p1.getDisplayName().getDefaultLocale());
+ assertEquals("display", p1.getDisplayName().getDefaultString());
+ assertEquals("affichage", p1.getDisplayName().getString(fr, false));
+ assertEquals("org.jboss.portal.test.portlet.TestPortlet", p1.getPortletClass());
+
+ InitParamMetaData ip1 = p1.getInitParams().get(0);
+ assertEquals(default_locale, ip1.getDescription().getDefaultLocale());
+ assertEquals("first parameter", ip1.getDescription().getDefaultString());
+ assertEquals("premier parametre", ip1.getDescription().getString(fr, false));
+ assertEquals("one", ip1.getName());
+ assertEquals("1", ip1.getValue());
+
+ InitParamMetaData ip2 = p1.getInitParams().get(1);
+ assertNotNull(ip2);
+ assertEquals("second parameter", ip2.getDescription().getDefaultString());
+ assertEquals("deuxieme parametre", ip2.getDescription().getString(fr, false));
+ assertEquals("two", ip2.getName());
+ assertEquals("2", ip2.getValue());
+
+ // Expiration cache
+ assertEquals(0, p1.getExpirationCache());
+
+ SupportsMetaData smd1 = p1.getSupports().get(0);
+ assertEquals("text/html", smd1.getMimeType());
+ assertEquals(Mode.create("VIEW"), smd1.getPortletModes().get(0).getPortletMode());
+ assertEquals(Mode.create("EDIT"), smd1.getPortletModes().get(1).getPortletMode());
+ assertEquals(Mode.create("HELP"), smd1.getPortletModes().get(2).getPortletMode());
+ // window state jsr 286
+ assertEquals(WindowState.create("MAXIMIZED"), smd1.getWindowStates().get(0).getWindowState());
+ assertEquals(WindowState.create("NORMAL"), smd1.getWindowStates().get(1).getWindowState());
+
+ SupportsMetaData smd2 = p1.getSupports().get(1);
+ assertEquals("foo", smd2.getId());
+ assertEquals("text/wml", smd2.getMimeType());
+ assertEquals(Mode.create("VIEW"), smd2.getPortletModes().get(0).getPortletMode());
+ assertEquals(Mode.create("HELP"), smd2.getPortletModes().get(1).getPortletMode());
+ // window state jsr 286
+ assertEquals(WindowState.create("NORMAL"), smd2.getWindowStates().get(0).getWindowState());
+ assertEquals(WindowState.create("CUSTOM"), smd2.getWindowStates().get(1).getWindowState());
+
+ List<SupportedLocaleMetaData> localeList = p1.getSupportedLocale();
+ assertEquals(3, localeList.size());
+ assertEquals("en", localeList.get(0).getLocale());
+ assertEquals("fr", localeList.get(1).getLocale());
+ assertEquals("fr_FR", localeList.get(2).getLocale());
+
+ assertEquals("MyResourceBundle", p1.getResourceBundle());
+
+ PortletInfoMetaData pimd = p1.getPortletInfo();
+ assertNotNull(pimd);
+ assertEquals("very long portlet title", pimd.getTitle());
+ assertEquals("short portlet title", pimd.getShortTitle());
+ assertEquals("a,b,c,d,e,f", pimd.getKeywords());
+
+ PortletPreferencesMetaData ppmd = p1.getPortletPreferences();
+ assertNotNull(ppmd);
+ assertEquals("MyValidator", ppmd.getPreferenceValidator());
+ assertEquals("1", ppmd.getPortletPreferences().get("one").getValue().get(0));
+ assertEquals("2", ppmd.getPortletPreferences().get("two").getValue().get(0));
+ assertEquals(false, ppmd.getPortletPreferences().get("two").isReadOnly());
+ assertEquals("3", ppmd.getPortletPreferences().get("three").getValue().get(0));
+ assertEquals(true, ppmd.getPortletPreferences().get("three").isReadOnly());
+ assertEquals("1", ppmd.getPortletPreferences().get("all").getValue().get(0));
+ assertEquals("2", ppmd.getPortletPreferences().get("all").getValue().get(1));
+ assertEquals("3", ppmd.getPortletPreferences().get("all").getValue().get(2));
+
+ SecurityRoleRefMetaData srrmd1 = p1.getSecurityRoleRef().get(0);
+ assertNotNull(srrmd1);
+ assertEquals("role with no link", srrmd1.getDescription().getDefaultString());
+ assertEquals("role sans link", srrmd1.getDescription().getString(fr, false));
+ assertEquals("ROLE_NAME_WITHOUT_LINK", srrmd1.getRoleName());
+
+ SecurityRoleRefMetaData srrmd2 = p1.getSecurityRoleRef().get(1);
+ assertNotNull(srrmd2);
+ assertEquals("role with link", srrmd2.getDescription().getDefaultString());
+ assertEquals("role avec link", srrmd2.getDescription().getString(fr, false));
+ assertEquals("ROLE_NAME_WITH_LINK", srrmd2.getRoleName());
+ assertEquals("ROLE_LINK", srrmd2.getRoleLink());
+
+ // JSR 286 properties
+ assertEquals(PortletCacheScopeEnum.PUBLIC, p1.getCacheScope());
+ assertEquals("http://example.com/testEvents", p1.getSupportedProcessingEvent().get(0).getQname()
+ .getNamespaceURI());
+ assertEquals("portletEvent", p1.getSupportedProcessingEvent().get(0).getQname().getLocalPart());
+ assertEquals("x", p1.getSupportedProcessingEvent().get(0).getQname().getPrefix());
+ assertEquals("foo", p1.getSupportedPublicRenderParameters().get(0));
+ assertEquals("bar", p1.getSupportedPublicRenderParameters().get(1));
+ assertEquals("foo2", p1.getSupportedPublicRenderParameters().get(2));
+ assertEquals("foo2bar", p1.getSupportedPublicRenderParameters().get(3));
+
+ assertTrue(p1.getContainerRuntimeOptions().containsKey("option1"));
+ assertTrue(p1.getContainerRuntimeOptions().containsKey("option2"));
+ assertEquals("value1", p1.getContainerRuntimeOptions().get("option1").getValues().get(0));
+ assertEquals("value2", p1.getContainerRuntimeOptions().get("option1").getValues().get(1));
+ assertEquals("value3", p1.getContainerRuntimeOptions().get("option2").getValues().get(0));
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
Added: modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/RenderParameterTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/RenderParameterTestEverythingTestCase.java (rev 0)
+++ modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/RenderParameterTestEverythingTestCase.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,79 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata;
+
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.portlet.impl.metadata.PublicRenderParameterMetaData;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import static org.jboss.unit.api.Assert.*;
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class RenderParameterTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+ @Test
+ public void test02()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/renderParameter/portlet2.xml";
+
+ PortletApplication20MetaData md = unmarshall20(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ PublicRenderParameterMetaData prp1 = md.getPublicRenderParameters().get(0);
+ assertNotNull(prp1);
+
+ assertEquals("blah", prp1.getIdentifier());
+ assertEquals("renderParameter1", prp1.getName());
+
+
+ PublicRenderParameterMetaData prp2 = md.getPublicRenderParameters().get(1);
+ assertEquals("foo", prp2.getQname().getLocalPart());
+ assertEquals("x", prp2.getQname().getPrefix());
+ assertEquals("http://someurl.com", prp2.getQname().getNamespaceURI());
+
+ assertEquals("fooo", prp1.getAlias().get(0).getLocalPart());
+ assertEquals("rP1", prp1.getAlias().get(1).getLocalPart());
+
+ assertEquals("foo", prp2.getAlias().get(0).getLocalPart());
+ assertEquals("http://someurl.alias.com", prp2.getAlias().get(0).getNamespaceURI());
+ assertEquals("s", prp2.getAlias().get(0).getPrefix());
+
+ assertEquals("render parameter foo", prp1.getDescription().getDefaultString());
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
Added: modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/SecurityConstraintTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/SecurityConstraintTestEverythingTestCase.java (rev 0)
+++ modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/SecurityConstraintTestEverythingTestCase.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,215 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata;
+
+import java.util.Locale;
+
+import org.jboss.portal.portlet.TransportGuarantee;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.portal.portlet.impl.metadata.security.SecurityConstraintMetaData;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import static org.jboss.unit.api.Assert.*;
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class SecurityConstraintTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+ @Test
+ public void test01()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/security/portlet1.xml";
+
+ PortletApplication10MetaData md = unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+ assertEquals("1.0", md.getVersion());
+
+ SecurityConstraintMetaData scd1 = md.getSecurityConstraints().get(0);
+ assertNotNull(scd1);
+ assertEquals("test", scd1.getDisplayName().getDefaultString());
+ assertEquals("Test", scd1.getDisplayName().getString(new Locale("de"), false));
+ assertEquals(TransportGuarantee.NONE, scd1.getUserDataConstraint().getTransportQuarantee());
+
+ assertEquals("foo", scd1.getPortletList().getPortletNames().get(0));
+ assertEquals("foobar", scd1.getPortletList().getPortletNames().get(1));
+ assertEquals("foo", scd1.getId());
+
+ SecurityConstraintMetaData scd2 = md.getSecurityConstraints().get(1);
+ assertNotNull(scd2);
+ assertEquals(TransportGuarantee.INTEGRAL, scd2.getUserDataConstraint().getTransportQuarantee());
+ assertEquals("foo", scd2.getPortletList().getPortletNames().get(0));
+ assertEquals("fooConstraint", scd1.getUserDataConstraint().getDescription().getDefaultString());
+ assertEquals("FooConstraint", scd1.getUserDataConstraint().getDescription().getString(new Locale("de"), false));
+
+ try
+ {
+ scd2.getPortletList().getPortletNames().get(1);
+ fail("2nd security constraint should only contain one element,");
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ // expected java.lang.IndexOutOfBoundsException
+ }
+
+ PortletMetaData pmd1 = md.getPortlet("foo");
+ assertNotNull(pmd1);
+
+ PortletMetaData pmd2 = md.getPortlet("foobar");
+ assertNotNull(pmd2);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /*
+ public void test011()
+ {
+ try
+ {
+
+ String xmlFile = "security/portlet1-fail1.xml";
+ String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
+
+ unmarshall(xmlFile, namespace, PortletApplication10MetaData.class);
+
+ fail();
+ }
+ catch(Exception e)
+ {
+ // OK
+ }
+ }
+
+ public void test012()
+ {
+ try
+ {
+
+ String xmlFile = "security/portlet1-fail1.xml";
+ String namespace = PortletMetaDataConstants.PORTLET_JSR_168_NS;
+
+ unmarshall(xmlFile, namespace, PortletApplication10MetaData.class);
+ fail();
+ }
+ catch(Exception e)
+ {
+ // OK
+ }
+ }
+ */
+
+ @Test
+ public void test02()
+ {
+ try
+ {
+
+ String xmlFile = "metadata/security/portlet2.xml";
+
+ PortletApplication10MetaData md = unmarshall10( xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+ assertEquals("2.0", md.getVersion());
+
+ SecurityConstraintMetaData scd1 = md.getSecurityConstraints().get(0);
+ assertNotNull(scd1);
+ assertEquals("test", scd1.getDisplayName().getDefaultString());
+ assertEquals("Test", scd1.getDisplayName().getString(new Locale("de"), false));
+ assertEquals("foo", scd1.getId());
+
+ assertEquals(TransportGuarantee.NONE, scd1.getUserDataConstraint().getTransportQuarantee());
+ assertEquals("foo", scd1.getPortletList().getPortletNames().get(0));
+ assertEquals("foobar", scd1.getPortletList().getPortletNames().get(1));
+
+
+ SecurityConstraintMetaData scd2 = md.getSecurityConstraints().get(1);
+ assertNotNull(scd2);
+ assertEquals(TransportGuarantee.INTEGRAL, scd2.getUserDataConstraint().getTransportQuarantee());
+ assertEquals("foo", scd2.getPortletList().getPortletNames().get(0));
+ assertEquals("fooConstraint", scd1.getUserDataConstraint().getDescription().getDefaultString());
+ assertEquals("FooConstraint", scd1.getUserDataConstraint().getDescription().getString(new Locale("de"), false));
+
+ try
+ {
+ scd2.getPortletList().getPortletNames().get(1);
+ fail("2nd security constraint should only contain one element,");
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ // expected java.lang.IndexOutOfBoundsException
+ }
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+ /*
+ public void test021()
+ {
+ try
+ {
+
+ String xmlFile = "security/portlet2-fail1.xml";
+ String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
+
+ unmarshall(xmlFile, namespace, PortletApplication20MetaData.class);
+ fail();
+ }
+ catch(Exception e)
+ {
+ // OK
+ }
+ }
+
+ public void test022()
+ {
+ try
+ {
+
+ String xmlFile = "security/portlet2-fail2.xml";
+ String namespace = PortletMetaDataConstants.PORTLET_JSR_286_NS;
+
+ unmarshall(xmlFile, namespace, PortletApplication20MetaData.class);
+ fail();
+ }
+ catch(Exception e)
+ {
+ // OK
+ }
+ }
+ */
+}
Added: modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/UserAttributeTestEverythingTestCase.java
===================================================================
--- modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/UserAttributeTestEverythingTestCase.java (rev 0)
+++ modules/portlet/trunk/mc/src/test/java/org/jboss/portal/portlet/mc/metadata/UserAttributeTestEverythingTestCase.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,100 @@
+/******************************************************************************
+ * 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.portlet.mc.metadata;
+
+import java.util.Locale;
+
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.portlet.impl.metadata.UserAttributeMetaData;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import static org.jboss.unit.api.Assert.*;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class UserAttributeTestEverythingTestCase extends AbstractMetaDataTestCase
+{
+
+ @Test
+ public void test01()
+ {
+ try
+ {
+ String xmlFile = "metadata/userAttribute/portlet1.xml";
+
+ PortletApplication10MetaData md = unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication10MetaData);
+
+ UserAttributeMetaData umb = md.getUserAttributes().get("blub");
+ assertNotNull(umb);
+ assertEquals("notFoo", umb.getId());
+ assertNull(umb.getDescription());
+
+ UserAttributeMetaData umd = md.getUserAttributes().get("foo");
+ assertNotNull(umd);
+ assertEquals("realFoo", umd.getId());
+ assertEquals("foobar", umd.getDescription().getDefaultString());
+ assertEquals("fuhbar", umd.getDescription().getString(new Locale("de"), true));
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ @Test
+ public void test02()
+ {
+ try
+ {
+ String xmlFile = "metadata/userAttribute/portlet2.xml";
+
+ PortletApplication10MetaData md = unmarshall10(xmlFile);
+ assertNotNull(md);
+ assertTrue(md instanceof PortletApplication20MetaData);
+
+ UserAttributeMetaData umb = md.getUserAttributes().get("blub");
+ assertNotNull(umb);
+ assertEquals("notFoo", umb.getId());
+ assertNull(umb.getDescription());
+
+ UserAttributeMetaData umd = md.getUserAttributes().get("foo");
+ assertNotNull(umd);
+ assertEquals("realFoo", umd.getId());
+ assertEquals("foobar", umd.getDescription().getDefaultString());
+ assertEquals("fuhbar", umd.getDescription().getString(new Locale("de"), true));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+}
Added: modules/portlet/trunk/mc/src/test/resources/local-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/local-jboss-unit.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/local-jboss-unit.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-unit
+ xmlns="urn:jboss:jboss-unit:1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
+ <pojo>
+ <test>
+ <class name="org.jboss.portal.portlet.mc.metadata.CustomPortletModeTestEverythingTestCase" />
+ <parameter name="parser">
+ <value>annotation</value>
+ <value>factory</value>
+ </parameter>
+ </test>
+ <test>
+ <class name="org.jboss.portal.portlet.mc.metadata.CustomWindowStateTestEverythingTestCase" />
+ <parameter name="parser">
+ <value>annotation</value>
+ <value>factory</value>
+ </parameter>
+ </test>
+ <test>
+ <class name="org.jboss.portal.portlet.mc.metadata.EventTestEverythingTestCase" />
+ <parameter name="parser">
+ <value>annotation</value>
+ <value>factory</value>
+ </parameter>
+ </test>
+ <test>
+ <class name="org.jboss.portal.portlet.mc.metadata.FilterTestEverythingTestCase" />
+ <parameter name="parser">
+ <value>annotation</value>
+ <value>factory</value>
+ </parameter>
+ </test>
+ <test>
+ <class name="org.jboss.portal.portlet.mc.metadata.GeneralMetaDataTestCase" />
+ <parameter name="parser">
+ <value>annotation</value>
+ <value>factory</value>
+ </parameter>
+ </test>
+ <test>
+ <class name="org.jboss.portal.portlet.mc.metadata.PortletTestEverythingTestCase" />
+ <parameter name="parser">
+ <value>annotation</value>
+ <value>factory</value>
+ </parameter>
+ </test>
+ <test>
+ <class name="org.jboss.portal.portlet.mc.metadata.RenderParameterTestEverythingTestCase" />
+ <parameter name="parser">
+ <value>annotation</value>
+ <value>factory</value>
+ </parameter>
+ </test>
+ <test>
+ <class name="org.jboss.portal.portlet.mc.metadata.SecurityConstraintTestEverythingTestCase" />
+ <parameter name="parser">
+ <value>annotation</value>
+ <value>factory</value>
+ </parameter>
+ </test>
+ <test>
+ <class name="org.jboss.portal.portlet.mc.metadata.UserAttributeTestEverythingTestCase" />
+ <parameter name="parser">
+ <value>annotation</value>
+ <value>factory</value>
+ </parameter>
+ </test>
+ </pojo>
+</jboss-unit>
Added: modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/portlet1-fail.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/portlet1-fail.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/portlet1-fail.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <custom-portlet-mode id="cmode1">
+ <description>portletMode1</description>
+ <description xml:lang="de">eigener portlet modus</description>
+ <portlet-mode>Custom</portlet-mode>
+ <portal-managed>true</portal-managed>
+ <decoration-name>Portlet Mode One</decoration-name>
+ <decoration-name xml:lang="de">Eigener Portlet Modus Eins</decoration-name>
+ </custom-portlet-mode>
+
+ <custom-portlet-mode>
+ <decoration-name>Portlet Mode One</decoration-name>
+ <portlet-mode>Custom2</portlet-mode>
+ <portal-managed>false</portal-managed>
+ </custom-portlet-mode>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/portlet1.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/portlet1.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/portlet1.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <custom-portlet-mode id="mode1">
+ <description>portletMode1</description>
+ <description xml:lang="de">eigener portlet modus</description>
+ <portlet-mode>Custom</portlet-mode>
+ </custom-portlet-mode>
+
+ <custom-portlet-mode>
+ <portlet-mode>Custom2</portlet-mode>
+ </custom-portlet-mode>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/portlet2.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/portlet2.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/customPortletMode/portlet2.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <custom-portlet-mode id="cmode1">
+ <description>portletMode1</description>
+ <description xml:lang="de">eigener portlet modus</description>
+ <portlet-mode>Custom</portlet-mode>
+ <portal-managed>true</portal-managed>
+ </custom-portlet-mode>
+
+ <custom-portlet-mode>
+ <portlet-mode>Custom2</portlet-mode>
+ <portal-managed>false</portal-managed>
+ </custom-portlet-mode>
+
+ <custom-portlet-mode>
+ <description>Portlet Mode Three</description>
+ <portlet-mode>Custom3</portlet-mode>
+ </custom-portlet-mode>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/customWindowState/portlet1.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/customWindowState/portlet1.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/customWindowState/portlet1.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <custom-window-state id="foo">
+ <description>WindowState</description>
+ <description xml:lang="de">Offenes Fenster</description>
+ <window-state>windowState1</window-state>
+ </custom-window-state>
+
+ <custom-window-state>
+ <window-state>windowState2</window-state>
+ </custom-window-state>
+
+ <custom-window-state id="drei">
+ <window-state>windowState3</window-state>
+ </custom-window-state>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/customWindowState/portlet2.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/customWindowState/portlet2.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/customWindowState/portlet2.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <custom-window-state id="foo">
+ <description>WindowState</description>
+ <description xml:lang="de">Offenes Fenster</description>
+ <window-state>windowState1</window-state>
+ </custom-window-state>
+
+ <custom-window-state>
+ <window-state>windowState2</window-state>
+ </custom-window-state>
+
+ <custom-window-state id="drei">
+ <window-state>windowState3</window-state>
+ </custom-window-state>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/event/portlet-event1.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/event/portlet-event1.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/event/portlet-event1.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <event-definition id="shouldfail">
+ <name>MustFail</name>
+ </event-definition>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/event/portlet-event2-fail.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/event/portlet-event2-fail.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/event/portlet-event2-fail.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet id="portlet">
+ <portlet-name>Portlet2</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSessionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet session</title>
+ </portlet-info>
+ <supported-processing-event>
+ <qname xmlns:x="http://example.com/testEvents">x:portletEvent</qname>
+ </supported-processing-event>
+ <supported-processing-event>
+ <name>hellouh</name>
+ </supported-processing-event>
+
+ <supported-publishing-event>
+ <qname xmlns:x="http://example.com/testEvents">x:portletEvent</qname>
+ <name>fooooo</name>
+ </supported-publishing-event>
+ <supported-publishing-event>
+ <name>hellouh</name>
+ </supported-publishing-event>
+ </portlet>
+
+ <event-definition>
+ <qname xmlns:x="http://example.com/testEvents">x:portletEvent</qname>
+ <name>hellouh</name>
+ <alias>hello</alias>
+ </event-definition>
+
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/event/portlet-event2.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/event/portlet-event2.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/event/portlet-event2.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet id="portlet">
+ <portlet-name>Portlet2</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSessionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet session</title>
+ </portlet-info>
+ <supported-processing-event>
+ <qname xmlns:x="http://example.com/testEvents">x:portletEvent</qname>
+ </supported-processing-event>
+ <supported-processing-event>
+ <name>hellouh</name>
+ </supported-processing-event>
+
+ <supported-publishing-event>
+ <qname xmlns:x="http://example.com/testEvents">x:portletEvent</qname>
+ </supported-publishing-event>
+ <supported-publishing-event>
+ <name>hellouh</name>
+ </supported-publishing-event>
+ </portlet>
+
+ <event-definition id="eventID">
+ <description>descriptionDefaultLanguage</description>
+ <description xml:lang="de">Beschreibung in Deutsch</description>
+ <qname xmlns:x="http://example.com/testEvents">x:portletEvent</qname>
+ <value-type>
+ org.jboss.portal.event.invoke.refill.beer
+ </value-type>
+ </event-definition>
+
+ <event-definition>
+ <name>hellouh</name>
+ <alias>hello</alias>
+ </event-definition>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/filter/portlet-filter1.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/filter/portlet-filter1.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/filter/portlet-filter1.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <filter>
+ <filter-name>testFilter</filter-name>
+ </filter>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/filter/portlet-filter2.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/filter/portlet-filter2.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/filter/portlet-filter2.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <filter>
+ <description>test</description>
+ <description xml:lang="de">bla</description>
+ <display-name xml:lang="fr">foo</display-name>
+ <display-name>foobar</display-name>
+ <filter-name>testFilter</filter-name>
+ <filter-class>
+ org.jboss.portal.meta.NoExistingClass
+ </filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ <init-param id="eins">
+ <description xml:lang="fr">biere</description>
+ <description>beer</description>
+ <name>foo</name>
+ <value>bar</value>
+ </init-param>
+ <init-param>
+ <name>test</name>
+ <value>testing</value>
+ </init-param>
+ </filter>
+
+ <filter>
+ <filter-name>testFilterZwei</filter-name>
+ <filter-class>org.jboss.portal.meta.NoExistingClass</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ </filter>
+
+ <filter>
+ <filter-name>foo</filter-name>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>testFilter</filter-name>
+ <portlet-name>Portlet1</portlet-name>
+ <portlet-name>Portlet2</portlet-name>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>testFilterZwei</filter-name>
+ <portlet-name>Portlet2</portlet-name>
+ </filter-mapping>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet-app_1_0.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet-app_1_0.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet-app_1_0.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0"
+ id="id">
+ <portlet id="id">
+ <description xml:lang="en">description</description>
+ <portlet-name>portlet-name</portlet-name>
+ <display-name xml:lang="en">display-name</display-name>
+ <portlet-class>portlet-class</portlet-class>
+ <init-param id="id">
+ <description xml:lang="en">description</description>
+ <name>name</name>
+ <value>value</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports id="id">
+ <mime-type>mime-type</mime-type>
+ <portlet-mode>portlet-mode</portlet-mode>
+ </supports>
+ <supported-locale>supported-locale</supported-locale>
+ <resource-bundle>resource-bundle</resource-bundle>
+ <portlet-info id="id">
+ <title>title</title>
+ <short-title>short-title</short-title>
+ <keywords>keywords</keywords>
+ </portlet-info>
+ <portlet-preferences id="id">
+ <preference id="id">
+ <name>name</name>
+ <value>value</value>
+ <read-only>true</read-only>
+ </preference>
+ <preferences-validator>preferences-validator</preferences-validator>
+ </portlet-preferences>
+ <security-role-ref id="id">
+ <description xml:lang="">description</description>
+ <role-name>NMTOKEN</role-name>
+ <role-link>role-link</role-link>
+ </security-role-ref>
+ </portlet>
+ <custom-portlet-mode id="id">
+ <description xml:lang="en">description</description>
+ <portlet-mode>portlet-mode</portlet-mode>
+ </custom-portlet-mode>
+ <custom-window-state id="id">
+ <description xml:lang="en">description</description>
+ <window-state>window-state</window-state>
+ </custom-window-state>
+ <user-attribute id="">
+ <description xml:lang="en">description</description>
+ <name>name</name>
+ </user-attribute>
+ <security-constraint id="id">
+ <display-name xml:lang="en">display-name</display-name>
+ <portlet-collection>
+ <portlet-name>portlet-name</portlet-name>
+ </portlet-collection>
+ <user-data-constraint id="">
+ <description xml:lang="">description</description>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+</portlet-app>
Added: modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet-app_2_0.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet-app_2_0.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet-app_2_0.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0"
+ id="id">
+ <portlet id="id">
+ <description xml:lang="en">description</description>
+ <portlet-name>portlet-name</portlet-name>
+ <display-name xml:lang="en">display-name</display-name>
+ <portlet-class>portlet-class</portlet-class>
+ <init-param id="id">
+ <description xml:lang="en">description</description>
+ <name>name</name>
+ <value>value</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <cache-scope>PRIVATE</cache-scope>
+ <supports id="id">
+ <mime-type>mime-type</mime-type>
+ <portlet-mode>portlet-mode</portlet-mode>
+ <window-state>window-state</window-state>
+ </supports>
+ <supported-locale>supported-locale</supported-locale>
+ <resource-bundle>resource-bundle</resource-bundle>
+ <portlet-info id="id">
+ <title>title</title>
+ <short-title>short-title</short-title>
+ <keywords>keywords</keywords>
+ </portlet-info>
+ <portlet-preferences id="id">
+ <preference id="id">
+ <name>name</name>
+ <value>value</value>
+ <read-only>true</read-only>
+ </preference>
+ <preferences-validator>preferences-validator</preferences-validator>
+ </portlet-preferences>
+ <security-role-ref id="id">
+ <description xml:lang="en">description</description>
+ <role-name>NMTOKEN</role-name>
+ <role-link>role-link</role-link>
+ </security-role-ref>
+ <supported-processing-event id="id">
+ <qname>QName</qname>
+ </supported-processing-event>
+ <supported-publishing-event id="id">
+ <qname>QName</qname>
+ </supported-publishing-event>
+ <supported-public-render-parameter>supported-public-render-parameter</supported-public-render-parameter>
+ <container-runtime-option>
+ <name>name</name>
+ <value>value</value>
+ </container-runtime-option>
+ </portlet>
+ <custom-portlet-mode id="id">
+ <description xml:lang="en">description</description>
+ <portlet-mode>portlet-mode</portlet-mode>
+ <portal-managed>true</portal-managed>
+ </custom-portlet-mode>
+ <custom-window-state id="id">
+ <description xml:lang="en">description</description>
+ <window-state>window-state</window-state>
+ </custom-window-state>
+ <user-attribute id="id">
+ <description xml:lang="en">description</description>
+ <name>name</name>
+ </user-attribute>
+ <security-constraint id="id">
+ <display-name xml:lang="en">display-name</display-name>
+ <portlet-collection>
+ <portlet-name>portlet-name</portlet-name>
+ </portlet-collection>
+ <user-data-constraint id="id">
+ <description xml:lang="en">description</description>
+ <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+ <resource-bundle>resource-bundle</resource-bundle>
+ <filter>
+ <description xml:lang="en">description</description>
+ <display-name xml:lang="en">display-name</display-name>
+ <filter-name>filter-name</filter-name>
+ <filter-class>filter-class</filter-class>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ <init-param id="">
+ <description xml:lang="en">description</description>
+ <name>name</name>
+ <value>value</value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>filter-name</filter-name>
+ <portlet-name>portlet-name</portlet-name>
+ </filter-mapping>
+ <default-namespace>http://tempuri.org</default-namespace>
+ <event-definition id="id">
+ <description xml:lang="en">description</description>
+ <qname>QName</qname>
+ <alias>QName</alias>
+ <value-type>value-type</value-type>
+ </event-definition>
+ <public-render-parameter id="id">
+ <description xml:lang="en">description</description>
+ <identifier>identifier</identifier>
+ <qname>QName</qname>
+ <alias>QName</alias>
+ </public-render-parameter>
+ <listener id="id">
+ <description xml:lang="en">description</description>
+ <display-name xml:lang="en">display-name</display-name>
+ <listener-class>listener-class</listener-class>
+ </listener>
+ <container-runtime-option>
+ <name>name</name>
+ <value>value</value>
+ </container-runtime-option>
+</portlet-app>
Added: modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet1.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet1.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet1.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,337 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+ <portlet>
+ <description>default</description>
+ <description xml:lang="fr">defaut</description>
+ <portlet-name>Portlet1</portlet-name>
+ <display-name>display</display-name>
+ <display-name xml:lang="fr">affichage</display-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortlet
+ </portlet-class>
+ <init-param>
+ <description>first parameter</description>
+ <description xml:lang="fr">premier parametre</description>
+ <name>one</name>
+ <value>1</value>
+ </init-param>
+ <init-param>
+ <description>second parameter</description>
+ <description xml:lang="fr">deuxieme parametre</description>
+ <name>two</name>
+ <value>2</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ <supports>
+ <mime-type>text/wml</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <resource-bundle>MyResourceBundle</resource-bundle>
+ <portlet-info>
+ <title>very long portlet title</title>
+ <short-title>short portlet title</short-title>
+ <keywords>a,b,c,d,e,f</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>one</name>
+ <value>1</value>
+ </preference>
+ <preference>
+ <name>two</name>
+ <value>2</value>
+ <read-only>false</read-only>
+ </preference>
+ <preference>
+ <name>three</name>
+ <value>3</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>all</name>
+ <value>1</value>
+ <value>2</value>
+ <value>3</value>
+ </preference>
+ <preferences-validator>MyValidator</preferences-validator>
+ </portlet-preferences>
+ <security-role-ref>
+ <description>role with no link</description>
+ <description xml:lang="fr">role sans link</description>
+ <role-name>ROLE_NAME_WITHOUT_LINK</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <description>role with link</description>
+ <description xml:lang="fr">role avec link</description>
+ <role-name>ROLE_NAME_WITH_LINK</role-name>
+ <role-link>ROLE_LINK</role-link>
+ </security-role-ref>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet2</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSessionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet session</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet3</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestDispatcherPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet request dispatcher</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet4</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestRedirectPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet redirection</title>
+ </portlet-info>
+ </portlet>
+
+
+ <portlet>
+ <portlet-name>Portlet5</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortletPreferencesPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet preferences</title>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>one</name>
+ <value>1</value>
+ </preference>
+ <preference>
+ <name>two</name>
+ <value>2</value>
+ <read-only>false</read-only>
+ </preference>
+ <preference>
+ <name>three</name>
+ <value>3</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>all</name>
+ <value>1</value>
+ <value>2</value>
+ <value>3</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet6</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestResourceBundlePortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <resource-bundle>Portlet6</resource-bundle>
+ <portlet-info>
+ <title>Very long portlet title</title>
+ <short-title>Short portlet title</short-title>
+ <keywords>a,b,c,d,e,f</keywords>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet7</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestExceptionDuringActionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test exception during the action request</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet8</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSecurityPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test portlet security</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet9</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestUserInformationPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test user information</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet10</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortletModePortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test portlet modes</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet11</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSecuredProtocolPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test https URL</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet12</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestCachedContentPortlet
+ </portlet-class>
+ <expiration-cache>60</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test cached content</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet13</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.CrossContextSessionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test cross session context</title>
+ </portlet-info>
+ </portlet>
+
+
+ <custom-portlet-mode>
+ <description>first mode</description>
+ <description xml:lang="fr">premier mode</description>
+ <portlet-mode>configure</portlet-mode>
+ </custom-portlet-mode>
+ <custom-portlet-mode>
+ <description>second mode</description>
+ <portlet-mode>inactive</portlet-mode>
+ </custom-portlet-mode>
+ <custom-window-state>
+ <description>first state</description>
+ <description xml:lang="fr">premier etat</description>
+ <window-state>blur</window-state>
+ </custom-window-state>
+ <custom-window-state>
+ <description>second state</description>
+ <window-state>black and white</window-state>
+ </custom-window-state>
+ <user-attribute>
+ <description>first attribute</description>
+ <description xml:lang="fr">premier attribut</description>
+ <name>att1</name>
+ </user-attribute>
+ <user-attribute>
+ <description>second attribute</description>
+ <name>att2</name>
+ </user-attribute>
+
+ <security-constraint>
+ <portlet-collection>
+ <portlet-name>Portlet1</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+ <security-constraint>
+ <portlet-collection>
+ <portlet-name>Portlet1</portlet-name>
+ <portlet-name>Portlet4</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <transport-guarantee>INTEGRAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+</portlet-app>
Added: modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet2-jsr286.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet2-jsr286.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet2-jsr286.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,367 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+ <portlet>
+ <description>default</description>
+ <description xml:lang="fr">defaut</description>
+ <portlet-name>Portlet1</portlet-name>
+ <display-name>display</display-name>
+ <display-name xml:lang="fr">affichage</display-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortlet
+ </portlet-class>
+ <init-param>
+ <description>first parameter</description>
+ <description xml:lang="fr">premier parametre</description>
+ <name>one</name>
+ <value>1</value>
+ </init-param>
+ <init-param>
+ <description>second parameter</description>
+ <description xml:lang="fr">deuxieme parametre</description>
+ <name>two</name>
+ <value>2</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ <supports>
+ <mime-type>text/wml</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <resource-bundle>MyResourceBundle</resource-bundle>
+ <portlet-info>
+ <title>very long portlet title</title>
+ <short-title>short portlet title</short-title>
+ <keywords>a,b,c,d,e,f</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>one</name>
+ <value>1</value>
+ </preference>
+ <preference>
+ <name>two</name>
+ <value>2</value>
+ <read-only>false</read-only>
+ </preference>
+ <preference>
+ <name>three</name>
+ <value>3</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>all</name>
+ <value>1</value>
+ <value>2</value>
+ <value>3</value>
+ </preference>
+ <preferences-validator>MyValidator</preferences-validator>
+ </portlet-preferences>
+ <security-role-ref>
+ <description>role with no link</description>
+ <description xml:lang="fr">role sans link</description>
+ <role-name>ROLE_NAME_WITHOUT_LINK</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <description>role with link</description>
+ <description xml:lang="fr">role avec link</description>
+ <role-name>ROLE_NAME_WITH_LINK</role-name>
+ <role-link>ROLE_LINK</role-link>
+ </security-role-ref>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet2</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSessionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet session</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet3</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestDispatcherPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet request dispatcher</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet4</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestRedirectPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet redirection</title>
+ </portlet-info>
+ </portlet>
+
+
+ <portlet>
+ <portlet-name>Portlet5</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortletPreferencesPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet preferences</title>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>one</name>
+ <value>1</value>
+ </preference>
+ <preference>
+ <name>two</name>
+ <value>2</value>
+ <read-only>false</read-only>
+ </preference>
+ <preference>
+ <name>three</name>
+ <value>3</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>all</name>
+ <value>1</value>
+ <value>2</value>
+ <value>3</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet6</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestResourceBundlePortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <resource-bundle>Portlet6</resource-bundle>
+ <portlet-info>
+ <title>Very long portlet title</title>
+ <short-title>Short portlet title</short-title>
+ <keywords>a,b,c,d,e,f</keywords>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet7</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestExceptionDuringActionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test exception during the action request</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet8</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSecurityPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test portlet security</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet9</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestUserInformationPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test user information</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet10</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortletModePortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test portlet modes</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet11</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSecuredProtocolPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test https URL</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet12</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestCachedContentPortlet
+ </portlet-class>
+ <expiration-cache>60</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test cached content</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet13</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.CrossContextSessionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test cross session context</title>
+ </portlet-info>
+ </portlet>
+
+
+ <custom-portlet-mode>
+ <description>first mode</description>
+ <description xml:lang="fr">premier mode</description>
+ <portlet-mode>configure</portlet-mode>
+ </custom-portlet-mode>
+ <custom-portlet-mode>
+ <description>second mode</description>
+ <portlet-mode>inactive</portlet-mode>
+ </custom-portlet-mode>
+ <custom-window-state>
+ <description>first state</description>
+ <description xml:lang="fr">premier etat</description>
+ <window-state>blur</window-state>
+ </custom-window-state>
+ <custom-window-state>
+ <description>second state</description>
+ <window-state>black and white</window-state>
+ </custom-window-state>
+ <user-attribute>
+ <description>first attribute</description>
+ <description xml:lang="fr">premier attribut</description>
+ <name>att1</name>
+ </user-attribute>
+ <user-attribute>
+ <description>second attribute</description>
+ <name>att2</name>
+ </user-attribute>
+
+ <security-constraint>
+ <portlet-collection>
+ <portlet-name>Portlet1</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+ <security-constraint>
+ <portlet-collection>
+ <portlet-name>Portlet1</portlet-name>
+ <portlet-name>Portlet4</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <transport-guarantee>INTEGRAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+ <resource-bundle>MyResourceBundle</resource-bundle>
+ <default-namespace>foobar</default-namespace>
+
+ <public-render-parameter id="param1">
+ <description>Public render parameter one</description>
+ <identifier>blub</identifier>
+ <name>param1</name>
+ <alias>Parameter1</alias>
+ <alias>Parameter2</alias>
+ </public-render-parameter>
+
+ <listener id="myListener1">
+ <description>Description EN</description>
+ <description xml:lang="de">Beschreibung</description>
+ <display-name>My Listener One</display-name>
+ <display-name xml:lang="de">Mein Zuhörer Eins</display-name>
+ <listener-class>org.jboss.portal.portlet.test.listener.MyListener</listener-class>
+ </listener>
+
+ <listener id="myListener2">
+ <display-name>My Listener Two</display-name>
+ <listener-class>org.jboss.portal.portlet.test.listener.MyListenerTwo</listener-class>
+ </listener>
+
+ <container-runtime-option>
+ <name>foo</name>
+ <value>foobar</value>
+ <value>foobar2</value>
+ </container-runtime-option>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet2.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet2.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/general/portlet2.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,338 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+ <portlet>
+ <description>default</description>
+ <description xml:lang="fr">defaut</description>
+ <portlet-name>Portlet1</portlet-name>
+ <display-name>display</display-name>
+ <display-name xml:lang="fr">affichage</display-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortlet
+ </portlet-class>
+ <init-param>
+ <description>first parameter</description>
+ <description xml:lang="fr">premier parametre</description>
+ <name>one</name>
+ <value>1</value>
+ </init-param>
+ <init-param>
+ <description>second parameter</description>
+ <description xml:lang="fr">deuxieme parametre</description>
+ <name>two</name>
+ <value>2</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ <supports>
+ <mime-type>text/wml</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <resource-bundle>MyResourceBundle</resource-bundle>
+ <portlet-info>
+ <title>very long portlet title</title>
+ <short-title>short portlet title</short-title>
+ <keywords>a,b,c,d,e,f</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>one</name>
+ <value>1</value>
+ </preference>
+ <preference>
+ <name>two</name>
+ <value>2</value>
+ <read-only>false</read-only>
+ </preference>
+ <preference>
+ <name>three</name>
+ <value>3</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>all</name>
+ <value>1</value>
+ <value>2</value>
+ <value>3</value>
+ </preference>
+ <preferences-validator>MyValidator</preferences-validator>
+ </portlet-preferences>
+ <security-role-ref>
+ <description>role with no link</description>
+ <description xml:lang="fr">role sans link</description>
+ <role-name>ROLE_NAME_WITHOUT_LINK</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <description>role with link</description>
+ <description xml:lang="fr">role avec link</description>
+ <role-name>ROLE_NAME_WITH_LINK</role-name>
+ <role-link>ROLE_LINK</role-link>
+ </security-role-ref>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet2</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSessionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet session</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet3</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestDispatcherPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet request dispatcher</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet4</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestRedirectPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet redirection</title>
+ </portlet-info>
+ </portlet>
+
+
+ <portlet>
+ <portlet-name>Portlet5</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortletPreferencesPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet preferences</title>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>one</name>
+ <value>1</value>
+ </preference>
+ <preference>
+ <name>two</name>
+ <value>2</value>
+ <read-only>false</read-only>
+ </preference>
+ <preference>
+ <name>three</name>
+ <value>3</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>all</name>
+ <value>1</value>
+ <value>2</value>
+ <value>3</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet6</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestResourceBundlePortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <resource-bundle>Portlet6</resource-bundle>
+ <portlet-info>
+ <title>Very long portlet title</title>
+ <short-title>Short portlet title</short-title>
+ <keywords>a,b,c,d,e,f</keywords>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet7</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestExceptionDuringActionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test exception during the action request</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet8</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSecurityPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test portlet security</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet9</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestUserInformationPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test user information</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet10</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortletModePortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test portlet modes</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet11</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSecuredProtocolPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test https URL</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet12</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestCachedContentPortlet
+ </portlet-class>
+ <expiration-cache>60</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test cached content</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet13</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.CrossContextSessionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test cross session context</title>
+ </portlet-info>
+ </portlet>
+
+
+ <custom-portlet-mode>
+ <description>first mode</description>
+ <description xml:lang="fr">premier mode</description>
+ <portlet-mode>configure</portlet-mode>
+ </custom-portlet-mode>
+ <custom-portlet-mode>
+ <description>second mode</description>
+ <portlet-mode>inactive</portlet-mode>
+ </custom-portlet-mode>
+ <custom-window-state>
+ <description>first state</description>
+ <description xml:lang="fr">premier etat</description>
+ <window-state>blur</window-state>
+ </custom-window-state>
+ <custom-window-state>
+ <description>second state</description>
+ <window-state>black and white</window-state>
+ </custom-window-state>
+ <user-attribute>
+ <description>first attribute</description>
+ <description xml:lang="fr">premier attribut</description>
+ <name>att1</name>
+ </user-attribute>
+ <user-attribute>
+ <description>second attribute</description>
+ <name>att2</name>
+ </user-attribute>
+
+ <security-constraint>
+ <portlet-collection>
+ <portlet-name>Portlet1</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+ <security-constraint>
+ <portlet-collection>
+ <portlet-name>Portlet1</portlet-name>
+ <portlet-name>Portlet4</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <transport-guarantee>INTEGRAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet1-simple.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet1-simple.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet1-simple.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,10 @@
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <portlet>
+ <portlet-name>foo</portlet-name>
+ </portlet>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet1.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet1.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet1.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,268 @@
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+ <portlet id="fragmichnicht">
+ <description>default</description>
+ <description xml:lang="fr">defaut</description>
+ <portlet-name>Portlet1</portlet-name>
+ <display-name>display</display-name>
+ <display-name xml:lang="fr">affichage</display-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortlet
+ </portlet-class>
+ <init-param>
+ <description>first parameter</description>
+ <description xml:lang="fr">premier parametre</description>
+ <name>one</name>
+ <value>1</value>
+ </init-param>
+ <init-param>
+ <description>second parameter</description>
+ <description xml:lang="fr">deuxieme parametre</description>
+ <name>two</name>
+ <value>2</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ <supports>
+ <mime-type>text/wml</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <supported-locale>fr_FR</supported-locale>
+ <resource-bundle>MyResourceBundle</resource-bundle>
+ <portlet-info>
+ <title>very long portlet title</title>
+ <short-title>short portlet title</short-title>
+ <keywords>a,b,c,d,e,f</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>one</name>
+ <value>1</value>
+ </preference>
+ <preference>
+ <name>two</name>
+ <value>2</value>
+ <read-only>false</read-only>
+ </preference>
+ <preference>
+ <name>three</name>
+ <value>3</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>all</name>
+ <value>1</value>
+ <value>2</value>
+ <value>3</value>
+ </preference>
+ <preferences-validator>MyValidator</preferences-validator>
+ </portlet-preferences>
+ <security-role-ref>
+ <description>role with no link</description>
+ <description xml:lang="fr">role sans link</description>
+ <role-name>ROLE_NAME_WITHOUT_LINK</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <description>role with link</description>
+ <description xml:lang="fr">role avec link</description>
+ <role-name>ROLE_NAME_WITH_LINK</role-name>
+ <role-link>ROLE_LINK</role-link>
+ </security-role-ref>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet2</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSessionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet session</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet3</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestDispatcherPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet request dispatcher</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet4</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestRedirectPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet redirection</title>
+ </portlet-info>
+ </portlet>
+
+
+ <portlet>
+ <portlet-name>Portlet5</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortletPreferencesPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet preferences</title>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>one</name>
+ <value>1</value>
+ </preference>
+ <preference>
+ <name>two</name>
+ <value>2</value>
+ <read-only>false</read-only>
+ </preference>
+ <preference>
+ <name>three</name>
+ <value>3</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>all</name>
+ <value>1</value>
+ <value>2</value>
+ <value>3</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet6</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestResourceBundlePortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <supported-locale>fr_FR</supported-locale>
+ <resource-bundle>Portlet6</resource-bundle>
+ <portlet-info>
+ <title>Very long portlet title</title>
+ <short-title>Short portlet title</short-title>
+ <keywords>a,b,c,d,e,f</keywords>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet7</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestExceptionDuringActionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test exception during the action request</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet8</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSecurityPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test portlet security</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet9</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestUserInformationPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test user information</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet10</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortletModePortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test portlet modes</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet11</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSecuredProtocolPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test https URL</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet12</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestCachedContentPortlet
+ </portlet-class>
+ <expiration-cache>60</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test cached content</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet13</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.CrossContextSessionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test cross session context</title>
+ </portlet-info>
+ </portlet>
+</portlet-app>
Added: modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet2-jsr286.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet2-jsr286.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet2-jsr286.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,111 @@
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+ <portlet id="fragmichnicht2">
+ <description>default</description>
+ <description xml:lang="fr">defaut</description>
+ <portlet-name>Portlet1</portlet-name>
+ <display-name>display</display-name>
+ <display-name xml:lang="fr">affichage</display-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortlet
+ </portlet-class>
+ <init-param>
+ <description>first parameter</description>
+ <description xml:lang="fr">premier parametre</description>
+ <name>one</name>
+ <value>1</value>
+ </init-param>
+ <init-param>
+ <description>second parameter</description>
+ <description xml:lang="fr">deuxieme parametre</description>
+ <name>two</name>
+ <value>2</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <cache-scope>PUBLIC</cache-scope>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ <window-state>MAXIMIZED</window-state>
+ <window-state>NORMAL</window-state>
+ </supports>
+ <supports id="foo">
+ <mime-type>text/wml</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ <window-state>NORMAL</window-state>
+ <window-state>CUSTOM</window-state>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <supported-locale>fr_FR</supported-locale>
+ <resource-bundle>MyResourceBundle</resource-bundle>
+ <portlet-info>
+ <title>very long portlet title</title>
+ <short-title>short portlet title</short-title>
+ <keywords>a,b,c,d,e,f</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>one</name>
+ <value>1</value>
+ </preference>
+ <preference>
+ <name>two</name>
+ <value>2</value>
+ <read-only>false</read-only>
+ </preference>
+ <preference>
+ <name>three</name>
+ <value>3</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>all</name>
+ <value>1</value>
+ <value>2</value>
+ <value>3</value>
+ </preference>
+ <preferences-validator>MyValidator</preferences-validator>
+ </portlet-preferences>
+ <security-role-ref>
+ <description>role with no link</description>
+ <description xml:lang="fr">role sans link</description>
+ <role-name>ROLE_NAME_WITHOUT_LINK</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <description>role with link</description>
+ <description xml:lang="fr">role avec link</description>
+ <role-name>ROLE_NAME_WITH_LINK</role-name>
+ <role-link>ROLE_LINK</role-link>
+ </security-role-ref>
+ <supported-processing-event>
+ <qname xmlns:x="http://example.com/testEvents">x:portletEvent</qname>
+ </supported-processing-event>
+ <supported-publishing-event>
+ <qname xmlns:x="http://example.com/testEvents">x:portletEvent</qname>
+ </supported-publishing-event>
+
+ <supported-public-render-parameter>foo</supported-public-render-parameter>
+ <supported-public-render-parameter>bar</supported-public-render-parameter>
+ <supported-public-render-parameter>foo2</supported-public-render-parameter>
+ <supported-public-render-parameter>foo2bar</supported-public-render-parameter>
+ <container-runtime-option>
+ <name>option1</name>
+ <value>value1</value>
+ <value>value2</value>
+ </container-runtime-option>
+
+ <container-runtime-option>
+ <name>option2</name>
+ <value>value3</value>
+ </container-runtime-option>
+
+ </portlet>
+
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet2.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet2.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/portlet/portlet2.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,270 @@
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+ <portlet id="fragmichnicht2">
+ <description>default</description>
+ <description xml:lang="fr">defaut</description>
+ <portlet-name>Portlet1</portlet-name>
+ <display-name>display</display-name>
+ <display-name xml:lang="fr">affichage</display-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortlet
+ </portlet-class>
+ <init-param>
+ <description>first parameter</description>
+ <description xml:lang="fr">premier parametre</description>
+ <name>one</name>
+ <value>1</value>
+ </init-param>
+ <init-param>
+ <description>second parameter</description>
+ <description xml:lang="fr">deuxieme parametre</description>
+ <name>two</name>
+ <value>2</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <cache-scope>PUBLIC</cache-scope>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ <supports id="foo">
+ <mime-type>text/wml</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <supported-locale>fr_FR</supported-locale>
+ <resource-bundle>MyResourceBundle</resource-bundle>
+ <portlet-info>
+ <title>very long portlet title</title>
+ <short-title>short portlet title</short-title>
+ <keywords>a,b,c,d,e,f</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>one</name>
+ <value>1</value>
+ </preference>
+ <preference>
+ <name>two</name>
+ <value>2</value>
+ <read-only>false</read-only>
+ </preference>
+ <preference>
+ <name>three</name>
+ <value>3</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>all</name>
+ <value>1</value>
+ <value>2</value>
+ <value>3</value>
+ </preference>
+ <preferences-validator>MyValidator</preferences-validator>
+ </portlet-preferences>
+ <security-role-ref>
+ <description>role with no link</description>
+ <description xml:lang="fr">role sans link</description>
+ <role-name>ROLE_NAME_WITHOUT_LINK</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <description>role with link</description>
+ <description xml:lang="fr">role avec link</description>
+ <role-name>ROLE_NAME_WITH_LINK</role-name>
+ <role-link>ROLE_LINK</role-link>
+ </security-role-ref>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet2</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSessionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet session</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet3</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestDispatcherPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet request dispatcher</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet4</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestRedirectPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet redirection</title>
+ </portlet-info>
+ </portlet>
+
+
+ <portlet>
+ <portlet-name>Portlet5</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortletPreferencesPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>test the portlet preferences</title>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>one</name>
+ <value>1</value>
+ </preference>
+ <preference>
+ <name>two</name>
+ <value>2</value>
+ <read-only>false</read-only>
+ </preference>
+ <preference>
+ <name>three</name>
+ <value>3</value>
+ <read-only>true</read-only>
+ </preference>
+ <preference>
+ <name>all</name>
+ <value>1</value>
+ <value>2</value>
+ <value>3</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet6</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestResourceBundlePortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <supported-locale>fr_FR</supported-locale>
+ <resource-bundle>Portlet6</resource-bundle>
+ <portlet-info>
+ <title>Very long portlet title</title>
+ <short-title>Short portlet title</short-title>
+ <keywords>a,b,c,d,e,f</keywords>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet7</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestExceptionDuringActionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test exception during the action request</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet8</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSecurityPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test portlet security</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet9</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestUserInformationPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test user information</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet10</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestPortletModePortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test portlet modes</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet11</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestSecuredProtocolPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test https URL</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet12</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.TestCachedContentPortlet
+ </portlet-class>
+ <expiration-cache>60</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>Test cached content</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Portlet13</portlet-name>
+ <portlet-class>
+ org.jboss.portal.test.portlet.CrossContextSessionPortlet
+ </portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title>p13</title>
+ </portlet-info>
+ </portlet>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/portlet-app_1_0.xsd
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/portlet-app_1_0.xsd (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/portlet-app_1_0.xsd 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,682 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema
+ targetNamespace="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:portlet="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified" attributeFormDefault="unqualified"
+ version="1.0" xml:lang="en">
+ <annotation>
+ <documentation>
+ This is the XML Schema for the Portlet 1.0 deployment
+ descriptor.
+ </documentation>
+ </annotation>
+ <annotation>
+ <documentation>
+ The following conventions apply to all J2EE deployment
+ descriptor elements unless indicated otherwise. - In
+ elements that specify a pathname to a file within the same
+ JAR file, relative filenames (i.e., those not starting with
+ "/") are considered relative to the root of the JAR file's
+ namespace. Absolute filenames (i.e., those starting with
+ "/") also specify names in the root of the JAR file's
+ namespace. In general, relative names are preferred. The
+ exception is .war files where absolute names are preferred
+ for consistency with the Servlet API.
+ </documentation>
+ </annotation>
+ <!-- *********************************************************** -->
+ <import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2001/xml.xsd" />
+ <element name="portlet-app" type="portlet:portlet-appType">
+ <annotation>
+ <documentation>
+ The portlet-app element is the root of the deployment
+ descriptor for a portlet application. This element has a
+ required attribute version to specify to which version
+ of the schema the deployment descriptor conforms.
+ </documentation>
+ </annotation>
+ <unique name="portlet-name-uniqueness">
+ <annotation>
+ <documentation>
+ The portlet element contains the name of a portlet.
+ This name must be unique within the portlet
+ application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:portlet" />
+ <field xpath="portlet:portlet-name" />
+ </unique>
+ <unique name="custom-portlet-mode-uniqueness">
+ <annotation>
+ <documentation>
+ The custom-portlet-mode element contains the
+ portlet-mode. This portlet mode must be unique
+ within the portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:custom-portlet-mode" />
+ <field xpath="portlet:portlet-mode" />
+ </unique>
+ <unique name="custom-window-state-uniqueness">
+ <annotation>
+ <documentation>
+ The custom-window-state element contains the
+ window-state. This window state must be unique
+ within the portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:custom-window-state" />
+ <field xpath="portlet:window-state" />
+ </unique>
+ <unique name="user-attribute-name-uniqueness">
+ <annotation>
+ <documentation>
+ The user-attribute element contains the name the
+ attribute. This name must be unique within the
+ portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:user-attribute" />
+ <field xpath="portlet:name" />
+ </unique>
+ </element>
+ <complexType name="portlet-appType">
+ <sequence>
+ <element name="portlet" type="portlet:portletType"
+ minOccurs="0" maxOccurs="unbounded">
+ <unique name="init-param-name-uniqueness">
+ <annotation>
+ <documentation>
+ The init-param element contains the name the
+ attribute. This name must be unique within
+ the portlet.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:init-param" />
+ <field xpath="portlet:name" />
+ </unique>
+ <unique name="supports-mime-type-uniqueness">
+ <annotation>
+ <documentation>
+ The supports element contains the supported
+ mime-type. This mime type must be unique
+ within the portlet.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:supports" />
+ <field xpath="mime-type" />
+ </unique>
+ <unique name="preference-name-uniqueness">
+ <annotation>
+ <documentation>
+ The preference element contains the name the
+ preference. This name must be unique within
+ the portlet.
+ </documentation>
+ </annotation>
+ <selector
+ xpath="portlet:portlet-preferences/portlet:preference" />
+ <field xpath="portlet:name" />
+ </unique>
+ <unique name="security-role-ref-name-uniqueness">
+ <annotation>
+ <documentation>
+ The security-role-ref element contains the
+ role-name. This role name must be unique
+ within the portlet.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:security-role-ref" />
+ <field xpath="portlet:role-name" />
+ </unique>
+ </element>
+ <element name="custom-portlet-mode"
+ type="portlet:custom-portlet-modeType" minOccurs="0"
+ maxOccurs="unbounded" />
+ <element name="custom-window-state"
+ type="portlet:custom-window-stateType" minOccurs="0"
+ maxOccurs="unbounded" />
+ <element name="user-attribute"
+ type="portlet:user-attributeType" minOccurs="0"
+ maxOccurs="unbounded" />
+ <element name="security-constraint"
+ type="portlet:security-constraintType" minOccurs="0"
+ maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="version" type="string" use="required" />
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <complexType name="custom-portlet-modeType">
+ <annotation>
+ <documentation>
+ A custom portlet mode that one or more portlets in this
+ portlet application supports. Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType"
+ minOccurs="0" maxOccurs="unbounded" />
+ <element name="portlet-mode"
+ type="portlet:portlet-modeType" />
+ </sequence>
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <complexType name="custom-window-stateType">
+ <annotation>
+ <documentation>
+ A custom window state that one or more portlets in this
+ portlet application supports. Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType"
+ minOccurs="0" maxOccurs="unbounded" />
+ <element name="window-state"
+ type="portlet:window-stateType" />
+ </sequence>
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <complexType name="expiration-cacheType">
+ <annotation>
+ <documentation>
+ Expriation-cache defines expiration-based caching for
+ this portlet. The parameter indicates the time in
+ seconds after which the portlet output expires. -1
+ indicates that the output never expires. Used in:
+ portlet
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="int" />
+ </simpleContent>
+ </complexType>
+ <complexType name="init-paramType">
+ <annotation>
+ <documentation>
+ The init-param element contains a name/value pair as an
+ initialization param of the portlet Used in:portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType"
+ minOccurs="0" maxOccurs="unbounded" />
+ <element name="name" type="portlet:nameType" />
+ <element name="value" type="portlet:valueType" />
+ </sequence>
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <complexType name="keywordsType">
+ <annotation>
+ <documentation>
+ Locale specific keywords associated with this portlet.
+ The kewords are separated by commas. Used in:
+ portlet-info
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string" />
+ </simpleContent>
+ </complexType>
+ <complexType name="mime-typeType">
+ <annotation>
+ <documentation>
+ MIME type name, e.g. "text/html". The MIME type may also
+ contain the wildcard character '*', like "text/*" or
+ "*/*". Used in: supports
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string" />
+ </simpleContent>
+ </complexType>
+ <complexType name="nameType">
+ <annotation>
+ <documentation>
+ The name element contains the name of a parameter. Used
+ in: init-param, ...
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string" />
+ </simpleContent>
+ </complexType>
+ <complexType name="portletType">
+ <annotation>
+ <documentation>
+ The portlet element contains the declarative data of a
+ portlet. Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType"
+ minOccurs="0" maxOccurs="unbounded" />
+ <element name="portlet-name"
+ type="portlet:portlet-nameType" />
+ <element name="display-name" type="portlet:display-nameType"
+ minOccurs="0" maxOccurs="unbounded" />
+ <element name="portlet-class"
+ type="portlet:portlet-classType" />
+ <element name="init-param" type="portlet:init-paramType"
+ minOccurs="0" maxOccurs="unbounded" />
+ <element name="expiration-cache"
+ type="portlet:expiration-cacheType" minOccurs="0" />
+ <element name="supports" type="portlet:supportsType"
+ maxOccurs="unbounded" />
+ <element name="supported-locale"
+ type="portlet:supported-localeType" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice>
+ <sequence>
+ <element name="resource-bundle"
+ type="portlet:resource-bundleType" />
+ <element name="portlet-info"
+ type="portlet:portlet-infoType" minOccurs="0" />
+ </sequence>
+ <element name="portlet-info"
+ type="portlet:portlet-infoType" />
+ </choice>
+ <element name="portlet-preferences"
+ type="portlet:portlet-preferencesType" minOccurs="0" />
+ <element name="security-role-ref"
+ type="portlet:security-role-refType" minOccurs="0"
+ maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <simpleType name="portlet-classType">
+ <annotation>
+ <documentation>
+ The portlet-class element contains the fully qualified
+ class name of the portlet. Used in: portlet
+ </documentation>
+ </annotation>
+ <restriction base="portlet:fully-qualified-classType" />
+ </simpleType>
+ <complexType name="portlet-collectionType">
+ <annotation>
+ <documentation>
+ The portlet-collectionType is used to identify a subset
+ of portlets within a portlet application to which a
+ security constraint applies. Used in:
+ security-constraint
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="portlet-name" type="portlet:portlet-nameType"
+ maxOccurs="unbounded" />
+ </sequence>
+ </complexType>
+ <complexType name="portlet-infoType">
+ <sequence>
+ <element name="title" type="portlet:titleType" />
+ <element name="short-title" type="portlet:short-titleType"
+ minOccurs="0" />
+ <element name="keywords" type="portlet:keywordsType"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <complexType name="portlet-modeType">
+ <annotation>
+ <documentation>
+ Portlet modes. The specification pre-defines the
+ following values as valid portlet mode constants:
+ "edit", "help", "view". Portlet mode names are not case
+ sensitive. Used in: custom-portlet-mode, supports
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string" />
+ </simpleContent>
+ </complexType>
+ <complexType name="portlet-nameType">
+ <annotation>
+ <documentation>
+ The portlet-name element contains the canonical name of
+ the portlet. Each portlet name is unique within the
+ portlet application. Used in: portlet, portlet-mapping
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string" />
+ </simpleContent>
+ </complexType>
+ <complexType name="portlet-preferencesType">
+ <annotation>
+ <documentation>
+ Portlet persistent preference store. Used in: portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="preference" type="portlet:preferenceType"
+ minOccurs="0" maxOccurs="unbounded" />
+ <element name="preferences-validator"
+ type="portlet:preferences-validatorType" minOccurs="0" />
+ </sequence>
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <complexType name="preferenceType">
+ <annotation>
+ <documentation>
+ Persistent preference values that may be used for
+ customization and personalization by the portlet. Used
+ in: portlet-preferences
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="name" type="portlet:nameType" />
+ <element name="value" type="portlet:valueType" minOccurs="0"
+ maxOccurs="unbounded" />
+ <element name="read-only" type="portlet:read-onlyType"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <simpleType name="preferences-validatorType">
+ <annotation>
+ <documentation>
+ The class specified under preferences-validator
+ implements the PreferencesValidator interface to
+ validate the preferences settings. Used in:
+ portlet-preferences
+ </documentation>
+ </annotation>
+ <restriction base="portlet:fully-qualified-classType" />
+ </simpleType>
+ <simpleType name="read-onlyType">
+ <annotation>
+ <documentation>
+ read-only indicates that a setting cannot be changed in
+ any of the standard portlet modes ("view","edit" or
+ "help"). Per default all preferences are modifiable.
+ Valid values are: - true for read-only - false for
+ modifiable Used in: preferences
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string">
+ <enumeration value="true" />
+ <enumeration value="false" />
+ </restriction>
+ </simpleType>
+ <complexType name="resource-bundleType">
+ <annotation>
+ <documentation>
+ Filename of the resource bundle containing the language
+ specific portlet informations in different languages.
+ Used in: portlet-info
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string" />
+ </simpleContent>
+ </complexType>
+ <complexType name="role-linkType">
+ <annotation>
+ <documentation>
+ The role-link element is a reference to a defined
+ security role. The role-link element must contain the
+ name of one of the security roles defined in the
+ security-role elements. Used in: security-role-ref
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string" />
+ </simpleContent>
+ </complexType>
+ <complexType name="security-constraintType">
+ <annotation>
+ <documentation>
+ The security-constraintType is used to associate
+ intended security constraints with one or more portlets.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="display-name" type="portlet:display-nameType"
+ minOccurs="0" maxOccurs="unbounded" />
+ <element name="portlet-collection"
+ type="portlet:portlet-collectionType" />
+ <element name="user-data-constraint"
+ type="portlet:user-data-constraintType" />
+ </sequence>
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <complexType name="security-role-refType">
+ <annotation>
+ <documentation>
+ The security-role-ref element contains the declaration
+ of a security role reference in the code of the web
+ application. The declaration consists of an optional
+ description, the security role name used in the code,
+ and an optional link to a security role. If the security
+ role is not specified, the Deployer must choose an
+ appropriate security role. The value of the role name
+ element must be the String used as the parameter to the
+ EJBContext.isCallerInRole(String roleName) method or the
+ HttpServletRequest.isUserInRole(String role) method.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType"
+ minOccurs="0" maxOccurs="unbounded" />
+ <element name="role-name" type="portlet:role-nameType" />
+ <element name="role-link" type="portlet:role-linkType"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <complexType name="short-titleType">
+ <annotation>
+ <documentation>
+ Locale specific short version of the static title. Used
+ in: portlet-info
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string" />
+ </simpleContent>
+ </complexType>
+ <complexType name="supportsType">
+ <annotation>
+ <documentation>
+ Supports indicates the portlet modes a portlet supports
+ for a specific content type. All portlets must support
+ the view mode. Used in: portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="mime-type" type="portlet:mime-typeType" />
+ <element name="portlet-mode" type="portlet:portlet-modeType"
+ minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <complexType name="supported-localeType">
+ <annotation>
+ <documentation>
+ Indicated the locales the portlet supports. Used in:
+ portlet
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string" />
+ </simpleContent>
+ </complexType>
+ <complexType name="titleType">
+ <annotation>
+ <documentation>
+ Locale specific static title for this portlet. Used in:
+ portlet-info
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string" />
+ </simpleContent>
+ </complexType>
+ <simpleType name="transport-guaranteeType">
+ <annotation>
+ <documentation>
+ The transport-guaranteeType specifies that the
+ communication between client and portlet should be NONE,
+ INTEGRAL, or CONFIDENTIAL. NONE means that the portlet
+ does not require any transport guarantees. A value of
+ INTEGRAL means that the portlet requires that the data
+ sent between the client and portlet be sent in such a
+ way that it can't be changed in transit. CONFIDENTIAL
+ means that the portlet requires that the data be
+ transmitted in a fashion that prevents other entities
+ from observing the contents of the transmission. In most
+ cases, the presence of the INTEGRAL or CONFIDENTIAL flag
+ will indicate that the use of SSL is required. Used in:
+ user-data-constraint
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string">
+ <enumeration value="NONE" />
+ <enumeration value="INTEGRAL" />
+ <enumeration value="CONFIDENTIAL" />
+ </restriction>
+ </simpleType>
+ <complexType name="user-attributeType">
+ <annotation>
+ <documentation>
+ User attribute defines a user specific attribute that
+ the portlet application needs. The portlet within this
+ application can access this attribute via the request
+ parameter USER_INFO map. Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType"
+ minOccurs="0" maxOccurs="unbounded" />
+ <element name="name" type="portlet:nameType" />
+ </sequence>
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <complexType name="user-data-constraintType">
+ <annotation>
+ <documentation>
+ The user-data-constraintType is used to indicate how
+ data communicated between the client and portlet should
+ be protected. Used in: security-constraint
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType"
+ minOccurs="0" maxOccurs="unbounded" />
+ <element name="transport-guarantee"
+ type="portlet:transport-guaranteeType" />
+ </sequence>
+ <attribute name="id" type="string" use="optional" />
+ </complexType>
+ <complexType name="valueType">
+ <annotation>
+ <documentation>
+ The value element contains the value of a parameter.
+ Used in: init-param
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string" />
+ </simpleContent>
+ </complexType>
+ <complexType name="window-stateType">
+ <annotation>
+ <documentation>
+ Portlet window state. Window state names are not case
+ sensitive. Used in: custom-window-state
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string" />
+ </simpleContent>
+ </complexType>
+ <!--- everything below is copied from j2ee_1_4.xsd -->
+ <complexType name="descriptionType">
+ <annotation>
+ <documentation>
+ The description element is used to provide text
+ describing the parent element. The description element
+ should include any information that the portlet
+ application war file producer wants to provide to the
+ consumer of the portlet application war file (i.e., to
+ the Deployer). Typically, the tools used by the portlet
+ application war file consumer will display the
+ description when processing the parent element that
+ contains the description. It has an optional attribute
+ xml:lang to indicate which language is used in the
+ description according to RFC 1766
+ (http://www.ietf.org/rfc/rfc1766.txt). The default value
+ of this attribute is English(“en”). Used in: init-param,
+ portlet, portlet-app, security-role
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="string">
+ <attribute ref="xml:lang" />
+ </extension>
+ </simpleContent>
+ </complexType>
+ <complexType name="display-nameType">
+ <annotation>
+ <documentation>
+ The display-name type contains a short name that is
+ intended to be displayed by tools. It is used by
+ display-name elements. The display name need not be
+ unique. Example: ...
+ <display-name xml:lang="en">
+ Employee Self Service
+ </display-name>
+
+ It has an optional attribute xml:lang to indicate which
+ language is used in the description according to RFC
+ 1766 (http://www.ietf.org/rfc/rfc1766.txt). The default
+ value of this attribute is English(“en”).
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string">
+ <attribute ref="xml:lang" />
+ </extension>
+ </simpleContent>
+ </complexType>
+ <simpleType name="fully-qualified-classType">
+ <annotation>
+ <documentation>
+ The elements that use this type designate the name of a
+ Java class or interface.
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string" />
+ </simpleType>
+ <simpleType name="role-nameType">
+ <annotation>
+ <documentation>
+ The role-nameType designates the name of a security
+ role.
+
+ The name must conform to the lexical rules for an
+ NMTOKEN.
+ </documentation>
+ </annotation>
+ <restriction base="NMTOKEN" />
+ </simpleType>
+ <simpleType name="string">
+ <annotation>
+ <documentation>
+ This is a special string datatype that is defined by
+ J2EE as a base type for defining collapsed strings. When
+ schemas require trailing/leading space elimination as
+ well as collapsing the existing whitespace, this base
+ type may be used.
+ </documentation>
+ </annotation>
+ <restriction base="string">
+ <whiteSpace value="collapse" />
+ </restriction>
+ </simpleType>
+</schema>
Added: modules/portlet/trunk/mc/src/test/resources/metadata/portlet-app_2_0.xsd
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/portlet-app_2_0.xsd (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/portlet-app_2_0.xsd 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,830 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:portlet="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0" xml:lang="en">
+ <annotation>
+ <documentation>
+ This is the XML Schema for the Portlet 2.0 deployment descriptor.
+ </documentation>
+ </annotation>
+ <annotation>
+ <documentation>
+ The following conventions apply to all J2EE
+ deployment descriptor elements unless indicated otherwise.
+ - In elements that specify a pathname to a file within the
+ same JAR file, relative filenames (i.e., those not
+ starting with "/") are considered relative to the root of
+ the JAR file's namespace. Absolute filenames (i.e., those
+ starting with "/") also specify names in the root of the
+ JAR file's namespace. In general, relative names are
+ preferred. The exception is .war files where absolute
+ names are preferred for consistency with the Servlet API.
+ </documentation>
+ </annotation>
+ <!-- *********************************************************** -->
+ <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+ <element name="portlet-app" type="portlet:portlet-appType">
+ <annotation>
+ <documentation>
+ The portlet-app element is the root of the deployment descriptor
+ for a portlet application. This element has a required attribute version
+ to specify to which version of the schema the deployment descriptor
+ conforms. In order to be a valid JSR 286 portlet application the version
+ must have the value "2.0".
+ </documentation>
+ </annotation>
+ <unique name="portlet-name-uniqueness">
+ <annotation>
+ <documentation>
+ The portlet element contains the name of a portlet.
+ This name must be unique within the portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:portlet"/>
+ <field xpath="portlet:portlet-name"/>
+ </unique>
+ <unique name="custom-portlet-mode-uniqueness">
+ <annotation>
+ <documentation>
+ The custom-portlet-mode element contains the portlet-mode.
+ This portlet mode must be unique within the portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:custom-portlet-mode"/>
+ <field xpath="portlet:portlet-mode"/>
+ </unique>
+ <unique name="custom-window-state-uniqueness">
+ <annotation>
+ <documentation>
+ The custom-window-state element contains the window-state.
+ This window state must be unique within the portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:custom-window-state"/>
+ <field xpath="portlet:window-state"/>
+ </unique>
+ <unique name="user-attribute-name-uniqueness">
+ <annotation>
+ <documentation>
+ The user-attribute element contains the name the attribute.
+ This name must be unique within the portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:user-attribute"/>
+ <field xpath="portlet:name"/>
+ </unique>
+ <unique name="filter-name-uniqueness">
+ <annotation>
+ <documentation>
+ The filter element contains the name of a filter.
+ The name must be unique within the portlet application.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:filter"/>
+ <field xpath="portlet:filter-name"/>
+ </unique>
+ </element>
+ <complexType name="portlet-appType">
+ <sequence>
+ <element name="portlet" type="portlet:portletType" minOccurs="0" maxOccurs="unbounded">
+ <unique name="init-param-name-uniqueness">
+ <annotation>
+ <documentation>
+ The init-param element contains the name the attribute.
+ This name must be unique within the portlet.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:init-param"/>
+ <field xpath="portlet:name"/>
+ </unique>
+ <unique name="supports-mime-type-uniqueness">
+ <annotation>
+ <documentation>
+ The supports element contains the supported mime-type.
+ This mime type must be unique within the portlet.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:supports"/>
+ <field xpath="mime-type"/>
+ </unique>
+ <unique name="preference-name-uniqueness">
+ <annotation>
+ <documentation>
+ The preference element contains the name the preference.
+ This name must be unique within the portlet.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:portlet-preferences/portlet:preference"/>
+ <field xpath="portlet:name"/>
+ </unique>
+ <unique name="security-role-ref-name-uniqueness">
+ <annotation>
+ <documentation>
+ The security-role-ref element contains the role-name.
+ This role name must be unique within the portlet.
+ </documentation>
+ </annotation>
+ <selector xpath="portlet:security-role-ref"/>
+ <field xpath="portlet:role-name"/>
+ </unique>
+ </element>
+ <element name="custom-portlet-mode" type="portlet:custom-portlet-modeType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="custom-window-state" type="portlet:custom-window-stateType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="user-attribute" type="portlet:user-attributeType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="security-constraint" type="portlet:security-constraintType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="resource-bundle" type="portlet:resource-bundleType" minOccurs="0"/>
+ <element name="filter" type="portlet:filterType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="filter-mapping" type="portlet:filter-mappingType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="default-namespace" type="xs:anyURI" minOccurs="0"/>
+ <element name="event-definition" type="portlet:event-definitionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="public-render-parameter" type="portlet:public-render-parameterType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="listener" type="portlet:listenerType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="container-runtime-option" type="portlet:container-runtime-optionType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="version" type="portlet:string" use="required"/>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="cache-scopeType">
+ <annotation>
+ <documentation>
+ Caching scope, allowed values are "private" indicating that the content should not be shared
+ across users and "public" indicating that the content may be shared across users.
+ The default value if not present is "private".
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="custom-portlet-modeType">
+ <annotation>
+ <documentation>
+ A custom portlet mode that one or more portlets in
+ this portlet application supports.
+ If the portal does not need to provide some management functionality
+ for this portlet mode, the portal-managed element needs to be set
+ to "false", otherwise to "true". Default is "true".
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="portlet-mode" type="portlet:portlet-modeType"/>
+ <element name="portal-managed" type="portlet:portal-managedType" minOccurs="0"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="custom-window-stateType">
+ <annotation>
+ <documentation>
+ A custom window state that one or more portlets in this
+ portlet application supports.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="window-state" type="portlet:window-stateType"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="expiration-cacheType">
+ <annotation>
+ <documentation>
+ Expiration-time defines the time in seconds after which the portlet output expires.
+ -1 indicates that the output never expires.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="int"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="init-paramType">
+ <annotation>
+ <documentation>
+ The init-param element contains a name/value pair as an
+ initialization param of the portlet
+ Used in:portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="name" type="portlet:nameType"/>
+ <element name="value" type="portlet:valueType"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="keywordsType">
+ <annotation>
+ <documentation>
+ Locale specific keywords associated with this portlet.
+ The kewords are separated by commas.
+ Used in: portlet-info
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="mime-typeType">
+ <annotation>
+ <documentation>
+ MIME type name, e.g. "text/html".
+ The MIME type may also contain the wildcard
+ character '*', like "text/*" or "*/*".
+ Used in: supports
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="nameType">
+ <annotation>
+ <documentation>
+ The name element contains the name of a parameter.
+ Used in: init-param, ...
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="portletType">
+ <annotation>
+ <documentation>
+ The portlet element contains the declarative data of a portlet.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="portlet-name" type="portlet:portlet-nameType"/>
+ <element name="display-name" type="portlet:display-nameType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="portlet-class" type="portlet:portlet-classType"/>
+ <element name="init-param" type="portlet:init-paramType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="expiration-cache" type="portlet:expiration-cacheType" minOccurs="0"/>
+ <element name="cache-scope" type="portlet:cache-scopeType" minOccurs="0"/>
+ <element name="supports" type="portlet:supportsType" maxOccurs="unbounded"/>
+ <element name="supported-locale" type="portlet:supported-localeType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="resource-bundle" type="portlet:resource-bundleType" minOccurs="0"/>
+ <element name="portlet-info" type="portlet:portlet-infoType" minOccurs="0"/>
+ <element name="portlet-preferences" type="portlet:portlet-preferencesType" minOccurs="0"/>
+ <element name="security-role-ref" type="portlet:security-role-refType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="supported-processing-event" type="portlet:event-definition-referenceType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="supported-publishing-event" type="portlet:event-definition-referenceType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="supported-public-render-parameter" type="portlet:string" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="container-runtime-option" type="portlet:container-runtime-optionType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <simpleType name="portlet-classType">
+ <annotation>
+ <documentation>
+ The portlet-class element contains the fully
+ qualified class name of the portlet.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <restriction base="portlet:fully-qualified-classType"/>
+ </simpleType>
+ <complexType name="container-runtime-optionType">
+ <annotation>
+ <documentation>
+ The container-runtime-option element contains settings
+ for the portlet container that the portlet expects to be honored
+ at runtime. These settings may re-define default portlet container
+ behavior, like the javax.portlet.escapeXml setting that disables
+ XML encoding of URLs produced by the portlet tag library as
+ default.
+ Names with the javax.portlet prefix are reserved for the Java
+ Portlet Specification.
+ Used in: portlet-app, portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="name" type="portlet:nameType"/>
+ <element name="value" type="portlet:valueType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ <complexType name="filter-mappingType">
+ <annotation>
+ <documentation>
+ Declaration of the filter mappings in this portlet
+ application is done by using filter-mappingType.
+ The container uses the filter-mapping
+ declarations to decide which filters to apply to a request,
+ and in what order. To determine which filters to
+ apply it matches filter-mapping declarations on the
+ portlet-name and the lifecyle phase defined in the
+ filter element. The order in which filters are invoked
+ is the order in which filter-mapping declarations
+ that match appear in the list of filter-mapping elements.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="filter-name" type="portlet:filter-nameType"/>
+ <element name="portlet-name" type="portlet:portlet-nameType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ <complexType name="filterType">
+ <annotation>
+ <documentation>
+ The filter element specifies a filter that can transform the
+ content of portlet requests and portlet responses.
+ Filters can access the initialization parameters declared in
+ the deployment descriptor at runtime via the FilterConfig
+ interface.
+ A filter can be restricted to one or more lifecycle phases
+ of the portlet. Valid entries for lifecycle are:
+ ACTION_PHASE, EVENT_PHASE, RENDER_PHASE,
+ RESOURCE_PHASE
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="display-name" type="portlet:display-nameType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="filter-name" type="portlet:filter-nameType"/>
+ <element name="filter-class" type="portlet:fully-qualified-classType"/>
+ <element name="lifecycle" type="portlet:string" maxOccurs="unbounded"/>
+ <element name="init-param" type="portlet:init-paramType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ <complexType name="portlet-collectionType">
+ <annotation>
+ <documentation>
+ The portlet-collectionType is used to identify a subset
+ of portlets within a portlet application to which a
+ security constraint applies.
+ Used in: security-constraint
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="portlet-name" type="portlet:portlet-nameType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ <complexType name="event-definitionType">
+ <annotation>
+ <documentation>
+ The event-definitionType is used to declare events the portlet can either
+ receive or emit.
+ The name must be unique and must be the one the
+ portlet is using in its code for referencing this event.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <choice>
+ <element name="qname" type="xs:QName"/>
+ <element name="name" type="xs:NCName"/>
+ </choice>
+ <element name="alias" type="xs:QName" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="value-type" type="portlet:fully-qualified-classType" minOccurs="0"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="event-definition-referenceType">
+ <annotation>
+ <documentation>
+ The event-definition-referenceType is used to reference events
+ declared with the event-definition element at application level.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <choice>
+ <element name="qname" type="xs:QName"/>
+ <element name="name" type="xs:NCName"/>
+ </choice>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="listenerType">
+ <annotation>
+ <documentation>
+ The listenerType is used to declare listeners for this portlet application.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="display-name" type="portlet:display-nameType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="listener-class" type="portlet:fully-qualified-classType"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="portlet-infoType">
+ <sequence>
+ <element name="title" type="portlet:titleType" minOccurs="0"/>
+ <element name="short-title" type="portlet:short-titleType" minOccurs="0"/>
+ <element name="keywords" type="portlet:keywordsType" minOccurs="0"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <simpleType name="portal-managedType">
+ <annotation>
+ <documentation>
+ portal-managed indicates if a custom portlet mode
+ needs to be managed by the portal or not.
+ Per default all custom portlet modes are portal managed.
+ Valid values are:
+ - true for portal-managed
+ - false for not portal managed
+ Used in: custom-portlet-modes
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string">
+ <enumeration value="true"/>
+ <enumeration value="false"/>
+ </restriction>
+ </simpleType>
+ <complexType name="portlet-modeType">
+ <annotation>
+ <documentation>
+ Portlet modes. The specification pre-defines the following values
+ as valid portlet mode constants:
+ "edit", "help", "view".
+ Portlet mode names are not case sensitive.
+ Used in: custom-portlet-mode, supports
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="portlet-nameType">
+ <annotation>
+ <documentation>
+ The portlet-name element contains the canonical name of the
+ portlet. Each portlet name is unique within the portlet
+ application.
+ Used in: portlet, filter-mapping
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="portlet-preferencesType">
+ <annotation>
+ <documentation>
+ Portlet persistent preference store.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="preference" type="portlet:preferenceType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="preferences-validator" type="portlet:preferences-validatorType" minOccurs="0"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="preferenceType">
+ <annotation>
+ <documentation>
+ Persistent preference values that may be used for customization
+ and personalization by the portlet.
+ Used in: portlet-preferences
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="name" type="portlet:nameType"/>
+ <element name="value" type="portlet:valueType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="read-only" type="portlet:read-onlyType" minOccurs="0"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <simpleType name="preferences-validatorType">
+ <annotation>
+ <documentation>
+ The class specified under preferences-validator implements
+ the PreferencesValidator interface to validate the
+ preferences settings.
+ Used in: portlet-preferences
+ </documentation>
+ </annotation>
+ <restriction base="portlet:fully-qualified-classType"/>
+ </simpleType>
+ <simpleType name="read-onlyType">
+ <annotation>
+ <documentation>
+ read-only indicates that a setting cannot
+ be changed in any of the standard portlet modes
+ ("view","edit" or "help").
+ Per default all preferences are modifiable.
+ Valid values are:
+ - true for read-only
+ - false for modifiable
+ Used in: preferences
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string">
+ <enumeration value="true"/>
+ <enumeration value="false"/>
+ </restriction>
+ </simpleType>
+ <complexType name="resource-bundleType">
+ <annotation>
+ <documentation>
+ Name of the resource bundle containing the language specific
+ portlet informations in different languages (Filename without
+ the language specific part (e.g. _en) and the ending (.properties).
+ Used in: portlet-info
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="role-linkType">
+ <annotation>
+ <documentation>
+ The role-link element is a reference to a defined security role.
+ The role-link element must contain the name of one of the
+ security roles defined in the security-role elements.
+ Used in: security-role-ref
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="security-constraintType">
+ <annotation>
+ <documentation>
+ The security-constraintType is used to associate
+ intended security constraints with one or more portlets.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="display-name" type="portlet:display-nameType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="portlet-collection" type="portlet:portlet-collectionType"/>
+ <element name="user-data-constraint" type="portlet:user-data-constraintType"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="security-role-refType">
+ <annotation>
+ <documentation>
+ The security-role-ref element contains the declaration of a
+ security role reference in the code of the web application. The
+ declaration consists of an optional description, the security
+ role name used in the code, and an optional link to a security
+ role. If the security role is not specified, the Deployer must
+ choose an appropriate security role.
+ The value of the role name element must be the String used
+ as the parameter to the
+ EJBContext.isCallerInRole(String roleName) method
+ or the HttpServletRequest.isUserInRole(String role) method.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="role-name" type="portlet:role-nameType"/>
+ <element name="role-link" type="portlet:role-linkType" minOccurs="0"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="public-render-parameterType">
+ <annotation>
+ <documentation>
+ The public-render-parameters defines a render parameter that is allowed to be public
+ and thus be shared with other portlets.
+ The identifier must be used for referencing this public render parameter in the portlet code.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="identifier" type="portlet:string"/>
+ <choice>
+ <element name="qname" type="xs:QName"/>
+ <element name="name" type="xs:NCName"/>
+ </choice>
+ <element name="alias" type="xs:QName" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="short-titleType">
+ <annotation>
+ <documentation>
+ Locale specific short version of the static title.
+ Used in: portlet-info
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="supportsType">
+ <annotation>
+ <documentation>
+ Supports indicates the portlet modes a
+ portlet supports for a specific content type. All portlets must
+ support the view mode.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="mime-type" type="portlet:mime-typeType"/>
+ <element name="portlet-mode" type="portlet:portlet-modeType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="window-state" type="portlet:window-stateType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="supported-localeType">
+ <annotation>
+ <documentation>
+ Indicated the locales the portlet supports.
+ Used in: portlet
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="titleType">
+ <annotation>
+ <documentation>
+ Locale specific static title for this portlet.
+ Used in: portlet-info
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <simpleType name="transport-guaranteeType">
+ <annotation>
+ <documentation>
+ The transport-guaranteeType specifies that
+ the communication between client and portlet should
+ be NONE, INTEGRAL, or CONFIDENTIAL.
+ NONE means that the portlet does not
+ require any transport guarantees. A value of
+ INTEGRAL means that the portlet requires that the
+ data sent between the client and portlet be sent in
+ such a way that it can't be changed in transit.
+ CONFIDENTIAL means that the portlet requires
+ that the data be transmitted in a fashion that
+ prevents other entities from observing the contents
+ of the transmission.
+ In most cases, the presence of the INTEGRAL or
+ CONFIDENTIAL flag will indicate that the use
+ of SSL is required.
+ Used in: user-data-constraint
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string">
+ <enumeration value="NONE"/>
+ <enumeration value="INTEGRAL"/>
+ <enumeration value="CONFIDENTIAL"/>
+ </restriction>
+ </simpleType>
+ <complexType name="user-attributeType">
+ <annotation>
+ <documentation>
+ User attribute defines a user specific attribute that the
+ portlet application needs. The portlet within this application
+ can access this attribute via the request parameter USER_INFO
+ map.
+ Used in: portlet-app
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="name" type="portlet:nameType"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="user-data-constraintType">
+ <annotation>
+ <documentation>
+ The user-data-constraintType is used to indicate how
+ data communicated between the client and portlet should be
+ protected.
+ Used in: security-constraint
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="description" type="portlet:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="transport-guarantee" type="portlet:transport-guaranteeType"/>
+ </sequence>
+ <attribute name="id" type="portlet:string" use="optional"/>
+ </complexType>
+ <complexType name="valueType">
+ <annotation>
+ <documentation>
+ The value element contains the value of a parameter.
+ Used in: init-param
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <complexType name="window-stateType">
+ <annotation>
+ <documentation>
+ Portlet window state. Window state names are not case sensitive.
+ Used in: custom-window-state
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string"/>
+ </simpleContent>
+ </complexType>
+ <!--- everything below is copied from j2ee_1_4.xsd -->
+ <complexType name="descriptionType">
+ <annotation>
+ <documentation>
+ The description element is used to provide text describing the
+ parent element. The description element should include any
+ information that the portlet application war file producer wants
+ to provide to the consumer of the portlet application war file
+ (i.e., to the Deployer). Typically, the tools used by the
+ portlet application war file consumer will display the
+ description when processing the parent element that contains the
+ description. It has an optional attribute xml:lang to indicate
+ which language is used in the description according to
+ RFC 1766 (http://www.ietf.org/rfc/rfc1766.txt). The default
+ value of this attribute is English(“en”).
+ Used in: init-param, portlet, portlet-app, security-role
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string">
+ <attribute ref="xml:lang"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+ <complexType name="display-nameType">
+ <annotation>
+ <documentation>
+ The display-name type contains a short name that is intended
+ to be displayed by tools. It is used by display-name
+ elements. The display name need not be unique.
+ Example:
+ ...
+ <display-name xml:lang="en">Employee Self Service</display-name>
+
+ It has an optional attribute xml:lang to indicate
+ which language is used in the description according to
+ RFC 1766 (http://www.ietf.org/rfc/rfc1766.txt). The default
+ value of this attribute is English(“en”).
+ </documentation>
+ </annotation>
+ <simpleContent>
+ <extension base="portlet:string">
+ <attribute ref="xml:lang"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+ <simpleType name="fully-qualified-classType">
+ <annotation>
+ <documentation>
+ The elements that use this type designate the name of a
+ Java class or interface.
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string"/>
+ </simpleType>
+ <simpleType name="role-nameType">
+ <annotation>
+ <documentation>
+ The role-nameType designates the name of a security role.
+
+ The name must conform to the lexical rules for an NMTOKEN.
+ </documentation>
+ </annotation>
+ <restriction base="NMTOKEN"/>
+ </simpleType>
+ <simpleType name="string">
+ <annotation>
+ <documentation>
+ This is a special string datatype that is defined by JavaEE
+ as a base type for defining collapsed strings. When
+ schemas require trailing/leading space elimination as
+ well as collapsing the existing whitespace, this base
+ type may be used.
+ </documentation>
+ </annotation>
+ <restriction base="string">
+ <whiteSpace value="collapse"/>
+ </restriction>
+ </simpleType>
+ <simpleType name="filter-nameType">
+ <annotation>
+ <documentation>
+ The logical name of the filter is declare
+ by using filter-nameType. This name is used to map the
+ filter. Each filter name is unique within the portlet
+ application.
+ Used in: filter, filter-mapping
+ </documentation>
+ </annotation>
+ <restriction base="portlet:string"/>
+ </simpleType>
+</schema>
Added: modules/portlet/trunk/mc/src/test/resources/metadata/renderParameter/portlet2.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/renderParameter/portlet2.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/renderParameter/portlet2.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,20 @@
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <public-render-parameter>
+ <description>render parameter foo</description>
+ <identifier>blah</identifier>
+ <name>renderParameter1</name>
+ <alias>fooo</alias>
+ <alias>rP1</alias>
+ </public-render-parameter>
+
+ <public-render-parameter>
+ <identifier>blub</identifier>
+ <qname xmlns:x="http://someurl.com">x:foo</qname>
+ <alias xmlns:s="http://someurl.alias.com">s:foo</alias>
+ </public-render-parameter>
+
+</portlet-app>
Added: modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet1-fail1.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet1-fail1.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet1-fail1.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <portlet>
+ <portlet-name>foo</portlet-name>
+ <portlet-class>org.jboss.portal.foo</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ </portlet>
+
+ <portlet>
+ <portlet-name>foobar</portlet-name>
+ <portlet-class>org.jboss.portal.foo</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ </portlet>
+
+ <security-constraint id="foo">
+ <display-name>test</display-name>
+ <display-name xml:lang="de">Test</display-name>
+ <portlet-collection>
+ <portlet-name>foo</portlet-name>
+ <portlet-name>foobar</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <description>fooConstraint</description>
+ <description xml:lang="de">FooConstraint</description>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+ <security-constraint>
+ <portlet-collection>
+ <portlet-name>foo</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet1-fail2.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet1-fail2.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet1-fail2.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <portlet>
+ <portlet-name>foo</portlet-name>
+ <portlet-class>org.jboss.portal.foo</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ </portlet>
+
+ <security-constraint id="foo">
+ <display-name>test</display-name>
+ <display-name xml:lang="de">Test</display-name>
+ <portlet-collection>
+ <portlet-name>foo</portlet-name>
+ <portlet-name>foobar</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <description>fooConstraint</description>
+ <description xml:lang="de">FooConstraint</description>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet1.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet1.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet1.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <portlet>
+ <portlet-name>foo</portlet-name>
+ <portlet-class>org.jboss.portal.foo</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Foo</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>foobar</portlet-name>
+ <portlet-class>org.jboss.portal.foo</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>FooBar</title>
+ </portlet-info>
+ </portlet>
+
+ <security-constraint id="foo">
+ <display-name>test</display-name>
+ <display-name xml:lang="de">Test</display-name>
+ <portlet-collection>
+ <portlet-name>foo</portlet-name>
+ <portlet-name>foobar</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <description>fooConstraint</description>
+ <description xml:lang="de">FooConstraint</description>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+ <security-constraint>
+ <portlet-collection>
+ <portlet-name>foo</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <transport-guarantee>INTEGRAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet2-fail1.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet2-fail1.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet2-fail1.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet>
+ <portlet-name>foo</portlet-name>
+ <portlet-class>org.jboss.portal.foo</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ </portlet>
+
+ <portlet>
+ <portlet-name>foobar</portlet-name>
+ <portlet-class>org.jboss.portal.foo</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ </portlet>
+
+ <security-constraint id="foo">
+ <display-name>test</display-name>
+ <display-name xml:lang="de">Test</display-name>
+ <portlet-collection>
+ <portlet-name>foo</portlet-name>
+ <portlet-name>foobar</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <description>fooConstraint</description>
+ <description xml:lang="de">FooConstraint</description>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+ <security-constraint>
+ <portlet-collection>
+ <portlet-name>foo</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet2-fail2.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet2-fail2.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet2-fail2.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet>
+ <portlet-name>foo</portlet-name>
+ <portlet-class>org.jboss.portal.foo</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ </portlet>
+
+ <security-constraint id="foo">
+ <display-name>test</display-name>
+ <display-name xml:lang="de">Test</display-name>
+ <portlet-collection>
+ <portlet-name>foo</portlet-name>
+ <portlet-name>foobar</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <description>fooConstraint</description>
+ <description xml:lang="de">FooConstraint</description>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet2.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet2.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/security/portlet2.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet>
+ <portlet-name>foo</portlet-name>
+ <portlet-class>org.jboss.portal.foo</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Foo</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>foobar</portlet-name>
+ <portlet-class>org.jboss.portal.foo</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>FooBar</title>
+ </portlet-info>
+ </portlet>
+
+ <security-constraint id="foo">
+ <display-name>test</display-name>
+ <display-name xml:lang="de">Test</display-name>
+ <portlet-collection>
+ <portlet-name>foo</portlet-name>
+ <portlet-name>foobar</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <description>fooConstraint</description>
+ <description xml:lang="de">FooConstraint</description>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+ <security-constraint>
+ <portlet-collection>
+ <portlet-name>foo</portlet-name>
+ </portlet-collection>
+ <user-data-constraint>
+ <transport-guarantee>INTEGRAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/userAttribute/portlet1.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/userAttribute/portlet1.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/userAttribute/portlet1.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,17 @@
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+ <user-attribute id="notFoo">
+ <name>blub</name>
+ </user-attribute>
+
+ <user-attribute id="realFoo">
+ <description>foobar</description>
+ <description xml:lang="de">fuhbar</description>
+ <name>foo</name>
+ </user-attribute>
+
+
+</portlet-app>
\ No newline at end of file
Added: modules/portlet/trunk/mc/src/test/resources/metadata/userAttribute/portlet2.xml
===================================================================
--- modules/portlet/trunk/mc/src/test/resources/metadata/userAttribute/portlet2.xml (rev 0)
+++ modules/portlet/trunk/mc/src/test/resources/metadata/userAttribute/portlet2.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -0,0 +1,17 @@
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <user-attribute id="notFoo">
+ <name>blub</name>
+ </user-attribute>
+
+ <user-attribute id="realFoo">
+ <description>foobar</description>
+ <description xml:lang="de">fuhbar</description>
+ <name>foo</name>
+ </user-attribute>
+
+
+</portlet-app>
\ No newline at end of file
Modified: modules/portlet/trunk/pom.xml
===================================================================
--- modules/portlet/trunk/pom.xml 2008-02-29 00:27:43 UTC (rev 10157)
+++ modules/portlet/trunk/pom.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -42,6 +42,7 @@
<module>bridge</module>
<module>federation</module>
<module>management</module>
+ <module>mc</module>
<module>test</module>
</modules>
Modified: modules/portlet/trunk/test/pom.xml
===================================================================
--- modules/portlet/trunk/test/pom.xml 2008-02-29 00:27:43 UTC (rev 10157)
+++ modules/portlet/trunk/test/pom.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -30,6 +30,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-mc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>concurrent</groupId>
<artifactId>concurrent</artifactId>
</dependency>
@@ -62,10 +67,6 @@
<artifactId>portal-test-generic</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- </dependency>
- <dependency>
<groupId>jboss</groupId>
<artifactId>jboss-logging-jdk</artifactId>
</dependency>
@@ -343,21 +344,17 @@
<property name="dependency.junit.jar" value="${maven.dependency.junit.junit.jar.path}"/>
<property name="dependency.cargo-manager.war"
value="${maven.dependency.cargo.cargo-manager.war.path}"/>
- <property name="dependency.portal-web.jar"
- value="${maven.dependency.org.jboss.portal.web.web-web.jar.path}"/>
+ <property name="dependency.portal-web.jar" value="${maven.dependency.org.jboss.portal.web.web-web.jar.path}"/>
<!--<property name="dependency.jsr168api.jar" value="${maven.dependency.org.jboss.portal.portlet.portlet-jsr168api.jar.path}"/>-->
- <property name="dependency.jsr168api.jar"
- value="${maven.dependency.javax.portlet.portlet-api.jar.path}"/>
- <property name="dependency.ccpp.jar"
- value="${maven.dependency.javax.ccpp.ccpp.jar.path}"/>
- <property name="dependency.portal-portlet.jar"
- value="${maven.dependency.org.jboss.portal.portlet.portlet-portlet.jar.path}"/>
- <property name="dependency.portal-portlet-controller.jar"
- value="${maven.dependency.org.jboss.portal.portlet.portlet-controller.jar.path}"/>
- <property name="dependency.portal-portlet-tests.test-jar"
- value="${maven.dependency.org.jboss.portal.portlet.portlet-portlet.tests.test-jar.path}"/>
- <property name="dependency.cargo-core-uberjar.jar"
- value="${maven.dependency.cargo.cargo-core-uberjar.jar.path}"/>
+ <property name="dependency.jsr168api.jar" value="${maven.dependency.javax.portlet.portlet-api.jar.path}"/>
+ <property name="dependency.ccpp.jar" value="${maven.dependency.javax.ccpp.ccpp.jar.path}"/>
+
+ <property name="dependency.portal-portlet.jar" value="${maven.dependency.org.jboss.portal.portlet.portlet-portlet.jar.path}"/>
+ <property name="dependency.portal-portlet-controller.jar" value="${maven.dependency.org.jboss.portal.portlet.portlet-controller.jar.path}"/>
+ <property name="dependency.portal-portlet-mc.jar" value="${maven.dependency.org.jboss.portal.portlet.portlet-mc.jar.path}"/>
+ <property name="dependency.portal-portlet-tests.test-jar" value="${maven.dependency.org.jboss.portal.portlet.portlet-portlet.tests.test-jar.path}"/>
+
+ <property name="dependency.cargo-core-uberjar.jar" value="${maven.dependency.cargo.cargo-core-uberjar.jar.path}"/>
<property name="dependency.cargo-ant.jar" value="${maven.dependency.cargo.cargo-ant.jar.path}"/>
<property name="dependency.jaxb-api.jar"
value="${maven.dependency.javax.xml.bind.jaxb-api.jar.path}"/>
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationContextImpl.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationContextImpl.java 2008-02-29 00:27:43 UTC (rev 10157)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationContextImpl.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -1,72 +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.portlet.test;
-
-import org.jboss.portal.portlet.container.PortletApplicationContext;
-import org.jboss.portal.portlet.container.managed.ManagedPortletApplication;
-import org.jboss.portal.web.WebApp;
-
-import javax.servlet.ServletContext;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortletApplicationContextImpl implements PortletApplicationContext
-{
-
- /** . */
- private final WebApp webApp;
-
- ManagedPortletApplication managedPortletApplication;
-
- public PortletApplicationContextImpl(WebApp webApp)
- {
- this.webApp = webApp;
- }
-
- public ServletContext getServletContext()
- {
- return webApp.getServletContext();
- }
-
- public String getContextPath()
- {
- return webApp.getContextPath();
- }
-
- public ClassLoader getClassLoader()
- {
- return webApp.getClassLoader();
- }
-
- public void managedStart()
- {
- managedPortletApplication.managedStart();
- }
-
- public void managedStop()
- {
- managedPortletApplication.managedStop();
- }
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployer.java 2008-02-29 00:27:43 UTC (rev 10157)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployer.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -1,346 +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.portlet.test;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.portlet.container.managed.PortletApplicationRegistry;
-import org.jboss.portal.portlet.container.managed.ManagedPortletApplication;
-import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEventBroadcaster;
-import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEventListener;
-import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEvent;
-import org.jboss.portal.portlet.container.managed.ManagedObjectEvent;
-import org.jboss.portal.portlet.container.managed.ManagedObject;
-import org.jboss.portal.portlet.container.managed.ManagedObjectLifeCycleEvent;
-import org.jboss.portal.portlet.container.managed.LifeCycleStatus;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
-import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import static org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.PORTLET_JSR_168_NS;
-import static org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.PORTLET_JSR_286_NS;
-import org.jboss.portal.portlet.impl.container.PortletApplicationLifeCycle;
-import org.jboss.portal.portlet.impl.container.PortletContainerLifeCycle;
-import org.jboss.portal.portlet.test.metadata.factory.PortletApplicationModelFactory;
-import org.jboss.portal.portlet.test.metadata.impl.AnnotationPortletApplication10MetaData;
-import org.jboss.portal.portlet.test.metadata.impl.AnnotationPortletApplication20MetaData;
-import org.jboss.portal.portlet.test.metadata.impl.ValueTrimmingFilter;
-import org.jboss.portal.web.ServletContainer;
-import org.jboss.portal.web.WebApp;
-import org.jboss.portal.web.WebAppEvent;
-import org.jboss.portal.web.WebAppLifeCycleEvent;
-import org.jboss.portal.web.WebAppListener;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
-import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortletApplicationDeployer implements WebAppListener, PortletApplicationRegistry
-{
-
- static
- {
- try
- {
- SingletonSchemaResolverFactory factory = SingletonSchemaResolverFactory.getInstance();
- DefaultSchemaResolver resolver = (DefaultSchemaResolver)factory.getSchemaBindingResolver();
-
- /** SchemaResolver */
- resolver.addSchemaLocation(PORTLET_JSR_168_NS, "portlet-app_1_0.xsd");
- resolver.addSchemaLocation(PORTLET_JSR_286_NS, "portlet-app_2_0.xsd");
- resolver.addClassBinding(PORTLET_JSR_286_NS, AnnotationPortletApplication20MetaData.class);
- resolver.addClassBinding(PORTLET_JSR_168_NS, AnnotationPortletApplication10MetaData.class);
- }
- catch (Exception e)
- {
- throw new Error(e);
- }
- }
-
- /** . */
- private Logger log = Logger.getLogger(PortletApplicationDeployer.class);
-
- /** . */
- private PortletApplicationRegistry registry;
-
- /** . */
- private ServletContainer servletContainer;
-
- /** . */
- private Map<String, PortletApplicationDeployment> deploymentMap = new HashMap<String, PortletApplicationDeployment>();
-
- /** . */
- private ClassLoader classLoader;
-
- /** . */
- private final Map<String, PortletApplicationLifeCycle> applications = new HashMap<String, PortletApplicationLifeCycle>();
-
- /** . */
- private PortletContainerInvoker portletContainerInvoker;
-
- /** . */
- private ManagedObjectRegistryEventBroadcaster broadcaster;
-
- public PortletApplicationRegistry getRegistry()
- {
- return registry;
- }
-
- public void setRegistry(PortletApplicationRegistry registry)
- {
- this.registry = registry;
- }
-
- public ServletContainer getServletContainer()
- {
- return servletContainer;
- }
-
- public void setServletContainer(ServletContainer servletContainer)
- {
- this.servletContainer = servletContainer;
- }
-
- public PortletContainerInvoker getPortletContainerInvoker()
- {
- return portletContainerInvoker;
- }
-
- public void setPortletContainerInvoker(PortletContainerInvoker portletContainerInvoker)
- {
- this.portletContainerInvoker = portletContainerInvoker;
- }
-
- public void onEvent(WebAppEvent event)
- {
- if (event instanceof WebAppLifeCycleEvent)
- {
- WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent)event;
- String cp = event.getWebApp().getContextPath();
- switch (lifeCycleEvent.getType())
- {
- case WebAppLifeCycleEvent.ADDED:
- log.debug("Going to install war file" + cp);
- add(event.getWebApp());
- log.debug("Installed war file" + cp);
- break;
- case WebAppLifeCycleEvent.REMOVED:
- try
- {
- log.debug("Going to uninstall war file" + cp);
- remove(event.getWebApp());
- log.debug("Uninstalled war file" + cp);
- }
- catch (Throwable e)
- {
- log.error("Uninstalled war file " + cp + " with an error", e);
- }
- break;
- }
- }
- }
-
- protected void add(WebApp webApp)
- {
- //
- PortletApplication10MetaData metaData = buildPortletApplicationMetaData(webApp);
- if (metaData != null)
- {
- ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(classLoader);
- PortletApplicationDeployment deployment = new PortletApplicationDeployment(broadcaster, webApp, metaData);
- deploymentMap.put(webApp.getContextPath(), deployment);
- deployment.install();
-
- //
- PortletApplicationLifeCycle portletApplicationLifeCycle = deployment.getPortletApplicationLifeCycle();
- applications.put(portletApplicationLifeCycle.getId(), portletApplicationLifeCycle);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldCL);
- }
- }
- }
-
- private void remove(WebApp webApp)
- {
- PortletApplicationDeployment deployment = deploymentMap.remove(webApp.getContextPath());
- if (deployment != null)
- {
- PortletApplicationLifeCycle portletApplicationLifeCycle = deployment.getPortletApplicationLifeCycle();
- applications.remove(portletApplicationLifeCycle.getId());
-
- //
- ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(classLoader);
- deployment.uninstall();
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldCL);
- }
- }
- }
-
- public void start()
- {
- broadcaster = new ManagedObjectRegistryEventBroadcaster();
- classLoader = Thread.currentThread().getContextClassLoader();
-
- //
- broadcaster.addListener(bridgeToInvoker);
- servletContainer.addWebAppListener(this);
- }
-
- public void stop()
- {
- // This should generate remove web app event and in cascade clear the registry
- // as well as the portlet container invoker
- servletContainer.removeWebAppListener(this);
-
- //
- classLoader = null;
- broadcaster = null;
- }
-
- private PortletApplication10MetaData buildPortletApplicationMetaData(WebApp webApp)
- {
- try
- {
- URL url = webApp.getServletContext().getResource("/WEB-INF/portlet.xml");
- if (url != null)
- {
- InputStream in = null;
- try
- {
- in = IOTools.safeBufferedWrapper(url.openStream());
-
- // Validate
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setNamespaceAware(true);
- unmarshaller.setSchemaValidation(false);
- unmarshaller.setValidation(false);
-
- //
- PortletApplicationModelFactory factory = new PortletApplicationModelFactory();
-
- // Unmarshal
- PortletApplication10MetaData portletApplicationMD = (PortletApplication10MetaData)unmarshaller.unmarshal(in, new ValueTrimmingFilter(factory), null);
-
- //
- return portletApplicationMD;
- }
- finally
- {
- IOTools.safeClose(in);
- }
- }
- }
- catch (IOException e)
- {
- log.error("Cannot read portlet.xml", e);
- }
- catch (JBossXBException e)
- {
- log.error("Cannot parse portlet.xml", e);
- }
- return null;
- }
-
- public Collection<? extends ManagedPortletApplication> getManagedPortletApplications()
- {
- return applications.values();
- }
-
- public ManagedPortletApplication getManagedPortletApplication(String id)
- {
- return applications.get(id);
- }
-
- public void addListener(ManagedObjectRegistryEventListener listener)
- {
- broadcaster.addListener(listener);
- }
-
- public void removeListener(ManagedObjectRegistryEventListener listener)
- {
- broadcaster.addListener(listener);
- }
-
- /**
- * Bridge managed object event to add/remove portlet container in portlet container invoker.
- */
- private final ManagedObjectRegistryEventListener bridgeToInvoker = new ManagedObjectRegistryEventListener()
- {
- public void onEvent(ManagedObjectRegistryEvent event)
- {
- if (event instanceof ManagedObjectEvent)
- {
- ManagedObjectEvent managedObjectEvent = (ManagedObjectEvent)event;
- ManagedObject managedObject = managedObjectEvent.getManagedObject();
-
- //
- if (managedObject instanceof PortletContainerLifeCycle)
- {
- PortletContainerLifeCycle portletContainerLifeCycle = (PortletContainerLifeCycle)managedObject;
- PortletContainer portletContainer = portletContainerLifeCycle.getPortletContainer();
-
- //
- if (managedObjectEvent instanceof ManagedObjectLifeCycleEvent)
- {
- ManagedObjectLifeCycleEvent lifeCycleEvent = (ManagedObjectLifeCycleEvent)managedObjectEvent;
-
- //
- LifeCycleStatus status = lifeCycleEvent.getStatus();
-
- //
- if (status == LifeCycleStatus.STARTED)
- {
- portletContainerInvoker.addPortletContainer(portletContainer);
- }
- else
- {
- portletContainerInvoker.removePortletContainer(portletContainer);
- }
- }
- }
- }
- }
- };
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployment.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployment.java 2008-02-29 00:27:43 UTC (rev 10157)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployment.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -1,168 +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.portlet.test;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.portlet.impl.info.ContainerInfoBuilder;
-import org.jboss.portal.portlet.impl.info.ContainerInfoBuilderContext;
-import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.impl.info.ContainerFilterInfo;
-import org.jboss.portal.portlet.impl.jsr168.ContainerInfoBuilderContextImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletFilterImpl;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import org.jboss.portal.portlet.impl.container.PortletApplicationLifeCycle;
-import org.jboss.portal.portlet.impl.container.PortletFilterLifeCycle;
-import org.jboss.portal.portlet.impl.container.PortletContainerLifeCycle;
-import org.jboss.portal.portlet.container.object.PortletApplicationObject;
-import org.jboss.portal.portlet.container.object.PortletContainerObject;
-import org.jboss.portal.portlet.container.object.PortletFilterObject;
-import org.jboss.portal.portlet.container.managed.ManagedObjectRegistryEventListener;
-import org.jboss.portal.web.WebApp;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortletApplicationDeployment
-{
-
- /** . */
- private final Logger log;
-
- /** . */
- private final WebApp webApp;
-
- /** . */
- private final PortletApplication10MetaData metaData;
-
- /** . */
- private final ManagedObjectRegistryEventListener listener;
-
- /** . */
- private PortletApplicationLifeCycle portletApplicationLifeCycle;
-
- public PortletApplicationDeployment(
- ManagedObjectRegistryEventListener listener,
- WebApp webApp,
- PortletApplication10MetaData metaData)
- {
- this.listener = listener;
- this.webApp = webApp;
- this.metaData = metaData;
- this.log = Logger.getLogger(PortletApplicationDeployment.class + "." + webApp.getContextPath().replace('.', '_'));
- }
-
- public PortletApplicationLifeCycle getPortletApplicationLifeCycle()
- {
- return portletApplicationLifeCycle;
- }
-
- void install()
- {
-
- log.debug("Starting installation");
-
- //
- ContainerInfoBuilderContext builderContext = new ContainerInfoBuilderContextImpl(metaData, webApp);
- ContainerInfoBuilder builder = new ContainerInfoBuilder(webApp.getContextPath(), metaData, builderContext);
- builder.build();
-
- //
- PortletApplicationObject portletApplicationObject = new PortletApplicationImpl(builder.getApplication());
- PortletApplicationContextImpl portletApplicationContext = new PortletApplicationContextImpl(webApp);
-
-
- //
- portletApplicationLifeCycle = new PortletApplicationLifeCycle(
- listener,
- portletApplicationContext,
- portletApplicationObject);
-
- // Needed for the managed callbacks
- portletApplicationContext.managedPortletApplication = portletApplicationLifeCycle;
-
- //
- for (ContainerFilterInfo filterInfo : builder.getApplication().getFilters().values())
- {
- PortletFilterObject portletFilterObject = new PortletFilterImpl(filterInfo);
- PortletFilterContextImpl portletFilterContext = new PortletFilterContextImpl();
-
- //
- PortletFilterLifeCycle portletFilterLifeCycle = portletApplicationLifeCycle.addPortletFilter(portletFilterContext, portletFilterObject);
-
- // Needed for the managed callbacks
- portletFilterContext.managedPortletFilter = portletFilterLifeCycle;
- }
-
- //
- for (ContainerPortletInfo containerInfo : builder.getPortlets())
- {
- PortletContainerObject portletContainerObject = new PortletContainerImpl(containerInfo);
- PortletContainerContextImpl portletContainerContext = new PortletContainerContextImpl();
-
- //
- PortletContainerLifeCycle portletContainerLifeCycle = portletApplicationLifeCycle.addPortletContainer(portletContainerContext, portletContainerObject);
-
- // Needed for the managed callbacks
- portletContainerContext.managedPortletContainer = portletContainerLifeCycle;
-
- // Now create deps
- for (String filterRef : containerInfo.getFilterRefs())
- {
- PortletFilterLifeCycle portletFilterLifeCycle = portletApplicationLifeCycle.getManagedPortletFilter(filterRef);
-
- //
- if (portletFilterLifeCycle != null)
- {
- portletApplicationLifeCycle.addDependency(portletFilterLifeCycle, portletContainerLifeCycle);
- }
- else
- {
- // todo
- }
- }
- }
-
- //
- portletApplicationLifeCycle.create();
-
- //
- portletApplicationLifeCycle.managedStart();
-
- //
-
- }
-
- void uninstall()
- {
- log.debug("Uninstalling");
-
- //
- portletApplicationLifeCycle.managedStop();
-
- //
- log.debug("Uninstalled");
- }
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletContainerContextImpl.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletContainerContextImpl.java 2008-02-29 00:27:43 UTC (rev 10157)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletContainerContextImpl.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -1,47 +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.portlet.test;
-
-import org.jboss.portal.portlet.container.PortletContainerContext;
-import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortletContainerContextImpl implements PortletContainerContext
-{
-
- /** . */
- ManagedPortletContainer managedPortletContainer;
-
- public void managedStart()
- {
- managedPortletContainer.managedStart();
- }
-
- public void managedStop()
- {
- managedPortletContainer.managedStop();
- }
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletFilterContextImpl.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletFilterContextImpl.java 2008-02-29 00:27:43 UTC (rev 10157)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletFilterContextImpl.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -1,46 +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.portlet.test;
-
-import org.jboss.portal.portlet.container.PortletFilterContext;
-import org.jboss.portal.portlet.container.managed.ManagedPortletFilter;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortletFilterContextImpl implements PortletFilterContext
-{
-
- ManagedPortletFilter managedPortletFilter;
-
- public void managedStart()
- {
- managedPortletFilter.managedStart();
- }
-
- public void managedStop()
- {
- managedPortletFilter.managedStop();
- }
-}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestPortletApplicationDeployer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestPortletApplicationDeployer.java 2008-02-29 00:27:43 UTC (rev 10157)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestPortletApplicationDeployer.java 2008-02-29 17:00:22 UTC (rev 10158)
@@ -24,6 +24,7 @@
package org.jboss.portal.portlet.test;
import org.jboss.portal.web.WebApp;
+import org.jboss.portal.portlet.mc.PortletApplicationDeployer;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-29 00:27:43 UTC (rev 10157)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -134,6 +134,9 @@
<path id="mc.portal-portlet-controller">
<pathelement path="${dependency.portal-portlet-controller.jar}"/>
</path>
+ <path id="mc.portal-portlet-mc">
+ <pathelement path="${dependency.portal-portlet-mc.jar}"/>
+ </path>
<path id="mc.jaxb-api">
<pathelement path="${dependency.jaxb-api.jar}"/>
</path>
@@ -404,6 +407,7 @@
<path refid="mc.portal-common"/>
<path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
<!-- Remote plugin -->
<path refid="mc.jboss-remoting"/>
@@ -440,6 +444,7 @@
<path refid="mc.portal-common"/>
<path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
<!-- Remote plugin -->
<path refid="mc.jboss-remoting"/>
@@ -707,6 +712,7 @@
<path location="${dependency.jsr168api.jar}"/>
<path location="${dependency.ccpp.jar}"/>
<path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
</path>
</copy>
@@ -749,6 +755,7 @@
<path refid="mc.portal-common"/>
<path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
<!-- Remote plugin -->
<path refid="mc.jboss-remoting"/>
@@ -809,6 +816,7 @@
<path refid="mc.portal-common"/>
<path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
<!-- Remote plugin -->
<path refid="mc.jboss-remoting"/>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-29 00:27:43 UTC (rev 10157)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -23,7 +23,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="PortletApplicationDeployer" class="org.jboss.portal.portlet.test.PortletApplicationDeployer">
+ <bean name="PortletApplicationDeployer" class="org.jboss.portal.portlet.mc.PortletApplicationDeployer">
<property name="servletContainer"><inject bean="ServletContainer"/></property>
<property name="portletContainerInvoker"><inject bean="PortletContainerInvoker"/></property>
</bean>
Modified: modules/portlet/trunk/test/src/test/resources/test/local-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/test/local-jboss-unit.xml 2008-02-29 00:27:43 UTC (rev 10157)
+++ modules/portlet/trunk/test/src/test/resources/test/local-jboss-unit.xml 2008-02-29 17:00:22 UTC (rev 10158)
@@ -21,69 +21,6 @@
</class>
</test>
<test>
- <class name="org.jboss.portal.portlet.test.metadata.CustomPortletModeTestEverythingTestCase" />
- <parameter name="parser">
- <value>annotation</value>
- <value>factory</value>
- </parameter>
- </test>
- <test>
- <class name="org.jboss.portal.portlet.test.metadata.CustomWindowStateTestEverythingTestCase" />
- <parameter name="parser">
- <value>annotation</value>
- <value>factory</value>
- </parameter>
- </test>
- <test>
- <class name="org.jboss.portal.portlet.test.metadata.EventTestEverythingTestCase" />
- <parameter name="parser">
- <value>annotation</value>
- <value>factory</value>
- </parameter>
- </test>
- <test>
- <class name="org.jboss.portal.portlet.test.metadata.FilterTestEverythingTestCase" />
- <parameter name="parser">
- <value>annotation</value>
- <value>factory</value>
- </parameter>
- </test>
- <test>
- <class name="org.jboss.portal.portlet.test.metadata.GeneralMetaDataTestCase" />
- <parameter name="parser">
- <value>annotation</value>
- <value>factory</value>
- </parameter>
- </test>
- <test>
- <class name="org.jboss.portal.portlet.test.metadata.PortletTestEverythingTestCase" />
- <parameter name="parser">
- <value>annotation</value>
- <value>factory</value>
- </parameter>
- </test>
- <test>
- <class name="org.jboss.portal.portlet.test.metadata.RenderParameterTestEverythingTestCase" />
- <parameter name="parser">
- <value>annotation</value>
- <value>factory</value>
- </parameter>
- </test>
- <test>
- <class name="org.jboss.portal.portlet.test.metadata.SecurityConstraintTestEverythingTestCase" />
- <parameter name="parser">
- <value>annotation</value>
- <value>factory</value>
- </parameter>
- </test>
- <test>
- <class name="org.jboss.portal.portlet.test.metadata.UserAttributeTestEverythingTestCase" />
- <parameter name="parser">
- <value>annotation</value>
- <value>factory</value>
- </parameter>
- </test>
- <test>
<class name="org.jboss.portal.portlet.controller.StateControllerContextTestCase">
</class>
</test>
16 years, 1 month
JBoss Portal SVN: r10157 - in modules/portlet/trunk: controller/src/main/java/org/jboss/portal/portlet/controller/event and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-28 19:27:43 -0500 (Thu, 28 Feb 2008)
New Revision: 10157
Added:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventProduction.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseSessionImpl.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/Event.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseSession.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
Log:
rework a bit the event controller context
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseSessionImpl.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseSessionImpl.java 2008-02-28 14:45:26 UTC (rev 10156)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseSessionImpl.java 2008-02-29 00:27:43 UTC (rev 10157)
@@ -37,50 +37,52 @@
{
/** . */
- private final Logger log;
+ static final int READ_MODE = 0;
/** . */
- LinkedList<Event> producedEventHistory;
+ static final int READ_WRITE_MODE = 1;
/** . */
- LinkedList<Event> consumedEventHistory;
+ static final int INTERRUPTED_MODE = 2;
/** . */
- LinkedList<Event> producedEvents;
+ private final Logger log;
/** . */
+ LinkedList<EventProduction> producedEvents;
+
+ /** . */
LinkedList<Event> toConsumeEvents;
/** . */
- boolean interruped;
+ int consumedEventSize;
+ /** . */
+ int producedEventSize;
+
+ /** . */
+ int mode;
+
EventPhaseSessionImpl(Logger log)
{
this.log = log;
- this.producedEventHistory = new LinkedList<Event>();
- this.consumedEventHistory = new LinkedList<Event>();
- this.producedEvents = new LinkedList<Event>();
+ this.producedEvents = new LinkedList<EventProduction>();
this.toConsumeEvents = new LinkedList<Event>();
- this.interruped = false;
+ this.consumedEventSize = 0;
+ this.producedEventSize = 0;
+ this.mode = READ_MODE;
}
- public Iterator<Event> browseProducedEventHistory()
- {
- return this.producedEventHistory.iterator();
- }
-
-
- public Iterator<Event> browseConsumedEventHistory()
- {
- return this.consumedEventHistory.iterator();
- }
-
public void queueEvent(Event event)
{
- if (interruped)
+ if (mode == INTERRUPTED_MODE)
{
- throw new IllegalStateException("The event phase is interruped");
+ throw new IllegalStateException("The event phase cannot queue events because it is interruped");
}
+ if (mode == READ_MODE)
+ {
+ throw new IllegalStateException("The event phase cannot queue events");
+ }
if (event == null)
{
throw new IllegalArgumentException("No null event accepted");
@@ -95,9 +97,15 @@
public void interrupt()
{
+ if (mode == READ_MODE)
+ {
+ throw new IllegalStateException("The event phase is not interruptable");
+ }
+
+ //
log.trace("Event delivery interruped");
//
- this.interruped = true;
+ this.mode = INTERRUPTED_MODE;
}
}
Added: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventProduction.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventProduction.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventProduction.java 2008-02-29 00:27:43 UTC (rev 10157)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.portlet.controller;
+
+import org.jboss.portal.portlet.controller.event.Event;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class EventProduction
+{
+
+ /** . */
+ private final Event consumedEvent;
+
+ /** . */
+ private final Event producedEvent;
+
+ EventProduction(Event consumedEvent, Event producedEvent)
+ {
+ this.consumedEvent = consumedEvent;
+ this.producedEvent = producedEvent;
+ }
+
+ public Event getConsumedEvent()
+ {
+ return consumedEvent;
+ }
+
+ public Event getProducedEvent()
+ {
+ return producedEvent;
+ }
+}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-02-28 14:45:26 UTC (rev 10156)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-02-29 00:27:43 UTC (rev 10157)
@@ -111,7 +111,8 @@
// Feed session it with the events that may have been produced
for (UpdateNavigationalStateResponse.Event portletEvent : stateResponse.getEvents())
{
- session.producedEvents.add(new Event(portletEvent.getName(), portletEvent.getPayload(), portletRequest.getWindowId()));
+ Event producedEvent = new Event(portletEvent.getName(), portletEvent.getPayload(), portletRequest.getWindowId());
+ session.producedEvents.add(new EventProduction(null, producedEvent));
}
//
@@ -120,7 +121,8 @@
// Deliver events
while (session.producedEvents.size() > 0)
{
- Event producedEvent = session.producedEvents.removeFirst();
+ EventProduction eventProduction = session.producedEvents.removeFirst();
+ Event producedEvent = eventProduction.getProducedEvent();
//
String producerId = producedEvent.getWindowId();
@@ -147,7 +149,7 @@
int producedEventThreshold = controller.getProducedEventThreshold();
if (producedEventThreshold >= 0)
{
- if (session.producedEventHistory.size() + 1 > producedEventThreshold)
+ if (session.producedEventSize + 1 > producedEventThreshold)
{
log.trace("Event distribution interrupted because the maximum number of produced event is reached");
eventDistributionStatus = PortletResponse.PRODUCED_EVENT_FLOODED;
@@ -158,7 +160,8 @@
// Give control to the event context
try
{
- eventCC.handleEvent(session, producedEvent);
+ session.mode = EventPhaseSessionImpl.READ_WRITE_MODE;
+ eventCC.eventProduced(session, eventProduction.getConsumedEvent(), producedEvent);
}
catch (Exception e)
{
@@ -168,7 +171,7 @@
}
// Perform flow control
- if (session.interruped)
+ if (session.mode == EventPhaseSessionImpl.INTERRUPTED_MODE)
{
log.trace("Event distribution interrupted by controller context");
eventDistributionStatus = PortletResponse.INTERRUPTED;
@@ -185,8 +188,6 @@
//
PortletInfo consumerPortletInfo = context.getPortletInfo(consumedId);
-
- //
if (consumerPortletInfo == null)
{
if (log.isTraceEnabled())
@@ -213,7 +214,7 @@
int consumedEventThreshold = controller.getConsumedEventThreshold();
if (consumedEventThreshold >= 0)
{
- if (session.consumedEventHistory.size() + 1 > consumedEventThreshold)
+ if (session.consumedEventSize + 1 > consumedEventThreshold)
{
log.trace("Event distribution interrupted because the maximum number of consumed event is reached");
eventDistributionStatus = PortletResponse.CONSUMED_EVENT_FLOODED;
@@ -225,8 +226,19 @@
PortletInvocationResponse eventResponse = deliverEvent(context, toConsumeEvent, pageNavigationalState, requestProperties.getCookies());
// Now it is consumed we add it to the history
- session.consumedEventHistory.addFirst(toConsumeEvent);
+ session.consumedEventSize++;
+ // And we make a callback
+ try
+ {
+ session.mode = EventPhaseSessionImpl.READ_MODE;
+ eventCC.eventConsumed(session, producedEvent, toConsumeEvent);
+ }
+ catch (Exception e)
+ {
+ log.trace("Event consumed callback threw an exception that is ignored by the controller", e);
+ }
+
//
if (eventResponse instanceof UpdateNavigationalStateResponse)
{
@@ -238,7 +250,8 @@
// Add events to source event queue
for (UpdateNavigationalStateResponse.Event portletEvent : eventStateResponse.getEvents())
{
- session.producedEvents.add(new Event(portletEvent.getName(), portletEvent.getPayload(), toConsumeEvent.getWindowId()));
+ Event blah = new Event(portletEvent.getName(), portletEvent.getPayload(), toConsumeEvent.getWindowId());
+ session.producedEvents.add(new EventProduction(toConsumeEvent, blah));
}
//
@@ -259,7 +272,7 @@
}
// We archive the consumed event in the history
- session.producedEventHistory.addFirst(producedEvent);
+ session.producedEventSize++;
}
//
Added: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java 2008-02-29 00:27:43 UTC (rev 10157)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * 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.portlet.controller.event;
+
+/**
+ * An implementation of the event controller context that do no ops.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AbstractEventControllerContext implements EventControllerContext
+{
+ public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
+ {
+ }
+
+ public void eventConsumed(EventPhaseSession session, Event sourceEvent, Event consumedEvent)
+ {
+ }
+}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/Event.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/Event.java 2008-02-28 14:45:26 UTC (rev 10156)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/Event.java 2008-02-29 00:27:43 UTC (rev 10157)
@@ -24,6 +24,7 @@
import javax.xml.namespace.QName;
import java.io.Serializable;
+import java.util.concurrent.atomic.AtomicLong;
/**
* An event associated with a portlet window.
@@ -34,6 +35,8 @@
public class Event
{
+ private static final AtomicLong generator = new AtomicLong();
+
/** . */
private final QName name;
@@ -43,6 +46,9 @@
/** . */
private final String windowId;
+ /** . */
+ private final long serialNumber = generator.incrementAndGet();
+
public Event(QName name, Serializable payload, String windowId)
{
if (name == null)
@@ -73,8 +79,13 @@
return windowId;
}
+ public long getSerialNumber()
+ {
+ return serialNumber;
+ }
+
public String toString()
{
- return "Event[name=" + name + ",windowId=" + windowId + ",payload=" + payload + "]";
+ return "Event[name=" + name + ",windowId=" + windowId + ",payload=" + payload + ",serialNumber=" + serialNumber + "]";
}
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java 2008-02-28 14:45:26 UTC (rev 10156)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java 2008-02-29 00:27:43 UTC (rev 10157)
@@ -44,8 +44,26 @@
* to the portlet controller invoker.</p>
*
* @param session the session
+ * @param sourceEvent the source event
* @param producedEvent the produced event
*/
- void handleEvent(EventPhaseSession session, Event producedEvent);
+ void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent);
+ /**
+ * <p>Signal to the context when an event is consumed by a portlet. The session argument
+ * only provides querying capabilities and it is not possible to queue event
+ * or interrupt the session.</p>
+ *
+ * <p>During the invocation of this method, any runtime exception thrown will
+ * be ignored by the controller.</p>
+ *
+ * <p>During the invocation of this method, any error thrown will be propagated
+ * to the portlet controller invoker.</p>
+ *
+ * @param session the session
+ * @param sourceEvent the source event
+ * @param consumedEvent the consumed event
+ */
+ void eventConsumed(EventPhaseSession session, Event sourceEvent, Event consumedEvent);
+
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseSession.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseSession.java 2008-02-28 14:45:26 UTC (rev 10156)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseSession.java 2008-02-29 00:27:43 UTC (rev 10157)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.controller.event;
-import java.util.Iterator;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -32,33 +30,19 @@
{
/**
- * Returns an iterator for browsing the history of the produced events.
- * The iterator returns the produced events from the most recent to the oldest.
- *
- * @return all the events produced during the session
- */
- Iterator<Event> browseProducedEventHistory();
-
- /**
- * Returns an iterator for browsing the history of the consumed events.
- * The iterator returns the consumed events from the most recent to the oldest.
- *
- * @return all the events consumed during the session
- */
- Iterator<Event> browseConsumedEventHistory();
-
- /**
* Queue an event for consumption. The queue is a FIFO queue.
*
* @param event an event
* @throws IllegalArgumentException if the event is null
- * @throws IllegalStateException if the event phase is interrupted
+ * @throws IllegalStateException if an event cannot be published
*/
void queueEvent(Event event) throws IllegalArgumentException, IllegalStateException;
/**
* Stop processing of all events and returns from the controller.
+ *
+ * @throws IllegalStateException if the session cannot be interrupted.
*/
- void interrupt();
+ void interrupt() throws IllegalStateException;
}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java 2008-02-28 14:45:26 UTC (rev 10156)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java 2008-02-29 00:27:43 UTC (rev 10157)
@@ -45,7 +45,7 @@
this.invoker = invoker;
}
- public void handleEvent(EventPhaseSession session, Event producedEvent)
+ public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
{
try
{
@@ -54,8 +54,8 @@
PortletInfo portletInfo = portlet.getInfo();
if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
{
- Event consumedEvent = new Event(producedEvent.getName(), producedEvent.getPayload(), portlet.getContext().getId());
- session.queueEvent(consumedEvent);
+ Event distributedEvent = new Event(producedEvent.getName(), producedEvent.getPayload(), portlet.getContext().getId());
+ session.queueEvent(distributedEvent);
}
}
}
@@ -65,4 +65,8 @@
session.interrupt();
}
}
+
+ public void eventConsumed(EventPhaseSession session, Event sourceEvent, Event consumedEvent)
+ {
+ }
}
Modified: modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java
===================================================================
--- modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java 2008-02-28 14:45:26 UTC (rev 10156)
+++ modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java 2008-02-29 00:27:43 UTC (rev 10157)
@@ -42,7 +42,7 @@
/** . */
private final Map<Point, List<Point>> wires = new HashMap<Point, List<Point>>();
- public void handleEvent(EventPhaseSession session, Event producedEvent)
+ public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
{
List<Point> dsts = wires.get(new Point(producedEvent.getName(), producedEvent.getWindowId()));
@@ -56,6 +56,10 @@
}
}
+ public void eventConsumed(EventPhaseSession session, Event sourceEvent, Event consumedEvent)
+ {
+ }
+
public void createWire(QName srcName, String srcWindowId, QName dstName, String dstWindowId)
{
Point src = new Point(srcName, srcWindowId);
Modified: modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java
===================================================================
--- modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java 2008-02-28 14:45:26 UTC (rev 10156)
+++ modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java 2008-02-29 00:27:43 UTC (rev 10157)
@@ -29,9 +29,9 @@
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
import org.jboss.portal.portlet.controller.response.PortletResponse;
-import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.event.EventPhaseSession;
import org.jboss.portal.portlet.controller.event.Event;
+import org.jboss.portal.portlet.controller.event.AbstractEventControllerContext;
import org.jboss.portal.portlet.OpaqueStateString;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.support.PortletSupport;
@@ -310,9 +310,9 @@
//
controller.setConsumedEventThreshold(10);
controller.setProducedEventThreshold(10);
- context.setEventControllerContext(new EventControllerContext()
+ context.setEventControllerContext(new AbstractEventControllerContext()
{
- public void handleEvent(EventPhaseSession session, Event producedEvent)
+ public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
{
session.interrupt();
}
@@ -348,9 +348,9 @@
//
controller.setConsumedEventThreshold(10);
controller.setProducedEventThreshold(10);
- context.setEventControllerContext(new EventControllerContext()
+ context.setEventControllerContext(new AbstractEventControllerContext()
{
- public void handleEvent(EventPhaseSession session, Event producedEvent)
+ public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
{
throw new RuntimeException();
}
@@ -362,9 +362,9 @@
//
final Error error = new Error();
- context.setEventControllerContext(new EventControllerContext()
+ context.setEventControllerContext(new AbstractEventControllerContext()
{
- public void handleEvent(EventPhaseSession session, Event producedEvent)
+ public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
{
throw error;
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java 2008-02-28 14:45:26 UTC (rev 10156)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java 2008-02-29 00:27:43 UTC (rev 10157)
@@ -29,9 +29,6 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.PortletInfo;
-import java.util.List;
-import java.util.ArrayList;
-
/**
* Route events according to the portlets discovered on the page. For now it is pretty trivial.
* We could leverage JSP tags to 'wire' portlets on the same page for instance.
@@ -56,7 +53,7 @@
this.prepareResponse = prepareResponse;
}
- public void handleEvent(EventPhaseSession session, Event producedEvent)
+ public void eventProduced(EventPhaseSession session, Event sourceEvent, Event producedEvent)
{
for (String windowId : prepareResponse.getWindowIds())
{
@@ -72,17 +69,20 @@
//
if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
{
- session.queueEvent(new Event(producedEvent.getName(), producedEvent.getPayload(), windowId));
+ Event distributedEvent = new Event(producedEvent.getName(), producedEvent.getPayload(), windowId);
+ session.queueEvent(distributedEvent);
}
}
}
catch (PortletInvokerException e)
{
e.printStackTrace();
-
- //
session.interrupt();
}
}
}
+
+ public void eventConsumed(EventPhaseSession session, Event sourceEvent, Event consumedEvent)
+ {
+ }
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-28 14:45:26 UTC (rev 10156)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-29 00:27:43 UTC (rev 10157)
@@ -26,7 +26,6 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.state.StateControllerContext;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
@@ -53,7 +52,7 @@
{
/** . */
- private final EventControllerContext eventControllerContext;
+ private final PageEventControllerContext eventControllerContext;
/** . */
private final StateControllerContext stateControllerContext;
@@ -118,7 +117,7 @@
return invoker.invoke(invocation);
}
- public EventControllerContext getEventControllerContext()
+ public PageEventControllerContext getEventControllerContext()
{
return eventControllerContext;
}
16 years, 2 months
JBoss Portal SVN: r10156 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/state/producer and 5 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-28 09:45:26 -0500 (Thu, 28 Feb 2008)
New Revision: 10156
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/PortletCustomizationInterceptor.java
Removed:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestInstanceContext.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java
modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml
Log:
replace TestInstanceContext by an interceptor placed on the consumer side.
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/PortletCustomizationInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/PortletCustomizationInterceptor.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/PortletCustomizationInterceptor.java 2008-02-28 14:45:26 UTC (rev 10156)
@@ -0,0 +1,136 @@
+/******************************************************************************
+ * 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.portlet.aspects.portlet;
+
+import org.jboss.portal.portlet.invocation.PortletInterceptor;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.spi.InstanceContext;
+import org.jboss.portal.portlet.state.AccessMode;
+import org.jboss.portal.portlet.StateEvent;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.AttributeResolver;
+
+/**
+ * <p>This interceptor takes in charge the management of portlet customization when the invocation carries
+ * an read only access mode. The customizations will be stored in the principal scope of the portlet
+ * invocation for security reasons.</p>
+ *
+ * <p>This interceptor must not be used in a production environment.</p>
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletCustomizationInterceptor extends PortletInterceptor
+{
+ protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
+ {
+ InstanceContext oldContext = invocation.getInstanceContext();
+ if ((invocation instanceof ActionInvocation || invocation instanceof EventInvocation) && oldContext.getAccessMode() == AccessMode.READ_ONLY)
+ {
+ PortletContext oldTarget = invocation.getTarget();
+ try
+ {
+ AttributeResolver resolver = invocation.getContext().getAttributeResolver(PortletInvocation.PRINCIPAL_SCOPE);
+ PortletInstanceContext newContext = new PortletInstanceContext(resolver, oldTarget);
+
+ //
+ invocation.setInstanceContext(newContext);
+ invocation.setTarget(newContext.getTarget());
+
+ //
+ return invocation.invokeNext();
+ }
+ finally
+ {
+ invocation.setTarget(oldTarget);
+ invocation.setInstanceContext(oldContext);
+ }
+ }
+ else
+ {
+ return invocation.invokeNext();
+ }
+ }
+
+ private static class PortletInstanceContext implements InstanceContext
+ {
+
+ /** . */
+ private AttributeResolver resolver;
+
+ /** . */
+ private PortletContext target;
+
+ /** . */
+ private boolean useClone;
+
+ /** . */
+ private String id;
+
+ public PortletInstanceContext(
+ AttributeResolver resolver,
+ PortletContext portletContext)
+ {
+ String id = portletContext.getId();
+ PortletContext target = portletContext;
+ boolean useClone = false;
+ PortletContext clone = (PortletContext)resolver.getAttribute("clone." + id);
+ if (clone != null)
+ {
+ target = clone;
+ useClone = true;
+ }
+
+ //
+ this.resolver = resolver;
+ this.useClone = useClone;
+ this.target = target;
+ this.id = id;
+ }
+
+ public PortletContext getTarget()
+ {
+ return target;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public AccessMode getAccessMode()
+ {
+ return useClone ? AccessMode.READ_WRITE : AccessMode.CLONE_BEFORE_WRITE;
+ }
+
+ public void onStateEvent(StateEvent event)
+ {
+ target = event.getPortletContext();
+ useClone = true;
+ resolver.setAttribute("clone." + id, target);
+ }
+ }
+}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2008-02-28 13:41:58 UTC (rev 10155)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2008-02-28 14:45:26 UTC (rev 10156)
@@ -318,6 +318,7 @@
instanceCtx.onStateEvent(event);
}
}
+ break;
}
case READ_WRITE:
{
@@ -346,6 +347,7 @@
StateEvent event = new StateEvent(modifiedCtx, StateEvent.Type.PORTLET_MODIFIED_EVENT);
instanceCtx.onStateEvent(event);
}
+ break;
}
case READ_ONLY:
{
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java 2008-02-28 13:41:58 UTC (rev 10155)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java 2008-02-28 14:45:26 UTC (rev 10156)
@@ -37,6 +37,7 @@
import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
+import org.jboss.portal.portlet.impl.spi.AbstractInstanceContext;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.EventInvocation;
@@ -125,17 +126,15 @@
Portlet portlet = getPortlet(windowId);
- TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
-
actionInvocation.setClientContext(new AbstractClientContext(req));
actionInvocation.setServerContext(new AbstractServerContext(req, resp));
- actionInvocation.setInstanceContext(instanceContext);
+ actionInvocation.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
actionInvocation.setUserContext(new AbstractUserContext(req));
actionInvocation.setWindowContext(new AbstractWindowContext(windowId));
actionInvocation.setPortalContext(new TestPortalContext());
actionInvocation.setSecurityContext(new AbstractSecurityContext(req));
actionInvocation.setRequestContext(new AbstractRequestContext(req));
- actionInvocation.setTarget(instanceContext.getTarget());
+ actionInvocation.setTarget(portlet.getContext());
return invoke((PortletInvocation)actionInvocation);
}
@@ -147,16 +146,16 @@
Portlet portlet = getPortlet(windowId);
- TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
+// TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
eventInvocation.setClientContext(new AbstractClientContext(req, requestCookies));
eventInvocation.setServerContext(new AbstractServerContext(req, resp));
- eventInvocation.setInstanceContext(instanceContext);
+ eventInvocation.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
eventInvocation.setUserContext(new AbstractUserContext(req));
eventInvocation.setWindowContext(new AbstractWindowContext(windowId));
eventInvocation.setPortalContext(new TestPortalContext());
eventInvocation.setSecurityContext(new AbstractSecurityContext(req));
- eventInvocation.setTarget(instanceContext.getTarget());
+ eventInvocation.setTarget(portlet.getContext());
return invoke(eventInvocation);
}
@@ -168,17 +167,15 @@
Portlet portlet = getPortlet(windowId);
- TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
-
resourceInvocation.setClientContext(new AbstractClientContext(req));
resourceInvocation.setServerContext(new AbstractServerContext(req, resp));
- resourceInvocation.setInstanceContext(instanceContext);
+ resourceInvocation.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
resourceInvocation.setUserContext(new AbstractUserContext(req));
resourceInvocation.setWindowContext(new AbstractWindowContext(windowId));
resourceInvocation.setPortalContext(new TestPortalContext());
resourceInvocation.setSecurityContext(new AbstractSecurityContext(req));
resourceInvocation.setRequestContext(new AbstractRequestContext(req));
- resourceInvocation.setTarget(instanceContext.getTarget());
+ resourceInvocation.setTarget(portlet.getContext());
//
return invoke((PortletInvocation)resourceInvocation);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java 2008-02-28 13:41:58 UTC (rev 10155)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java 2008-02-28 14:45:26 UTC (rev 10156)
@@ -37,6 +37,7 @@
import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
+import org.jboss.portal.portlet.impl.spi.AbstractInstanceContext;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -220,20 +221,18 @@
HttpServletResponse resp = context.getClientResponse();
//
- TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), false);
-
PortletInvocationContext renderContext = context.getPortletControllerContext().createPortletInvocationContext(portlet.getContext().getId(), pageNS);
//
RenderInvocation render = new RenderInvocation(renderContext);
render.setClientContext(new AbstractClientContext(req, pageProperties.getCookies()));
render.setServerContext(new AbstractServerContext(req, resp));
- render.setInstanceContext(instanceContext);
+ render.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
render.setUserContext(new AbstractUserContext(req));
render.setWindowContext(new AbstractWindowContext(portlet.getContext().getId()));
render.setPortalContext(new TestPortalContext());
render.setSecurityContext(new AbstractSecurityContext(req));
- render.setTarget(instanceContext.getTarget());
+ render.setTarget(portlet.getContext());
render.setMode(mode);
render.setWindowState(windowState);
render.setNavigationalState(portletNS);
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestInstanceContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestInstanceContext.java 2008-02-28 13:41:58 UTC (rev 10155)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestInstanceContext.java 2008-02-28 14:45:26 UTC (rev 10156)
@@ -1,103 +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.portlet.test.controller;
-
-import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.StateEvent;
-import org.jboss.portal.portlet.spi.InstanceContext;
-import org.jboss.portal.portlet.state.AccessMode;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class TestInstanceContext implements InstanceContext
-{
-
- /** . */
- private HttpServletRequest req;
-
- /** . */
- private boolean modifiable;
-
- /** . */
- private PortletContext target;
-
- /** . */
- private boolean useClone;
-
- /** . */
- private String id;
-
- public TestInstanceContext(
- HttpServletRequest req,
- PortletContext portletContext,
- boolean modifiable)
- {
- String id = portletContext.getId();
- PortletContext target = portletContext;
- boolean useClone = false;
- HttpSession session = req.getSession(false);
- if (session != null)
- {
- PortletContext clone = (PortletContext)session.getAttribute("clone." + id);
- if (clone != null)
- {
- target = clone;
- useClone = true;
- }
- }
-
- //
- this.req = req;
- this.useClone = useClone;
- this.target = target;
- this.id = id;
- this.modifiable = modifiable;
- }
-
- public PortletContext getTarget()
- {
- return target;
- }
-
- public String getId()
- {
- return id;
- }
-
- public AccessMode getAccessMode()
- {
- return modifiable ? (useClone ? AccessMode.READ_WRITE : AccessMode.CLONE_BEFORE_WRITE) : AccessMode.READ_ONLY;
- }
-
- public void onStateEvent(StateEvent event)
- {
- target = event.getPortletContext();
- req.getSession().setAttribute("clone." + id, target);
- }
-}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java 2008-02-28 13:41:58 UTC (rev 10155)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java 2008-02-28 14:45:26 UTC (rev 10156)
@@ -22,9 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp;
-import org.jboss.portal.portlet.test.controller.TestInstanceContext;
import org.jboss.portal.portlet.test.controller.TestPortalContext;
-import org.jboss.portal.portlet.test.jsp.WindowResult;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -37,6 +35,7 @@
import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
+import org.jboss.portal.portlet.impl.spi.AbstractInstanceContext;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
@@ -169,7 +168,7 @@
RenderInvocation render = new RenderInvocation(renderContext);
render.setClientContext(new AbstractClientContext(portletControllerContext.getClientRequest()));
render.setServerContext(new AbstractServerContext(portletControllerContext.getClientRequest(), portletControllerContext.getClientResponse()));
- render.setInstanceContext(new TestInstanceContext(portletControllerContext.getClientRequest(), portlet.getContext(), false));
+ render.setInstanceContext(new AbstractInstanceContext(portlet.getContext().getId()));
render.setUserContext(new AbstractUserContext(portletControllerContext.getClientRequest()));
render.setWindowContext(new AbstractWindowContext(windowId));
render.setPortalContext(new TestPortalContext());
Modified: modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml 2008-02-28 13:41:58 UTC (rev 10155)
+++ modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml 2008-02-28 14:45:26 UTC (rev 10156)
@@ -56,10 +56,13 @@
<!-- Consumer stack -->
<bean name="ConsumerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ConsumerCacheInterceptor">
</bean>
+ <bean name="PortletCustomizationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.PortletCustomizationInterceptor">
+ </bean>
<bean name="ConsumerStackFactory" class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
<property name="interceptors">
<array>
<inject bean="ConsumerCacheInterceptor"/>
+ <inject bean="PortletCustomizationInterceptor"/>
</array>
</property>
</bean>
Modified: modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-02-28 13:41:58 UTC (rev 10155)
+++ modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-02-28 14:45:26 UTC (rev 10156)
@@ -56,10 +56,13 @@
<!-- Consumer stack -->
<bean name="ConsumerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ConsumerCacheInterceptor">
</bean>
+ <bean name="PortletCustomizationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.PortletCustomizationInterceptor">
+ </bean>
<bean name="ConsumerStackFactory" class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
<property name="interceptors">
<array>
<inject bean="ConsumerCacheInterceptor"/>
+ <inject bean="PortletCustomizationInterceptor"/>
</array>
</property>
</bean>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-28 13:41:58 UTC (rev 10155)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-28 14:45:26 UTC (rev 10156)
@@ -43,10 +43,13 @@
<!-- Consumer stack -->
<bean name="ConsumerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ConsumerCacheInterceptor">
</bean>
+ <bean name="PortletCustomizationInterceptor" class="org.jboss.portal.portlet.aspects.portlet.PortletCustomizationInterceptor">
+ </bean>
<bean name="ConsumerStackFactory" class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
<property name="interceptors">
<array>
<inject bean="ConsumerCacheInterceptor"/>
+ <inject bean="PortletCustomizationInterceptor"/>
</array>
</property>
</bean>
16 years, 2 months
JBoss Portal SVN: r10155 - in modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state: producer and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-28 08:41:58 -0500 (Thu, 28 Feb 2008)
New Revision: 10155
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/AbstractPropertyContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/AccessMode.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
Log:
make AccessMode an enum type
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/AbstractPropertyContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/AbstractPropertyContext.java 2008-02-28 12:34:47 UTC (rev 10154)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/AbstractPropertyContext.java 2008-02-28 13:41:58 UTC (rev 10155)
@@ -98,9 +98,8 @@
}
//
- for (int i = 0; i < changes.length; i++)
+ for (PropertyChange change : changes)
{
- PropertyChange change = changes[i];
prefs.setProperty(change.getKey(), change.getValue());
}
status = UPDATE_SUCCESSFUL;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/AccessMode.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/AccessMode.java 2008-02-28 12:34:47 UTC (rev 10154)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/AccessMode.java 2008-02-28 13:41:58 UTC (rev 10155)
@@ -28,17 +28,17 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5776 $
*/
-public class AccessMode
+public enum AccessMode
{
/** Read only access mode. */
- public static final AccessMode READ_ONLY = new AccessMode("READ_ONLY");
+ READ_ONLY("READ_ONLY"),
/** Read write access mode. */
- public static final AccessMode READ_WRITE = new AccessMode("READ_WRITE");
+ READ_WRITE("READ_WRITE"),
/** Clone before write access mode. */
- public static final AccessMode CLONE_BEFORE_WRITE = new AccessMode("CLONE_BEFORE_WRITE");
+ CLONE_BEFORE_WRITE("CLONE_BEFORE_WRITE");
/** The type as a string. */
private final String name;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2008-02-28 12:34:47 UTC (rev 10154)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2008-02-28 13:41:58 UTC (rev 10155)
@@ -253,29 +253,84 @@
PropertyMap newPrefs = prefs.getPrefs();
//
- if (access == AccessMode.CLONE_BEFORE_WRITE)
+ switch(access)
{
- boolean persist = stateManagementPolicy.persistLocally();
+ case CLONE_BEFORE_WRITE:
+ {
+ boolean persist = stateManagementPolicy.persistLocally();
- // Create the state
- if (context.isStateful())
- {
- StatefulContext statefulContext = (StatefulContext)context;
- if (persist)
+ // Create the state
+ if (context.isStateful())
{
- try
+ StatefulContext statefulContext = (StatefulContext)context;
+ if (persist)
{
- // The state id should be ok as it was used before to load the state
- LocalContext localContext = (LocalContext)statefulContext;
- String portletStateId = localContext.getStateId();
- String cloneStateId = persistenceManager.cloneState(portletStateId, newPrefs);
+ try
+ {
+ // The state id should be ok as it was used before to load the state
+ LocalContext localContext = (LocalContext)statefulContext;
+ String portletStateId = localContext.getStateId();
+ String cloneStateId = persistenceManager.cloneState(portletStateId, newPrefs);
+ // Return the clone context
+ String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
+ PortletContext clonedCtx = PortletContext.createPortletContext(cloneId);
+ StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
+ instanceCtx.onStateEvent(event);
+ }
+ catch (NoSuchStateException e)
+ {
+ throw new PortletInvokerException("Unexpected exception", e);
+ }
+ catch (InvalidStateIdException e)
+ {
+ throw new PortletInvokerException("Unexpected exception", e);
+ }
+ }
+ else
+ {
+ PortletContext clonedCtx = marshall(context.getPortletId(), newPrefs);
+ StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
+ instanceCtx.onStateEvent(event);
+ }
+ }
+ else
+ {
+ // Add the missing mutable portlet state
+ getPropertiesFromMetaData(portlet.getContext(), newPrefs);
+
+ //
+ if (persist)
+ {
+ // Create the new state
+ String cloneStateId = persistenceManager.createState(context.getPortletId(), newPrefs);
+
// Return the clone context
String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
PortletContext clonedCtx = PortletContext.createPortletContext(cloneId);
StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
instanceCtx.onStateEvent(event);
}
+ else
+ {
+ PortletContext clonedCtx = marshall(context.getPortletId(), newPrefs);
+ StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
+ instanceCtx.onStateEvent(event);
+ }
+ }
+ }
+ case READ_WRITE:
+ {
+ StatefulContext statefulContext = (StatefulContext)context;
+ if (statefulContext.isLocal())
+ {
+ // Update the state
+ try
+ {
+ LocalContext localContext = (LocalContext)statefulContext;
+ String stateId = localContext.getStateId();
+ persistenceManager.updateState(stateId, newPrefs);
+ }
catch (NoSuchStateException e)
{
throw new PortletInvokerException("Unexpected exception", e);
@@ -287,69 +342,17 @@
}
else
{
- PortletContext clonedCtx = marshall(context.getPortletId(), newPrefs);
- StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
+ PortletContext modifiedCtx = marshall(context.getPortletId(), newPrefs);
+ StateEvent event = new StateEvent(modifiedCtx, StateEvent.Type.PORTLET_MODIFIED_EVENT);
instanceCtx.onStateEvent(event);
}
}
- else
+ case READ_ONLY:
{
- // Add the missing mutable portlet state
- getPropertiesFromMetaData(portlet.getContext(), newPrefs);
-
- //
- if (persist)
- {
- // Create the new state
- String cloneStateId = persistenceManager.createState(context.getPortletId(), newPrefs);
-
- // Return the clone context
- String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
- PortletContext clonedCtx = PortletContext.createPortletContext(cloneId);
- StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
- instanceCtx.onStateEvent(event);
- }
- else
- {
- PortletContext clonedCtx = marshall(context.getPortletId(), newPrefs);
- StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
- instanceCtx.onStateEvent(event);
- }
+ throw new PortletStateChangeRequiredException("Modification was requested for portlet with id '"
+ + context.getPortletId() + "' but access mode was READ ONLY.");
}
}
- else if (access == AccessMode.READ_WRITE)
- {
- StatefulContext statefulContext = (StatefulContext)context;
- if (statefulContext.isLocal())
- {
- // Update the state
- try
- {
- LocalContext localContext = (LocalContext)statefulContext;
- String stateId = localContext.getStateId();
- persistenceManager.updateState(stateId, newPrefs);
- }
- catch (NoSuchStateException e)
- {
- throw new PortletInvokerException("Unexpected exception", e);
- }
- catch (InvalidStateIdException e)
- {
- throw new PortletInvokerException("Unexpected exception", e);
- }
- }
- else
- {
- PortletContext modifiedCtx = marshall(context.getPortletId(), newPrefs);
- StateEvent event = new StateEvent(modifiedCtx, StateEvent.Type.PORTLET_MODIFIED_EVENT);
- instanceCtx.onStateEvent(event);
- }
- }
- else if (access == AccessMode.READ_ONLY)
- {
- throw new PortletStateChangeRequiredException("Modification was requested for portlet with id '"
- + context.getPortletId() + "' but access mode was READ ONLY.");
- }
}
//
16 years, 2 months
JBoss Portal SVN: r10154 - branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/portlet.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-02-28 07:34:47 -0500 (Thu, 28 Feb 2008)
New Revision: 10154
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
Log:
JBPORTAL-1932: Portlet Session replication failing.
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-02-28 12:34:12 UTC (rev 10153)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-02-28 12:34:47 UTC (rev 10154)
@@ -162,7 +162,7 @@
return render;
}
- private static class ControllerActionContext extends AbstractActionContext
+ public static class ControllerActionContext extends AbstractActionContext
{
private InvokePortletCommandFactory cmdFactory;
private ControllerContext controllerContext;
@@ -199,7 +199,7 @@
}
}
- private static class ControllerRenderContext extends AbstractRenderContext
+ public static class ControllerRenderContext extends AbstractRenderContext
{
private InvokePortletCommandFactory cmdFactory;
private ControllerContext controllerContext;
16 years, 2 months