org.squirrelframework.foundation.fsm.impl
Class AbstractExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>

java.lang.Object
  extended by org.squirrelframework.foundation.component.impl.AbstractSubject
      extended by org.squirrelframework.foundation.fsm.impl.AbstractExecutionService<T,S,E,C>
All Implemented Interfaces:
Observable, ActionExecutionService<T,S,E,C>
Direct Known Subclasses:
ActionExecutionServiceImpl

public abstract class AbstractExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>
extends AbstractSubject
implements ActionExecutionService<T,S,E,C>


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.squirrelframework.foundation.fsm.ActionExecutionService
ActionExecutionService.ActionEvent<T extends StateMachine<T,S,E,C>,S,E,C>, ActionExecutionService.AfterExecActionEvent<T extends StateMachine<T,S,E,C>,S,E,C>, ActionExecutionService.AfterExecActionListener<T extends StateMachine<T,S,E,C>,S,E,C>, ActionExecutionService.BeforeExecActionEvent<T extends StateMachine<T,S,E,C>,S,E,C>, ActionExecutionService.BeforeExecActionListener<T extends StateMachine<T,S,E,C>,S,E,C>, ActionExecutionService.ExecActionExceptionEvent<T extends StateMachine<T,S,E,C>,S,E,C>, ActionExecutionService.ExecActionExceptionListener<T extends StateMachine<T,S,E,C>,S,E,C>
 
Field Summary
protected  LinkedList<Pair<String,List<org.squirrelframework.foundation.fsm.impl.AbstractExecutionService.ActionContext<T,S,E,C>>>> actionBuckets
           
protected  boolean dummyExecution
           
 
Constructor Summary
AbstractExecutionService()
           
 
Method Summary
 void addExecActionExceptionListener(ActionExecutionService.ExecActionExceptionListener<T,S,E,C> listener)
          Add action execution exception listener which can be used for monitoring execution
 void addExecActionListener(ActionExecutionService.AfterExecActionListener<T,S,E,C> listener)
          Add after action execution listener which can be used for monitoring execution
 void addExecActionListener(ActionExecutionService.BeforeExecActionListener<T,S,E,C> listener)
          Add before action execution listener which can be used for monitoring execution
 void begin(String bucketName)
          Begin a action execution collection in the bucket.
 void defer(Action<T,S,E,C> action, S from, S to, E event, C context, T stateMachine)
          Add action and all the execution parameters into execution context;
 void execute()
          Execute all the actions collected by front bucket.
 void removeExecActionExceptionListener(ActionExecutionService.ExecActionExceptionListener<T,S,E,C> listener)
          Remove action execution exception listener
 void removeExecActionListener(ActionExecutionService.AfterExecActionListener<T,S,E,C> listener)
          Remove after action execution listener
 void removeExecActionListener(ActionExecutionService.BeforeExecActionListener<T,S,E,C> listener)
          Remove before action execution listener
 void reset()
          Reset all deferred actions and its count
 void setDummyExecution(boolean dummyExecution)
          Set dummy execution true will cause no action being actually invoked when calling ActionExecutionService.execute().
 
Methods inherited from class org.squirrelframework.foundation.component.impl.AbstractSubject
addListener, addListener, fireEvent, getListenerSize, isNotifiable, removeAllListeners, removeListener, removeListener, removeListener, removeListener, setNotifiable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.squirrelframework.foundation.component.Observable
addListener, addListener, fireEvent, getListenerSize, isNotifiable, removeAllListeners, removeListener, removeListener, removeListener, removeListener, setNotifiable
 

Field Detail

actionBuckets

protected final LinkedList<Pair<String,List<org.squirrelframework.foundation.fsm.impl.AbstractExecutionService.ActionContext<T extends StateMachine<T,S,E,C>,S,E,C>>>> actionBuckets

dummyExecution

protected boolean dummyExecution
Constructor Detail

AbstractExecutionService

public AbstractExecutionService()
Method Detail

begin

public void begin(String bucketName)
Description copied from interface: ActionExecutionService
Begin a action execution collection in the bucket.

Specified by:
begin in interface ActionExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>

defer

public void defer(Action<T,S,E,C> action,
                  S from,
                  S to,
                  E event,
                  C context,
                  T stateMachine)
Description copied from interface: ActionExecutionService
Add action and all the execution parameters into execution context;

Specified by:
defer in interface ActionExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>
Parameters:
action - activity to be executed
from - source state
to - target state
event - activity cause
context - external environment context
stateMachine - state machine reference

execute

public void execute()
Description copied from interface: ActionExecutionService
Execute all the actions collected by front bucket.

Specified by:
execute in interface ActionExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>

reset

public void reset()
Description copied from interface: ActionExecutionService
Reset all deferred actions and its count

Specified by:
reset in interface ActionExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>

addExecActionListener

public void addExecActionListener(ActionExecutionService.BeforeExecActionListener<T,S,E,C> listener)
Description copied from interface: ActionExecutionService
Add before action execution listener which can be used for monitoring execution

Specified by:
addExecActionListener in interface ActionExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>
Parameters:
listener - action execution listener

removeExecActionListener

public void removeExecActionListener(ActionExecutionService.BeforeExecActionListener<T,S,E,C> listener)
Description copied from interface: ActionExecutionService
Remove before action execution listener

Specified by:
removeExecActionListener in interface ActionExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>
Parameters:
listener - action execution listener

addExecActionListener

public void addExecActionListener(ActionExecutionService.AfterExecActionListener<T,S,E,C> listener)
Description copied from interface: ActionExecutionService
Add after action execution listener which can be used for monitoring execution

Specified by:
addExecActionListener in interface ActionExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>
Parameters:
listener - action execution listener

removeExecActionListener

public void removeExecActionListener(ActionExecutionService.AfterExecActionListener<T,S,E,C> listener)
Description copied from interface: ActionExecutionService
Remove after action execution listener

Specified by:
removeExecActionListener in interface ActionExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>
Parameters:
listener - action execution listener

addExecActionExceptionListener

public void addExecActionExceptionListener(ActionExecutionService.ExecActionExceptionListener<T,S,E,C> listener)
Description copied from interface: ActionExecutionService
Add action execution exception listener which can be used for monitoring execution

Specified by:
addExecActionExceptionListener in interface ActionExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>
Parameters:
listener - action execution exception listener

removeExecActionExceptionListener

public void removeExecActionExceptionListener(ActionExecutionService.ExecActionExceptionListener<T,S,E,C> listener)
Description copied from interface: ActionExecutionService
Remove action execution exception listener

Specified by:
removeExecActionExceptionListener in interface ActionExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>
Parameters:
listener - action execution exception listener

setDummyExecution

public void setDummyExecution(boolean dummyExecution)
Description copied from interface: ActionExecutionService
Set dummy execution true will cause no action being actually invoked when calling ActionExecutionService.execute().

Specified by:
setDummyExecution in interface ActionExecutionService<T extends StateMachine<T,S,E,C>,S,E,C>


Copyright © 2013-2014. All Rights Reserved.