org.ikasan.framework.initiator.scheduled.quartz
Class QuartzStatefulScheduledDrivenInitiator

java.lang.Object
  extended by org.ikasan.framework.initiator.AbstractInitiator
      extended by org.ikasan.framework.initiator.scheduled.quartz.QuartzStatefulScheduledDrivenInitiator
All Implemented Interfaces:
Initiator, QuartzDrivenInitiator, MonitorSubject

public class QuartzStatefulScheduledDrivenInitiator
extends AbstractInitiator
implements QuartzDrivenInitiator, MonitorSubject

Quartz implementation of an Ikasan Schedule Driven Initiator.

Author:
Ikasan Development Team

Field Summary
protected  EventProvider eventProvider
           
static String QUARTZ_SCHEDULE_DRIVEN_INITIATOR_TYPE
           
static String REINVOKE_IMMEDIATELY_FLAG
           
protected  org.quartz.Scheduler scheduler
          Quartz scheduler
 
Fields inherited from class org.ikasan.framework.initiator.AbstractInitiator
error, errorLoggingService, EXCEPTION_ACTION_IMPLIED_ROLLBACK, excludedEventService, exclusions, flow, moduleName, monitorListeners, name, retryCount, stopping, UNSUPPORTED_EXCLUDE_ENCONTERED
 
Constructor Summary
QuartzStatefulScheduledDrivenInitiator(String initiatorName, String moduleName, EventProvider eventProvider, Flow flow, IkasanExceptionHandler exceptionHandler)
          Constructor.
 
Method Summary
protected  void cancelRetryCycle()
          Cancels retry activity
protected  void completeRetryCycle()
          Cancel the retry activity, and resume any business as usual activity
 String getInitiatorJobName()
          Returns the Quartz job name of this initiator
protected  org.apache.log4j.Logger getLogger()
          Provides access to the implementation class specific logger instance
 org.quartz.Scheduler getScheduler()
          Provides access to the underlying scheduler
 String getType()
          Returns the type of the initiator
 boolean invoke()
          Standard invocation of an initiator.
 boolean isAllowImmediateReinvocationOnEvent()
          Accessor for allowImmediateReinvocationOnEvent
 boolean isRecovering()
          Is this initiator in a recovering state.
 boolean isRunning()
          Is this initiator running.
 void setAllowImmediateReinvocationOnEvent(boolean allowImmediateReinvocationOnEvent)
          Setter for allowImmediateReinvocationOnEventS
 void setScheduler(org.quartz.Scheduler scheduler)
          Setter for scheduler
 void setTriggers(List<org.quartz.Trigger> triggers)
           
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 stopInitiator()
          Only the extending class knows how to stop the initiator.
 
Methods inherited from class org.ikasan.framework.initiator.AbstractInitiator
addListener, continueRetryCycle, getExceptionHandler, getExclusions, getFlow, getHandledEventCount, getLastEventTime, getModuleName, getMonitorListeners, getName, getRetryCount, getState, handleAction, handleRetry, invokeFlow, invokeFlow, isError, isStopping, logError, notifyMonitorListeners, removeListener, resume, setErrorLoggingService, setExcludedEventService, start, stop, stopInError, 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

QUARTZ_SCHEDULE_DRIVEN_INITIATOR_TYPE

public static final String QUARTZ_SCHEDULE_DRIVEN_INITIATOR_TYPE
See Also:
Constant Field Values

REINVOKE_IMMEDIATELY_FLAG

public static final String REINVOKE_IMMEDIATELY_FLAG
See Also:
Constant Field Values

eventProvider

protected EventProvider eventProvider

scheduler

protected org.quartz.Scheduler scheduler
Quartz scheduler

Constructor Detail

QuartzStatefulScheduledDrivenInitiator

public QuartzStatefulScheduledDrivenInitiator(String initiatorName,
                                              String moduleName,
                                              EventProvider eventProvider,
                                              Flow flow,
                                              IkasanExceptionHandler exceptionHandler)
Constructor.

Parameters:
initiatorName - The name of the initiator
name - of the Module
eventProvider - The provider of the events to this initiator
flow - The flow leading from this initiator
exceptionHandler - The exception handler for this initiator
Method Detail

setScheduler

public void setScheduler(org.quartz.Scheduler scheduler)
Setter for scheduler

Parameters:
scheduler - The scheduler to set
Throws:
org.quartz.SchedulerException

startRetryCycle

protected void startRetryCycle(Integer maxAttempts,
                               long delay)
                        throws InitiatorOperationException
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
Throws:
InitiatorOperationException

completeRetryCycle

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

Specified by:
completeRetryCycle in class AbstractInitiator
Throws:
InitiatorOperationException

cancelRetryCycle

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

Specified by:
cancelRetryCycle in class AbstractInitiator
Throws:
InitiatorOperationException

stopInitiator

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

Specified by:
stopInitiator in class AbstractInitiator
Throws:
InitiatorOperationException - Excetpion if we cannot stop initiator

startInitiator

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

Specified by:
startInitiator in class AbstractInitiator
Throws:
InitiatorOperationException - Exception if we cannot start initiator

getType

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

Specified by:
getType in interface Initiator
Returns:
type

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

getScheduler

public org.quartz.Scheduler getScheduler()
Provides access to the underlying scheduler

Specified by:
getScheduler in interface QuartzDrivenInitiator
Returns:
scheduler instance

isRunning

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

Specified by:
isRunning in interface Initiator
Returns:
boolean

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

setTriggers

public void setTriggers(List<org.quartz.Trigger> triggers)

invoke

public boolean invoke()
Standard invocation of an initiator.

Specified by:
invoke in interface QuartzDrivenInitiator
Parameters:
mergedJobDataMap -
Returns:
true if its ok to reinvoke again immediately

isAllowImmediateReinvocationOnEvent

public boolean isAllowImmediateReinvocationOnEvent()
Accessor for allowImmediateReinvocationOnEvent

Returns:
allowImmediateReinvocationOnEvent

setAllowImmediateReinvocationOnEvent

public void setAllowImmediateReinvocationOnEvent(boolean allowImmediateReinvocationOnEvent)
Setter for allowImmediateReinvocationOnEventS

Parameters:
allowImmediateReinvocationOnEvent -

getInitiatorJobName

public String getInitiatorJobName()
Returns the Quartz job name of this initiator

Returns:


Copyright © 2007-2012 Ikasan. All Rights Reserved.