public abstract class AbstractCommand extends Object implements SeMa4gCommand
AbstractCommand provides base functionality to run a SeMa4g command.
SeMa4gCommand.State| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCommand() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkCycleDependencies(List<SeMa4gCommand> usedDependencies)
Checks if there is a cycle dependencies
|
SeMa4gCommand |
dependingOn(SeMa4gCommand... dependencies)
Definies the
SeMa4gCommand (one or more) which have to
be finished before this command can be executed. |
abstract void |
execute()
Use this method to implement the execution code.
|
List<SeMa4gCommand> |
getDependencies()
Returns the list of
SeMa4gCommand for this SeMa4gCommand
which have to be (successfully) executed before this command can be started |
SeMa4g |
getExecutionContext()
Returns the
SeMa4g for this command. |
SeMa4gCommand.State |
getState()
Returns the current
SeMa4gCommand.State |
void |
reset()
this method is called to reset the command
|
void |
run()
This method is used by the execution context to start the command
|
void |
setExecutionContext(SeMa4g executionContext)
Sets the
SeMa4g for this command. |
void |
setState(SeMa4gCommand.State state)
Sets the
SeMa4gCommand.State
of the command |
void |
signalError()
This command can be called to interrupt the execution and
start the error behavior.
|
void |
signalFinish()
This command can be called to finish an execution and
start the next one.
|
void |
startCheckCycleDependencies()
starts a cycle dependency check
|
public void signalFinish()
public List<SeMa4gCommand> getDependencies()
SeMa4gCommand for this SeMa4gCommand
which have to be (successfully) executed before this command can be startedgetDependencies in interface SeMa4gCommandpublic SeMa4g getExecutionContext()
SeMa4g for this command.getExecutionContext in interface SeMa4gCommandSeMa4g for this commandpublic SeMa4gCommand.State getState()
SeMa4gCommand.StategetState in interface SeMa4gCommandpublic void setExecutionContext(SeMa4g executionContext)
SeMa4g for this command.setExecutionContext in interface SeMa4gCommandexecutionContext - the SeMa4g for this commandpublic void setState(SeMa4gCommand.State state)
SeMa4gCommand.State
of the commandsetState in interface SeMa4gCommandstate - the new statepublic SeMa4gCommand dependingOn(SeMa4gCommand... dependencies) throws SeMa4gException
SeMa4gCommand (one or more) which have to
be finished before this command can be executed.dependingOn in interface SeMa4gCommanddependencies - list of commands which have to be finished,
before this command can be startedSeMa4gException - when a cycle dependency is detectedpublic void checkCycleDependencies(List<SeMa4gCommand> usedDependencies) throws SeMa4gException
checkCycleDependencies in interface SeMa4gCommandusedDependencies - all dependencies for this commandSeMa4gException - when a cycle dependency is detectedpublic void reset()
reset in interface SeMa4gCommandpublic void run()
run in interface SeMa4gCommandpublic void startCheckCycleDependencies()
throws SeMa4gException
startCheckCycleDependencies in interface SeMa4gCommandSeMa4gException - in case there is a cycle dependencypublic void signalError()
signalError in interface SeMa4gCommandpublic abstract void execute()
Copyright © 2018. All rights reserved.