Package adams.core.command
Interface ExternalCommand
-
- All Superinterfaces:
CleanUpHandler
,Destroyable
,FlowContextHandler
,OptionHandler
,QuickInfoSupporter
,Stoppable
,StoppableWithFeedback
- All Known Subinterfaces:
AsyncCapableExternalCommand
,ExternalCommandWithOptions
,ExternalCommandWithProgrammaticArguments
- All Known Implementing Classes:
AbstractAsyncCapableExternalCommand
,AbstractAsyncCapableExternalCommandWithOptions
,AbstractExternalCommand
,AbstractExternalCommandWithOptions
public interface ExternalCommand extends OptionHandler, FlowContextHandler, QuickInfoSupporter, StoppableWithFeedback, CleanUpHandler
Interface for classes that execute external commands.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addFormattedOutput(Object output)
Gets called by the output formatter class.void
cleanUp()
Cleans up data structures, frees up memory.String
execute()
Executes the command.Class
generates()
Returns what output type the command generates via its output formatter.String[]
getLastCommand()
Returns the last command that was executed.OutputFormatter
getOutputFormatter()
Returns the formatter to use for the output that is being forwarded.OutputType
getOutputType()
Returns what output to forward.StdErrProcessor
getStdErrProcessor()
Returns the handler for processing the output received on stderr.StdOutProcessor
getStdOutProcessor()
Returns the handler for processing the output received on stdout.boolean
hasLastCommand()
Checks whether a command has been executed (and recorded).boolean
hasOutput()
Whether there is any pending output.boolean
isExecuted()
Returns whether the command was executed.boolean
isFinished()
Returns whether the command finished.boolean
isRunning()
Returns whether the command is currently running.boolean
isUsingBlocking()
Whether the command is used in a blocking or async fashion.Object
output()
Returns the next line in the output.String
outputFormatterTipText()
Returns the tip text for this property.String
outputTypeTipText()
Returns the tip text for this property.void
setOutputFormatter(OutputFormatter value)
Sets the formatter to use for the output that is being forwarded.void
setOutputType(OutputType value)
Sets what output to forward.void
setStdErrProcessor(StdErrProcessor value)
Sets the handler for processing the output received on stderr.void
setStdOutProcessor(StdOutProcessor value)
Sets the handler for processing the output received on stdout.String
stdErrProcessorTipText()
Returns the tip text for this property.String
stdOutProcessorTipText()
Returns the tip text for this property.-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.flow.core.FlowContextHandler
getFlowContext, setFlowContext
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
Methods inherited from interface adams.core.QuickInfoSupporter
getQuickInfo
-
Methods inherited from interface adams.core.Stoppable
stopExecution
-
Methods inherited from interface adams.core.StoppableWithFeedback
isStopped
-
-
-
-
Method Detail
-
setOutputType
void setOutputType(OutputType value)
Sets what output to forward.- Parameters:
value
- the type of output
-
getOutputType
OutputType getOutputType()
Returns what output to forward.- Returns:
- the type of output
-
outputTypeTipText
String outputTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setStdErrProcessor
void setStdErrProcessor(StdErrProcessor value)
Sets the handler for processing the output received on stderr.- Parameters:
value
- the handler
-
getStdErrProcessor
StdErrProcessor getStdErrProcessor()
Returns the handler for processing the output received on stderr.- Returns:
- the handler
-
stdErrProcessorTipText
String stdErrProcessorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setStdOutProcessor
void setStdOutProcessor(StdOutProcessor value)
Sets the handler for processing the output received on stdout.- Parameters:
value
- the handler
-
getStdOutProcessor
StdOutProcessor getStdOutProcessor()
Returns the handler for processing the output received on stdout.- Returns:
- the handler
-
stdOutProcessorTipText
String stdOutProcessorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutputFormatter
void setOutputFormatter(OutputFormatter value)
Sets the formatter to use for the output that is being forwarded.- Parameters:
value
- the formatter
-
getOutputFormatter
OutputFormatter getOutputFormatter()
Returns the formatter to use for the output that is being forwarded.- Returns:
- the formatter
-
outputFormatterTipText
String outputFormatterTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
isUsingBlocking
boolean isUsingBlocking()
Whether the command is used in a blocking or async fashion.- Returns:
- true if blocking, false if async
-
execute
String execute()
Executes the command.- Returns:
- null if successful, otherwise error message
-
hasLastCommand
boolean hasLastCommand()
Checks whether a command has been executed (and recorded).- Returns:
- true if executed/recorded
-
getLastCommand
String[] getLastCommand()
Returns the last command that was executed.- Returns:
- the last command, null if not available
-
isExecuted
boolean isExecuted()
Returns whether the command was executed.- Returns:
- true if executed
-
isRunning
boolean isRunning()
Returns whether the command is currently running.- Returns:
- true if running
-
isFinished
boolean isFinished()
Returns whether the command finished.- Returns:
- true if finished
-
hasOutput
boolean hasOutput()
Whether there is any pending output.- Returns:
- true if output pending
-
output
Object output()
Returns the next line in the output.- Returns:
- the line, null if none available
-
addFormattedOutput
void addFormattedOutput(Object output)
Gets called by the output formatter class.- Parameters:
output
- the formatted output to collect
-
generates
Class generates()
Returns what output type the command generates via its output formatter.- Returns:
- the type
-
cleanUp
void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
-