org.ikasan.framework.initiator
Class SimpleInitiator

java.lang.Object
  extended by org.ikasan.framework.initiator.AbstractInitiator
      extended by org.ikasan.framework.initiator.SimpleInitiator
All Implemented Interfaces:
Initiator

public class SimpleInitiator
extends AbstractInitiator
implements Initiator

Experimental implementation of Initiator that is invoked directly with content

Author:
Ikasan Development Team

Field Summary
static String SIMPLE_INITIATOR_TYPE
           
 
Fields inherited from class org.ikasan.framework.initiator.AbstractInitiator
error, errorLoggingService, EXCEPTION_ACTION_IMPLIED_ROLLBACK, exceptionHandler, excludedEventService, exclusions, monitorListeners, name, retryCount, stopping, UNSUPPORTED_EXCLUDE_ENCONTERED
 
Constructor Summary
SimpleInitiator(String initiatorName, String moduleName, PayloadFactory payloadFactory, 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
 Flow getFlow()
          Returns the flow that this invokes
protected  org.apache.log4j.Logger getLogger()
          Provides access to the implementation class specific logger instance
 String getName()
          The flow initiator's name.
 Integer getRetryCount()
          Accessor for retryCount
 InitiatorState getState()
          Returns the current state of the Initiator
 String getType()
          Returns the type of the initiator
 boolean initiate(String originationId, String payloadContent)
           
 boolean isAvailable()
          Accessor for available
 boolean isError()
          Is this initiator in an error state.
 boolean isRecovering()
          Is this initiator in a recovering state.
 boolean isRunning()
          Is this initiator running.
 void setAvailable(boolean available)
          Setter for available
 void setBeanName(String beanName)
           
 void start()
          Start this initiator.
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.
 void stop()
          Stop this initiator.
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, getHandledEventCount, getLastEventTime, getModuleName, getMonitorListeners, handleAction, handleRetry, invokeFlow, invokeFlow, isStopping, logError, notifyMonitorListeners, removeListener, resume, setErrorLoggingService, setExcludedEventService, 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, getHandledEventCount, getLastEventTime
 

Field Detail

SIMPLE_INITIATOR_TYPE

public static final String SIMPLE_INITIATOR_TYPE
See Also:
Constant Field Values
Constructor Detail

SimpleInitiator

public SimpleInitiator(String initiatorName,
                       String moduleName,
                       PayloadFactory payloadFactory,
                       Flow flow,
                       IkasanExceptionHandler exceptionHandler)
Constructor

Parameters:
available -
moduleName -
payloadFactory -
flow -
Method Detail

initiate

public boolean initiate(String originationId,
                        String payloadContent)

isAvailable

public boolean isAvailable()
Accessor for available

Returns:

setAvailable

public void setAvailable(boolean available)
Setter for available

Parameters:
available -

getFlow

public Flow getFlow()
Description copied from interface: Initiator
Returns the flow that this invokes

Specified by:
getFlow in interface Initiator
Overrides:
getFlow in class AbstractInitiator
Returns:
Flow

getName

public String getName()
Description copied from interface: Initiator
The flow initiator's name.

Specified by:
getName in interface Initiator
Overrides:
getName in class AbstractInitiator
Returns:
name

isError

public boolean isError()
Description copied from interface: Initiator
Is this initiator in an error state. This error state also denotes this initiator as stopped.

Specified by:
isError in interface Initiator
Overrides:
isError in class AbstractInitiator
Returns:
boolean

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

start

public void start()
Description copied from interface: Initiator
Start this initiator.

Specified by:
start in interface Initiator
Overrides:
start in class AbstractInitiator

stop

public void stop()
Description copied from interface: Initiator
Stop this initiator.

Specified by:
stop in interface Initiator
Overrides:
stop in class AbstractInitiator

setBeanName

public void setBeanName(String beanName)

getState

public InitiatorState getState()
Description copied from interface: Initiator
Returns the current state of the Initiator

Specified by:
getState in interface Initiator
Overrides:
getState in class AbstractInitiator
Returns:
InitiatorState representing the current state of the Initiators

getType

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

Specified by:
getType in interface Initiator
Returns:
type

getRetryCount

public Integer getRetryCount()
Description copied from class: AbstractInitiator
Accessor for retryCount

Specified by:
getRetryCount in interface Initiator
Overrides:
getRetryCount in class AbstractInitiator
Returns:
no of attempts made to retry

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

cancelRetryCycle

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

Specified by:
cancelRetryCycle in class AbstractInitiator

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

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

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

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


Copyright © 2007-2012 Ikasan. All Rights Reserved.