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 0c16fbf698f98ca2cd332fa20c3d19ee9e96fc89
Author: Nicolas Filotto <[email protected]>
AuthorDate: Wed Apr 6 10:47:11 2022 +0200

    CAMEL-17792: Add doc about the message headers of camel-velocity
---
 .../apache/camel/component/velocity/velocity.json  |  6 ++++++
 .../src/main/docs/velocity-component.adoc          | 22 ++++------------------
 .../component/velocity/VelocityConstants.java      | 14 +++++++++++---
 .../camel/component/velocity/VelocityEndpoint.java |  2 +-
 4 files changed, 22 insertions(+), 22 deletions(-)

diff --git 
a/components/camel-velocity/src/generated/resources/org/apache/camel/component/velocity/velocity.json
 
b/components/camel-velocity/src/generated/resources/org/apache/camel/component/velocity/velocity.json
index 4994a2acc1e..bd31f0e191f 100644
--- 
a/components/camel-velocity/src/generated/resources/org/apache/camel/component/velocity/velocity.json
+++ 
b/components/camel-velocity/src/generated/resources/org/apache/camel/component/velocity/velocity.json
@@ -28,6 +28,12 @@
     "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 [...]
     "velocityEngine": { "kind": "property", "displayName": "Velocity Engine", 
"group": "advanced", "label": "advanced", "required": false, "type": "object", 
"javaType": "org.apache.velocity.app.VelocityEngine", "deprecated": false, 
"autowired": false, "secret": false, "description": "To use the VelocityEngine 
otherwise a new engine is created" }
   },
+  "headers": {
+    "CamelVelocityResourceUri": { "kind": "header", "displayName": "", 
"group": "producer", "label": "", "required": false, "javaType": "String", 
"deprecated": false, "deprecationNote": "", "autowired": false, "secret": 
false, "description": "The name of the velocity template." },
+    "CamelVelocityTemplate": { "kind": "header", "displayName": "", "group": 
"producer", "label": "", "required": false, "javaType": "String", "deprecated": 
false, "deprecationNote": "", "autowired": false, "secret": false, 
"description": "The content of the velocity template." },
+    "CamelVelocityContext": { "kind": "header", "displayName": "", "group": 
"producer", "label": "", "required": false, "javaType": 
"org.apache.velocity.context.Context", "deprecated": false, "deprecationNote": 
"", "autowired": false, "secret": false, "description": "The velocity context 
to use." },
+    "CamelVelocitySupplementalContext": { "kind": "header", "displayName": "", 
"group": "producer", "label": "", "required": false, "javaType": "Map<String, 
Object>", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "description": "To add additional information to the used 
VelocityContext. The value of this header should be a Map with key\/values that 
will added (override any existing key with the same name). This can be used to 
pre setup some common key\/ [...]
+  },
   "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-velocity/src/main/docs/velocity-component.adoc 
b/components/camel-velocity/src/main/docs/velocity-component.adoc
index 12ff8d2d95c..ef51863c8c8 100644
--- a/components/camel-velocity/src/main/docs/velocity-component.adoc
+++ b/components/camel-velocity/src/main/docs/velocity-component.adoc
@@ -57,26 +57,12 @@ include::partial$component-endpoint-options.adoc[]
 
 // endpoint options: END
 
-
-== Message Headers
-
-You can use the following headers on the message:
-
-[width="100%",cols="10%,90%",options="header",]
-|=======================================================================
-|Header |Description
-
-|`CamelVelocityResourceUri` |The *templateName* as a `String` object.
-
-|`CamelVelocitySupplementalContext` |To add additional information to the used 
VelocityContext.
-The value of this header should be a `Map` with key/values that will
-added (override any existing key with the same name). +
-This can be used to pre setup some common key/values you want to reuse
-in your velocity endpoints.
-|=======================================================================
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
 
 Headers set during the Velocity evaluation are returned to the message
-and added as headers. Then its kinda possible to return values from
+and added as headers. Then it is possible to return values from
 Velocity to the Message.
 
 For example, to set the header value of `fruit` in the Velocity template
diff --git 
a/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityConstants.java
 
b/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityConstants.java
index 6befbe88ad0..6dbded2f0a3 100644
--- 
a/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityConstants.java
+++ 
b/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityConstants.java
@@ -16,17 +16,25 @@
  */
 package org.apache.camel.component.velocity;
 
+import org.apache.camel.spi.Metadata;
+
 /**
  * Velocity Constants.
  */
 public final class VelocityConstants {
 
+    @Metadata(description = "The name of the velocity template.", javaType = 
"String")
     public static final String VELOCITY_RESOURCE_URI = 
"CamelVelocityResourceUri";
-
+    @Metadata(description = "The content of the velocity template.", javaType 
= "String")
     public static final String VELOCITY_TEMPLATE = "CamelVelocityTemplate";
-
+    @Metadata(description = "The velocity context to use.", javaType = 
"org.apache.velocity.context.Context")
     public static final String VELOCITY_CONTEXT = "CamelVelocityContext";
-
+    @Metadata(description = "To add additional information to the used 
VelocityContext.\n" +
+                            "The value of this header should be a `Map` with 
key/values that will\n" +
+                            "added (override any existing key with the same 
name). \n" +
+                            "This can be used to pre setup some common 
key/values you want to reuse\n" +
+                            "in your velocity endpoints.",
+              javaType = "Map<String, Object>")
     public static final String VELOCITY_SUPPLEMENTAL_CONTEXT = 
"CamelVelocitySupplementalContext";
 
     private VelocityConstants() {
diff --git 
a/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityEndpoint.java
 
b/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityEndpoint.java
index 897873bfc72..46aa55c4ad2 100644
--- 
a/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityEndpoint.java
+++ 
b/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityEndpoint.java
@@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory;
  * Transform messages using a Velocity template.
  */
 @UriEndpoint(firstVersion = "1.2.0", scheme = "velocity", title = "Velocity", 
syntax = "velocity:resourceUri",
-             producerOnly = true, category = { Category.TRANSFORMATION })
+             producerOnly = true, category = { Category.TRANSFORMATION }, 
headersClass = VelocityConstants.class)
 public class VelocityEndpoint extends ResourceEndpoint {
 
     private VelocityEngine velocityEngine;

Reply via email to