This is an automated email from the ASF dual-hosted git repository. nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers in repository https://gitbox.apache.org/repos/asf/camel.git
commit 8e31169875b8172267760489f3472892cce99727 Author: Nicolas Filotto <[email protected]> AuthorDate: Mon Mar 21 12:31:17 2022 +0100 CAMEL-17792: Add doc about the message headers of camel-exec --- .../org/apache/camel/component/exec/exec.json | 11 +++++ .../camel-exec/src/main/docs/exec-component.adoc | 48 ++-------------------- .../apache/camel/component/exec/ExecBinding.java | 37 +++++++++++++++-- .../apache/camel/component/exec/ExecEndpoint.java | 2 +- 4 files changed, 49 insertions(+), 49 deletions(-) diff --git a/components/camel-exec/src/generated/resources/org/apache/camel/component/exec/exec.json b/components/camel-exec/src/generated/resources/org/apache/camel/component/exec/exec.json index 4a61929..34c87d3 100644 --- a/components/camel-exec/src/generated/resources/org/apache/camel/component/exec/exec.json +++ b/components/camel-exec/src/generated/resources/org/apache/camel/component/exec/exec.json @@ -25,6 +25,17 @@ "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...] "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...] }, + "headers": { + "CamelExecCommandExecutable": { "kind": "header", "displayName": "", "group": "in", "label": "in", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the system command that will be executed. Overrides\n`executable` in the URI." }, + "CamelExecCommandArgs": { "kind": "header", "displayName": "", "group": "in", "label": "in", "required": false, "javaType": "java.util.List<String> or String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "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." }, + "CamelExecCommandOutFile": { "kind": "header", "displayName": "", "group": "in", "label": "in", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of a file, created by the executable, that should be considered\nas its output. Overrides any existing `outFile` in the URI." }, + "CamelExecCommandWorkingDir": { "kind": "header", "displayName": "", "group": "in", "label": "in", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The directory in which the command should be executed. Overrides any\nexisting `workingDir` in the URI." }, + "CamelExecCommandTimeout": { "kind": "header", "displayName": "", "group": "in", "label": "in", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The timeout, in milliseconds, after which the executable should be\nterminated. Overrides any existing `timeout` in the URI." }, + "CamelExecStderr": { "kind": "header", "displayName": "", "group": "out", "label": "out", "required": false, "javaType": "java.io.InputStream", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "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`." }, + "CamelExecExitValue": { "kind": "header", "displayName": "", "group": "out", "label": "out", "required": false, "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "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." }, + "CamelExecUseStderrOnEmptyStdout": { "kind": "header", "displayName": "", "group": "in", "label": "in", "required": false, "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Indicates that when `stdout` is empty, this component will populate the\nCamel Message Body with `stderr`. This behavior is disabled (`false`) by\ndefault." }, + "CamelExecCommandLogLevel": { "kind": "header", "displayName": "", "group": "in", "label": "in", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "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)" } + }, "properties": { "executable": { "kind": "path", "displayName": "Executable", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Sets the executable to be executed. The executable must not be empty or null." }, "args": { "kind": "parameter", "displayName": "Args", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The arguments may be one or many whitespace-separated tokens." }, diff --git a/components/camel-exec/src/main/docs/exec-component.adoc b/components/camel-exec/src/main/docs/exec-component.adoc index 5f71568..4d37d53 100644 --- a/components/camel-exec/src/main/docs/exec-component.adoc +++ b/components/camel-exec/src/main/docs/exec-component.adoc @@ -53,51 +53,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END - -== Message headers - -The supported headers are defined in -`org.apache.camel.component.exec.ExecBinding`. - -[width="100%",cols="10%,10%,10%,70%",options="header",] -|======================================================================= -|Name |Type |Message |Description - -|`ExecBinding.EXEC_COMMAND_EXECUTABLE` |`String` |`in` |The name of the system command that will be executed. Overrides -`executable` in the URI. - -|`ExecBinding.EXEC_COMMAND_ARGS` |`java.util.List<String>` |`in` |Command-line arguments to pass to the executed process. The arguments -are used literally - no quoting is applied. Overrides any existing -`args` in the URI. - -|`ExecBinding.EXEC_COMMAND_ARGS` |`String`| `in` |The arguments of the executable as a Single string where -each argument is whitespace separated (see `args` in URI option). The -arguments are used literally, no quoting is applied. Overrides any -existing `args` in the URI. - -|`ExecBinding.EXEC_COMMAND_OUT_FILE` |`String` |`in` |The name of a file, created by the executable, that should be considered -as its output. Overrides any existing `outFile` in the URI. - -|`ExecBinding.EXEC_COMMAND_TIMEOUT` |`long` |`in` |The timeout, in milliseconds, after which the executable should be -terminated. Overrides any existing `timeout` in the URI. - -|`ExecBinding.EXEC_COMMAND_WORKING_DIR` |`String` |`in` |The directory in which the command should be executed. Overrides any -existing `workingDir` in the URI. - -|`ExecBinding.EXEC_EXIT_VALUE` |`int` |`out` |The value of this header is the _exit value_ of the executable. Non-zero -exit values typically indicate abnormal termination. Note that the exit -value is OS-dependent. - -|`ExecBinding.EXEC_STDERR` |`java.io.InputStream` |`out` |The value of this header points to the standard error stream (stderr) of -the executable. If no stderr is written, the value is `null`. - -|`ExecBinding.EXEC_USE_STDERR_ON_EMPTY_STDOUT` |`boolean` |`in` |Indicates that when `stdout` is empty, this component will populate the -Camel Message Body with `stderr`. This behavior is disabled (`false`) by -default. - -|`ExecBinding.EXEC_COMMANDS_LOG_LEVEL` |`String` |`in` |Logging level to be used for commands during execution. The default value is DEBUG. -Possible values are TRACE, DEBUG, INFO, WARN, ERROR or OFF (Values of LoggingLevel enum) -|======================================================================= +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Message body diff --git a/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecBinding.java b/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecBinding.java index 51210a7..dfcee03 100644 --- a/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecBinding.java +++ b/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecBinding.java @@ -19,6 +19,7 @@ package org.apache.camel.component.exec; import java.io.InputStream; import org.apache.camel.Exchange; +import org.apache.camel.spi.Metadata; /** * Represents the binding of input and output types of a {@link ExecCommandExecutor} to an {@link Exchange}. The input @@ -33,14 +34,21 @@ public interface ExecBinding { * e.g. in the URI <i> <code>exec:C:/Program Files/jdk/java.exe</code> </i>, <code>C:/Program * Files/jdk/java.exe<code> is the executable. */ + @Metadata(label = "in", description = "The name of the system command that will be executed. Overrides\n" + + "`executable` in the URI.", + javaType = "String") String EXEC_COMMAND_EXECUTABLE = "CamelExecCommandExecutable"; /** * The header value overrides the existing command arguments in the {@link ExecEndpoint} URI. The arguments may be a * <code>List<String></code>. In this case no parsing of the arguments is necessary. * - * @see {@link #EXEC_COMMAND_EXECUTABLE} + * @see #EXEC_COMMAND_EXECUTABLE */ + @Metadata(label = "in", description = "Command-line argument(s) to pass to the executed process. The argument(s)\n" + + "is/are used literally - no quoting is applied. Overrides any existing\n" + + "`args` in the URI.", + javaType = "java.util.List<String> or String") String EXEC_COMMAND_ARGS = "CamelExecCommandArgs"; /** @@ -49,6 +57,9 @@ public interface ExecBinding { * * @see ExecResultConverter#toInputStream(ExecResult) */ + @Metadata(label = "in", description = "The name of a file, created by the executable, that should be considered\n" + + "as its output. Overrides any existing `outFile` in the URI.", + javaType = "String") String EXEC_COMMAND_OUT_FILE = "CamelExecCommandOutFile"; /** @@ -56,17 +67,26 @@ public interface ExecBinding { * command in the endpoint URI. If this is not configured, the working directory of the current process will be * used. */ + @Metadata(label = "in", description = "The directory in which the command should be executed. Overrides any\n" + + "existing `workingDir` in the URI.", + javaType = "String") String EXEC_COMMAND_WORKING_DIR = "CamelExecCommandWorkingDir"; /** * Specifies the amount of time, in milliseconds, after which the process of the executable should be terminated. * The default value is {@link Long#MAX_VALUE}. */ + @Metadata(label = "in", description = "The timeout, in milliseconds, after which the executable should be\n" + + "terminated. Overrides any existing `timeout` in the URI.", + javaType = "long") String EXEC_COMMAND_TIMEOUT = "CamelExecCommandTimeout"; /** * The value of this header is a {@link InputStream} with the standard error stream of the executable. */ + @Metadata(label = "out", description = "The value of this header points to the standard error stream (stderr) of\n" + + "the executable. If no stderr is written, the value is `null`.", + javaType = "java.io.InputStream") String EXEC_STDERR = "CamelExecStderr"; /** @@ -74,18 +94,29 @@ public interface ExecBinding { * exit value indicates abnormal termination. <br> * <b>Note that the exit value is OS dependent.</b> */ + @Metadata(label = "out", description = "The value of this header is the _exit value_ of the executable. Non-zero\n" + + "exit values typically indicate abnormal termination. Note that the exit\n" + + "value is OS-dependent.", + javaType = "int") String EXEC_EXIT_VALUE = "CamelExecExitValue"; /** - * The value of this header is a boolean which indicates whether or not to fallback and use stderr when stdout is - * empty. + * The value of this header is a boolean which indicates whether to fallback and use stderr when stdout is empty. */ + @Metadata(label = "in", description = "Indicates that when `stdout` is empty, this component will populate the\n" + + "Camel Message Body with `stderr`. This behavior is disabled (`false`) by\n" + + "default.", + javaType = "boolean") String EXEC_USE_STDERR_ON_EMPTY_STDOUT = "CamelExecUseStderrOnEmptyStdout"; /** * The 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) */ + @Metadata(label = "in", + description = "Logging level to be used for commands during execution. The default value is DEBUG.\n" + + "Possible values are TRACE, DEBUG, INFO, WARN, ERROR or OFF (Values of LoggingLevel enum)", + javaType = "String") String EXEC_COMMAND_LOG_LEVEL = "CamelExecCommandLogLevel"; /** diff --git a/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecEndpoint.java b/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecEndpoint.java index d73bed7..5a54d77 100644 --- a/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecEndpoint.java +++ b/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecEndpoint.java @@ -34,7 +34,7 @@ import org.apache.camel.util.StringHelper; * Execute commands on the underlying operating system. */ @UriEndpoint(firstVersion = "2.3.0", scheme = "exec", title = "Exec", syntax = "exec:executable", producerOnly = true, - category = { Category.SYSTEM }) + category = { Category.SYSTEM }, headersClass = ExecBinding.class) public class ExecEndpoint extends DefaultEndpoint { /**
