org.keridwen.core.messaging
Interface EventDispatcher

All Known Implementing Classes:
CoreEventDispatcher

public interface EventDispatcher

An EventDispatcher is a class that dispatches the Events raised by the application modules to the registred BundleControllers.


Method Summary
 void clean()
          Removes all registered BundleControllers and EventDispatchers.
 boolean isEventRegistered(Event<?,?> event)
           
 void registerBundle(BundleController controller)
          Registers the given BundleController to be called on Event dispatch.
 void registerEventDispatcher(EventDispatcher dispatcher)
          Registers the given EventDispatcher to be called on Event dispatch.
 void terminate()
          Terminates all threads running in the registred controllers.
<ReturnType>
Supervisor<ReturnType>
triggerChangeEvent(Event<ReturnType,?> event, Condition condition)
          Triggers the given Event that will trigger the command execution as soon as the change Condition becomes true.
<ReturnType>
Supervisor<ReturnType>
triggerEvent(Event<ReturnType,?> event)
          Triggers the given Event asynchronously.
<ReturnType>
Supervisor<ReturnType>
triggerEvent(Event<ReturnType,?> event, int nbThreads)
           
<ReturnType>
Supervisor<ReturnType>
triggerTimeEvent(Event<ReturnType,?> event, long delay, TimeUnit unit)
          Triggers the given Event after the given delay.
<ReturnType>
Supervisor<ReturnType>
triggerTimeEventAtFixedRate(Event<ReturnType,?> event, long initialDelay, long period, TimeUnit unit)
          Triggers the given Event after the given delay and at a given period.
<ReturnType>
Supervisor<ReturnType>
triggerTimeEventWithFixedDelay(Event<ReturnType,?> event, long initialDelay, long delay, TimeUnit unit)
          Triggers the given Event after the given delay with the given delay between two executions.
 void unregisterBundle(BundleController controller)
          Unregisters the given BundleController.
 void unregisterEventDispatcher(EventDispatcher dispatcher)
          Unregisters the given EventDispatcher.
 

Method Detail

triggerEvent

<ReturnType> Supervisor<ReturnType> triggerEvent(Event<ReturnType,?> event)
Triggers the given Event asynchronously.

Type Parameters:
ReturnType - type of the data returned by the command triggered by the event.
Parameters:
event - the event to trigger
Returns:
the command supervisor

triggerEvent

<ReturnType> Supervisor<ReturnType> triggerEvent(Event<ReturnType,?> event,
                                                 int nbThreads)

triggerChangeEvent

<ReturnType> Supervisor<ReturnType> triggerChangeEvent(Event<ReturnType,?> event,
                                                       Condition condition)
Triggers the given Event that will trigger the command execution as soon as the change Condition becomes true.

Type Parameters:
ReturnType - type of the data returned by the command triggered by the event.
Parameters:
event - the event to trigger
condition - the Condition to watch
Returns:
the command supervisor

triggerTimeEvent

<ReturnType> Supervisor<ReturnType> triggerTimeEvent(Event<ReturnType,?> event,
                                                     long delay,
                                                     TimeUnit unit)
Triggers the given Event after the given delay.

Type Parameters:
ReturnType - type of the data returned by the command triggered by the event.
Parameters:
event - the event to trigger
delay - the time from now to delay execution
unit - the time unit of the delay parameter
Returns:
the scheduled command supervisor

triggerTimeEventWithFixedDelay

<ReturnType> Supervisor<ReturnType> triggerTimeEventWithFixedDelay(Event<ReturnType,?> event,
                                                                   long initialDelay,
                                                                   long delay,
                                                                   TimeUnit unit)
Triggers the given Event after the given delay with the given delay between two executions.

Type Parameters:
ReturnType - type of the data returned by the command triggered by the event.
Parameters:
event - the event to trigger
initialDelay - the time from now to delay the first execution
delay - the delay between termination of one execution and the commencement of the next
unit - the time unit of the parameters
Returns:
the scheduled command supervisor

triggerTimeEventAtFixedRate

<ReturnType> Supervisor<ReturnType> triggerTimeEventAtFixedRate(Event<ReturnType,?> event,
                                                                long initialDelay,
                                                                long period,
                                                                TimeUnit unit)
Triggers the given Event after the given delay and at a given period.

Type Parameters:
ReturnType - type of the data returned by the command triggered by the event.
Parameters:
event - the event to trigger
initialDelay - the time from now to delay the first execution
period - the period between two consecutive executions
unit - the time unit of the parameters
Returns:
the scheduled command supervisor

isEventRegistered

boolean isEventRegistered(Event<?,?> event)

registerEventDispatcher

void registerEventDispatcher(EventDispatcher dispatcher)
Registers the given EventDispatcher to be called on Event dispatch.

Parameters:
dispatcher - the EventDispatcher to register

unregisterEventDispatcher

void unregisterEventDispatcher(EventDispatcher dispatcher)
Unregisters the given EventDispatcher.

Parameters:
dispatcher - the EventDispatcher to unregister

registerBundle

void registerBundle(BundleController controller)
Registers the given BundleController to be called on Event dispatch.

Parameters:
controller - the BundleController to register

unregisterBundle

void unregisterBundle(BundleController controller)
Unregisters the given BundleController.

Parameters:
controller - the BundleController to unregister

clean

void clean()
Removes all registered BundleControllers and EventDispatchers.


terminate

void terminate()
Terminates all threads running in the registred controllers.



Copyright © 2010-2013 Artenum. All Rights Reserved.