Package org.mwolff.command.builder
Class XMLChainBuilder<T>
- java.lang.Object
-
- org.mwolff.command.builder.XMLChainBuilder<T>
-
- All Implemented Interfaces:
ChainCommand<T>
,Command<T>
,ProcessCommand<T>
public class XMLChainBuilder<T> extends Object implements Command<T>, ProcessCommand<T>, ChainCommand<T>
Chain builder parsing an XML file for building chains or process chains.- Author:
- Manfred Wolff
-
-
Field Summary
-
Fields inherited from interface org.mwolff.command.process.ProcessCommand
END
-
-
Constructor Summary
Constructors Constructor Description XMLChainBuilder(String xmlFilename)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CommandContainer<T>
buildChain()
Optional<String>
executeAsProcess(String startCommand, T context)
Execute a command as a process.Optional<String>
executeAsProcess(T context)
Execute a command as a process.CommandTransition
executeCommand(T parameterObject)
Executes the command.CommandTransition
executeCommandAsChain(T parameterObject)
String
getProcessID()
Gets the process ID of the command.void
setProcessID(String processID)
Sets the process ID of the command-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mwolff.command.process.ProcessCommand
addTransition, findNext, getTransitionList
-
-
-
-
Constructor Detail
-
XMLChainBuilder
public XMLChainBuilder(String xmlFilename)
-
-
Method Detail
-
executeAsProcess
public Optional<String> executeAsProcess(String startCommand, T context)
Description copied from interface:ProcessCommand
Execute a command as a process. The result is the decision which process step should be executed next.- Specified by:
executeAsProcess
in interfaceProcessCommand<T>
- Parameters:
startCommand
- The command the process should start with.context
- The context to work with.- Returns:
- The next process step to execute. Null stops the process.
-
executeAsProcess
public Optional<String> executeAsProcess(T context)
Description copied from interface:ProcessCommand
Execute a command as a process. The result is the decision which process step should be executed next.- Specified by:
executeAsProcess
in interfaceProcessCommand<T>
- Parameters:
context
- The context to work with.- Returns:
- The next process step to execute. Null stops the process.
-
getProcessID
public String getProcessID()
Description copied from interface:ProcessCommand
Gets the process ID of the command.- Specified by:
getProcessID
in interfaceProcessCommand<T>
- Returns:
- The process ID
-
setProcessID
public void setProcessID(String processID)
Description copied from interface:ProcessCommand
Sets the process ID of the command- Specified by:
setProcessID
in interfaceProcessCommand<T>
- Parameters:
processID
- Sets the process id of this process command.
-
buildChain
protected CommandContainer<T> buildChain() throws CommandException
- Throws:
CommandException
-
executeCommand
public CommandTransition executeCommand(T parameterObject)
Description copied from interface:Command
Executes the command. The command can have the result SUCCESS if everything is fine or FAILURE if an error occurred.- Specified by:
executeCommand
in interfaceCommand<T>
- Parameters:
parameterObject
- The parameter object to pass.- Returns:
- FAILURE if something went wrong, SUCCESS otherwise.
-
executeCommandAsChain
public CommandTransition executeCommandAsChain(T parameterObject)
- Specified by:
executeCommandAsChain
in interfaceChainCommand<T>
- Parameters:
parameterObject
- The parameter object to pass.- Returns:
- SUCCESS is the next chain should overtake, ABORT otherwise.
-
-