Author: julien(a)jboss.com
Date: 2008-03-07 07:50:04 -0500 (Fri, 07 Mar 2008)
New Revision: 10237
Added:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseContextImpl.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseContext.java
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventControllerContextSafeInvoker.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
Log:
rename EventPhaseSession to EventPhaseContext
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventControllerContextSafeInvoker.java
===================================================================
---
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventControllerContextSafeInvoker.java 2008-03-07
12:30:18 UTC (rev 10236)
+++
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventControllerContextSafeInvoker.java 2008-03-07
12:50:04 UTC (rev 10237)
@@ -23,7 +23,7 @@
package org.jboss.portal.portlet.controller;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
-import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.apache.log4j.Logger;
@@ -40,7 +40,7 @@
/** . */
private final Logger log = Logger.getLogger(EventControllerContextSafeInvoker.class);
- public boolean eventProduced(EventControllerContext context, EventPhaseSession
session, Event sourceEvent, Event producedEvent)
+ public boolean eventProduced(EventControllerContext context, EventPhaseContext
context, Event sourceEvent, Event producedEvent)
{
try
{
@@ -59,7 +59,7 @@
}
}
- public boolean eventConsumed(EventControllerContext context, EventPhaseSession
session, Event consumedEvent, PortletInvocationResponse consumerResponse)
+ public boolean eventConsumed(EventControllerContext context, EventPhaseContext
context, Event consumedEvent, PortletInvocationResponse consumerResponse)
{
try
{
@@ -77,7 +77,7 @@
}
}
- public boolean eventFailed(EventControllerContext context, EventPhaseSession session,
Event failedEvent, Throwable throwable)
+ public boolean eventFailed(EventControllerContext context, EventPhaseContext context,
Event failedEvent, Throwable throwable)
{
try
{
@@ -95,7 +95,7 @@
}
}
- public boolean eventDiscarded(EventControllerContext context, EventPhaseSession
session, Event discardedEvent, int cause)
+ public boolean eventDiscarded(EventControllerContext context, EventPhaseContext
context, Event discardedEvent, int cause)
{
try
{
Copied:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseContextImpl.java
(from rev 10219,
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseSessionImpl.java)
===================================================================
---
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseContextImpl.java
(rev 0)
+++
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/EventPhaseContextImpl.java 2008-03-07
12:50:04 UTC (rev 10237)
@@ -0,0 +1,110 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.controller;
+
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
+import org.jboss.portal.portlet.controller.event.Event;
+import org.apache.log4j.Logger;
+
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class EventPhaseContextImpl implements EventPhaseContext
+{
+
+ /** . */
+ static final int READ_MODE = 0;
+
+ /** . */
+ static final int READ_WRITE_MODE = 1;
+
+ /** . */
+ static final int INTERRUPTED_MODE = 2;
+
+ /** . */
+ private final Logger log;
+
+ /** . */
+ LinkedList<EventProduction> producedEvents;
+
+ /** . */
+ LinkedList<Event> toConsumeEvents;
+
+ /** . */
+ int consumedEventSize;
+
+ /** . */
+ int producedEventSize;
+
+ /** . */
+ int mode;
+
+ EventPhaseContextImpl(Logger log)
+ {
+ this.log = log;
+ this.producedEvents = new LinkedList<EventProduction>();
+ this.toConsumeEvents = new LinkedList<Event>();
+ this.consumedEventSize = 0;
+ this.producedEventSize = 0;
+ this.mode = READ_MODE;
+ }
+
+ public void queueEvent(Event event)
+ {
+ if (mode == INTERRUPTED_MODE)
+ {
+ throw new IllegalStateException("The event phase cannot queue events
because it is interruped");
+ }
+ if (mode == READ_MODE)
+ {
+ throw new IllegalStateException("The event phase cannot queue
events");
+ }
+ if (event == null)
+ {
+ throw new IllegalArgumentException("No null event accepted");
+ }
+
+ //
+ log.trace("Queued event " + event + " in the session");
+
+ //
+ this.toConsumeEvents.addLast(event);
+ }
+
+ public void interrupt()
+ {
+ if (mode == READ_MODE)
+ {
+ throw new IllegalStateException("The event phase is not
interruptable");
+ }
+
+ //
+ log.trace("Event delivery interruped");
+
+ //
+ this.mode = INTERRUPTED_MODE;
+ }
+}
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java
===================================================================
---
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-03-07
12:30:18 UTC (rev 10236)
+++
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/PortletRequestHandler.java 2008-03-07
12:50:04 UTC (rev 10237)
@@ -108,22 +108,22 @@
UpdateNavigationalStateResponse stateResponse =
(UpdateNavigationalStateResponse)response;
//
- EventPhaseSessionImpl session = new EventPhaseSessionImpl(log);
+ EventPhaseContextImpl phaseContext = new EventPhaseContextImpl(log);
// Feed session it with the events that may have been produced
for (UpdateNavigationalStateResponse.Event portletEvent :
stateResponse.getEvents())
{
Event producedEvent = new Event(portletEvent.getName(),
portletEvent.getPayload(), portletRequest.getWindowId());
- session.producedEvents.add(new EventProduction(null, producedEvent));
+ phaseContext.producedEvents.add(new EventProduction(null, producedEvent));
}
//
int eventDistributionStatus = PortletResponse.DISTRIBUTION_DONE;
// Deliver events
- while (session.producedEvents.size() > 0)
+ while (phaseContext.producedEvents.size() > 0)
{
- EventProduction eventProduction = session.producedEvents.removeFirst();
+ EventProduction eventProduction = phaseContext.producedEvents.removeFirst();
Event producedEvent = eventProduction.getProducedEvent();
//
@@ -134,7 +134,7 @@
if (producerPortletInfo == null)
{
log.trace("Cannot deliver event " + producedEvent +"
because the producer does not have portlet info");
- safeInvoker.eventDiscarded(eventCC, session, producedEvent,
EventControllerContext.EVENT_PRODUCER_INFO_NOT_AVAILABLE);
+ safeInvoker.eventDiscarded(eventCC, phaseContext, producedEvent,
EventControllerContext.EVENT_PRODUCER_INFO_NOT_AVAILABLE);
continue;
}
@@ -144,7 +144,7 @@
if
(!producerPortletInfo.getEventing().getProducedEvents().containsKey(producedEvent.getName()))
{
log.trace("Cannot deliver event " + producedEvent +"
because the producer of the event does not produce the event name");
- safeInvoker.eventDiscarded(eventCC, session, producedEvent,
EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
+ safeInvoker.eventDiscarded(eventCC, phaseContext, producedEvent,
EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
continue;
}
}
@@ -153,24 +153,24 @@
int producedEventThreshold = controller.getProducedEventThreshold();
if (producedEventThreshold >= 0)
{
- if (session.producedEventSize + 1 > producedEventThreshold)
+ if (phaseContext.producedEventSize + 1 > producedEventThreshold)
{
log.trace("Event distribution interrupted because the maximum
number of produced event is reached");
eventDistributionStatus = PortletResponse.PRODUCED_EVENT_FLOODED;
- safeInvoker.eventDiscarded(eventCC, session, producedEvent,
EventControllerContext.PRODUCED_EVENT_FLOODED);
+ safeInvoker.eventDiscarded(eventCC, phaseContext, producedEvent,
EventControllerContext.PRODUCED_EVENT_FLOODED);
break;
}
}
// Give control to the event context
- session.mode = EventPhaseSessionImpl.READ_WRITE_MODE;
- if (!safeInvoker.eventProduced(eventCC, session,
eventProduction.getConsumedEvent(), producedEvent))
+ phaseContext.mode = EventPhaseContextImpl.READ_WRITE_MODE;
+ if (!safeInvoker.eventProduced(eventCC, phaseContext,
eventProduction.getConsumedEvent(), producedEvent))
{
continue;
}
// Perform flow control
- if (session.mode == EventPhaseSessionImpl.INTERRUPTED_MODE)
+ if (phaseContext.mode == EventPhaseContextImpl.INTERRUPTED_MODE)
{
log.trace("Event distribution interrupted by controller
context");
eventDistributionStatus = PortletResponse.INTERRUPTED;
@@ -178,9 +178,9 @@
}
//
- while (session.toConsumeEvents.size() > 0)
+ while (phaseContext.toConsumeEvents.size() > 0)
{
- Event toConsumeEvent = session.toConsumeEvents.removeFirst();
+ Event toConsumeEvent = phaseContext.toConsumeEvents.removeFirst();
String consumedId = toConsumeEvent.getWindowId();
//
@@ -188,7 +188,7 @@
if (consumerPortletInfo == null)
{
log.trace("Cannot deliver event " + producedEvent +"
because the consumer of the event does not have a portlet info");
- safeInvoker.eventDiscarded(eventCC, session, toConsumeEvent,
EventControllerContext.EVENT_CONSUMER_INFO_NOT_AVAILABLE);
+ safeInvoker.eventDiscarded(eventCC, phaseContext, toConsumeEvent,
EventControllerContext.EVENT_CONSUMER_INFO_NOT_AVAILABLE);
continue;
}
@@ -198,7 +198,7 @@
if
(!consumerPortletInfo.getEventing().getConsumedEvents().containsKey(toConsumeEvent.getName()))
{
log.trace("Cannot deliver event " + producedEvent +"
because the consumer of the event does not accept the event name");
- safeInvoker.eventDiscarded(eventCC, session, toConsumeEvent,
EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
+ safeInvoker.eventDiscarded(eventCC, phaseContext, toConsumeEvent,
EventControllerContext.PORTLET_DOES_NOT_CONSUME_EVENT);
continue;
}
}
@@ -207,10 +207,10 @@
int consumedEventThreshold = controller.getConsumedEventThreshold();
if (consumedEventThreshold >= 0)
{
- if (session.consumedEventSize + 1 > consumedEventThreshold)
+ if (phaseContext.consumedEventSize + 1 > consumedEventThreshold)
{
log.trace("Event distribution interrupted because the maximum
number of consumed event is reached");
- safeInvoker.eventDiscarded(eventCC, session, toConsumeEvent,
EventControllerContext.CONSUMED_EVENT_FLOODED);
+ safeInvoker.eventDiscarded(eventCC, phaseContext, toConsumeEvent,
EventControllerContext.CONSUMED_EVENT_FLOODED);
eventDistributionStatus = PortletResponse.CONSUMED_EVENT_FLOODED;
break;
}
@@ -225,12 +225,12 @@
catch (Exception e)
{
log.trace("Event delivery of " + toConsumeEvent + "
failed", e);
- safeInvoker.eventFailed(eventCC, session, toConsumeEvent, e);
+ safeInvoker.eventFailed(eventCC, phaseContext, toConsumeEvent, e);
continue;
}
// Now it is consumed
- session.consumedEventSize++;
+ phaseContext.consumedEventSize++;
// Update nav state if needed
if (eventResponse instanceof UpdateNavigationalStateResponse)
@@ -244,7 +244,7 @@
for (UpdateNavigationalStateResponse.Event portletEvent :
eventStateResponse.getEvents())
{
Event toRouteEvent = new Event(portletEvent.getName(),
portletEvent.getPayload(), toConsumeEvent.getWindowId());
- session.producedEvents.add(new EventProduction(toConsumeEvent,
toRouteEvent));
+ phaseContext.producedEvents.add(new EventProduction(toConsumeEvent,
toRouteEvent));
}
//
@@ -256,12 +256,12 @@
}
// And we make a callback
- session.mode = EventPhaseSessionImpl.READ_MODE;
- safeInvoker.eventConsumed(eventCC, session, toConsumeEvent,
eventResponse);
+ phaseContext.mode = EventPhaseContextImpl.READ_MODE;
+ safeInvoker.eventConsumed(eventCC, phaseContext, toConsumeEvent,
eventResponse);
}
// We archive the consumed event in the history
- session.producedEventSize++;
+ phaseContext.producedEventSize++;
}
//
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java
===================================================================
---
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java 2008-03-07
12:30:18 UTC (rev 10236)
+++
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/AbstractEventControllerContext.java 2008-03-07
12:50:04 UTC (rev 10237)
@@ -32,19 +32,19 @@
*/
public class AbstractEventControllerContext implements EventControllerContext
{
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event
producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event
producedEvent)
{
}
- public void eventConsumed(EventPhaseSession session, Event consumedEvent,
PortletInvocationResponse consumerResponse)
+ public void eventConsumed(EventPhaseContext context, Event consumedEvent,
PortletInvocationResponse consumerResponse)
{
}
- public void eventFailed(EventPhaseSession session, Event consumedEvent, Throwable
throwable)
+ public void eventFailed(EventPhaseContext context, Event consumedEvent, Throwable
throwable)
{
}
- public void eventDiscarded(EventPhaseSession session, Event discardedEvent, int
cause)
+ public void eventDiscarded(EventPhaseContext context, Event discardedEvent, int
cause)
{
}
}
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java
===================================================================
---
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java 2008-03-07
12:30:18 UTC (rev 10236)
+++
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventControllerContext.java 2008-03-07
12:50:04 UTC (rev 10237)
@@ -66,11 +66,11 @@
* <p>During the invocation of this method, any error thrown will be propagated
* to the portlet controller invoker.</p>
*
- * @param session the session
+ * @param context the session
* @param sourceEvent the source event
* @param producedEvent the produced event
*/
- void eventProduced(EventPhaseSession session, Event sourceEvent, Event
producedEvent);
+ void eventProduced(EventPhaseContext context, Event sourceEvent, Event
producedEvent);
/**
* <p>Context call back when an event is consumed by a portlet. The session
argument
@@ -83,11 +83,11 @@
* <p>During the invocation of this method, any error thrown will be propagated
* to the portlet controller invoker.</p>
*
- * @param session the session
+ * @param context the session
* @param consumedEvent the consumed event
* @param consumerResponse the consumer response
*/
- void eventConsumed(EventPhaseSession session, Event consumedEvent,
PortletInvocationResponse consumerResponse);
+ void eventConsumed(EventPhaseContext context, Event consumedEvent,
PortletInvocationResponse consumerResponse);
/**
* <p>Context call back when an event failed to be delivered because the invoker
threw an exception.
@@ -100,11 +100,11 @@
* <p>During the invocation of this method, any error thrown will be propagated
* to the portlet controller invoker.</p>
*
- * @param session the session
+ * @param context the session
* @param failedEvent the failed event
* @param throwable the throwable
*/
- void eventFailed(EventPhaseSession session, Event failedEvent, Throwable throwable);
+ void eventFailed(EventPhaseContext context, Event failedEvent, Throwable throwable);
/**
* <p>Context call back when an event is discarded by the controller for a
specific reason.
@@ -128,10 +128,10 @@
* <p>During the invocation of this method, any error thrown will be propagated
* to the portlet controller invoker.</p>
*
- * @param session the session
+ * @param context the session
* @param discardedEvent the discarded event
* @param cause the cause
*/
- void eventDiscarded(EventPhaseSession session, Event discardedEvent, int cause);
+ void eventDiscarded(EventPhaseContext context, Event discardedEvent, int cause);
}
Copied:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseContext.java
(from rev 10219,
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseSession.java)
===================================================================
---
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseContext.java
(rev 0)
+++
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/event/EventPhaseContext.java 2008-03-07
12:50:04 UTC (rev 10237)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.controller.event;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface EventPhaseContext
+{
+
+ /**
+ * Queue an event for consumption. The queue is a FIFO queue.
+ *
+ * @param event an event
+ * @throws IllegalArgumentException if the event is null
+ * @throws IllegalStateException if an event cannot be published
+ */
+ void queueEvent(Event event) throws IllegalArgumentException, IllegalStateException;
+
+ /**
+ * Stop processing of all events and returns from the controller.
+ *
+ * @throws IllegalStateException if the session cannot be interrupted.
+ */
+ void interrupt() throws IllegalStateException;
+
+}
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java
===================================================================
---
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java 2008-03-07
12:30:18 UTC (rev 10236)
+++
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/event/EventControllerContextImpl.java 2008-03-07
12:50:04 UTC (rev 10237)
@@ -28,7 +28,7 @@
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
-import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.info.PortletInfo;
/**
@@ -46,7 +46,7 @@
this.invoker = invoker;
}
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event
producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event
producedEvent)
{
try
{
@@ -56,26 +56,26 @@
if
(portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
{
Event distributedEvent = new Event(producedEvent.getName(),
producedEvent.getPayload(), portlet.getContext().getId());
- session.queueEvent(distributedEvent);
+ context.queueEvent(distributedEvent);
}
}
}
catch (PortletInvokerException e)
{
System.out.println("e = " + e);
- session.interrupt();
+ context.interrupt();
}
}
- public void eventConsumed(EventPhaseSession session, Event consumedEvent,
PortletInvocationResponse consumerResponse)
+ public void eventConsumed(EventPhaseContext context, Event consumedEvent,
PortletInvocationResponse consumerResponse)
{
}
- public void eventFailed(EventPhaseSession session, Event failedEvent, Throwable
throwable)
+ public void eventFailed(EventPhaseContext context, Event failedEvent, Throwable
throwable)
{
}
- public void eventDiscarded(EventPhaseSession session, Event discardedEvent, int
cause)
+ public void eventDiscarded(EventPhaseContext context, Event discardedEvent, int
cause)
{
}
}
Modified:
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java
===================================================================
---
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java 2008-03-07
12:30:18 UTC (rev 10236)
+++
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextSupport.java 2008-03-07
12:50:04 UTC (rev 10237)
@@ -24,7 +24,7 @@
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.event.Event;
-import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import javax.xml.namespace.QName;
@@ -43,7 +43,7 @@
/** . */
private final Map<Point, List<Point>> wires = new HashMap<Point,
List<Point>>();
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event
producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event
producedEvent)
{
List<Point> dsts = wires.get(new Point(producedEvent.getName(),
producedEvent.getWindowId()));
@@ -52,20 +52,20 @@
{
for (Point dst : dsts)
{
- session.queueEvent(new Event(dst.name, producedEvent.getPayload(),
dst.windowId));
+ context.queueEvent(new Event(dst.name, producedEvent.getPayload(),
dst.windowId));
}
}
}
- public void eventConsumed(EventPhaseSession session, Event consumedEvent,
PortletInvocationResponse consumerResponse)
+ public void eventConsumed(EventPhaseContext context, Event consumedEvent,
PortletInvocationResponse consumerResponse)
{
}
- public void eventFailed(EventPhaseSession session, Event failedEvent, Throwable
throwable)
+ public void eventFailed(EventPhaseContext context, Event failedEvent, Throwable
throwable)
{
}
- public void eventDiscarded(EventPhaseSession session, Event discardedEvent, int
cause)
+ public void eventDiscarded(EventPhaseContext context, Event discardedEvent, int
cause)
{
}
Modified:
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java
===================================================================
---
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java 2008-03-07
12:30:18 UTC (rev 10236)
+++
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java 2008-03-07
12:50:04 UTC (rev 10237)
@@ -29,7 +29,7 @@
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
import org.jboss.portal.portlet.controller.response.PortletResponse;
-import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.controller.event.AbstractEventControllerContext;
import org.jboss.portal.portlet.OpaqueStateString;
@@ -312,9 +312,9 @@
controller.setProducedEventThreshold(10);
context.setEventControllerContext(new AbstractEventControllerContext()
{
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event
producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event
producedEvent)
{
- session.interrupt();
+ context.interrupt();
}
});
fooPortlet.addHandler(eventProducerActionHandler);
@@ -350,7 +350,7 @@
controller.setProducedEventThreshold(10);
context.setEventControllerContext(new AbstractEventControllerContext()
{
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event
producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event
producedEvent)
{
throw new RuntimeException();
}
@@ -364,7 +364,7 @@
final Error error = new Error();
context.setEventControllerContext(new AbstractEventControllerContext()
{
- public void eventProduced(EventPhaseSession session, Event sourceEvent, Event
producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event
producedEvent)
{
throw error;
}
Modified:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java 2008-03-07
12:30:18 UTC (rev 10236)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java 2008-03-07
12:50:04 UTC (rev 10237)
@@ -24,7 +24,7 @@
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.event.Event;
-import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -54,7 +54,7 @@
this.prepareResponse = prepareResponse;
}
- public void eventProduced(EventPhaseSession context, Event sourceEvent, Event
producedEvent)
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event
producedEvent)
{
for (String windowId : prepareResponse.getWindowIds())
{
@@ -83,15 +83,15 @@
}
}
- public void eventConsumed(EventPhaseSession session, Event consumedEvent,
PortletInvocationResponse consumerResponse)
+ public void eventConsumed(EventPhaseContext context, Event consumedEvent,
PortletInvocationResponse consumerResponse)
{
}
- public void eventFailed(EventPhaseSession session, Event failedEvent, Throwable
throwable)
+ public void eventFailed(EventPhaseContext context, Event failedEvent, Throwable
throwable)
{
}
- public void eventDiscarded(EventPhaseSession session, Event discardedEvent, int
cause)
+ public void eventDiscarded(EventPhaseContext context, Event discardedEvent, int
cause)
{
}
}