org.javasteps.engine
Class ProcessImpl

java.lang.Object
  extended by org.javasteps.engine.ProcessImpl
All Implemented Interfaces:
Process, ProcessContext

public class ProcessImpl
extends Object
implements Process

The Process implementation class

Version:
1.1
Author:
Ran Kornfeld

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.javasteps.ProcessContext
ProcessContext.ProcessStatus
 
Field Summary
protected  Map<String,Object> params
           
protected  StepsList topLevelSteps
           
 
Constructor Summary
ProcessImpl()
           
 
Method Summary
 void addProcessListener(ProcessListener listener)
          Adds a ProcessListener to the process to get process execution events.
 int getActionStepsCount()
          Gets the total number of ActionSteps in this process
 StepAction getExceptionHandler()
           
 String getName()
           
 Object getParameter(String key)
          Gets a process wide parameter
 Map<String,Object> getParameters()
          Gets the process wide parameters' map
 ProcessContext.ProcessStatus getStatus()
          Gets the current process status
 StepsList getStepsList()
           
 boolean isStopped()
          Check if the process was stoped before it was finished
 void notifyActionStepFinish(ActionStep step)
           
 void notifyActionStepStart(ActionStep step)
           
 void registerExceptionHandler(StepAction handler)
          Registers a process exception handler.
 void reset()
          Resets the process state.
 void setActionStepCount(int actionStepCount)
           
 void setName(String name)
           
 void setParameter(String key, Object value)
          Sets a process wide parameter
 ProcessContext.ProcessStatus start()
          Starts the process from the first step
 void stop(boolean failed)
          Stop the running process, will not continue to the next step.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

topLevelSteps

protected StepsList topLevelSteps

params

protected Map<String,Object> params
Constructor Detail

ProcessImpl

public ProcessImpl()
Method Detail

setActionStepCount

public void setActionStepCount(int actionStepCount)
Parameters:
actionStepCount - The actionStepCount to set.

getActionStepsCount

public int getActionStepsCount()
Description copied from interface: ProcessContext
Gets the total number of ActionSteps in this process

Specified by:
getActionStepsCount in interface ProcessContext
See Also:
ProcessContext.getActionStepsCount()

start

public ProcessContext.ProcessStatus start()
Description copied from interface: Process
Starts the process from the first step

Specified by:
start in interface Process
Returns:
The status of the process
See Also:
Process.start()

setName

public void setName(String name)

getName

public String getName()

getStepsList

public StepsList getStepsList()

stop

public void stop(boolean failed)
Description copied from interface: ProcessContext
Stop the running process, will not continue to the next step.

Specified by:
stop in interface ProcessContext
Parameters:
failed - true if the process was stopped because of a failure. Will set the Status to FAILED.
See Also:
ProcessContext.stop(boolean)

isStopped

public boolean isStopped()
Description copied from interface: ProcessContext
Check if the process was stoped before it was finished

Specified by:
isStopped in interface ProcessContext
See Also:
ProcessContext.isStopped()

getStatus

public ProcessContext.ProcessStatus getStatus()
Description copied from interface: ProcessContext
Gets the current process status

Specified by:
getStatus in interface ProcessContext
Returns:
The process status
See Also:
ProcessContext.getStatus()

getParameter

public Object getParameter(String key)
Description copied from interface: ProcessContext
Gets a process wide parameter

Specified by:
getParameter in interface ProcessContext
Parameters:
key - The parameter's key
Returns:
The parameter's value
See Also:
ProcessContext.getParameter(java.lang.String)

setParameter

public void setParameter(String key,
                         Object value)
Description copied from interface: ProcessContext
Sets a process wide parameter

Specified by:
setParameter in interface ProcessContext
Parameters:
key - The parameter's key
value - The parameter's value
See Also:
ProcessContext.setParameter(java.lang.String, java.lang.Object)

getParameters

public Map<String,Object> getParameters()
Description copied from interface: ProcessContext
Gets the process wide parameters' map

Specified by:
getParameters in interface ProcessContext
See Also:
ProcessContext.getParameters()

registerExceptionHandler

public void registerExceptionHandler(StepAction handler)
Description copied from interface: Process
Registers a process exception handler. The StepAction will be executed on StepActionExceptions

Specified by:
registerExceptionHandler in interface Process
Parameters:
handler - The exception handler
See Also:
Process.registerExceptionHandler(org.javasteps.StepAction)

getExceptionHandler

public StepAction getExceptionHandler()
Specified by:
getExceptionHandler in interface Process
Returns:
Returns the exceptionHandler.
See Also:
Process.getExceptionHandler()

reset

public void reset()
Description copied from interface: Process
Resets the process state. This method will change the status to IDLE, remove all process parameters and remove all ProcessListeners.

Specified by:
reset in interface Process
See Also:
Process.reset()

addProcessListener

public void addProcessListener(ProcessListener listener)
Description copied from interface: Process
Adds a ProcessListener to the process to get process execution events. Listeners can be added only when process is IDLE. Trying to add a listener on running process will do nothing.

Specified by:
addProcessListener in interface Process
Parameters:
listener - The process listener
See Also:
Process.addProcessListener(org.javasteps.event.ProcessListener)

notifyActionStepStart

public void notifyActionStepStart(ActionStep step)

notifyActionStepFinish

public void notifyActionStepFinish(ActionStep step)