Package org.apache.camel.component.exec
Interface ExecBinding
- All Known Implementing Classes:
DefaultExecBinding
public interface ExecBinding
Represents the binding of input and output types of a
ExecCommandExecutor
to an Exchange
. The input
of the executor is an ExecCommand
and the output is an ExecResult
.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The header value overrides the existing command arguments in theExecEndpoint
URI.static final String
The header value overrides the executable of the command, configured in the exec endpoint URI.static final String
Which exit values of the process are considered a success.static final String
The value of this header define logging level to be used for commands during execution.static final String
Specifies the file name of a file, created by the executable, that should be considered as output of the executable, e.g.static final String
Specifies the amount of time, in milliseconds, after which the process of the executable should be terminated.static final String
Sets the working directory of theEXEC_COMMAND_EXECUTABLE
.static final String
The value of this header is the exit value that is returned, after the execution.static final String
The value of this header is aInputStream
with the standard error stream of the executable.static final String
The value of this header is a boolean which indicates whether to fallback and use stderr when stdout is empty. -
Method Summary
Modifier and TypeMethodDescriptionreadInput
(org.apache.camel.Exchange exchange, ExecEndpoint endpoint) void
writeOutput
(org.apache.camel.Exchange exchange, ExecResult result) Populates the exchange form theExecResult
.
-
Field Details
-
EXEC_COMMAND_EXECUTABLE
@Metadata(label="in", description="The name of the system command that will be executed. Overrides\n`executable` in the URI.", javaType="String") static final String EXEC_COMMAND_EXECUTABLEThe header value overrides the executable of the command, configured in the exec endpoint URI. As executable is considered the remaining of theExecEndpoint
URI;
e.g. in the URIexec:C:/Program Files/jdk/java.exe
,C:/Program Files/jdk/java.exe
is the executable.
- See Also:
-
EXEC_COMMAND_ARGS
@Metadata(label="in", description="Command-line argument(s) to pass to the executed process. The argument(s)\nis/are used literally - no quoting is applied. Overrides any existing\n`args` in the URI.", javaType="java.util.List<String> or String") static final String EXEC_COMMAND_ARGSThe header value overrides the existing command arguments in theExecEndpoint
URI. The arguments may be aList
. In this case no parsing of the arguments is necessary.- See Also:
-
EXEC_COMMAND_OUT_FILE
@Metadata(label="in", description="The name of a file, created by the executable, that should be considered\nas its output. Overrides any existing `outFile` in the URI.", javaType="String") static final String EXEC_COMMAND_OUT_FILESpecifies the file name of a file, created by the executable, that should be considered as output of the executable, e.g. a log file.- See Also:
-
ExecResultConverter.toInputStream(ExecResult)
- Constant Field Values
-
EXEC_COMMAND_WORKING_DIR
@Metadata(label="in", description="The directory in which the command should be executed. Overrides any\nexisting `workingDir` in the URI.", javaType="String") static final String EXEC_COMMAND_WORKING_DIRSets the working directory of theEXEC_COMMAND_EXECUTABLE
. The header value overrides any existing command in the endpoint URI. If this is not configured, the working directory of the current process will be used.- See Also:
-
EXEC_COMMAND_TIMEOUT
@Metadata(label="in", description="The timeout, in milliseconds, after which the executable should be\nterminated. Overrides any existing `timeout` in the URI.", javaType="long") static final String EXEC_COMMAND_TIMEOUTSpecifies the amount of time, in milliseconds, after which the process of the executable should be terminated. The default value isLong.MAX_VALUE
.- See Also:
-
EXEC_COMMAND_EXIT_VALUES
@Metadata(label="in", description="The exit values for successful execution of the process.\nOverrides any existing `exitValues` in the URI.", javaType="String") static final String EXEC_COMMAND_EXIT_VALUESWhich exit values of the process are considered a success. When the process exits with a value not in this list, an ExecuteException is raised. When the list is empty (the default), no exception is raised based on the exit value. Example:- See Also:
-
EXEC_STDERR
@Metadata(label="out", description="The value of this header points to the standard error stream (stderr) of\nthe executable. If no stderr is written, the value is `null`.", javaType="java.io.InputStream") static final String EXEC_STDERRThe value of this header is aInputStream
with the standard error stream of the executable.- See Also:
-
EXEC_EXIT_VALUE
@Metadata(label="out", description="The value of this header is the _exit value_ of the executable. Non-zero\nexit values typically indicate abnormal termination. Note that the exit\nvalue is OS-dependent.", javaType="int") static final String EXEC_EXIT_VALUEThe value of this header is the exit value that is returned, after the execution. By convention a non-zero status exit value indicates abnormal termination.
Note that the exit value is OS dependent.- See Also:
-
EXEC_USE_STDERR_ON_EMPTY_STDOUT
@Metadata(label="in", description="Indicates that when `stdout` is empty, this component will populate the\nCamel Message Body with `stderr`. This behavior is disabled (`false`) by\ndefault.", javaType="boolean") static final String EXEC_USE_STDERR_ON_EMPTY_STDOUTThe value of this header is a boolean which indicates whether to fallback and use stderr when stdout is empty.- See Also:
-
EXEC_COMMAND_LOG_LEVEL
@Metadata(label="in", description="Logging level to be used for commands during execution. The default value is DEBUG.\nPossible values are TRACE, DEBUG, INFO, WARN, ERROR or OFF (Values of LoggingLevel enum)", javaType="String") static final String EXEC_COMMAND_LOG_LEVELThe value of this header define logging level to be used for commands during execution. The default value is INFO. Possible values are TRACE, DEBUG, INFO, WARN, ERROR or OFF. (Values of LoggingLevel enum)- See Also:
-
-
Method Details
-
readInput
- Parameters:
exchange
- a CamelExchange
endpoint
- anExecEndpoint
instance- Returns:
- an
ExecCommand
object - See Also:
-
writeOutput
Populates the exchange form theExecResult
.- Parameters:
exchange
- a CamelExchange
, in which to write theresult
result
- the result of a command execution- See Also:
-