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 9b7457e068744db6031e36515a55c0f5ea78b617
Author: Nicolas Filotto <[email protected]>
AuthorDate: Thu Mar 31 19:25:11 2022 +0200

    CAMEL-17792: Add doc about the message headers of camel-mybatis
---
 .../apache/camel/component/mybatis/mybatis-bean.json  |  3 +++
 .../org/apache/camel/component/mybatis/mybatis.json   |  4 ++++
 .../src/main/docs/mybatis-bean-component.adoc         | 19 +++----------------
 .../src/main/docs/mybatis-component.adoc              | 18 +++---------------
 .../camel/component/mybatis/MyBatisBeanEndpoint.java  |  7 +++++--
 .../camel/component/mybatis/MyBatisConstants.java     | 13 ++++++++++++-
 .../camel/component/mybatis/MyBatisEndpoint.java      |  6 ++++--
 7 files changed, 34 insertions(+), 36 deletions(-)

diff --git 
a/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis-bean.json
 
b/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis-bean.json
index bd668fc..2789ffc 100644
--- 
a/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis-bean.json
+++ 
b/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis-bean.json
@@ -27,6 +27,9 @@
     "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 [...]
     "sqlSessionFactory": { "kind": "property", "displayName": "Sql Session 
Factory", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": "org.apache.ibatis.session.SqlSessionFactory", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
use the SqlSessionFactory" }
   },
