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 206c3da0568d9d4667235557fc6db9e113293ff8 Author: Nicolas Filotto <[email protected]> AuthorDate: Thu Mar 31 19:17:56 2022 +0200 CAMEL-17792: Add doc about the message headers of camel-mvel --- .../org/apache/camel/component/mvel/mvel.json | 4 ++++ .../camel-mvel/src/main/docs/mvel-component.adoc | 25 +++------------------- .../apache/camel/component/mvel/MvelConstants.java | 7 +++++- .../apache/camel/component/mvel/MvelEndpoint.java | 2 +- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/components/camel-mvel/src/generated/resources/org/apache/camel/component/mvel/mvel.json b/components/camel-mvel/src/generated/resources/org/apache/camel/component/mvel/mvel.json index 0b81e27..baa4976 100644 --- a/components/camel-mvel/src/generated/resources/org/apache/camel/component/mvel/mvel.json +++ b/components/camel-mvel/src/generated/resources/org/apache/camel/component/mvel/mvel.json @@ -27,6 +27,10 @@ "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": { + "CamelMvelResourceUri": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A URI for the template resource to use instead of the endpoint\nconfigured." }, + "CamelMvelTemplate": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The template to use instead of the endpoint configured." } + }, "properties": { "resourceUri": { "kind": "path", "displayName": "Resource Uri", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Path to the resource. You can prefix with: classpath, file, http, ref, or bean. classpath, file and http loads the resource using these protocols (classpath is default). ref will lookup the resource in the registry. bean will [...] "allowContextMapAll": { "kind": "parameter", "displayName": "Allow Context Map All", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether the context map should allow access to all details. By default only the message body and headers can be accessed. This option can be enabled for full access to the current Exchange and CamelContext. [...] diff --git a/components/camel-mvel/src/main/docs/mvel-component.adoc b/components/camel-mvel/src/main/docs/mvel-component.adoc index 4f392c0..ddf7c94 100644 --- a/components/camel-mvel/src/main/docs/mvel-component.adoc +++ b/components/camel-mvel/src/main/docs/mvel-component.adoc @@ -54,19 +54,6 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END - - -== Message Headers - -The MVEL component sets a couple headers on the message. - -[width="100%",cols="10%,90%",options="header",] -|======================================================================= -|Header |Description - -|`CamelMvelResourceUri` |The *templateName* as a `String` object. -|======================================================================= - == MVEL Context Camel will provide exchange information in the MVEL context (just a @@ -101,15 +88,9 @@ location for a template, or the template content itself. If any of these headers is set then Camel uses this over the endpoint configured resource. This allows you to provide a dynamic template at runtime. -[width="100%",cols="10%,10%,80%",options="header",] -|======================================================================= -|Header |Type |Description - -|CamelMvelResourceUri |String |A URI for the template resource to use instead of the endpoint -configured. - -|CamelMvelTemplate |String |The template to use instead of the endpoint configured. -|======================================================================= +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Example diff --git a/components/camel-mvel/src/main/java/org/apache/camel/component/mvel/MvelConstants.java b/components/camel-mvel/src/main/java/org/apache/camel/component/mvel/MvelConstants.java index 6252abb..a5647a6 100644 --- a/components/camel-mvel/src/main/java/org/apache/camel/component/mvel/MvelConstants.java +++ b/components/camel-mvel/src/main/java/org/apache/camel/component/mvel/MvelConstants.java @@ -16,13 +16,18 @@ */ package org.apache.camel.component.mvel; +import org.apache.camel.spi.Metadata; + /** * Mvel constants */ public final class MvelConstants { + @Metadata(description = "A URI for the template resource to use instead of the endpoint\n" + + "configured.", + javaType = "String") public static final String MVEL_RESOURCE_URI = "CamelMvelResourceUri"; - + @Metadata(description = "The template to use instead of the endpoint configured.", javaType = "String") public static final String MVEL_TEMPLATE = "CamelMvelTemplate"; private MvelConstants() { diff --git a/components/camel-mvel/src/main/java/org/apache/camel/component/mvel/MvelEndpoint.java b/components/camel-mvel/src/main/java/org/apache/camel/component/mvel/MvelEndpoint.java index 50dab51..3316c00 100644 --- a/components/camel-mvel/src/main/java/org/apache/camel/component/mvel/MvelEndpoint.java +++ b/components/camel-mvel/src/main/java/org/apache/camel/component/mvel/MvelEndpoint.java @@ -39,7 +39,7 @@ import org.mvel2.templates.TemplateRuntime; * Transform messages using an MVEL template. */ @UriEndpoint(firstVersion = "2.12.0", scheme = "mvel", title = "MVEL", syntax = "mvel:resourceUri", producerOnly = true, - category = { Category.TRANSFORMATION, Category.SCRIPT }) + category = { Category.TRANSFORMATION, Category.SCRIPT }, headersClass = MvelConstants.class) public class MvelEndpoint extends ResourceEndpoint { @UriParam(defaultValue = "false")
