org.benow.web.notify
Class EventAccumulator

java.lang.Object
  extended by org.benow.web.notify.EventAccumulator
All Implemented Interfaces:
org.benow.java.notify.Listener

public class EventAccumulator
extends java.lang.Object
implements org.benow.java.notify.Listener

A handy little class to accumulate events on a per session basis.

Author:
andy

Constructor Summary
EventAccumulator(java.lang.Object... notifiers)
           
 
Method Summary
static EventAccumulator createInSession()
          Create an accumulator subscribing to all events reported on the MessageBus.
static EventAccumulator createInSession(java.lang.Object... notifiers)
          Create accumulator subscribing to all events from the given objects.
 boolean onEvent(java.lang.Object notifier, org.benow.java.notify.event.Event event)
           
protected  void shutdown()
           
 java.util.List<org.benow.java.notify.event.Event> take()
           
static java.util.List<org.benow.java.notify.event.Event> takeEvents()
          Gets the events accumulated by the accumulator associated with the current session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventAccumulator

public EventAccumulator(java.lang.Object... notifiers)
Method Detail

shutdown

protected void shutdown()

onEvent

public boolean onEvent(java.lang.Object notifier,
                       org.benow.java.notify.event.Event event)
Specified by:
onEvent in interface org.benow.java.notify.Listener

take

public java.util.List<org.benow.java.notify.event.Event> take()

createInSession

public static EventAccumulator createInSession()
Create an accumulator subscribing to all events reported on the MessageBus. Accumulator is stored in the session, and can be retrieved with get();

Returns:

createInSession

public static EventAccumulator createInSession(java.lang.Object... notifiers)
Create accumulator subscribing to all events from the given objects. Accumulator is stored in the session, and can be retrieved with take(). NOTE: If there is already an existing accumulator, no other accumulator is created.

Parameters:
notifiers -
Returns:

takeEvents

public static java.util.List<org.benow.java.notify.event.Event> takeEvents()
Gets the events accumulated by the accumulator associated with the current session. If no accumulator is associated, null is returned. Accumulators can be created via create(), create(List)

Returns:
e