+  "headers": {
+    "CamelMyBatisResult": { "kind": "header", "displayName": "", "group": 
"producer", "label": "producer", "required": false, "javaType": "Object", 
"deprecated": false, "deprecationNote": "", "autowired": false, "secret": 
false, "description": "The *response* returned from MtBatis in any of the 
operations. For\ninstance an `INSERT` could return the auto-generated key, or 
number of\nrows etc." }
+  },
   "properties": {
     "beanName": { "kind": "path", "displayName": "Bean Name", "group": 
"producer", "label": "", "required": true, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": 
false, "secret": false, "description": "Name of the bean with the MyBatis 
annotations. This can either by a type alias or a FQN class name." },
     "methodName": { "kind": "path", "displayName": "Method Name", "group": 
"producer", "label": "", "required": true, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": 
false, "secret": false, "description": "Name of the method on the bean that has 
the SQL query to be executed." },
diff --git 
a/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis.json
 
b/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis.json
index ad1c669..fc12f598 100644
--- 
a/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis.json
+++ 
b/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis.json
@@ -28,6 +28,10 @@
     "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 [...]
     "sqlSessionFactory": { "kind": "property", "displayName": "Sql Session 
Factory", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": "org.apache.ibatis.session.SqlSessionFactory", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
use the SqlSessionFactory" }
   },
+  "headers": {
+    "CamelMyBatisResult": { "kind": "header", "displayName": "", "group": 
"producer", "label": "producer", "required": false, "javaType": "Object", 
"deprecated": false, "deprecationNote": "", "autowired": false, "secret": 
false, "description": "The *response* returned from MtBatis in any of the 
operations. For\ninstance an `INSERT` could return the auto-generated key, or 
number of\nrows etc." },
+    "CamelMyBatisStatementName": { "kind": "header", "displayName": "", 
"group": "common", "label": "", "required": false, "javaType": "String", 
"deprecated": false, "deprecationNote": "", "autowired": false, "secret": 
false, "description": "The *statementName* used (for example: insertAccount)." }
+  },
   "properties": {
     "statement": { "kind": "path", "displayName": "Statement", "group": 
"common", "label": "", "required": true, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": 
false, "secret": false, "description": "The statement name in the MyBatis XML 
mapping file which maps to the query, insert, update or delete operation you 
wish to evaluate." },
     "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error 
Handler", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "Allows for bridging the 
consumer to the Camel routing Error Handler, which mean any exceptions occurred 
while the consumer is trying to pickup incoming messages, or the likes, will 
now be processed as a m [...]
diff --git a/components/camel-mybatis/src/main/docs/mybatis-bean-component.adoc 
b/components/camel-mybatis/src/main/docs/mybatis-bean-component.adoc
index 6948fa1..b35516d9 100644
--- a/components/camel-mybatis/src/main/docs/mybatis-bean-component.adoc
+++ b/components/camel-mybatis/src/main/docs/mybatis-bean-component.adoc
@@ -51,22 +51,9 @@ include::partial$component-endpoint-options.adoc[]
 // endpoint options: START
 
 // endpoint options: END
-
-
-
-== Message Headers
-
-Camel will populate the result message, either IN or OUT with a header
-with the statement used:
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|===
-|Header |Type |Description
-
-|`CamelMyBatisResult` |`Object` |The *response* returned from MtBatis in any 
of the operations. For
-instance an `INSERT` could return the auto-generated key, or number of
-rows etc.
-|===
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
 
 == Message Body
 
diff --git a/components/camel-mybatis/src/main/docs/mybatis-component.adoc 
b/components/camel-mybatis/src/main/docs/mybatis-component.adoc
index 66bc481..2abe322 100644
--- a/components/camel-mybatis/src/main/docs/mybatis-component.adoc
+++ b/components/camel-mybatis/src/main/docs/mybatis-component.adoc
@@ -62,23 +62,11 @@ include::partial$component-endpoint-options.adoc[]
 
 // endpoint options: END
 
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
 
 
-== Message Headers
-
-Camel will populate the result message, either IN or OUT with a header
-with the statement used:
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Header |Type |Description
-
-|`CamelMyBatisStatementName` |`String` |The *statementName* used (for example: 
insertAccount).
-
-|`CamelMyBatisResult` |`Object` |The *response* returned from MtBatis in any 
of the operations. For
-instance an `INSERT` could return the auto-generated key, or number of
-rows etc.
-|=======================================================================
 
 == Message Body
 
diff --git 
a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisBeanEndpoint.java
 
b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisBeanEndpoint.java
index 6470913..0aadbff 100644
--- 
a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisBeanEndpoint.java
+++ 
b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisBeanEndpoint.java
@@ -25,11 +25,14 @@ import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriPath;
 
+import static 
org.apache.camel.component.mybatis.MyBatisConstants.SCHEME_MYBATIS_BEAN;
+
 /**
  * Perform queries, inserts, updates or deletes in a relational database using 
MyBatis.
  */
-@UriEndpoint(firstVersion = "2.22.0", scheme = "mybatis-bean", title = 
"MyBatis Bean",
-             syntax = "mybatis-bean:beanName:methodName", producerOnly = true, 
category = { Category.DATABASE, Category.SQL })
+@UriEndpoint(firstVersion = "2.22.0", scheme = SCHEME_MYBATIS_BEAN, title = 
"MyBatis Bean",
+             syntax = "mybatis-bean:beanName:methodName", producerOnly = true, 
category = { Category.DATABASE, Category.SQL },
+             headersClass = MyBatisConstants.class)
 public class MyBatisBeanEndpoint extends BaseMyBatisEndpoint {
 
     @UriPath
diff --git 
a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConstants.java
 
b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConstants.java
index 0f4e56c..7266f8e 100644
--- 
a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConstants.java
+++ 
b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConstants.java
@@ -16,13 +16,24 @@
  */
 package org.apache.camel.component.mybatis;
 
+import org.apache.camel.spi.Metadata;
+
 /**
  * MyBatis constants.
  */
 public final class MyBatisConstants {
 
-    public static final String MYBATIS_RESULT = "CamelMyBatisResult";
+    // The schemes
+    public static final String SCHEME_MYBATIS_BEAN = "mybatis-bean";
+    public static final String SCHEME_MYBATIS = "mybatis";
 
+    @Metadata(label = "producer", description = "The *response* returned from 
MtBatis in any of the operations. For\n" +
+                                                "instance an `INSERT` could 
return the auto-generated key, or number of\n" +
+                                                "rows etc.",
+              javaType = "Object")
+    public static final String MYBATIS_RESULT = "CamelMyBatisResult";
+    @Metadata(description = "The *statementName* used (for example: 
insertAccount).", javaType = "String",
+              applicableFor = SCHEME_MYBATIS)
     public static final String MYBATIS_STATEMENT_NAME = 
"CamelMyBatisStatementName";
 
     private MyBatisConstants() {
diff --git 
a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
 
b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
index b1541c7..a0f8c66 100644
--- 
a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
+++ 
b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
@@ -27,11 +27,13 @@ import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
 import org.apache.camel.util.ObjectHelper;
 
+import static 
org.apache.camel.component.mybatis.MyBatisConstants.SCHEME_MYBATIS;
+
 /**
  * Performs a query, poll, insert, update or delete in a relational database 
using MyBatis.
  */
-@UriEndpoint(firstVersion = "2.7.0", scheme = "mybatis", title = "MyBatis", 
syntax = "mybatis:statement",
-             category = { Category.DATABASE, Category.SQL })
+@UriEndpoint(firstVersion = "2.7.0", scheme = SCHEME_MYBATIS, title = 
"MyBatis", syntax = "mybatis:statement",
+             category = { Category.DATABASE, Category.SQL }, headersClass = 
MyBatisConstants.class)
 public class MyBatisEndpoint extends BaseMyBatisEndpoint {
 
     @UriPath

Reply via email to