org.ikasan.framework.initiator.eventdriven
Class EventDrivenInitiatorImpl

java.lang.Object
  extended by org.ikasan.framework.initiator.AbstractInitiator
      extended by org.ikasan.framework.initiator.eventdriven.EventDrivenInitiatorImpl
All Implemented Interfaces:
EventDrivenInitiator, EventListener, ExceptionListener, Initiator, MonitorSubject

public class EventDrivenInitiatorImpl
extends AbstractInitiator
implements EventDrivenInitiator, MonitorSubject

Event Driven Initiator implementation.

Author:
Ikasan Development Team

Field Summary
protected  org.ikasan.framework.initiator.eventdriven.EventDrivenInitiatorImpl.Anesthetist anesthetist
          The Anesthetist for stopping/starting the message listener container in a retry cycle
static String EVENT_DRIVEN_INITIATOR_TYPE
           
protected  org.ikasan.framework.initiator.eventdriven.EventDrivenInitiatorImpl.Halt halt
          The Halt for activating/deactivating the jms endpoint
protected  MessageEndpointManager messageEndpointManager
          message endpoint manager
 
Fields inherited from class org.ikasan.framework.initiator.AbstractInitiator
error, errorLoggingService, EXCEPTION_ACTION_IMPLIED_ROLLBACK, exceptionHandler, excludedEventService, exclusions, flow, moduleName, monitorListeners, name, retryCount, stopping, UNSUPPORTED_EXCLUDE_ENCONTERED
 
Constructor Summary
EventDrivenInitiatorImpl(String moduleName, String name, Flow flow, IkasanExceptionHandler exceptionHandler)
          Constructor
 
Method Summary
protected  boolean anesthetistOperating()
          Return true if the anesthetist is operating
protected  void cancelRetryCycle()
          Cancels retry activity
protected  void completeRetryCycle()
          Cancel the retry activity, and resume any business as usual activity
protected  void continueRetryCycle(long delay)
          Template method for subclasses to selectively override
protected  org.apache.log4j.Logger getLogger()
          Provides access to the implementation class specific logger instance
 MessageEndpointManager getMessageEndpointManager()
          Accessor for messageEndpointManager
 String getType()
          Returns the type of the initiator
 boolean isRecovering()
          Is this initiator in a recovering state.
 boolean isRunning()
          Is this initiator running.
 void onEvent(Event event)
          Ikasan event listener
 void onException(Throwable throwable)
          Ikasan exception listener
 void setMessageEndpointManager(MessageEndpointManager messageEndpointManager)
           
protected  void startInitiator()
          Only the extending class knows how to start the initiator.
protected  void startRetryCycle(Integer maxAttempts, long delay)
          Initiator needs to start a retry cycle due to an exception action.
protected  void stopInError()
          Sets the error flag before stopping the initiator
protected  void stopInitiator()
          Only the extending class knows how to stop the initiator.
 
Methods inherited from class org.ikasan.framework.initiator.AbstractInitiator
addListener, getExceptionHandler, getExclusions, getFlow, getHandledEventCount, getLastEventTime, getModuleName, getMonitorListeners, getName, getRetryCount, getState, handleAction, handleRetry, invokeFlow, invokeFlow, isError, isStopping, logError, notifyMonitorListeners, removeListener, resume, setErrorLoggingService, setExcludedEventService, start, stop, supportsExclusions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ikasan.framework.initiator.Initiator
getExceptionHandler, getFlow, getHandledEventCount, getLastEventTime, getName, getRetryCount, getState, isError, start, stop
 
Methods inherited from interface org.ikasan.framework.monitor.MonitorSubject
addListener, removeListener
 

Field Detail

EVENT_DRIVEN_INITIATOR_TYPE

public static final String EVENT_DRIVEN_INITIATOR_TYPE
See Also:
Constant Field Values

messageEndpointManager

protected MessageEndpointManager messageEndpointManager
message endpoint manager


anesthetist

protected org.ikasan.framework.initiator.eventdriven.EventDrivenInitiatorImpl.Anesthetist anesthetist
The Anesthetist for stopping/starting the message listener container in a retry cycle


halt

protected org.ikasan.framework.initiator.eventdriven.EventDrivenInitiatorImpl.Halt halt
The Halt for activating/deactivating the jms endpoint

Constructor Detail

EventDrivenInitiatorImpl

public EventDrivenInitiatorImpl(String moduleName,
                                String name,
                                Flow flow,
                                IkasanExceptionHandler exceptionHandler)
Constructor

Parameters:
moduleName - The name of the module
name - The name of this initiator
flow - The name of the flow it starts
Method Detail

getType

public String getType()
Description copied from interface: Initiator
Returns the type of the initiator

Specified by:
getType in interface Initiator
Returns:
type

onException

public void onException(Throwable throwable)
Description copied from interface: ExceptionListener
Ikasan exception listener

Specified by:
onException in interface ExceptionListener

onEvent

public void onEvent(Event event)
Description copied from interface: EventListener
Ikasan event listener

Specified by:
onEvent in interface EventListener

completeRetryCycle

protected void completeRetryCycle()
Description copied from class: AbstractInitiator
Cancel the retry activity, and resume any business as usual activity

Specified by:
completeRetryCycle in class AbstractInitiator

startRetryCycle

protected void startRetryCycle(Integer maxAttempts,
                               long delay)
Description copied from class: AbstractInitiator
Initiator needs to start a retry cycle due to an exception action. Only the extending class has the knowledge to start a retry cycle.

Specified by:
startRetryCycle in class AbstractInitiator
delay - The delay in milliseconds before we perform a retry

continueRetryCycle

protected void continueRetryCycle(long delay)
Description copied from class: AbstractInitiator
Template method for subclasses to selectively override

Overrides:
continueRetryCycle in class AbstractInitiator

cancelRetryCycle

protected void cancelRetryCycle()
Description copied from class: AbstractInitiator
Cancels retry activity

Specified by:
cancelRetryCycle in class AbstractInitiator

isRecovering

public boolean isRecovering()
Description copied from interface: Initiator
Is this initiator in a recovering state. This recovering state also denotes this initiator as running.

Specified by:
isRecovering in interface Initiator
Returns:
boolean

isRunning

public boolean isRunning()
Description copied from interface: Initiator
Is this initiator running.

Specified by:
isRunning in interface Initiator
Returns:
boolean

anesthetistOperating

protected boolean anesthetistOperating()
Return true if the anesthetist is operating

Returns:
true if the anesthetist is operating

startInitiator

protected void startInitiator()
Description copied from class: AbstractInitiator
Only the extending class knows how to start the initiator.

Specified by:
startInitiator in class AbstractInitiator

stopInitiator

protected void stopInitiator()
Description copied from class: AbstractInitiator
Only the extending class knows how to stop the initiator.

Specified by:
stopInitiator in class AbstractInitiator

stopInError

protected void stopInError()
Sets the error flag before stopping the initiator

Overrides:
stopInError in class AbstractInitiator

setMessageEndpointManager

public void setMessageEndpointManager(MessageEndpointManager messageEndpointManager)
Parameters:
messageEndpointManager -

getMessageEndpointManager

public MessageEndpointManager getMessageEndpointManager()
Accessor for messageEndpointManager

Specified by:
getMessageEndpointManager in interface EventDrivenInitiator
Returns:

getLogger

protected org.apache.log4j.Logger getLogger()
Description copied from class: AbstractInitiator
Provides access to the implementation class specific logger instance

Specified by:
getLogger in class AbstractInitiator
Returns:
Logger instance for the extending class


Copyright © 2007-2012 Ikasan. All Rights Reserved.