Class Exec
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.standalone.rats.output.AbstractRatOutput
-
- adams.flow.standalone.rats.output.Exec
-
- All Implemented Interfaces:
adams.core.AdditionalInformationHandler,adams.core.CleanUpHandler,adams.core.Destroyable,adams.core.GlobalInfoSupporter,adams.core.logging.LoggingLevelHandler,adams.core.logging.LoggingSupporter,adams.core.management.EnvironmentVariablesHandler,adams.core.management.WorkingDirectoryHandler,adams.core.option.OptionHandler,adams.core.QuickInfoSupporter,adams.core.ShallowCopySupporter<AbstractRatOutput>,adams.core.SizeOfHandler,adams.core.Stoppable,adams.core.StoppableWithFeedback,adams.event.VariableChangeListener,RatOutput,Serializable
public class Exec extends AbstractRatOutput implements adams.core.management.EnvironmentVariablesHandler, adams.core.management.WorkingDirectoryHandler
Executes the specified command when the rat finishes execution.
Ignores any input.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-cmd <java.lang.String> (property: command) The external command to run. default: ls -l .
-working-directory <java.lang.String> (property: workingDirectory) The current working directory for the command. default:
-env-var <adams.core.base.BaseKeyValuePair> [-env-var ...] (property: envVars) The environment variables to overlay on top of the current ones. default:
-placeholder <boolean> (property: commandContainsPlaceholder) Set this to true to enable automatic placeholder expansion for the command string. default: false
-variable <boolean> (property: commandContainsVariable) Set this to true to enable automatic variable expansion for the command string. default: false
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringm_Commandthe command to run.protected booleanm_CommandContainsPlaceholderwhether the command string contains a placeholder, which needs to be expanded first.protected booleanm_CommandContainsVariablewhether the command string contains a variable, which needs to be expanded first.protected adams.core.base.BaseKeyValuePair[]m_EnvVarsenvironment variables.protected com.github.fracpete.processoutput4j.output.CollectingProcessOutputm_ProcessOutputfor executing the command.protected Stringm_WorkingDirectorythe current working directory.-
Fields inherited from class adams.flow.standalone.rats.output.AbstractRatOutput
m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_Input, m_LoggingPrefix, m_Owner, m_Stopped, m_VariablesUpdated
-
-
Constructor Summary
Constructors Constructor Description Exec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]accepts()Returns the type of data that gets accepted.StringcommandContainsPlaceholderTipText()Returns the tip text for this property.StringcommandContainsVariableTipText()Returns the tip text for this property.StringcommandTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.protected StringdoTransmit()Performs the actual transmission.StringenvVarsTipText()Returns the tip text for this property.StringgetCommand()Returns the command to run.booleangetCommandContainsPlaceholder()Returns whether the command string contains a placeholder which needs to be expanded first.booleangetCommandContainsVariable()Returns whether the command string contains a variable which needs to be expanded first.adams.core.base.BaseKeyValuePair[]getEnvVars()Returns the environment variables to overlay on top of the current ones.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringgetWorkingDirectory()Returns the current working directory for the command.StringglobalInfo()Returns a string describing the object.voidsetCommand(String value)Sets the command to run.voidsetCommandContainsPlaceholder(boolean value)Sets whether the command string contains a placeholder which needs to be expanded first.voidsetCommandContainsVariable(boolean value)Sets whether the command string contains a variable which needs to be expanded first.voidsetEnvVars(adams.core.base.BaseKeyValuePair[] value)Sets the environment variables to overlay on top of the current ones.voidsetWorkingDirectory(String value)Sets the current working directory for the command.voidstopExecution()Stops the execution.StringworkingDirectoryTipText()Returns the tip text for this property.-
Methods inherited from class adams.flow.standalone.rats.output.AbstractRatOutput
backupState, canInput, check, cleanUp, configureLogger, doWait, findVariables, getAdditionalInformation, getFullName, getOwner, getQueue, getVariables, handleException, initialize, initTransmission, input, isBackedUp, isStopped, pruneBackup, pruneBackup, restoreState, setOwner, setUp, shallowCopy, shallowCopy, transmit, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Command
protected String m_Command
the command to run.
-
m_WorkingDirectory
protected String m_WorkingDirectory
the current working directory.
-
m_EnvVars
protected adams.core.base.BaseKeyValuePair[] m_EnvVars
environment variables.
-
m_CommandContainsPlaceholder
protected boolean m_CommandContainsPlaceholder
whether the command string contains a placeholder, which needs to be expanded first.
-
m_CommandContainsVariable
protected boolean m_CommandContainsVariable
whether the command string contains a variable, which needs to be expanded first.
-
m_ProcessOutput
protected transient com.github.fracpete.processoutput4j.output.CollectingProcessOutput m_ProcessOutput
for executing the command.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceadams.core.GlobalInfoSupporter- Specified by:
globalInfoin classadams.core.option.AbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classadams.core.option.AbstractOptionHandler
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceadams.core.QuickInfoSupporter- Overrides:
getQuickInfoin classAbstractRatOutput- Returns:
- null if no info available, otherwise short string
-
setCommand
public void setCommand(String value)
Sets the command to run.- Parameters:
value- the command
-
getCommand
public String getCommand()
Returns the command to run.- Returns:
- the command
-
commandTipText
public String commandTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setWorkingDirectory
public void setWorkingDirectory(String value)
Sets the current working directory for the command.- Specified by:
setWorkingDirectoryin interfaceadams.core.management.WorkingDirectoryHandler- Parameters:
value- the directory, ignored if empty
-
getWorkingDirectory
public String getWorkingDirectory()
Returns the current working directory for the command.- Specified by:
getWorkingDirectoryin interfaceadams.core.management.WorkingDirectoryHandler- Returns:
- the directory, ignored if empty
-
workingDirectoryTipText
public String workingDirectoryTipText()
Returns the tip text for this property.- Specified by:
workingDirectoryTipTextin interfaceadams.core.management.WorkingDirectoryHandler- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setEnvVars
public void setEnvVars(adams.core.base.BaseKeyValuePair[] value)
Sets the environment variables to overlay on top of the current ones.- Specified by:
setEnvVarsin interfaceadams.core.management.EnvironmentVariablesHandler- Parameters:
value- the environment variables
-
getEnvVars
public adams.core.base.BaseKeyValuePair[] getEnvVars()
Returns the environment variables to overlay on top of the current ones.- Specified by:
getEnvVarsin interfaceadams.core.management.EnvironmentVariablesHandler- Returns:
- the environment variables
-
envVarsTipText
public String envVarsTipText()
Returns the tip text for this property.- Specified by:
envVarsTipTextin interfaceadams.core.management.EnvironmentVariablesHandler- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCommandContainsPlaceholder
public void setCommandContainsPlaceholder(boolean value)
Sets whether the command string contains a placeholder which needs to be expanded first.- Parameters:
value- true if command string contains a placeholder
-
getCommandContainsPlaceholder
public boolean getCommandContainsPlaceholder()
Returns whether the command string contains a placeholder which needs to be expanded first.- Returns:
- true if command string contains a placeholder
-
commandContainsPlaceholderTipText
public String commandContainsPlaceholderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCommandContainsVariable
public void setCommandContainsVariable(boolean value)
Sets whether the command string contains a variable which needs to be expanded first.- Parameters:
value- true if command string contains a variable
-
getCommandContainsVariable
public boolean getCommandContainsVariable()
Returns whether the command string contains a variable which needs to be expanded first.- Returns:
- true if command string contains a variable
-
commandContainsVariableTipText
public String commandContainsVariableTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
accepts
public Class[] accepts()
Returns the type of data that gets accepted.- Specified by:
acceptsin interfaceRatOutput- Specified by:
acceptsin classAbstractRatOutput- Returns:
- the type of data
-
doTransmit
protected String doTransmit()
Performs the actual transmission.- Specified by:
doTransmitin classAbstractRatOutput- Returns:
- null if successful, otherwise error message
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecutionin interfaceRatOutput- Specified by:
stopExecutionin interfaceadams.core.Stoppable- Overrides:
stopExecutionin classAbstractRatOutput
-
-