Author: julien(a)jboss.com
Date: 2008-02-27 18:06:44 -0500 (Wed, 27 Feb 2008)
New Revision: 10141
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/CCPPTestCase.java
Modified:
modules/portlet/trunk/build/pom.xml
modules/portlet/trunk/portlet/pom.xml
modules/portlet/trunk/test/pom.xml
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java
modules/portlet/trunk/test/src/test/build.xml
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:
implement simple cc/pp attribute
Modified: modules/portlet/trunk/build/pom.xml
===================================================================
--- modules/portlet/trunk/build/pom.xml 2008-02-27 22:56:58 UTC (rev 10140)
+++ modules/portlet/trunk/build/pom.xml 2008-02-27 23:06:44 UTC (rev 10141)
@@ -45,6 +45,7 @@
<version.ant>1.7.0</version.ant>
<version.sun-jaxb>2.1.4</version.sun-jaxb>
<version.portlet-api>2.0-Draft32</version.portlet-api>
+ <version.ccpp-api>1.0</version.ccpp-api>
</properties>
<repositories>
@@ -174,6 +175,11 @@
<artifactId>jsp-api</artifactId>
<version>${version.javax.servlet.jsp}</version>
</dependency>
+ <dependency>
+ <groupId>javax.ccpp</groupId>
+ <artifactId>ccpp</artifactId>
+ <version>${version.ccpp-api}</version>
+ </dependency>
<dependency>
<groupId>concurrent</groupId>
Modified: modules/portlet/trunk/portlet/pom.xml
===================================================================
--- modules/portlet/trunk/portlet/pom.xml 2008-02-27 22:56:58 UTC (rev 10140)
+++ modules/portlet/trunk/portlet/pom.xml 2008-02-27 23:06:44 UTC (rev 10141)
@@ -39,6 +39,10 @@
<groupId>sun-jaxb</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.ccpp</groupId>
+ <artifactId>ccpp</artifactId>
+ </dependency>
<!--TEST SCOPE-->
<dependency>
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java 2008-02-27
23:06:44 UTC (rev 10141)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * 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.common.invocation.InvocationException;
+
+import javax.ccpp.Profile;
+import javax.ccpp.Attribute;
+import javax.ccpp.Component;
+import javax.ccpp.ProfileDescription;
+import javax.ccpp.AttributeDescription;
+import javax.ccpp.ComponentDescription;
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * A simple implementation of CC/PP feature of JSR286.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class CCPPInterceptor extends PortletInterceptor
+{
+ protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+ {
+ try
+ {
+ invocation.setAttribute(PortletInvocation.REQUEST_SCOPE,
"javax.portlet.ccpp", SIMPLE_PROFILE);
+
+ //
+ return invocation.invokeNext();
+ }
+ finally
+ {
+ invocation.removeAttribute(PortletInvocation.REQUEST_SCOPE,
"javax.portlet.ccpp");
+ }
+ }
+
+ /**
+ * A simple implementation of a profile.
+ */
+ private static final Profile SIMPLE_PROFILE = new Profile()
+ {
+ public Attribute getAttribute(String s)
+ {
+ return null;
+ }
+
+ public Set getAttributes()
+ {
+ return Collections.emptySet();
+ }
+
+ public Component getComponent(String s)
+ {
+ return null;
+ }
+
+ public Set getComponents()
+ {
+ return Collections.emptySet();
+ }
+
+ public ProfileDescription getDescription()
+ {
+ return SIMPLE_PROFILE_DESCRPTION;
+ }
+ };
+
+ /**
+ * A simple implementation of a profile description.
+ */
+ private static final ProfileDescription SIMPLE_PROFILE_DESCRPTION = new
ProfileDescription()
+ {
+ public AttributeDescription getAttributeDescription(String s)
+ {
+ return null;
+ }
+
+ public Set getAttributeDescriptions()
+ {
+ return Collections.emptySet();
+ }
+
+ public ComponentDescription getComponentDescription(String s)
+ {
+ return null;
+ }
+
+ public Set getComponentDescriptions()
+ {
+ return Collections.emptySet();
+ }
+
+ public String getURI()
+ {
+ return null;
+ }
+ };
+}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/CCPPTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/CCPPTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletrequests/CCPPTestCase.java 2008-02-27
23:06:44 UTC (rev 10141)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * 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.test.portlet.jsr286.tck.portletrequests;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.ccpp.Profile;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase(Assertion.JSR286_89)
+public class CCPPTestCase
+{
+ public CCPPTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ Profile profile =
(Profile)request.getAttribute(PortletRequest.CCPP_PROFILE);
+ assertNotNull(profile);
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified: modules/portlet/trunk/test/pom.xml
===================================================================
--- modules/portlet/trunk/test/pom.xml 2008-02-27 22:56:58 UTC (rev 10140)
+++ modules/portlet/trunk/test/pom.xml 2008-02-27 23:06:44 UTC (rev 10141)
@@ -160,6 +160,10 @@
<artifactId>web-web</artifactId>
<type>jar</type>
</dependency>
+ <dependency>
+ <groupId>javax.ccpp</groupId>
+ <artifactId>ccpp</artifactId>
+ </dependency>
<!--
<dependency>
<groupId>org.jboss.portal.portlet</groupId>
@@ -344,6 +348,8 @@
<!--<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"
Modified:
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-27
22:56:58 UTC (rev 10140)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java 2008-02-27
23:06:44 UTC (rev 10141)
@@ -25,6 +25,7 @@
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;
@@ -76,7 +77,7 @@
addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, new
MapAttributeResolver());
addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new
MapAttributeResolver());
- addResolver(PortletInvocation.REQUEST_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.REQUEST_SCOPE, new
RequestAttributeResolver(clientRequest));
}
public String getWindowId()
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-27 22:56:58 UTC (rev 10140)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-27 23:06:44 UTC (rev 10141)
@@ -500,6 +500,7 @@
<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}"/>
@@ -614,6 +615,7 @@
<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}"/>
@@ -703,6 +705,7 @@
<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>
</copy>
@@ -778,6 +781,7 @@
<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}"/>
@@ -845,6 +849,7 @@
<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}"/>
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-27
22:56:58 UTC (rev 10140)
+++
modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml 2008-02-27
23:06:44 UTC (rev 10141)
@@ -80,6 +80,7 @@
<property name="servletContainerFactory"><inject
bean="ServletContainerFactory"/></property>
</bean>
<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">
<property name="interceptors">
@@ -88,6 +89,7 @@
<inject bean="SecureTransportInterceptor"/>
<inject bean="ContextDispatcherInterceptor"/>
<inject bean="ProducerCacheInterceptor"/>
+ <inject bean="CCPPInterceptor"/>
<inject bean="RequestAttributeConversationInterceptor"/>
</array>
</property>
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-27
22:56:58 UTC (rev 10140)
+++
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-02-27
23:06:44 UTC (rev 10141)
@@ -80,6 +80,7 @@
<property name="servletContainerFactory"><inject
bean="ServletContainerFactory"/></property>
</bean>
<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">
<property name="interceptors">
@@ -88,6 +89,7 @@
<inject bean="SecureTransportInterceptor"/>
<inject bean="ContextDispatcherInterceptor"/>
<inject bean="ProducerCacheInterceptor"/>
+ <inject bean="CCPPInterceptor"/>
<inject bean="RequestAttributeConversationInterceptor"/>
</array>
</property>
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-27
22:56:58 UTC (rev 10140)
+++
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-27
23:06:44 UTC (rev 10141)
@@ -65,6 +65,7 @@
<property name="servletContainerFactory"><inject
bean="ServletContainerFactory"/></property>
</bean>
<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">
<property name="interceptors">
@@ -73,6 +74,7 @@
<inject bean="SecureTransportInterceptor"/>
<inject bean="ContextDispatcherInterceptor"/>
<inject bean="ProducerCacheInterceptor"/>
+ <inject bean="CCPPInterceptor"/>
<inject bean="RequestAttributeConversationInterceptor"/>
</array>
</property>