Author: julien(a)jboss.com
Date: 2008-04-15 19:34:57 -0400 (Tue, 15 Apr 2008)
New Revision: 10594
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvokerInterceptor.java
Removed:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/TestPortletInvoker.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInterceptor2.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/TestPortletInvoker.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvoker.java
Modified:
modules/portlet/trunk/bridge/src/main/java/org/jboss/portal/portlet/bridge/BridgeInterceptor.java
modules/portlet/trunk/management/src/main/java/org/jboss/portal/portlet/management/PortletContainerManagementInterceptorImpl.java
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml
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/ConsumerCacheInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/LocalInterceptor.java
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/ProducerCacheInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/consumer/ConsumerPortletInvoker.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.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
Log:
migrate portlet container interceptor to use the unified portlet invoker interceptors
Modified:
modules/portlet/trunk/bridge/src/main/java/org/jboss/portal/portlet/bridge/BridgeInterceptor.java
===================================================================
---
modules/portlet/trunk/bridge/src/main/java/org/jboss/portal/portlet/bridge/BridgeInterceptor.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/bridge/src/main/java/org/jboss/portal/portlet/bridge/BridgeInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,8 +22,10 @@
******************************************************************************/
package org.jboss.portal.portlet.bridge;
-import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.PortletInvokerException;
/**
* The bridge interceptor set the bridge for the duration of the request made to the
portlet.
@@ -31,10 +33,10 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6549 $
*/
-public class BridgeInterceptor extends PortletInterceptor
+public class BridgeInterceptor extends PortletInvokerInterceptor
{
- protected Object invoke(PortletInvocation invocation) throws Exception
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
JBossServletContextProvider.BridgeInfo previousInfo =
JBossServletContextProvider.get();
try
@@ -44,7 +46,7 @@
JBossServletContextProvider.set(bridgeInfo);
// Proceed to invocation
- return invocation.invokeNext();
+ return super.invoke(invocation);
}
finally
{
Modified:
modules/portlet/trunk/management/src/main/java/org/jboss/portal/portlet/management/PortletContainerManagementInterceptorImpl.java
===================================================================
---
modules/portlet/trunk/management/src/main/java/org/jboss/portal/portlet/management/PortletContainerManagementInterceptorImpl.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/management/src/main/java/org/jboss/portal/portlet/management/PortletContainerManagementInterceptorImpl.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,75 +22,73 @@
******************************************************************************/
package org.jboss.portal.portlet.management;
-import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
-import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
/**
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @version $Revision$
*/
-public class PortletContainerManagementInterceptorImpl extends PortletInterceptor
implements PortletContainerManagementInterceptor
+public class PortletContainerManagementInterceptorImpl extends PortletInvokerInterceptor
implements PortletContainerManagementInterceptor
{
- private Map map = new ConcurrentHashMap();
+ /** . */
+ private final ConcurrentMap<String, PortletInfo> map = new
ConcurrentHashMap<String, PortletInfo>();
// Correctness is not insured.
- protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
PortletContext portlet = invocation.getTarget();
String portletName = portlet.getId();
- boolean error = false;
-
+ boolean error = true;
long delta = - System.currentTimeMillis();
- Object object;
+
+ //
try
{
- object = invocation.invokeNext();
+ PortletInvocationResponse response = super.invoke(invocation);
+ error = false;
+ return response;
}
- catch (InvocationException e)
+ finally
{
- error = true;
- throw e;
- }
- catch (Exception e)
- {
- error = true;
- throw e;
- }
+ delta += System.currentTimeMillis();
- delta += System.currentTimeMillis();
-
- if (invocation instanceof RenderInvocation)
- {
- PortletInfo info = getPortletInfo(portletName);
- info.newRenderCall(delta, error);
+ //
+ if (invocation instanceof RenderInvocation)
+ {
+ PortletInfo info = getPortletInfo(portletName);
+ info.newRenderCall(delta, error);
+ }
+ else if (invocation instanceof ActionInvocation)
+ {
+ PortletInfo info = getPortletInfo(portletName);
+ info.newActionCall(delta, error);
+ }
}
- else if (invocation instanceof ActionInvocation)
- {
- PortletInfo info = getPortletInfo(portletName);
- info.newActionCall(delta, error);
- }
- return object;
}
public synchronized PortletInfo getPortletInfo(String key)
{
- PortletInfo info = (PortletInfo)map.get(key);
+ PortletInfo info = map.get(key);
+
+ //
if (info == null)
{
- info = new PortletInfo();
- map.put(key, info);
+ info = map.putIfAbsent(key, new PortletInfo());
}
+
+ //
return info;
}
-
}
Deleted:
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 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/TestPortletInvoker.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -1,159 +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.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
Modified:
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/jboss-beans.xml 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-04-15
23:34:57 UTC (rev 10594)
@@ -40,59 +40,8 @@
</constructor>
</bean>
- <!-- 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.portal.InterceptorStackFactoryImpl">
- <property name="interceptors">
- <array>
- <inject bean="ConsumerCacheInterceptor"/>
- <inject bean="PortletCustomizationInterceptor"/>
- </array>
- </property>
- </bean>
-
- <!-- The consumer portlet invoker -->
- <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>
-
- <!-- Container stack -->
- <bean name="ValveInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ValveInterceptor"/>
- <bean name="SecureTransportInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor"/>
- <bean name="ContextDispatcherInterceptor"
-
class="org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor">
- <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="EventPayloadInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.EventPayloadInterceptor"/>
- <bean name="ContainerStackFactory"
class="org.jboss.portal.portlet.portal.InterceptorStackFactoryImpl">
- <property name="interceptors">
- <array>
- <inject bean="ValveInterceptor"/>
- <inject bean="SecureTransportInterceptor"/>
- <inject bean="ContextDispatcherInterceptor"/>
- <inject bean="ProducerCacheInterceptor"/>
- <inject bean="CCPPInterceptor"/>
- <inject bean="RequestAttributeConversationInterceptor"/>
- <inject bean="EventPayloadInterceptor"/>
- </array>
- </property>
- </bean>
-
- <!-- The portlet container invoker -->
- <bean name="ContainerPortletInvoker"
class="org.jboss.portal.portlet.container.ContainerPortletInvoker">
- <property name="stackFactory"><inject
bean="ContainerStackFactory"/></property>
- </bean>
-
<!-- The producer persistence manager -->
- <bean name="ProducerPersistenceManager"
-
class="org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService"/>
+ <bean name="ProducerPersistenceManager"
class="org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService"/>
<!-- The producer state management policy -->
<bean name="ProducerStateManagementPolicy"
class="org.jboss.portal.portlet.impl.state.StateManagementPolicyService">
@@ -102,6 +51,17 @@
<!-- The producer state converter -->
<bean name="ProducerStateConverter"
class="org.jboss.portal.portlet.impl.state.StateConverterV0"/>
+ <!-- The consumer portlet invoker -->
+ <bean name="ConsumerPortletInvoker"
class="org.jboss.portal.portlet.invocation.PortletInvokerInterceptor">
+ <property name="next"><inject
bean="ConsumerCacheInterceptor"/></property>
+ </bean>
+ <bean name="ConsumerCacheInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ConsumerCacheInterceptor">
+ <property name="next"><inject
bean="PortletCustomizationInterceptor"/></property>
+ </bean>
+ <bean name="PortletCustomizationInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.PortletCustomizationInterceptor">
+ <property name="next"><inject
bean="ProducerPortletInvoker"/></property>
+ </bean>
+
<!-- The producer portlet invoker -->
<bean name="ProducerPortletInvoker"
class="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker">
<property name="next"><inject
bean="ContainerPortletInvoker"/></property>
@@ -110,4 +70,36 @@
<property name="stateConverter"><inject
bean="ProducerStateConverter"/></property>
</bean>
+ <!-- The portlet container invoker -->
+ <bean name="ContainerPortletInvoker"
class="org.jboss.portal.portlet.container.ContainerPortletInvoker">
+ <property name="next"><inject
bean="ValveInterceptor"/></property>
+ </bean>
+
+ <!-- Container stack -->
+ <bean name="ValveInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ValveInterceptor">
+ <property name="portletApplicationRegistry"><inject
bean="PortletApplicationRegistry"
state="Instantiated"/></property>
+ <property name="next"><inject
bean="SecureTransportInterceptor"/></property>
+ </bean>
+ <bean name="SecureTransportInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor">
+ <property name="next"><inject
bean="ContextDispatcherInterceptor"/></property>
+ </bean>
+ <bean name="ContextDispatcherInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor">
+ <property name="servletContainerFactory"><inject
bean="ServletContainerFactory"/></property>
+ <property name="next"><inject
bean="ProducerCacheInterceptor"/></property>
+ </bean>
+ <bean name="ProducerCacheInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor">
+ <property name="next"><inject
bean="CCPPInterceptor"/></property>
+ </bean>
+ <bean name="CCPPInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.CCPPInterceptor">
+ <property name="next"><inject
bean="RequestAttributeConversationInterceptor"/></property>
+ </bean>
+ <bean name="RequestAttributeConversationInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor">
+ <property name="next"><inject
bean="EventPayloadInterceptor"/></property>
+ </bean>
+ <bean name="EventPayloadInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.EventPayloadInterceptor">
+ <property name="next"><inject
bean="PortletContainerDispatcher"/></property>
+ </bean>
+ <bean name="PortletContainerDispatcher"
class="org.jboss.portal.portlet.container.ContainerPortletDispatcher">
+ </bean>
+
</deployment>
Modified:
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 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,9 +22,10 @@
******************************************************************************/
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 org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.PortletInvokerException;
import javax.ccpp.Profile;
import javax.ccpp.Attribute;
@@ -43,9 +44,10 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class CCPPInterceptor extends PortletInterceptor
+public class CCPPInterceptor extends PortletInvokerInterceptor
{
- protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
Map<String, Object> requestAttributes = invocation.getRequestAttributes();
@@ -60,7 +62,7 @@
requestAttributes.put("javax.portlet.ccpp", SIMPLE_PROFILE);
//
- return invocation.invokeNext();
+ return super.invoke(invocation);
}
/**
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,9 +22,9 @@
******************************************************************************/
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.RenderInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
import org.jboss.portal.portlet.invocation.response.cache.ContentRef;
import org.jboss.portal.portlet.invocation.response.cache.StrongContentRef;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -32,9 +32,9 @@
import org.jboss.portal.portlet.invocation.response.ContentResponse;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.cache.CacheControl;
-import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
@@ -48,10 +48,10 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class ConsumerCacheInterceptor extends PortletInterceptor
+public class ConsumerCacheInterceptor extends PortletInvokerInterceptor
{
- protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
// Compute the cache key
String scopeKey = "cached_markup." +
invocation.getWindowContext().getId();
@@ -159,7 +159,7 @@
}
// Invoke
- PortletInvocationResponse response =
(PortletInvocationResponse)invocation.invokeNext();
+ PortletInvocationResponse response = super.invoke(invocation);
// Try to cache any fragment result
CacheControl control = null;
@@ -226,7 +226,7 @@
userContext.setAttribute(scopeKey, null);
// Invoke
- return invocation.invokeNext();
+ return super.invoke(invocation);
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,16 +22,17 @@
******************************************************************************/
package org.jboss.portal.portlet.aspects.portlet;
-import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.container.PortletApplication;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.web.RequestDispatchCallback;
import org.jboss.portal.web.ServletContainer;
import org.jboss.portal.web.ServletContainerFactory;
-import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.spi.ServerContext;
+import org.jboss.portal.portlet.PortletInvokerException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -45,7 +46,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 7226 $
*/
-public class ContextDispatcherInterceptor extends PortletInterceptor
+public class ContextDispatcherInterceptor extends PortletInvokerInterceptor
{
/** . */
@@ -64,7 +65,7 @@
this.servletContainerFactory = servletContainerFactory;
}
- protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
PortletContainer container =
(PortletContainer)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
PortletApplication portletApplication = container.getPortletApplication();
@@ -73,19 +74,35 @@
ServletContainer servletContainer = servletContainerFactory.getServletContainer();
try
{
- return reqCtx.dispatch(servletContainer, targetCtx, callback, invocation);
+ return (PortletInvocationResponse)reqCtx.dispatch(servletContainer, targetCtx,
callback, invocation);
}
- catch (ServletException e)
+ catch (Exception e)
{
- if (e.getRootCause() != null && e.getRootCause() instanceof Exception)
+ if (e instanceof PortletInvokerException)
{
- throw (Exception)e.getRootCause();
+ throw (PortletInvokerException)e;
}
- throw e;
+ else if (e instanceof RuntimeException)
+ {
+ throw (RuntimeException)e;
+ }
+ else if (e instanceof ServletException)
+ {
+ ServletException se = (ServletException)e;
+
+ //
+ if (se.getRootCause() != null && se.getRootCause() instanceof
Exception)
+ {
+ e = (Exception)se.getRootCause();
+ }
+ }
+
+ //
+ throw new PortletInvokerException(e);
}
}
- private static final RequestDispatchCallback callback = new RequestDispatchCallback()
+ private final RequestDispatchCallback callback = new RequestDispatchCallback()
{
public Object doCallback(ServletContext dispatchedServletContext,
HttpServletRequest req, HttpServletResponse resp, Object handback) throws
ServletException, IOException
{
@@ -98,10 +115,12 @@
// Set dispatched request and response and invocation
invocation.setDispatchedRequest(req);
invocation.setDispatchedResponse(resp);
- invocation.getDispatchedRequest().setAttribute(REQ_ATT_COMPONENT_INVOCATION,
invocation);
//
- return invocation.invokeNext();
+ req.setAttribute(REQ_ATT_COMPONENT_INVOCATION, invocation);
+
+ //
+ return ContextDispatcherInterceptor.super.invoke(invocation);
}
catch (Exception e)
{
@@ -110,7 +129,9 @@
finally
{
// Clear dispatched request and response
- invocation.getDispatchedRequest().setAttribute(REQ_ATT_COMPONENT_INVOCATION,
null);
+ req.setAttribute(REQ_ATT_COMPONENT_INVOCATION, null);
+
+ //
invocation.setDispatchedRequest(null);
invocation.setDispatchedResponse(null);
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,10 +22,11 @@
******************************************************************************/
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.EventInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.portlet.container.PortletApplication;
@@ -34,7 +35,7 @@
import org.jboss.portal.portlet.info.EventingInfo;
import org.jboss.portal.portlet.info.EventInfo;
import org.jboss.portal.portlet.impl.info.ContainerTypeInfo;
-import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.common.io.IOTools;
import org.apache.log4j.Logger;
@@ -50,13 +51,13 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class EventPayloadInterceptor extends PortletInterceptor
+public class EventPayloadInterceptor extends PortletInvokerInterceptor
{
/** . */
private final static Logger log = Logger.getLogger(EventPayloadInterceptor.class);
- protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
if (invocation instanceof EventInvocation)
{
@@ -183,7 +184,7 @@
//
try
{
- return invocation.invokeNext();
+ return super.invoke(invocation);
}
finally
{
@@ -192,7 +193,7 @@
}
else
{
- return invocation.invokeNext();
+ return super.invoke(invocation);
}
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/LocalInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/LocalInterceptor.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/LocalInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,9 +22,10 @@
******************************************************************************/
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 org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.PortletInvokerException;
/**
* An interceptor whose purpose is to detect invocation from the local portal.
@@ -32,7 +33,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class LocalInterceptor extends PortletInterceptor
+public class LocalInterceptor extends PortletInvokerInterceptor
{
/** . */
@@ -43,12 +44,12 @@
return Boolean.TRUE.equals(local.get());
}
- protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
try
{
local.set(Boolean.TRUE);
- return invocation.invokeNext();
+ return super.invoke(invocation);
}
finally
{
Modified:
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 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/PortletCustomizationInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,16 +22,17 @@
******************************************************************************/
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.invocation.PortletInvokerInterceptor;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.spi.InstanceContext;
import org.jboss.portal.portlet.spi.UserContext;
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.portlet.PortletInvokerException;
/**
* <p>This interceptor takes in charge the management of portlet customization when
the invocation carries
@@ -43,9 +44,9 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class PortletCustomizationInterceptor extends PortletInterceptor
+public class PortletCustomizationInterceptor extends PortletInvokerInterceptor
{
- protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
InstanceContext oldContext = invocation.getInstanceContext();
if ((invocation instanceof ActionInvocation || invocation instanceof
EventInvocation) && oldContext.getAccessMode() == AccessMode.READ_ONLY)
@@ -61,7 +62,7 @@
invocation.setTarget(newContext.getTarget());
//
- return invocation.invokeNext();
+ return super.invoke(invocation);
}
finally
{
@@ -71,7 +72,7 @@
}
else
{
- return invocation.invokeNext();
+ return super.invoke(invocation);
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,10 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.aspects.portlet;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.portlet.invocation.PortletInterceptor;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.apache.log4j.Logger;
+import org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
/**
* Not removed as it is a place holder to implement producer cache (i.e caching markup
@@ -34,14 +31,6 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 7226 $
*/
-public class ProducerCacheInterceptor extends PortletInterceptor
+public class ProducerCacheInterceptor extends PortletInvokerInterceptor
{
-
- /** . */
- private final Logger log = Logger.getLogger(ProducerCacheInterceptor.class);
-
- protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
- {
- return invocation.invokeNext();
- }
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,19 +22,20 @@
******************************************************************************/
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.RenderInvocation;
import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.portlet.invocation.ResourceInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.info.ContainerOptionInfo;
import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.common.util.UUIDGenerator;
import javax.servlet.http.HttpServletRequest;
@@ -53,13 +54,13 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class RequestAttributeConversationInterceptor extends PortletInterceptor
+public class RequestAttributeConversationInterceptor extends PortletInvokerInterceptor
{
/** . */
private static final UUIDGenerator generator = new UUIDGenerator();
- protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
PortletContainer container =
(PortletContainer)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
ContainerPortletInfo containerInfo = (ContainerPortletInfo)container.getInfo();
@@ -110,21 +111,21 @@
}
else
{
- return invocation.invokeNext();
+ return super.invoke(invocation);
}
}
else
{
- return invocation.invokeNext();
+ return super.invoke(invocation);
}
}
- private Object invoke(int maxScope, ActionInvocation actionInvocation) throws
Exception, InvocationException
+ private PortletInvocationResponse invoke(int maxScope, ActionInvocation
actionInvocation) throws IllegalArgumentException, PortletInvokerException
{
return invokeWithConversation(maxScope, new Conversation(), actionInvocation);
}
- private Object invoke(int maxScope, EventInvocation eventInvocation) throws Exception,
InvocationException
+ private PortletInvocationResponse invoke(int maxScope, EventInvocation
eventInvocation) throws IllegalArgumentException, PortletInvokerException
{
Conversation conversation = loadConversation(eventInvocation);
@@ -138,7 +139,7 @@
return invokeWithConversation(maxScope, conversation, eventInvocation);
}
- private Object invoke(RenderInvocation renderInvocation) throws Exception,
InvocationException
+ private PortletInvocationResponse invoke(RenderInvocation renderInvocation) throws
IllegalArgumentException, PortletInvokerException
{
Conversation conversation = loadConversation(renderInvocation);
@@ -152,11 +153,11 @@
}
else
{
- return renderInvocation.invokeNext();
+ return super.invoke(renderInvocation);
}
}
- private Object invoke(ResourceInvocation resourceInvocation) throws Exception,
InvocationException
+ private PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws
IllegalArgumentException, PortletInvokerException
{
Conversation conversation = loadConversation(resourceInvocation);
@@ -167,7 +168,7 @@
}
else
{
- return resourceInvocation.invokeNext();
+ return super.invoke(resourceInvocation);
}
}
@@ -203,10 +204,10 @@
return null;
}
- private Object invokeWithConversation(
+ private PortletInvocationResponse invokeWithConversation(
int maxScope,
Conversation conversation,
- PortletInvocation invocation) throws Exception, InvocationException
+ PortletInvocation invocation) throws IllegalArgumentException,
PortletInvokerException
{
invocation.setRequestAttributes(conversation.getAttributes());
@@ -220,7 +221,7 @@
inNS.setValue("javax.portlet.as", conversation.id);
//
- Object response = invocation.invokeNext();
+ PortletInvocationResponse response = super.invoke(invocation);
//
if (response instanceof UpdateNavigationalStateResponse)
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,15 +22,16 @@
******************************************************************************/
package org.jboss.portal.portlet.aspects.portlet;
-import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.TransportGuarantee;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.info.SecurityInfo;
-import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
import
org.jboss.portal.portlet.invocation.response.InsufficientTransportGuaranteeResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.spi.SecurityContext;
/**
@@ -39,10 +40,10 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 7226 $
*/
-public class SecureTransportInterceptor extends PortletInterceptor
+public class SecureTransportInterceptor extends PortletInvokerInterceptor
{
- protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
PortletContainer container =
(PortletContainer)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
PortletInfo containerInfo = container.getInfo();
@@ -65,7 +66,7 @@
if (invoke)
{
// Invoke
- return invocation.invokeNext();
+ return super.invoke(invocation);
}
else
{
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,16 +22,16 @@
******************************************************************************/
package org.jboss.portal.portlet.aspects.portlet;
-import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.concurrent.Valve;
import org.jboss.portal.portlet.container.ContainerPortletInvoker;
import org.jboss.portal.portlet.container.PortletContainerContext;
import org.jboss.portal.portlet.container.managed.PortletApplicationRegistry;
-import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
+import org.jboss.portal.portlet.PortletInvokerException;
/**
* This aspect has two responsabilities :<br/> <ul> <li>continue the
request only if the portlet container valve is
@@ -43,7 +43,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 7226 $
*/
-public class ValveInterceptor extends PortletInterceptor
+public class ValveInterceptor extends PortletInvokerInterceptor
{
/** . */
@@ -59,7 +59,7 @@
this.registry = portletApplicationRegistry;
}
- protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
PortletContainerImpl container =
(PortletContainerImpl)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
@@ -72,7 +72,7 @@
try
{
- response = (PortletInvocationResponse)invocation.invokeNext();
+ response = super.invoke(invocation);
}
finally
{
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -23,19 +23,17 @@
package org.jboss.portal.portlet.container;
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.NoSuchPortletException;
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.impl.info.ContainerPreferencesInfo;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.info.ContainerPreferenceInfo;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.state.PropertyChange;
import org.jboss.portal.portlet.state.PropertyMap;
@@ -54,51 +52,15 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 7226 $
*/
-public class ContainerPortletInvoker implements PortletInvoker
+public class ContainerPortletInvoker extends PortletInvokerInterceptor
{
/** The key under which the portlet container is stored in the request scope of the
invocation. */
public static final String PORTLET_CONTAINER = "PORTLET_CONTAINER";
/** . */
- private InterceptorStackFactory stackFactory;
-
- /** . */
private Map<String, Portlet> portlets = new HashMap<String, Portlet>();
- /** . */
- private InvocationHandler handler = new InvocationHandler()
- {
- public Object invoke(Invocation invocation) throws Exception,
org.jboss.portal.common.invocation.InvocationException
- {
- PortletInvocation portletInvocation = (PortletInvocation)invocation;
-
- //
- try
- {
- portletInvocation.setHandler(null);
-
- //
- PortletContainer container =
(PortletContainer)portletInvocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
- return container.dispatch(portletInvocation);
- }
- finally
- {
- portletInvocation.setHandler(this);
- }
- }
- };
-
- public InterceptorStackFactory getStackFactory()
- {
- return stackFactory;
- }
-
- public void setStackFactory(InterceptorStackFactory stackFactory)
- {
- this.stackFactory = stackFactory;
- }
-
public void addPortletContainer(PortletContainer portletContainer)
{
Map<String, Portlet> portlets = new HashMap<String,
Portlet>(this.portlets);
@@ -119,14 +81,6 @@
this.portlets = portlets;
}
- public void start() throws Exception
- {
- }
-
- public void stop() throws Exception
- {
- }
-
public Set<Portlet> getPortlets()
{
return new HashSet<Portlet>(portlets.values());
@@ -155,13 +109,12 @@
PortletContainer container = portlet.container;
//
- InvocationHandler prevHandler = invocation.getHandler();
try
{
-
- invocation.setHandler(handler);
invocation.setAttribute(ContainerPortletInvoker.PORTLET_CONTAINER, container);
- return
(PortletInvocationResponse)invocation.invoke(stackFactory.getInterceptorStack());
+
+ //
+ return super.invoke(invocation);
}
catch (Exception e)
{
@@ -180,7 +133,6 @@
}
finally
{
- invocation.setHandler(prevHandler);
invocation.removeAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInterceptor.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,21 +22,10 @@
******************************************************************************/
package org.jboss.portal.portlet.invocation;
-import org.jboss.portal.common.invocation.Invocation;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.invocation.Interceptor;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6712 $
*/
-public abstract class PortletInterceptor implements Interceptor
+public abstract class PortletInterceptor
{
-
- public Object invoke(Invocation invocation) throws Exception, InvocationException
- {
- return invoke((PortletInvocation)invocation);
- }
-
- protected abstract Object invoke(PortletInvocation invocation) throws Exception,
InvocationException;
}
Deleted:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInterceptor2.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInterceptor2.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInterceptor2.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -1,137 +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.invocation;
-
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.state.DestroyCloneFailure;
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.state.PropertyChange;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-
-import java.util.Set;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class PortletInterceptor2 implements PortletInvoker
-{
-
- /** . */
- private PortletInvoker next;
-
- public PortletInterceptor2()
- {
- }
-
- public PortletInterceptor2(PortletInvoker next)
- {
- this.next = next;
- }
-
- public PortletInvoker getNext()
- {
- return next;
- }
-
- public void setNext(PortletInvoker next)
- {
- this.next = next;
- }
-
- public Set<Portlet> getPortlets() throws PortletInvokerException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.getPortlets();
- }
-
- public Portlet getPortlet(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.getPortlet(portletContext);
- }
-
- public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.invoke(invocation);
- }
-
- public PortletContext createClone(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.createClone(portletContext);
- }
-
- public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.destroyClones(portletContexts);
- }
-
- public PropertyMap getProperties(PortletContext portletContext, Set<String>
keys) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.getProperties(portletContext, keys);
- }
-
- public PropertyMap getProperties(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.getProperties(portletContext);
- }
-
- public PortletContext setProperties(PortletContext portletContext, PropertyChange[]
changes) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.setProperties(portletContext, changes);
- }
-}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.invocation;
-import org.jboss.portal.common.invocation.Invocation;
import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
import org.jboss.portal.portlet.spi.InstanceContext;
@@ -47,7 +46,7 @@
* @version $Revision: 6765 $
* @since 2.4
*/
-public abstract class PortletInvocation extends Invocation
+public abstract class PortletInvocation
{
/** . */
Copied:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvokerInterceptor.java
(from rev 10591,
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInterceptor2.java)
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvokerInterceptor.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvokerInterceptor.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -0,0 +1,137 @@
+/******************************************************************************
+ * 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.invocation;
+
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.state.DestroyCloneFailure;
+import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+
+import java.util.Set;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletInvokerInterceptor implements PortletInvoker
+{
+
+ /** . */
+ private PortletInvoker next;
+
+ public PortletInvokerInterceptor()
+ {
+ }
+
+ public PortletInvokerInterceptor(PortletInvoker next)
+ {
+ this.next = next;
+ }
+
+ public PortletInvoker getNext()
+ {
+ return next;
+ }
+
+ public void setNext(PortletInvoker next)
+ {
+ this.next = next;
+ }
+
+ public Set<Portlet> getPortlets() throws PortletInvokerException
+ {
+ if (next == null)
+ {
+ throw new IllegalStateException("No next invoker");
+ }
+ return next.getPortlets();
+ }
+
+ public Portlet getPortlet(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException
+ {
+ if (next == null)
+ {
+ throw new IllegalStateException("No next invoker");
+ }
+ return next.getPortlet(portletContext);
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
+ {
+ if (next == null)
+ {
+ throw new IllegalStateException("No next invoker");
+ }
+ return next.invoke(invocation);
+ }
+
+ public PortletContext createClone(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ if (next == null)
+ {
+ throw new IllegalStateException("No next invoker");
+ }
+ return next.createClone(portletContext);
+ }
+
+ public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
+ {
+ if (next == null)
+ {
+ throw new IllegalStateException("No next invoker");
+ }
+ return next.destroyClones(portletContexts);
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext, Set<String>
keys) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
+ {
+ if (next == null)
+ {
+ throw new IllegalStateException("No next invoker");
+ }
+ return next.getProperties(portletContext, keys);
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ if (next == null)
+ {
+ throw new IllegalStateException("No next invoker");
+ }
+ return next.getProperties(portletContext);
+ }
+
+ public PortletContext setProperties(PortletContext portletContext, PropertyChange[]
changes) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
+ {
+ if (next == null)
+ {
+ throw new IllegalStateException("No next invoker");
+ }
+ return next.setProperties(portletContext, changes);
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/consumer/ConsumerPortletInvoker.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/consumer/ConsumerPortletInvoker.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/consumer/ConsumerPortletInvoker.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -30,7 +30,7 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateEvent;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.PortletInterceptor2;
+import org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.spi.InstanceContext;
import org.jboss.portal.portlet.state.AccessMode;
@@ -48,7 +48,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6765 $
*/
-public class ConsumerPortletInvoker extends PortletInterceptor2
+public class ConsumerPortletInvoker extends PortletInvokerInterceptor
{
/** . */
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-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -36,7 +36,7 @@
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.PortletInterceptor2;
+import org.jboss.portal.portlet.invocation.PortletInvokerInterceptor;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.spi.InstanceContext;
import org.jboss.portal.portlet.state.AbstractPropertyContext;
@@ -63,7 +63,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6765 $
*/
-public class ProducerPortletInvoker extends PortletInterceptor2
+public class ProducerPortletInvoker extends PortletInvokerInterceptor
{
/** . */
Deleted:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/TestPortletInvoker.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/TestPortletInvoker.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/TestPortletInvoker.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -1,158 +0,0 @@
-/******************************************************************************
- * 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.test.portlet.state;
-
-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.PropertyChange;
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.state.DestroyCloneFailure;
-
-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<String>
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();
- }
-}
Deleted:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvoker.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvoker.java 2008-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvoker.java 2008-04-15
23:34:57 UTC (rev 10594)
@@ -1,159 +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.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();
- }
-}
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-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml 2008-04-15
23:34:57 UTC (rev 10594)
@@ -53,76 +53,66 @@
</constructor>
</bean>
- <!-- Consumer stack -->
+ <!-- The producer persistence manager -->
+ <bean name="ProducerPersistenceManager"
class="org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService"/>
+
+ <!-- The producer state management policy -->
+ <bean name="ProducerStateManagementPolicy"
class="org.jboss.portal.portlet.impl.state.StateManagementPolicyService">
+ <property
name="persistLocally"><value>true</value></property>
+ </bean>
+
+ <!-- The producer state converter -->
+ <bean name="ProducerStateConverter"
class="org.jboss.portal.portlet.impl.state.StateConverterV0"/>
+
+ <!-- The consumer portlet invoker -->
+ <bean name="ConsumerPortletInvoker"
class="org.jboss.portal.portlet.invocation.PortletInvokerInterceptor">
+ <property name="next"><inject
bean="ConsumerCacheInterceptor"/></property>
+ </bean>
<bean name="ConsumerCacheInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ConsumerCacheInterceptor">
+ <property name="next"><inject
bean="PortletCustomizationInterceptor"/></property>
</bean>
<bean name="PortletCustomizationInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.PortletCustomizationInterceptor">
+ <property name="next"><inject
bean="ProducerPortletInvoker"/></property>
</bean>
- <bean name="ConsumerStackFactory"
class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
- <property name="interceptors">
- <array>
- <inject bean="ConsumerCacheInterceptor"/>
- <inject bean="PortletCustomizationInterceptor"/>
- </array>
- </property>
+
+ <!-- The producer portlet invoker -->
+ <bean name="ProducerPortletInvoker"
class="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker">
+ <property name="next"><inject
bean="ContainerPortletInvoker"/></property>
+ <property name="persistenceManager"><inject
bean="ProducerPersistenceManager"/></property>
+ <property name="stateManagementPolicy"><inject
bean="ProducerStateManagementPolicy"/></property>
+ <property name="stateConverter"><inject
bean="ProducerStateConverter"/></property>
</bean>
- <!-- The consumer portlet invoker -->
- <bean name="ConsumerPortletInvoker"
class="org.jboss.portal.portlet.test.controller.TestPortletInvoker">
- <property name="producer"><inject
bean="ProducerPortletInvoker"/></property>
- <property name="stackFactory"><inject
bean="ConsumerStackFactory"/></property>
+ <!-- The portlet container invoker -->
+ <bean name="ContainerPortletInvoker"
class="org.jboss.portal.portlet.container.ContainerPortletInvoker">
+ <property name="next"><inject
bean="ValveInterceptor"/></property>
</bean>
<!-- Container stack -->
<bean name="ValveInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ValveInterceptor">
<property name="portletApplicationRegistry"><inject
bean="PortletApplicationRegistry"
state="Instantiated"/></property>
+ <property name="next"><inject
bean="SecureTransportInterceptor"/></property>
</bean>
- <bean name="SecureTransportInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor"/>
- <bean name="ContextDispatcherInterceptor"
-
class="org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor">
+ <bean name="SecureTransportInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor">
+ <property name="next"><inject
bean="ContextDispatcherInterceptor"/></property>
+ </bean>
+ <bean name="ContextDispatcherInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor">
<property name="servletContainerFactory"><inject
bean="ServletContainerFactory"/></property>
+ <property name="next"><inject
bean="ProducerCacheInterceptor"/></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="EventPayloadInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.EventPayloadInterceptor"/>
- <bean name="ContainerStackFactory"
class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
- <property name="interceptors">
- <array>
- <inject bean="ValveInterceptor"/>
- <inject bean="SecureTransportInterceptor"/>
- <inject bean="ContextDispatcherInterceptor"/>
- <inject bean="ProducerCacheInterceptor"/>
- <inject bean="CCPPInterceptor"/>
- <inject bean="RequestAttributeConversationInterceptor"/>
- <inject bean="EventPayloadInterceptor"/>
- </array>
- </property>
+ <bean name="ProducerCacheInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor">
+ <property name="next"><inject
bean="CCPPInterceptor"/></property>
</bean>
-
- <!-- The portlet container invoker -->
- <bean name="ContainerPortletInvoker"
class="org.jboss.portal.portlet.container.ContainerPortletInvoker">
- <property name="stackFactory"><inject
bean="ContainerStackFactory"/></property>
+ <bean name="CCPPInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.CCPPInterceptor">
+ <property name="next"><inject
bean="RequestAttributeConversationInterceptor"/></property>
</bean>
-
- <!-- The producer persistence manager -->
- <bean name="ProducerPersistenceManager"
-
class="org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService"/>
-
- <!-- The producer state management policy -->
- <bean name="ProducerStateManagementPolicy"
class="org.jboss.portal.portlet.impl.state.StateManagementPolicyService">
- <property
name="persistLocally"><value>true</value></property>
+ <bean name="RequestAttributeConversationInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor">
+ <property name="next"><inject
bean="EventPayloadInterceptor"/></property>
</bean>
-
- <!-- The producer state converter -->
- <bean name="ProducerStateConverter"
class="org.jboss.portal.portlet.impl.state.StateConverterV0"/>
-
- <!-- The producer portlet invoker -->
- <bean name="ProducerPortletInvoker"
class="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker">
- <property name="next"><inject
bean="ContainerPortletInvoker"/></property>
- <property name="persistenceManager"><inject
bean="ProducerPersistenceManager"/></property>
- <property name="stateManagementPolicy"><inject
bean="ProducerStateManagementPolicy"/></property>
- <property name="stateConverter"><inject
bean="ProducerStateConverter"/></property>
+ <bean name="EventPayloadInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.EventPayloadInterceptor">
+ <property name="next"><inject
bean="PortletContainerDispatcher"/></property>
</bean>
+ <bean name="PortletContainerDispatcher"
class="org.jboss.portal.portlet.container.ContainerPortletDispatcher">
+ </bean>
</deployment>
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-04-15
20:03:41 UTC (rev 10593)
+++
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-04-15
23:34:57 UTC (rev 10594)
@@ -53,76 +53,66 @@
</constructor>
</bean>
- <!-- Consumer stack -->
+ <!-- The producer persistence manager -->
+ <bean name="ProducerPersistenceManager"
class="org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService"/>
+
+ <!-- The producer state management policy -->
+ <bean name="ProducerStateManagementPolicy"
class="org.jboss.portal.portlet.impl.state.StateManagementPolicyService">
+ <property
name="persistLocally"><value>true</value></property>
+ </bean>
+
+ <!-- The producer state converter -->
+ <bean name="ProducerStateConverter"
class="org.jboss.portal.portlet.impl.state.StateConverterV0"/>
+
+ <!-- The consumer portlet invoker -->
+ <bean name="ConsumerPortletInvoker"
class="org.jboss.portal.portlet.invocation.PortletInvokerInterceptor">
+ <property name="next"><inject
bean="ConsumerCacheInterceptor"/></property>
+ </bean>
<bean name="ConsumerCacheInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ConsumerCacheInterceptor">
+ <property name="next"><inject
bean="PortletCustomizationInterceptor"/></property>
</bean>
<bean name="PortletCustomizationInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.PortletCustomizationInterceptor">
+ <property name="next"><inject
bean="ProducerPortletInvoker"/></property>
</bean>
- <bean name="ConsumerStackFactory"
class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
- <property name="interceptors">
- <array>
- <inject bean="ConsumerCacheInterceptor"/>
- <inject bean="PortletCustomizationInterceptor"/>
- </array>
- </property>
+
+ <!-- The producer portlet invoker -->
+ <bean name="ProducerPortletInvoker"
class="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker">
+ <property name="next"><inject
bean="ContainerPortletInvoker"/></property>
+ <property name="persistenceManager"><inject
bean="ProducerPersistenceManager"/></property>
+ <property name="stateManagementPolicy"><inject
bean="ProducerStateManagementPolicy"/></property>
+ <property name="stateConverter"><inject
bean="ProducerStateConverter"/></property>
</bean>
- <!-- The consumer portlet invoker -->
- <bean name="ConsumerPortletInvoker"
class="org.jboss.portal.portlet.test.controller.TestPortletInvoker">
- <property name="producer"><inject
bean="ProducerPortletInvoker"/></property>
- <property name="stackFactory"><inject
bean="ConsumerStackFactory"/></property>
+ <!-- The portlet container invoker -->
+ <bean name="ContainerPortletInvoker"
class="org.jboss.portal.portlet.container.ContainerPortletInvoker">
+ <property name="next"><inject
bean="ValveInterceptor"/></property>
</bean>
<!-- Container stack -->
<bean name="ValveInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ValveInterceptor">
<property name="portletApplicationRegistry"><inject
bean="PortletApplicationRegistry"
state="Instantiated"/></property>
+ <property name="next"><inject
bean="SecureTransportInterceptor"/></property>
</bean>
- <bean name="SecureTransportInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor"/>
- <bean name="ContextDispatcherInterceptor"
-
class="org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor">
+ <bean name="SecureTransportInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor">
+ <property name="next"><inject
bean="ContextDispatcherInterceptor"/></property>
+ </bean>
+ <bean name="ContextDispatcherInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor">
<property name="servletContainerFactory"><inject
bean="ServletContainerFactory"/></property>
+ <property name="next"><inject
bean="ProducerCacheInterceptor"/></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="EventPayloadInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.EventPayloadInterceptor"/>
- <bean name="ContainerStackFactory"
class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
- <property name="interceptors">
- <array>
- <inject bean="ValveInterceptor"/>
- <inject bean="SecureTransportInterceptor"/>
- <inject bean="ContextDispatcherInterceptor"/>
- <inject bean="ProducerCacheInterceptor"/>
- <inject bean="CCPPInterceptor"/>
- <inject bean="RequestAttributeConversationInterceptor"/>
- <inject bean="EventPayloadInterceptor"/>
- </array>
- </property>
+ <bean name="ProducerCacheInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor">
+ <property name="next"><inject
bean="CCPPInterceptor"/></property>
</bean>
-
- <!-- The portlet container invoker -->
- <bean name="ContainerPortletInvoker"
class="org.jboss.portal.portlet.container.ContainerPortletInvoker">
- <property name="stackFactory"><inject
bean="ContainerStackFactory"/></property>
+ <bean name="CCPPInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.CCPPInterceptor">
+ <property name="next"><inject
bean="RequestAttributeConversationInterceptor"/></property>
</bean>
-
- <!-- The producer persistence manager -->
- <bean name="ProducerPersistenceManager"
-
class="org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService"/>
-
- <!-- The producer state management policy -->
- <bean name="ProducerStateManagementPolicy"
class="org.jboss.portal.portlet.impl.state.StateManagementPolicyService">
- <property
name="persistLocally"><value>true</value></property>
+ <bean name="RequestAttributeConversationInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor">
+ <property name="next"><inject
bean="EventPayloadInterceptor"/></property>
</bean>
-
- <!-- The producer state converter -->
- <bean name="ProducerStateConverter"
class="org.jboss.portal.portlet.impl.state.StateConverterV0"/>
-
- <!-- The producer portlet invoker -->
- <bean name="ProducerPortletInvoker"
class="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker">
- <property name="next"><inject
bean="ContainerPortletInvoker"/></property>
- <property name="persistenceManager"><inject
bean="ProducerPersistenceManager"/></property>
- <property name="stateManagementPolicy"><inject
bean="ProducerStateManagementPolicy"/></property>
- <property name="stateConverter"><inject
bean="ProducerStateConverter"/></property>
+ <bean name="EventPayloadInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.EventPayloadInterceptor">
+ <property name="next"><inject
bean="PortletContainerDispatcher"/></property>
</bean>
+ <bean name="PortletContainerDispatcher"
class="org.jboss.portal.portlet.container.ContainerPortletDispatcher">
+ </bean>
</deployment>