You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/03/21 14:42:28 UTC

[camel] 01/13: CAMEL-17792: Add doc about the message headers of camel-ehcache

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 1e20e6fc71d1ef88ffd35f69c1f7820268e84153
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Mon Mar 21 10:51:34 2022 +0100

    CAMEL-17792: Add doc about the message headers of camel-ehcache
---
 .../apache/camel/component/ehcache/ehcache.json    | 10 +++++
 .../src/main/docs/ehcache-component.adoc           | 43 ++--------------------
 .../camel/component/ehcache/EhcacheConstants.java  | 28 ++++++++++++++
 .../camel/component/ehcache/EhcacheEndpoint.java   |  2 +-
 4 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/components/camel-ehcache/src/generated/resources/org/apache/camel/component/ehcache/ehcache.json b/components/camel-ehcache/src/generated/resources/org/apache/camel/component/ehcache/ehcache.json
index 7007544..3a79fbf 100644
--- a/components/camel-ehcache/src/generated/resources/org/apache/camel/component/ehcache/ehcache.json
+++ b/components/camel-ehcache/src/generated/resources/org/apache/camel/component/ehcache/ehcache.json
@@ -39,6 +39,16 @@
     "keyType": { "kind": "property", "displayName": "Key Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ehcache.EhcacheConfiguration", "configurationField": "configuration", "description": "The cache key type, default java.lang.Object" },
     "valueType": { "kind": "property", "displayName": "Value Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ehcache.EhcacheConfiguration", "configurationField": "configuration", "description": "The cache value type, default java.lang.Object" }
   },
+  "headers": {
+    "CamelEhcacheAction": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to be performed on the cache, valid options are:\n\n* CLEAR\n* PUT\n* PUT_ALL\n* PUT_IF_ABSENT\n* GET\n* GET_ALL\n* REMOVE\n* REMOVE_ALL\n* REPLACE" },
+    "CamelEhcacheActionHasResult": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Set to true if the action has a result" },
+    "CamelEhcacheActionSucceeded": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Set to true if the action was successful" },
+    "CamelEhcacheKey": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The cache key used for an action" },
+    "CamelEhcacheKeys": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Set<Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A list of keys, used in\n\n* PUT_ALL\n* GET_ALL\n* REMOVE_ALL" },
+    "CamelEhcacheValue": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The value to put in the cache or the result of an operation" },
+    "CamelEhcacheOldValue": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The old value associated to a key for actions like PUT_IF_ABSENT or the\nObject used for comparison for actions like REPLACE" },
+    "CamelEhcacheEventType": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "EventType", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of event received" }
+  },
   "properties": {
     "cacheName": { "kind": "path", "displayName": "Cache Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "the cache name" },
     "cacheManager": { "kind": "parameter", "displayName": "Cache Manager", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.ehcache.CacheManager", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ehcache.EhcacheConfiguration", "configurationField": "configuration", "description": "The cache manager" },
diff --git a/components/camel-ehcache/src/main/docs/ehcache-component.adoc b/components/camel-ehcache/src/main/docs/ehcache-component.adoc
index 1eb5055..31945d1 100644
--- a/components/camel-ehcache/src/main/docs/ehcache-component.adoc
+++ b/components/camel-ehcache/src/main/docs/ehcache-component.adoc
@@ -51,46 +51,9 @@ include::partial$component-endpoint-options.adoc[]
 
 // endpoint options: END
 
-
-
-=== Message Headers Camel 
-
- 
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Header |Type |Description
-
-|CamelEhcacheAction |`String` |The operation to be perfomed on the cache, valid options are:
-
-* CLEAR
-* PUT
-* PUT_ALL
-* PUT_IF_ABSENT
-* GET
-* GET_ALL
-* REMOVE
-* REMOVE_ALL
-* REPLACE
-
-|CamelEhcacheActionHasResult |Boolean |Set to true if the action has a result
-
-|CamelEhcacheActionSucceeded |`Boolean` |Set to true if the actionsuccedded
-
-|CamelEhcacheKey |Object |The cache key used for an action
-
-|CamelEhcacheKeys |Set<Object> |A list of keys, used in
-
-* PUT_ALL
-* GET_ALL
-* REMOVE_ALL
-
-|CamelEhcacheValue |Object |The value to put in the cache or the result of an operation
-
-|CamelEhcacheOldValue |Object |The old value associated to a key for actions like PUT_IF_ABSENT or the
-Object used for comparison for actions like REPLACE
-
-|CamelEhcacheEventType |EventType |The type of event received
-|=======================================================================
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
 
 == Ehcache based idempotent repository example:
 
diff --git a/components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheConstants.java b/components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheConstants.java
index 8719ac7..d9ba28a 100644
--- a/components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheConstants.java
+++ b/components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheConstants.java
@@ -16,14 +16,42 @@
  */
 package org.apache.camel.component.ehcache;
 
+import org.apache.camel.spi.Metadata;
+
 public interface EhcacheConstants {
+    @Metadata(description = "The operation to be performed on the cache, valid options are:\n" +
+                            "\n" +
+                            "* CLEAR\n" +
+                            "* PUT\n" +
+                            "* PUT_ALL\n" +
+                            "* PUT_IF_ABSENT\n" +
+                            "* GET\n" +
+                            "* GET_ALL\n" +
+                            "* REMOVE\n" +
+                            "* REMOVE_ALL\n" +
+                            "* REPLACE",
+              javaType = "String")
     String ACTION = "CamelEhcacheAction";
+    @Metadata(description = "Set to true if the action has a result", javaType = "Boolean")
     String ACTION_HAS_RESULT = "CamelEhcacheActionHasResult";
+    @Metadata(description = "Set to true if the action was successful", javaType = "Boolean")
     String ACTION_SUCCEEDED = "CamelEhcacheActionSucceeded";
+    @Metadata(description = "The cache key used for an action", javaType = "Object")
     String KEY = "CamelEhcacheKey";
+    @Metadata(description = "A list of keys, used in\n" +
+                            "\n" +
+                            "* PUT_ALL\n" +
+                            "* GET_ALL\n" +
+                            "* REMOVE_ALL\n",
+              javaType = "Set<Object>")
     String KEYS = "CamelEhcacheKeys";
+    @Metadata(description = "The value to put in the cache or the result of an operation", javaType = "Object")
     String VALUE = "CamelEhcacheValue";
+    @Metadata(description = "The old value associated to a key for actions like PUT_IF_ABSENT or the\n" +
+                            "Object used for comparison for actions like REPLACE",
+              javaType = "Object")
     String OLD_VALUE = "CamelEhcacheOldValue";
+    @Metadata(description = "The type of event received", javaType = "EventType")
     String EVENT_TYPE = "CamelEhcacheEventType";
 
     String ACTION_CLEAR = "CLEAR";
diff --git a/components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheEndpoint.java b/components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheEndpoint.java
index 51a6b52..8b5b78b 100644
--- a/components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheEndpoint.java
+++ b/components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheEndpoint.java
@@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
  * Perform caching operations using <a href="http://www.ehcache.org">Ehcache</a>.
  */
 @UriEndpoint(firstVersion = "2.18.0", scheme = "ehcache", title = "Ehcache", syntax = "ehcache:cacheName",
-             category = { Category.CACHE, Category.DATAGRID, Category.CLUSTERING })
+             category = { Category.CACHE, Category.DATAGRID, Category.CLUSTERING }, headersClass = EhcacheConstants.class)
 public class EhcacheEndpoint extends DefaultEndpoint {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(EhcacheComponent.class);