org.d_haven.event.command
Class CommandEventHandler

java.lang.Object
  extended byorg.d_haven.event.impl.AbstractEventHandler
      extended byorg.d_haven.event.command.CommandEventHandler
All Implemented Interfaces:
EventHandler

public final class CommandEventHandler
extends AbstractEventHandler

The CommandEventHandler is used by the DefaultCommandManager to actually process the events. It is from this location that we run the commands and reschedule them as needed.


Constructor Summary
CommandEventHandler(CommandFailureHandler failureHandler, SwitchedEnqueuePredicate predicate)
          Create the CommandEventHandler with the failure handler and the predicate provided.
 
Method Summary
 CommandFailureHandler getCommandFailureHandler()
          Get the CommandFailureHandler in use for this event handler.
 void handleEvent(java.lang.Object element)
          Handle one event at a time.
 void setCommandEventPipeline(CommandEventPipeline pipeline)
          Provide the CommandEventPipeline to use for requeueing delayed and repeating commands.
 void setCommandFailureHandler(CommandFailureHandler handler)
          Set the CommandFailureHandler to use with this event handler.
 java.lang.String toString()
          Provide a debug string for this class.
 
Methods inherited from class org.d_haven.event.impl.AbstractEventHandler
handleEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandEventHandler

public CommandEventHandler(CommandFailureHandler failureHandler,
                           SwitchedEnqueuePredicate predicate)
Create the CommandEventHandler with the failure handler and the predicate provided.

Parameters:
failureHandler - The CommandFailureHandler used when a command fails
predicate - The predicate used to determine if we are accepting new commands
Method Detail

setCommandEventPipeline

public void setCommandEventPipeline(CommandEventPipeline pipeline)
Provide the CommandEventPipeline to use for requeueing delayed and repeating commands. This method must be called prior to handling any events.

Parameters:
pipeline - The pipeline to use for processing

handleEvent

public void handleEvent(java.lang.Object element)
Description copied from interface: EventHandler
Handle one event at a time.

Parameters:
element - The element that the EventHandler must process

toString

public java.lang.String toString()
Provide a debug string for this class.

Returns:
the debug string

getCommandFailureHandler

public CommandFailureHandler getCommandFailureHandler()
Get the CommandFailureHandler in use for this event handler.

Returns:
the failure handler

setCommandFailureHandler

public void setCommandFailureHandler(CommandFailureHandler handler)
Set the CommandFailureHandler to use with this event handler. It is assumed that the CommandManager has already checked for null values before setting this command failure handler.

Parameters:
handler - the new handler


Copyright © 2004-2005 D-Haven.org. All Rights Reserved.