|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ProcessAction
Executes a native process or command line program. By default, this process action blocks until the process finishes. The process's exit code is returned in the flow context using a ProcessActionResult object.
Optionally, if the flow chart is interrupted, the process is destroyed.
Furthermore, the process can be configured to run in the background, in which case interrupting the flow chart does not destroy the process nor is the exit code returned.
Finally, if a process action is executed on an agent, there is an implicit transaction break on that process action. This implicit transaction break allows a very large number of processes to execute on agents.
The Process Action returns its result in the flow context variable "RESULT". The following table contains more information on accessing and using the result.
Flow Context Variable | Field | Java Type | Description |
---|---|---|---|
RESULT | result | int | The process's exit code, as returned by the operating system, if the process executed synchronously. |
RESULT | stderr | java.lang.String | The standard error (stderr) from the completed process, if the process executed synchronously. |
RESULT | stdout | java.lang.String | The standard output (stdout) from the completed process, if the process executed synchronously. |
Nested Class Summary | |
---|---|
static class |
ProcessAction.ProcessActionResult
The result when a process finishes executing. |
Method Summary | |
---|---|
java.util.List<java.lang.String> |
getArguments()
Returns command line arguments for the native process. |
boolean |
getAsynchronous()
Returns whether the native process runs asynchronously, in the background. |
java.lang.String |
getCommand()
Returns the command line for the native process. |
java.util.Properties |
getCommandProperties()
Returns substitution properties that are referenced by the process command line. |
boolean |
getDestroyOnInterrupt()
Returns whether this process is destroyed if the current flow chart is interrupted. |
boolean |
getDestroyOnSignal()
Returns whether this process is destroyed if this process action receives a signal. |
boolean |
getDestroyOnTimeout()
Returns whether this process is destroyed if this process takes too long to execute. |
java.util.Properties |
getEnvironment()
Returns the environment properties used by the native process. |
java.lang.String |
getErrorCondition()
Returns the expression that is tested to detect whether a process failed. |
java.lang.String |
getStderrFile()
Returns the file name where the process's stderr (standard error) is redirected, if not otherwise set on the command line. |
java.lang.String |
getStdinFile()
Returns the file name where the process's stdin (standard in) is redirected, if not otherwise set on the command line. |
java.lang.String |
getStdoutFile()
Returns the file name where the process's stdout (standard out) is redirected, if not otherwise set on the command line. |
java.lang.String |
getWorkingDirectory()
Returns the starting directory where the native process runs. |
boolean |
isAppendToOutputFile()
Indicates whether this process's output is written to the end of the configured stdout and stderr files, if not otherwise set on the command line. |
void |
setAppendToOutputFile(boolean enabled)
Sets whether this process's output is written to the end of the configured stdout and stderr files, if not otherwise set on the command line. |
void |
setArguments(java.util.List arguments)
Sets command line arguments for the native process. |
void |
setAsynchronous(boolean asynchronous)
Sets whether the native process runs asynchronously, in the background. |
void |
setCommand(java.lang.String command)
Sets the command line for the native process. |
void |
setCommandProperties(java.util.Properties commandProperties)
Sets substitution properties that are referenced by the process command line. |
void |
setDestroyOnInterrupt(boolean destroyOnInterrupt)
Sets whether this process is destroyed if the current flow chart is interrupted. |
void |
setDestroyOnSignal(boolean destroyOnSignal)
Sets whether this process is destroyed if this process action receives a signal. |
void |
setDestroyOnTimeout(boolean destroyOnTimeout)
Sets whether this process is destroyed if this process takes too long to execute. |
void |
setEnvironment(java.util.Properties environment)
Sets the environment properties used by the native process. |
void |
setErrorCondition(java.lang.String errorCondition)
Sets the expression that is tested to detect whether a process failed. |
void |
setStderrFile(java.lang.String stderr)
Sets the file name where the process's stderr (standard error) is redirected, if not otherwise set on the command line. |
void |
setStdinFile(java.lang.String stdin)
Sets the file name where the process's stdin (standard in) is redirected, if not otherwise set on the command line. |
void |
setStdoutFile(java.lang.String stdout)
Sets the file name where the process's stdout (standard out) is redirected, if not otherwise set on the command line. |
void |
setWorkingDirectory(java.lang.String startingDirectory)
Sets the starting directory where the native process runs. |
Methods inherited from interface flux.runtimedatamap.RuntimeDataMap |
---|
getRuntimeDataMap, setRuntimeDataMap |
Methods inherited from interface flux.agent.AgentAction |
---|
getAgentPool, setAgentPool |
Method Detail |
---|
boolean isAppendToOutputFile()
java.util.List<java.lang.String> getArguments()
boolean getAsynchronous()
Background processes do not prevent the JVM from exiting. When run in the background, some native processes will still exit when the JVM exits, due to failed interactions between a native process and the JVM, which takes over standard I/O for forked processes.
java.lang.String getCommand()
getCommandProperties()
,
setCommandProperties(java.util.Properties)
java.util.Properties getCommandProperties()
getCommand()
,
setCommand(java.lang.String)
boolean getDestroyOnInterrupt()
boolean getDestroyOnSignal()
boolean getDestroyOnTimeout()
java.util.Properties getEnvironment()
Note that leaving the environment at its default setting of null may pass the environment of the Flux engine's JVM to the process. However, if the environment is set, it is possible that none of the Flux engine's JVM environment properties are passed to the process. In that case, additional environment properties may need to be set explicitly. The exact behavior depends on the specific JVM and operating system.
For example, the Windows command processor and other Windows programs need the "SystemRoot" property to be set in order to run correctly. Typically, this property is set to "c:\windows".
java.lang.String getErrorCondition()
If a process fails, an exception is thrown, thereby forcing the execution of the flow chart to enter Flux's standard error handling mechanisms.
By default, the error condition is undefined, which means that a process is never deemed to have failed and this process action does not throw an exception after a process executes.
If an error condition has been set, after the process returns its result, the error condition is evaluated using that result. If the error condition is then satisfied (found to be true), an exception is thrown. Otherwise, no exception is thrown.
As an example of an error condition that causes an exception to the thrown if the process's exit code is not zero, use the syntax "RESULT <> 0".
This property is ignored if the Process Action is configured to run asynchronously.
getAsynchronous()
,
setAsynchronous(boolean)
java.lang.String getStderrFile()
java.lang.String getStdinFile()
java.lang.String getStdoutFile()
java.lang.String getWorkingDirectory()
void setAppendToOutputFile(boolean enabled)
enabled
- Whether this process's output is written to the end of the
configured stdout and stderr files.void setArguments(java.util.List arguments)
arguments
- Command line arguments for the native process.void setAsynchronous(boolean asynchronous)
Background processes do not prevent the JVM from exiting. When run in the background, some native processes will still exit when the JVM exits, due to failed interactions between a native process and the JVM, which takes over standard I/O for forked processes.
asynchronous
- Whether the native process runs asynchronously, in the
background.void setCommand(java.lang.String command)
command
- The command line for the native process.
java.lang.IllegalArgumentException
- If the command is null or empty.getCommandProperties()
,
setCommandProperties(java.util.Properties)
void setCommandProperties(java.util.Properties commandProperties)
commandProperties
- Substitution properties that are referenced by the
process command line.getCommand()
,
setCommand(java.lang.String)
void setDestroyOnInterrupt(boolean destroyOnInterrupt)
destroyOnInterrupt
- Whether this process is destroyed if the current
flow chart is interrupted.void setDestroyOnSignal(boolean destroyOnSignal)
destroyOnSignal
- Whether this process is destroyed if this process
action receives a signal.void setDestroyOnTimeout(boolean destroyOnTimeout)
destroyOnTimeout
- Whether this process is destroyed if this process
takes too long to execute.void setEnvironment(java.util.Properties environment)
Note that leaving the environment at its default setting of null may pass the environment of the Flux engine's JVM to the process. However, if the environment is set, it is possible that none of the Flux engine's JVM environment properties are passed to the process. In that case, additional environment properties may need to be set explicitly. The exact behavior depends on the specific JVM and operating system.
For example, the Windows command processor and other Windows programs need the "SystemRoot" property to be set in order to run correctly. Typically, this property is set to "c:\windows".
environment
- The environment used by the native process.void setErrorCondition(java.lang.String errorCondition)
If a process fails, an exception is thrown, thereby forcing the execution of the flow chart to enter Flux's standard error handling mechanisms.
By default, the error condition is undefined, which means that a process is never deemed to have failed and this process action does not throw an exception after a process executes.
If an error condition has been set, after the process returns its result, the error condition is evaluated using that result. If the error condition is then satisfied (found to be true), an exception is thrown. Otherwise, no exception is thrown.
As an example of an error condition that causes an exception to the thrown if the process's exit code is not zero, use the syntax "RESULT <> 0".
This property is ignored if the Process Action is configured to run asynchronously.
errorCondition
- The expression that is tested to detect whether a
process failed. A null or empty error condition
indicates that the error condition is undefined.getAsynchronous()
,
setAsynchronous(boolean)
void setStderrFile(java.lang.String stderr)
stderr
- The file name where the process's stderr redirected.void setStdinFile(java.lang.String stdin)
stdin
- The file name where the process's stdin redirected.void setStdoutFile(java.lang.String stdout)
stdout
- The file name where the process's stdout is redirected.void setWorkingDirectory(java.lang.String startingDirectory)
startingDirectory
- The starting directory where the native process
runs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |