This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch feature/CAMEL-24961-catalog-body-types-most-used in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9ac1f8d3623cd027fb9b4a25b22d1cd9d182ceb4 Author: Claus Ibsen <[email protected]> AuthorDate: Thu Oct 22 11:50:19 2026 +0200 CAMEL-24961: Catalog body types for jira, github2, pqc, dns, caffeine and infinispan The body types of jira, github2, pqc, dns, caffeine-cache, caffeine-loadcache, infinispan and infinispan-embedded, the most used components in the route files that had none yet. pqc, dns, caffeine and infinispan-embedded were checked at runtime with camel run; jira and github2 were read from the code. The validator now takes an option a body depends on as unknown also when another option of the step names a body, such as xslt with output=bytes and a resultHandlerFactory, as the BodyType javadoc says. The component docs of jira, github2, dns and infinispan said things about the body that the code does not do. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../camel/catalog/components/caffeine-cache.json | 4 ++ .../catalog/components/caffeine-loadcache.json | 4 ++ .../org/apache/camel/catalog/components/dns.json | 4 ++ .../apache/camel/catalog/components/github2.json | 5 ++ .../catalog/components/infinispan-embedded.json | 5 ++ .../camel/catalog/components/infinispan.json | 5 ++ .../org/apache/camel/catalog/components/jira.json | 5 ++ .../org/apache/camel/catalog/components/pqc.json | 4 ++ .../apache/camel/catalog/docs/dns-component.adoc | 6 +- .../camel/catalog/docs/github2-component.adoc | 8 ++- .../camel/catalog/docs/infinispan-component.adoc | 40 +++++++----- .../docs/infinispan-embedded-component.adoc | 34 +++++----- .../apache/camel/catalog/docs/jira-component.adoc | 10 ++- .../component/caffeine/cache/caffeine-cache.json | 4 ++ .../caffeine/load/caffeine-loadcache.json | 4 ++ .../caffeine/cache/CaffeineCacheEndpoint.java | 24 ++++++++ .../caffeine/load/CaffeineLoadCacheEndpoint.java | 25 ++++++++ .../org/apache/camel/component/dns/dns.json | 4 ++ .../camel-dns/src/main/docs/dns-component.adoc | 6 +- .../apache/camel/component/dns/DnsEndpoint.java | 20 ++++++ .../apache/camel/component/github2/github2.json | 5 ++ .../src/main/docs/github2-component.adoc | 8 ++- .../camel/component/github2/GitHub2Endpoint.java | 59 ++++++++++++++++++ .../infinispan/embedded/infinispan-embedded.json | 5 ++ .../main/docs/infinispan-embedded-component.adoc | 34 +++++----- .../embedded/InfinispanEmbeddedEndpoint.java | 47 ++++++++++++++ .../component/infinispan/remote/infinispan.json | 5 ++ .../src/main/docs/infinispan-component.adoc | 40 +++++++----- .../remote/InfinispanRemoteEndpoint.java | 47 ++++++++++++++ .../org/apache/camel/component/jira/jira.json | 5 ++ .../camel-jira/src/main/docs/jira-component.adoc | 10 ++- .../apache/camel/component/jira/JiraEndpoint.java | 59 ++++++++++++++++++ .../org/apache/camel/component/pqc/pqc.json | 4 ++ .../apache/camel/component/pqc/PQCEndpoint.java | 54 ++++++++++++++++ .../camel/dsl/yaml/validator/CatalogBodyTypes.java | 9 +++ .../camel/dsl/yaml/validator/TextBodyFlowTest.java | 72 ++++++++++++++++++++++ 36 files changed, 602 insertions(+), 82 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/caffeine-cache.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/caffeine-cache.json index 268c39da8b4d..7e1cada6d649 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/caffeine-cache.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/caffeine-cache.json @@ -51,6 +51,10 @@ "CamelCaffeineValue": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The value of key for all put actions (PUT or PUT_ALL).", "constantName": "org.apache.camel.component.caffeine.CaffeineConstants#VALUE" }, "CamelCaffeineOldValue": { "index": 6, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The old value returned according to the action.", "constantName": "org.apache.camel.component.caffeine.CaffeineConstants#OLD_VALUE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "description": "The value to store for PUT, converted to the valueType when set, and a Map of the entries for PUT_ALL, unless the CamelCaffeineValue header gives it; without either they fail. The other actions do not use the body" }, + "producerOut": { "carriers": [ "unknown" ], "byOption": [ { "option": "action", "value": "GET_ALL", "carriers": [ "map" ], "javaType": "java.util.Map" }, { "option": "action", "value": "AS_MAP", "carriers": [ "map" ], "javaType": "java.util.concurrent.ConcurrentMap" }, { "option": "action", "value": "PUT", "carriers": [ "unchanged" ] }, { "option": "action", "value": "PUT_ALL", "carriers": [ "unchanged" ] }, { "option": "action", "value": "INVALIDATE", "carriers": [ "unchanged" ] }, [...] + }, "properties": { "cacheName": { "index": 0, "kind": "path", "displayName": "Cache Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Cache name" }, "action": { "index": 1, "kind": "parameter", "displayName": "Action", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "GET", "GET_ALL", "PUT", "PUT_ALL", "INVALIDATE", "INVALIDATE_ALL", "CLEANUP", "AS_MAP" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure the def [...] diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/caffeine-loadcache.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/caffeine-loadcache.json index 2ce307d4d9dc..32a660551b7f 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/caffeine-loadcache.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/caffeine-loadcache.json @@ -51,6 +51,10 @@ "CamelCaffeineValue": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The value of key for all put actions (PUT or PUT_ALL).", "constantName": "org.apache.camel.component.caffeine.CaffeineConstants#VALUE" }, "CamelCaffeineOldValue": { "index": 6, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The old value returned according to the action.", "constantName": "org.apache.camel.component.caffeine.CaffeineConstants#OLD_VALUE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "description": "The value to store for PUT, converted to the valueType when set, and a Map of the entries for PUT_ALL, unless the CamelCaffeineValue header gives it; without either they fail. The other actions do not use the body" }, + "producerOut": { "carriers": [ "unknown" ], "byOption": [ { "option": "action", "value": "GET_ALL", "carriers": [ "map" ], "javaType": "java.util.Map" }, { "option": "action", "value": "AS_MAP", "carriers": [ "map" ], "javaType": "java.util.concurrent.ConcurrentMap" }, { "option": "action", "value": "PUT", "carriers": [ "unchanged" ] }, { "option": "action", "value": "PUT_ALL", "carriers": [ "unchanged" ] }, { "option": "action", "value": "INVALIDATE", "carriers": [ "unchanged" ] }, [...] + }, "properties": { "cacheName": { "index": 0, "kind": "path", "displayName": "Cache Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "the cache name" }, "action": { "index": 1, "kind": "parameter", "displayName": "Action", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "GET", "GET_ALL", "PUT", "PUT_ALL", "INVALIDATE", "INVALIDATE_ALL", "CLEANUP", "AS_MAP" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure the def [...] diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/dns.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/dns.json index 9bd010f45fe9..065d7bed0e5b 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/dns.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/dns.json @@ -35,6 +35,10 @@ "CamelDnsType": { "index": 4, "kind": "header", "displayName": "", "group": "lookup dig", "label": "lookup dig", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of the lookup. Should match the values of org.xbill.dns.Type. Optional.", "constantName": "org.apache.camel.component.dns.DnsConstants#DNS_TYPE" }, "CamelDnsTerm": { "index": 5, "kind": "header", "displayName": "", "group": "wikipedia", "label": "wikipedia", "required": true, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The term", "constantName": "org.apache.camel.component.dns.DnsConstants#TERM" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "description": "The body is not used: the name to query is in a header, CamelDnsDomain for ip, CamelDnsName for lookup and dig, and CamelDnsTerm for wikipedia" }, + "producerOut": { "carriers": [ "unknown" ], "byOption": [ { "option": "dnsType", "value": "ip", "carriers": [ "pojo" ], "javaType": "java.net.InetAddress" }, { "option": "dnsType", "value": "lookup", "carriers": [ "list" ], "javaType": "org.xbill.DNS.Record[]" }, { "option": "dnsType", "value": "dig", "carriers": [ "pojo" ], "javaType": "org.xbill.DNS.Message" }, { "option": "dnsType", "value": "wikipedia", "carriers": [ "text", "null" ] } ], "description": "By the type: for ip the I [...] + }, "properties": { "dnsType": { "index": 0, "kind": "path", "displayName": "Dns Type", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.dns.DnsType", "enum": [ "dig", "ip", "lookup", "wikipedia" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of the lookup." }, "lazyStartProducer": { "index": 1, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "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 produc [...] diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/github2.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/github2.json index e956fb8a2d63..236cd99c0805 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/github2.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/github2.json @@ -43,6 +43,11 @@ "CamelGitHubCommitUrl": { "index": 7, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The commit URL", "constantName": "org.apache.camel.component.github2.GitHub2Constants#GITHUB_COMMIT_URL" }, "CamelGitHubEventPayload": { "index": 8, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "org.kohsuke.github.GHEventPayload", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event payload", "constantName": "org.apache.camel.component.github2.GitHub2Constants#GITHUB_EVENT_PAYLOAD" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "text", "null" ], "byOption": [ { "option": "commitMessageAsBody", "value": "false", "carriers": [ "pojo" ], "javaType": "org.kohsuke.github.GHCommit" }, { "option": "type", "value": "PULLREQUEST", "carriers": [ "pojo" ], "javaType": "org.kohsuke.github.GHPullRequest" }, { "option": "type", "value": "PULLREQUESTCOMMENT", "carriers": [ "pojo" ], "javaType": "org.kohsuke.github.GHIssueComment" }, { "option": "type", "value": "TAG", "carriers": [ "pojo" ], [...] + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "type", "value": "PULLREQUESTCOMMENT", "carriers": [ "text", "bytes", "stream", "file" ] }, { "option": "type", "value": "CREATEISSUE", "carriers": [ "null", "text", "bytes", "stream", "file" ] }, { "option": "type", "value": "PULLREQUESTSTATE", "carriers": [ "null", "text", "bytes", "stream", "file" ] } ], "description": "Read as text: the comment for pullRequestComment, which needs a body, and the description of the i [...] + "producerOut": { "carriers": [ "unknown" ], "byOption": [ { "option": "type", "value": "CLOSEPULLREQUEST", "carriers": [ "pojo" ], "javaType": "org.kohsuke.github.GHPullRequest" }, { "option": "type", "value": "PULLREQUESTCOMMENT", "carriers": [ "pojo", "unchanged" ] }, { "option": "type", "value": "PULLREQUESTSTATE", "carriers": [ "pojo" ], "javaType": "org.kohsuke.github.GHCommitStatus" }, { "option": "type", "value": "PULLREQUESTFILES", "carriers": [ "list" ], "javaType": "java.ut [...] + }, "properties": { "type": { "index": 0, "kind": "path", "displayName": "Type", "group": "common", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.github2.GitHub2Type", "enum": [ "CLOSEPULLREQUEST", "PULLREQUESTCOMMENT", "COMMIT", "PULLREQUEST", "TAG", "PULLREQUESTSTATE", "PULLREQUESTFILES", "GETCOMMITFILE", "CREATEISSUE", "EVENT" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "What git operation to execute" }, "branchName": { "index": 1, "kind": "path", "displayName": "Branch Name", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of branch" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan-embedded.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan-embedded.json index c50ae628c899..cf0d4383893d 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan-embedded.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan-embedded.json @@ -69,6 +69,11 @@ "CamelInfinispanOriginLocal": { "index": 20, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "true if the call originated on the local cache instance; false if originated from a remote one.", "constantName": "org.apache.camel.component.infinispan.InfinispanConstants#ORIGIN_LOCAL" }, "CamelInfinispanCurrentState": { "index": 21, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "True if this event is generated from an existing entry as the listener has Listener.", "constantName": "org.apache.camel.component.infinispan.InfinispanConstants#CURRENT_STATE" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "null" ], "dependsOn": [ "customListener" ], "description": "No body: the event type, the cache name and the key of the entry are in headers, and the value, when the event has one, in the CamelInfinispanEventData header" }, + "producerIn": { "carriers": [ "any" ], "description": "The body is not used: the key, the value and the Map for PUTALL come from the CamelInfinispanKey, CamelInfinispanValue and CamelInfinispanMap headers, or the key and value options" }, + "producerOut": { "carriers": [ "unknown" ], "dependsOn": [ "resultHeader" ], "byOption": [ { "option": "operation", "value": "PUTASYNC", "carriers": [ "pojo" ], "javaType": "java.util.concurrent.CompletableFuture" }, { "option": "operation", "value": "PUTALL", "carriers": [ "unchanged" ] }, { "option": "operation", "value": "PUTALLASYNC", "carriers": [ "pojo" ], "javaType": "java.util.concurrent.CompletableFuture" }, { "option": "operation", "value": "PUTIFABSENTASYNC", "carriers": [ [...] + }, "properties": { "cacheName": { "index": 0, "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 name of the cache to use. Use current to use the existing cache name from the currently configured cached manager. Or use default for the default cache manager name." }, "queryBuilder": { "index": 1, "kind": "parameter", "displayName": "Query Builder", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.infinispan.InfinispanQueryBuilder", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Specifies the query builder." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan.json index 39e6f3ebde04..d7949aa592fb 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/infinispan.json @@ -78,6 +78,11 @@ "CamelInfinispanEntryVersion": { "index": 16, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Provides access to the version of the created cache entry.", "constantName": "org.apache.camel.component.infinispan.InfinispanConstants#ENTRY_VERSION" }, "CamelInfinispanCommandRetried": { "index": 17, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "This will be true if the write command that caused this had to be retried again due to a topology change.", "constantName": "org.apache.camel.component.infinispan.InfinispanConstants#COMMAND_RETRIED" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "null" ], "dependsOn": [ "customListener" ], "description": "No body: the event type, the cache name and the key of the entry are in headers, and for the events of a continuous query (queryBuilder) the value in the CamelInfinispanEventData header" }, + "producerIn": { "carriers": [ "any" ], "description": "The body is not used: the key, the value and the Map for PUTALL come from the CamelInfinispanKey, CamelInfinispanValue and CamelInfinispanMap headers, or the key and value options" }, + "producerOut": { "carriers": [ "unknown" ], "dependsOn": [ "resultHeader" ], "byOption": [ { "option": "operation", "value": "PUTASYNC", "carriers": [ "pojo" ], "javaType": "java.util.concurrent.CompletableFuture" }, { "option": "operation", "value": "PUTALL", "carriers": [ "unchanged" ] }, { "option": "operation", "value": "PUTALLASYNC", "carriers": [ "pojo" ], "javaType": "java.util.concurrent.CompletableFuture" }, { "option": "operation", "value": "PUTIFABSENTASYNC", "carriers": [ [...] + }, "properties": { "cacheName": { "index": 0, "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 name of the cache to use. Use current to use the existing cache name from the currently configured cached manager. Or use default for the default cache manager name." }, "hosts": { "index": 1, "kind": "parameter", "displayName": "Hosts", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Specifies the host of the cache on Infinispan instance. Multiple hosts can be separated by semicolon." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jira.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jira.json index 2b0b518a69fe..947280f4bdc1 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jira.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jira.json @@ -60,6 +60,11 @@ "CamelJiraLinkType": { "index": 17, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of link", "constantName": "org.apache.camel.component.jira.JiraConstants#LINK_TYPE" }, "CamelJiraMinutesSpent": { "index": 18, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "-1", "description": "The minutes spent", "constantName": "org.apache.camel.component.jira.JiraConstants#MINUTES_SPENT" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "pojo", "null" ], "dependsOn": [ "watchedFields" ], "byOption": [ { "option": "sendOnlyUpdatedField", "value": "false", "carriers": [ "pojo" ], "javaType": "com.atlassian.jira.rest.client.api.domain.Issue" }, { "option": "type", "value": "NEWISSUES", "carriers": [ "pojo" ], "javaType": "com.atlassian.jira.rest.client.api.domain.Issue" }, { "option": "type", "value": "NEWCOMMENTS", "carriers": [ "pojo" ], "javaType": "com.atlassian.jira.rest.client.api.d [...] + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "type", "value": "ADDISSUE", "carriers": [ "null", "text", "bytes", "stream", "file" ] }, { "option": "type", "value": "UPDATEISSUE", "carriers": [ "null", "text", "bytes", "stream", "file" ] }, { "option": "type", "value": "TRANSITIONISSUE", "carriers": [ "null", "text", "bytes", "stream", "file" ] }, { "option": "type", "value": "ADDISSUELINK", "carriers": [ "null", "text", "bytes", "stream", "file" ] }, { "option": " [...] + "producerOut": { "carriers": [ "unchanged" ], "byOption": [ { "option": "type", "value": "ADDISSUE", "carriers": [ "pojo" ], "javaType": "com.atlassian.jira.rest.client.api.domain.Issue" }, { "option": "type", "value": "FETCHISSUE", "carriers": [ "pojo" ], "javaType": "com.atlassian.jira.rest.client.api.domain.Issue" }, { "option": "type", "value": "FETCHCOMMENTS", "carriers": [ "list" ], "javaType": "java.util.List<com.atlassian.jira.rest.client.api.domain.Comment>" } ], "descriptio [...] + }, "properties": { "type": { "index": 0, "kind": "path", "displayName": "Type", "group": "common", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.jira.JiraType", "enum": [ "ADDCOMMENT", "ADDISSUE", "ATTACH", "DELETEISSUE", "NEWISSUES", "NEWCOMMENTS", "WATCHUPDATES", "UPDATEISSUE", "TRANSITIONISSUE", "WATCHERS", "ADDISSUELINK", "ADDWORKLOG", "FETCHISSUE", "FETCHCOMMENTS" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "descripti [...] "delay": { "index": 1, "kind": "parameter", "displayName": "Delay", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 6000, "configurationClass": "org.apache.camel.component.jira.JiraConfiguration", "configurationField": "configuration", "description": "Time in milliseconds to elapse for the next poll." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pqc.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pqc.json index 39a2d8dc3ff6..c3aeb57ed737 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pqc.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pqc.json @@ -81,6 +81,10 @@ "CamelPQCHybridEncapsulation": { "index": 21, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "byte[]", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The hybrid encapsulation combining both classical and PQC encapsulations", "constantName": "org.apache.camel.component.pqc.PQCConstants#HYBRID_ENCAPSULATION" }, "CamelPQCHybridVerification": { "index": 22, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The verification result of hybrid signature (both must pass)", "constantName": "org.apache.camel.component.pqc.PQCConstants#HYBRID_VERIFY" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "sign", "carriers": [ "text", "bytes", "stream" ] }, { "option": "operation", "value": "verify", "carriers": [ "text", "bytes", "stream" ] }, { "option": "operation", "value": "hybridSign", "carriers": [ "text", "bytes", "stream" ] }, { "option": "operation", "value": "hybridVerify", "carriers": [ "text", "bytes", "stream" ] }, { "option": "operation", "value": "extractSecretKeyEncapsulation", "car [...] + "producerOut": { "carriers": [ "unchanged" ], "byOption": [ { "option": "operation", "value": "generateSecretKeyEncapsulation", "carriers": [ "pojo" ], "javaType": "org.bouncycastle.jcajce.SecretKeyWithEncapsulation" }, { "option": "operation", "value": "extractSecretKeyEncapsulation", "carriers": [ "pojo" ], "javaType": "org.bouncycastle.jcajce.SecretKeyWithEncapsulation" }, { "option": "operation", "value": "extractSecretKeyFromEncapsulation", "carriers": [ "pojo" ], "javaType": "j [...] + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pqc.PQCConfiguration", "configurationField": "configuration", "description": "Logical name" }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.pqc.PQCOperations", "enum": [ "sign", "verify", "hybridSign", "hybridVerify", "generateSecretKeyEncapsulation", "extractSecretKeyEncapsulation", "extractSecretKeyFromEncapsulation", "hybridGenerateSecretKeyEncapsulation", "hybridExtractSecretKeyEncapsulation", "hybridExtractSecretKeyFromEncapsulation", [...] diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/dns-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/dns-component.adoc index 63f273f75cf5..e2d3c2ac17e8 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/dns-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/dns-component.adoc @@ -17,7 +17,7 @@ DNSJava. The component is a thin layer on top of http://www.xbill.org/dnsjava/[DNSJava]. The component offers the following operations: -* `ip`: to resolve a domain by its ip +* `ip`: to resolve a domain to its ip * `lookup`: to lookup information about the domain * `dig`: to run DNS queries @@ -97,7 +97,7 @@ YAML:: This looks up a domain's IP. For example, _www.example.com_ resolves to 192.0.32.10. -The IP address to lookup must be provided in the header with key `"CamelDnsDomain"`. +The domain to resolve must be provided in the header with key `"CamelDnsDomain"`. === DNS lookup @@ -135,7 +135,7 @@ YAML:: ---- ==== -This returns a set of DNS records associated with a domain. + +This returns the DNS records associated with a domain, as an array of `org.xbill.DNS.Record`. + The name to lookup must be provided in the header with key `"CamelDnsName"`. diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/github2-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/github2-component.adoc index 446143a8382c..93cab2b50627 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/github2-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/github2-component.adoc @@ -121,14 +121,15 @@ YAML:: |pullRequest |polling |`org.kohsuke.github.GHPullRequest` -|pullRequestComment |polling |`org.kohsuke.github.GHPullRequestReviewComment` +|pullRequestComment |polling |`org.kohsuke.github.GHIssueComment` |tag |polling |`org.kohsuke.github.GHTag` |commit |polling |`org.kohsuke.github.GHCommit` or `String` with commit message and headers with some metadata. This can be configured by the `commitMessageAsBody` option. -|event |polling |`org.kohsuke.github.GHEventInfo` +|event |polling |`String` with the type of the event, such as `PUSH`, and the `org.kohsuke.github.GHEventInfo` in the +`CamelGitHubEventPayload` header |======================================================================= === Producer Endpoints @@ -147,7 +148,8 @@ pull request discussion is assumed. |createIssue |String (issue body text) | - `CamelGitHubIssueTitle` (String) (REQUIRED): Issue Title. -|pullRequestState |none | - `CamelGitHubPullRequest` (integer) (REQUIRED): Pull request number. +|pullRequestState |String (description of the status) | - `CamelGitHubPullRequestHeadCommitSha` (String) (REQUIRED): The sha +of the commit to set the status on. Sets the commit status on a pull request. |pullRequestFiles |none | - `CamelGitHubPullRequest` (integer) (REQUIRED): Pull request number. diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc index a6a5b9645c52..0cf7dff60b1f 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-component.adoc @@ -66,8 +66,8 @@ This section lists all available operations, along with their header information ** `CamelInfinispanLifespanTimeUnit` ** `CamelInfinispanMaxIdleTime` ** `CamelInfinispanMaxIdleTimeUnit` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Put All Operations [cols="40%,60%a", options="header"] @@ -106,8 +106,8 @@ The resulting value is returned in the exchange *body*. * *Required Headers* ** `CamelInfinispanKey` -* *Result Header* -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Contains Value Operation [cols="40%,60%a", options="header"] @@ -118,8 +118,8 @@ The resulting value is returned in the exchange *body*. * *Required Headers*: ** `CamelInfinispanValue` -* *Result Header* -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Remove Operations [cols="40%,60%a", options="header"] @@ -133,8 +133,8 @@ The resulting value is returned in the exchange *body*. ** `CamelInfinispanValue` * *Optional Headers*: ** `CamelInfinispanValue` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Replace Operations [cols="40%,60%a", options="header"] @@ -153,8 +153,8 @@ The resulting value is returned in the exchange *body*. ** `CamelInfinispanLifespanTimeUnit` ** `CamelInfinispanMaxIdleTime` ** `CamelInfinispanMaxIdleTimeUnit` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Clear Operations [cols="40%,60%a", options="header"] @@ -171,8 +171,8 @@ The resulting value is returned in the exchange *body*. | `InfinispanOperation.SIZE` | Returns the number of entries in the cache |=== -* *Result Header* -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Stats Operation [cols="40%,60%a", options="header"] @@ -181,8 +181,8 @@ The resulting value is returned in the exchange *body*. | `InfinispanOperation.STATS` | Returns statistics about the cache |=== -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Query Operation [cols="40%,60%a", options="header"] @@ -213,11 +213,13 @@ Java:: from("direct:start") .setHeader("CamelInfinispanOperation").constant("PUT") // <1> .setHeader("CamelInfinispanKey").constant("123") // <2> - .to("infinispan:myCacheName?cacheContainer=#cacheContainer"); // <3> + .setHeader("CamelInfinispanValue").constant("Hello") // <3> + .to("infinispan:myCacheName?cacheContainer=#cacheContainer"); // <4> ---- <1> Set the operation to perform <2> Set the key used to identify the element in the cache -<3> Use the configured cache manager `cacheContainer` from the registry to put an element to the cache named `myCacheName` +<3> Set the value to store: the message body is not used +<4> Use the configured cache manager `cacheContainer` from the registry to put an element to the cache named `myCacheName` XML:: + @@ -231,6 +233,9 @@ XML:: <setHeader name="CamelInfinispanKey"> <constant>123</constant> </setHeader> + <setHeader name="CamelInfinispanValue"> + <constant>Hello</constant> + </setHeader> <to uri="infinispan:myCacheName?cacheContainer=#cacheContainer"/> </route> ---- @@ -249,6 +254,9 @@ YAML:: - setHeader: name: CamelInfinispanKey constant: "123" + - setHeader: + name: CamelInfinispanValue + constant: Hello - to: uri: infinispan:myCacheName parameters: diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc index 6be7f5019d0f..3c9b623f0233 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/infinispan-embedded-component.adoc @@ -81,8 +81,8 @@ This section lists all available operations, along with their header information ** `CamelInfinispanLifespanTimeUnit` ** `CamelInfinispanMaxIdleTime` ** `CamelInfinispanMaxIdleTimeUnit` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Put All Operations [cols="40%,60%a", options="header"] @@ -120,8 +120,8 @@ This section lists all available operations, along with their header information * *Required Headers* ** `CamelInfinispanKey` -* *Result Header* -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Contains Value Operation [cols="40%,60%a", options="header"] @@ -146,8 +146,8 @@ This section lists all available operations, along with their header information ** `CamelInfinispanKey` * *Optional Headers*: ** `CamelInfinispanValue` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Replace Operations [cols="40%,60%a", options="header"] @@ -166,8 +166,8 @@ This section lists all available operations, along with their header information ** `CamelInfinispanLifespanTimeUnit` ** `CamelInfinispanMaxIdleTime` ** `CamelInfinispanMaxIdleTimeUnit` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Clear Operations [cols="40%,60%a", options="header"] @@ -184,8 +184,8 @@ This section lists all available operations, along with their header information | `InfinispanOperation.SIZE` | Returns the number of entries in the cache |=== -* *Result Header* -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Stats Operation [cols="40%,60%a", options="header"] @@ -194,8 +194,8 @@ This section lists all available operations, along with their header information | `InfinispanOperation.STATS` | Returns statistics about the cache |=== -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Query Operation [cols="40%,60%a", options="header"] @@ -206,8 +206,8 @@ This section lists all available operations, along with their header information * *Required Headers*: ** `CamelInfinispanQueryBuilder` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option [NOTE] ==== @@ -225,11 +225,13 @@ Write methods like put(key, value) and remove(key) do not return the previous va from("direct:start") .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.PUT) // <1> .setHeader(InfinispanConstants.KEY).constant("123") // <2> - .to("infinispan-embedded:myCacheName?cacheContainer=#cacheContainer"); // <3> + .setHeader(InfinispanConstants.VALUE).constant("Hello") // <3> + .to("infinispan-embedded:myCacheName?cacheContainer=#cacheContainer"); // <4> ---- <1> Set the operation to perform <2> Set the key used to identify the element in the cache -<3> Use the configured cache manager `cacheContainer` from the registry to put an element to the cache named `myCacheName` +<3> Set the value to store: the message body is not used +<4> Use the configured cache manager `cacheContainer` from the registry to put an element to the cache named `myCacheName` -- + It is possible to configure the lifetime and/or the idle time before the entry expires and gets evicted from the cache, as example: diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/jira-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/jira-component.adoc index 62980d533155..8f47121aa03e 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/jira-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/jira-component.adoc @@ -238,7 +238,7 @@ Optional: Required: * `CamelJiraIssueKey`: The issue key identifier. -* the body of the exchange is the description. +* the body of the exchange is the text of the comment. === Attach @@ -247,7 +247,8 @@ Only one file should attach per invocation. Required: * `CamelJiraIssueKey`: The issue key identifier. -* body of the exchange should be of type `File` +* the body of the exchange is the file to attach: a `File`, the file of the file consumer, or text, bytes or a stream, +named by the `CamelFileName` header === DeleteIssue @@ -261,7 +262,10 @@ Required: * `CamelJiraIssueKey`: The issue key identifier. * `CamelJiraIssueTransitionId`: The issue transition `id`. -* the body of the exchange is the description. + +Optional: + +* the body of the exchange is a comment to add to the issue after the transition. === UpdateIssue diff --git a/components/camel-caffeine/src/generated/resources/META-INF/org/apache/camel/component/caffeine/cache/caffeine-cache.json b/components/camel-caffeine/src/generated/resources/META-INF/org/apache/camel/component/caffeine/cache/caffeine-cache.json index 268c39da8b4d..7e1cada6d649 100644 --- a/components/camel-caffeine/src/generated/resources/META-INF/org/apache/camel/component/caffeine/cache/caffeine-cache.json +++ b/components/camel-caffeine/src/generated/resources/META-INF/org/apache/camel/component/caffeine/cache/caffeine-cache.json @@ -51,6 +51,10 @@ "CamelCaffeineValue": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The value of key for all put actions (PUT or PUT_ALL).", "constantName": "org.apache.camel.component.caffeine.CaffeineConstants#VALUE" }, "CamelCaffeineOldValue": { "index": 6, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The old value returned according to the action.", "constantName": "org.apache.camel.component.caffeine.CaffeineConstants#OLD_VALUE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "description": "The value to store for PUT, converted to the valueType when set, and a Map of the entries for PUT_ALL, unless the CamelCaffeineValue header gives it; without either they fail. The other actions do not use the body" }, + "producerOut": { "carriers": [ "unknown" ], "byOption": [ { "option": "action", "value": "GET_ALL", "carriers": [ "map" ], "javaType": "java.util.Map" }, { "option": "action", "value": "AS_MAP", "carriers": [ "map" ], "javaType": "java.util.concurrent.ConcurrentMap" }, { "option": "action", "value": "PUT", "carriers": [ "unchanged" ] }, { "option": "action", "value": "PUT_ALL", "carriers": [ "unchanged" ] }, { "option": "action", "value": "INVALIDATE", "carriers": [ "unchanged" ] }, [...] + }, "properties": { "cacheName": { "index": 0, "kind": "path", "displayName": "Cache Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Cache name" }, "action": { "index": 1, "kind": "parameter", "displayName": "Action", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "GET", "GET_ALL", "PUT", "PUT_ALL", "INVALIDATE", "INVALIDATE_ALL", "CLEANUP", "AS_MAP" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure the def [...] diff --git a/components/camel-caffeine/src/generated/resources/META-INF/org/apache/camel/component/caffeine/load/caffeine-loadcache.json b/components/camel-caffeine/src/generated/resources/META-INF/org/apache/camel/component/caffeine/load/caffeine-loadcache.json index 2ce307d4d9dc..32a660551b7f 100644 --- a/components/camel-caffeine/src/generated/resources/META-INF/org/apache/camel/component/caffeine/load/caffeine-loadcache.json +++ b/components/camel-caffeine/src/generated/resources/META-INF/org/apache/camel/component/caffeine/load/caffeine-loadcache.json @@ -51,6 +51,10 @@ "CamelCaffeineValue": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The value of key for all put actions (PUT or PUT_ALL).", "constantName": "org.apache.camel.component.caffeine.CaffeineConstants#VALUE" }, "CamelCaffeineOldValue": { "index": 6, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The old value returned according to the action.", "constantName": "org.apache.camel.component.caffeine.CaffeineConstants#OLD_VALUE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "description": "The value to store for PUT, converted to the valueType when set, and a Map of the entries for PUT_ALL, unless the CamelCaffeineValue header gives it; without either they fail. The other actions do not use the body" }, + "producerOut": { "carriers": [ "unknown" ], "byOption": [ { "option": "action", "value": "GET_ALL", "carriers": [ "map" ], "javaType": "java.util.Map" }, { "option": "action", "value": "AS_MAP", "carriers": [ "map" ], "javaType": "java.util.concurrent.ConcurrentMap" }, { "option": "action", "value": "PUT", "carriers": [ "unchanged" ] }, { "option": "action", "value": "PUT_ALL", "carriers": [ "unchanged" ] }, { "option": "action", "value": "INVALIDATE", "carriers": [ "unchanged" ] }, [...] + }, "properties": { "cacheName": { "index": 0, "kind": "path", "displayName": "Cache Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "the cache name" }, "action": { "index": 1, "kind": "parameter", "displayName": "Action", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "GET", "GET_ALL", "PUT", "PUT_ALL", "INVALIDATE", "INVALIDATE_ALL", "CLEANUP", "AS_MAP" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure the def [...] diff --git a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpoint.java b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpoint.java index 8ed4bb8c919c..f894367f75dc 100644 --- a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpoint.java +++ b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpoint.java @@ -24,6 +24,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.caffeine.CaffeineConfiguration; import org.apache.camel.component.caffeine.CaffeineConstants; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -38,6 +41,27 @@ import org.apache.camel.support.DefaultEndpoint; remote = false, internal = true, syntax = "caffeine-cache:cacheName", category = { Category.CACHE, Category.CLUSTERING }, producerOnly = true, headersClass = CaffeineConstants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + description = "The value to store for PUT, converted to the valueType when set, and a Map of" + + " the entries for PUT_ALL, unless the CamelCaffeineValue header gives it;" + + " without either they fail. The other actions do not use the body"), + producerOut = @BodyType(value = Carrier.UNKNOWN, + byOption = { + @BodyType.When(option = "action", value = "GET_ALL", carriers = Carrier.MAP, + javaType = "java.util.Map"), + @BodyType.When(option = "action", value = "AS_MAP", carriers = Carrier.MAP, + javaType = "java.util.concurrent.ConcurrentMap"), + @BodyType.When(option = "action", value = "PUT", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "PUT_ALL", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "INVALIDATE", + carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "INVALIDATE_ALL", + carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "CLEANUP", carriers = Carrier.UNCHANGED) }, + description = "By the action, which the CamelCaffeineAction header can set: the value of the" + + " key for GET, or the body as it was when the key is not in the cache, a Map" + + " of the entries found for GET_ALL, and the cache as a Map for AS_MAP. The" + + " other actions keep the body")) public class CaffeineCacheEndpoint extends DefaultEndpoint { @UriPath(description = "Cache name") diff --git a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpoint.java b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpoint.java index 755d0b779957..58bcf8183d7b 100644 --- a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpoint.java +++ b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpoint.java @@ -24,6 +24,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.caffeine.CaffeineConfiguration; import org.apache.camel.component.caffeine.CaffeineConstants; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -38,6 +41,28 @@ import org.apache.camel.support.DefaultEndpoint; remote = false, internal = true, syntax = "caffeine-loadcache:cacheName", category = { Category.CACHE, Category.CLUSTERING }, producerOnly = true, headersClass = CaffeineConstants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + description = "The value to store for PUT, converted to the valueType when set, and a Map of" + + " the entries for PUT_ALL, unless the CamelCaffeineValue header gives it;" + + " without either they fail. The other actions do not use the body"), + producerOut = @BodyType(value = Carrier.UNKNOWN, + byOption = { + @BodyType.When(option = "action", value = "GET_ALL", carriers = Carrier.MAP, + javaType = "java.util.Map"), + @BodyType.When(option = "action", value = "AS_MAP", carriers = Carrier.MAP, + javaType = "java.util.concurrent.ConcurrentMap"), + @BodyType.When(option = "action", value = "PUT", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "PUT_ALL", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "INVALIDATE", + carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "INVALIDATE_ALL", + carriers = Carrier.UNCHANGED), + @BodyType.When(option = "action", value = "CLEANUP", carriers = Carrier.UNCHANGED) }, + description = "By the action, which the CamelCaffeineAction header can set: the value of the" + + " key for GET, from the cache or else the cacheLoader, or the body as it was" + + " when the loader gives null, a Map of the entries found or loaded for" + + " GET_ALL, and the cache as a Map for AS_MAP. The other actions keep the" + + " body")) public class CaffeineLoadCacheEndpoint extends DefaultEndpoint { @UriPath(description = "the cache name") @Metadata(required = true) diff --git a/components/camel-dns/src/generated/resources/META-INF/org/apache/camel/component/dns/dns.json b/components/camel-dns/src/generated/resources/META-INF/org/apache/camel/component/dns/dns.json index 9bd010f45fe9..065d7bed0e5b 100644 --- a/components/camel-dns/src/generated/resources/META-INF/org/apache/camel/component/dns/dns.json +++ b/components/camel-dns/src/generated/resources/META-INF/org/apache/camel/component/dns/dns.json @@ -35,6 +35,10 @@ "CamelDnsType": { "index": 4, "kind": "header", "displayName": "", "group": "lookup dig", "label": "lookup dig", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of the lookup. Should match the values of org.xbill.dns.Type. Optional.", "constantName": "org.apache.camel.component.dns.DnsConstants#DNS_TYPE" }, "CamelDnsTerm": { "index": 5, "kind": "header", "displayName": "", "group": "wikipedia", "label": "wikipedia", "required": true, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The term", "constantName": "org.apache.camel.component.dns.DnsConstants#TERM" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "description": "The body is not used: the name to query is in a header, CamelDnsDomain for ip, CamelDnsName for lookup and dig, and CamelDnsTerm for wikipedia" }, + "producerOut": { "carriers": [ "unknown" ], "byOption": [ { "option": "dnsType", "value": "ip", "carriers": [ "pojo" ], "javaType": "java.net.InetAddress" }, { "option": "dnsType", "value": "lookup", "carriers": [ "list" ], "javaType": "org.xbill.DNS.Record[]" }, { "option": "dnsType", "value": "dig", "carriers": [ "pojo" ], "javaType": "org.xbill.DNS.Message" }, { "option": "dnsType", "value": "wikipedia", "carriers": [ "text", "null" ] } ], "description": "By the type: for ip the I [...] + }, "properties": { "dnsType": { "index": 0, "kind": "path", "displayName": "Dns Type", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.dns.DnsType", "enum": [ "dig", "ip", "lookup", "wikipedia" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of the lookup." }, "lazyStartProducer": { "index": 1, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "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 produc [...] diff --git a/components/camel-dns/src/main/docs/dns-component.adoc b/components/camel-dns/src/main/docs/dns-component.adoc index 63f273f75cf5..e2d3c2ac17e8 100644 --- a/components/camel-dns/src/main/docs/dns-component.adoc +++ b/components/camel-dns/src/main/docs/dns-component.adoc @@ -17,7 +17,7 @@ DNSJava. The component is a thin layer on top of http://www.xbill.org/dnsjava/[DNSJava]. The component offers the following operations: -* `ip`: to resolve a domain by its ip +* `ip`: to resolve a domain to its ip * `lookup`: to lookup information about the domain * `dig`: to run DNS queries @@ -97,7 +97,7 @@ YAML:: This looks up a domain's IP. For example, _www.example.com_ resolves to 192.0.32.10. -The IP address to lookup must be provided in the header with key `"CamelDnsDomain"`. +The domain to resolve must be provided in the header with key `"CamelDnsDomain"`. === DNS lookup @@ -135,7 +135,7 @@ YAML:: ---- ==== -This returns a set of DNS records associated with a domain. + +This returns the DNS records associated with a domain, as an array of `org.xbill.DNS.Record`. + The name to lookup must be provided in the header with key `"CamelDnsName"`. diff --git a/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsEndpoint.java b/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsEndpoint.java index 05b5fba1824a..7a57bfe3d357 100644 --- a/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsEndpoint.java +++ b/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsEndpoint.java @@ -21,6 +21,9 @@ import org.apache.camel.Component; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriPath; @@ -31,6 +34,23 @@ import org.apache.camel.support.DefaultEndpoint; */ @UriEndpoint(firstVersion = "2.7.0", scheme = "dns", title = "DNS", syntax = "dns:dnsType", producerOnly = true, category = { Category.NETWORKING }, headersClass = DnsConstants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + description = "The body is not used: the name to query is in a header, CamelDnsDomain for ip," + + " CamelDnsName for lookup and dig, and CamelDnsTerm for wikipedia"), + producerOut = @BodyType(value = Carrier.UNKNOWN, + byOption = { + @BodyType.When(option = "dnsType", value = "ip", carriers = Carrier.POJO, + javaType = "java.net.InetAddress"), + @BodyType.When(option = "dnsType", value = "lookup", carriers = Carrier.LIST, + javaType = "org.xbill.DNS.Record[]"), + @BodyType.When(option = "dnsType", value = "dig", carriers = Carrier.POJO, + javaType = "org.xbill.DNS.Message"), + @BodyType.When(option = "dnsType", value = "wikipedia", + carriers = { Carrier.TEXT, Carrier.NULL }) }, + description = "By the type: for ip the InetAddress of the domain, which converts to the" + + " address as text; for lookup the records of the answer as an array of" + + " Record, and the lookup fails when there are none; for dig the response" + + " Message; for wikipedia the text of the first TXT record, or no body")) public class DnsEndpoint extends DefaultEndpoint { @UriPath diff --git a/components/camel-github2/src/generated/resources/META-INF/org/apache/camel/component/github2/github2.json b/components/camel-github2/src/generated/resources/META-INF/org/apache/camel/component/github2/github2.json index e956fb8a2d63..236cd99c0805 100644 --- a/components/camel-github2/src/generated/resources/META-INF/org/apache/camel/component/github2/github2.json +++ b/components/camel-github2/src/generated/resources/META-INF/org/apache/camel/component/github2/github2.json @@ -43,6 +43,11 @@ "CamelGitHubCommitUrl": { "index": 7, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The commit URL", "constantName": "org.apache.camel.component.github2.GitHub2Constants#GITHUB_COMMIT_URL" }, "CamelGitHubEventPayload": { "index": 8, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "org.kohsuke.github.GHEventPayload", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event payload", "constantName": "org.apache.camel.component.github2.GitHub2Constants#GITHUB_EVENT_PAYLOAD" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "text", "null" ], "byOption": [ { "option": "commitMessageAsBody", "value": "false", "carriers": [ "pojo" ], "javaType": "org.kohsuke.github.GHCommit" }, { "option": "type", "value": "PULLREQUEST", "carriers": [ "pojo" ], "javaType": "org.kohsuke.github.GHPullRequest" }, { "option": "type", "value": "PULLREQUESTCOMMENT", "carriers": [ "pojo" ], "javaType": "org.kohsuke.github.GHIssueComment" }, { "option": "type", "value": "TAG", "carriers": [ "pojo" ], [...] + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "type", "value": "PULLREQUESTCOMMENT", "carriers": [ "text", "bytes", "stream", "file" ] }, { "option": "type", "value": "CREATEISSUE", "carriers": [ "null", "text", "bytes", "stream", "file" ] }, { "option": "type", "value": "PULLREQUESTSTATE", "carriers": [ "null", "text", "bytes", "stream", "file" ] } ], "description": "Read as text: the comment for pullRequestComment, which needs a body, and the description of the i [...] + "producerOut": { "carriers": [ "unknown" ], "byOption": [ { "option": "type", "value": "CLOSEPULLREQUEST", "carriers": [ "pojo" ], "javaType": "org.kohsuke.github.GHPullRequest" }, { "option": "type", "value": "PULLREQUESTCOMMENT", "carriers": [ "pojo", "unchanged" ] }, { "option": "type", "value": "PULLREQUESTSTATE", "carriers": [ "pojo" ], "javaType": "org.kohsuke.github.GHCommitStatus" }, { "option": "type", "value": "PULLREQUESTFILES", "carriers": [ "list" ], "javaType": "java.ut [...] + }, "properties": { "type": { "index": 0, "kind": "path", "displayName": "Type", "group": "common", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.github2.GitHub2Type", "enum": [ "CLOSEPULLREQUEST", "PULLREQUESTCOMMENT", "COMMIT", "PULLREQUEST", "TAG", "PULLREQUESTSTATE", "PULLREQUESTFILES", "GETCOMMITFILE", "CREATEISSUE", "EVENT" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "What git operation to execute" }, "branchName": { "index": 1, "kind": "path", "displayName": "Branch Name", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of branch" }, diff --git a/components/camel-github2/src/main/docs/github2-component.adoc b/components/camel-github2/src/main/docs/github2-component.adoc index 446143a8382c..93cab2b50627 100644 --- a/components/camel-github2/src/main/docs/github2-component.adoc +++ b/components/camel-github2/src/main/docs/github2-component.adoc @@ -121,14 +121,15 @@ YAML:: |pullRequest |polling |`org.kohsuke.github.GHPullRequest` -|pullRequestComment |polling |`org.kohsuke.github.GHPullRequestReviewComment` +|pullRequestComment |polling |`org.kohsuke.github.GHIssueComment` |tag |polling |`org.kohsuke.github.GHTag` |commit |polling |`org.kohsuke.github.GHCommit` or `String` with commit message and headers with some metadata. This can be configured by the `commitMessageAsBody` option. -|event |polling |`org.kohsuke.github.GHEventInfo` +|event |polling |`String` with the type of the event, such as `PUSH`, and the `org.kohsuke.github.GHEventInfo` in the +`CamelGitHubEventPayload` header |======================================================================= === Producer Endpoints @@ -147,7 +148,8 @@ pull request discussion is assumed. |createIssue |String (issue body text) | - `CamelGitHubIssueTitle` (String) (REQUIRED): Issue Title. -|pullRequestState |none | - `CamelGitHubPullRequest` (integer) (REQUIRED): Pull request number. +|pullRequestState |String (description of the status) | - `CamelGitHubPullRequestHeadCommitSha` (String) (REQUIRED): The sha +of the commit to set the status on. Sets the commit status on a pull request. |pullRequestFiles |none | - `CamelGitHubPullRequest` (integer) (REQUIRED): Pull request number. diff --git a/components/camel-github2/src/main/java/org/apache/camel/component/github2/GitHub2Endpoint.java b/components/camel-github2/src/main/java/org/apache/camel/component/github2/GitHub2Endpoint.java index 23d56fc73413..ba76c037e790 100644 --- a/components/camel-github2/src/main/java/org/apache/camel/component/github2/GitHub2Endpoint.java +++ b/components/camel-github2/src/main/java/org/apache/camel/component/github2/GitHub2Endpoint.java @@ -32,6 +32,9 @@ import org.apache.camel.component.github2.producer.GetCommitFileProducer; import org.apache.camel.component.github2.producer.PullRequestCommentProducer; import org.apache.camel.component.github2.producer.PullRequestFilesProducer; import org.apache.camel.component.github2.producer.PullRequestStateProducer; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; @@ -58,6 +61,62 @@ import org.apache.camel.util.StringHelper; */ @UriEndpoint(firstVersion = "4.18.0", scheme = "github2", title = "GitHub2", syntax = "github2:type/branchName", category = { Category.FILE, Category.CLOUD, Category.API }, headersClass = GitHub2Constants.class) +@BodyTypes(consumerOut = @BodyType(value = { Carrier.TEXT, Carrier.NULL }, + byOption = { + @BodyType.When(option = "commitMessageAsBody", value = "false", + carriers = Carrier.POJO, javaType = "org.kohsuke.github.GHCommit"), + @BodyType.When(option = "type", value = "PULLREQUEST", carriers = Carrier.POJO, + javaType = "org.kohsuke.github.GHPullRequest"), + @BodyType.When(option = "type", value = "PULLREQUESTCOMMENT", + carriers = Carrier.POJO, + javaType = "org.kohsuke.github.GHIssueComment"), + @BodyType.When(option = "type", value = "TAG", carriers = Carrier.POJO, + javaType = "org.kohsuke.github.GHTag"), + @BodyType.When(option = "type", value = "EVENT", carriers = Carrier.TEXT, + javaType = "java.lang.String") }, + description = "One message per new item, oldest first. commit gives the commit message (null" + + " when the data of the commit cannot be loaded), or the GHCommit with" + + " commitMessageAsBody=false, and event the type of the event, such as PUSH," + + " with the GHEventInfo in the CamelGitHubEventPayload header"), + producerIn = @BodyType(value = Carrier.ANY, + byOption = { + @BodyType.When(option = "type", value = "PULLREQUESTCOMMENT", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }), + @BodyType.When(option = "type", value = "CREATEISSUE", + carriers = { + Carrier.NULL, Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, + Carrier.FILE }), + @BodyType.When(option = "type", value = "PULLREQUESTSTATE", + carriers = { + Carrier.NULL, Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, + Carrier.FILE }) }, + description = "Read as text: the comment for pullRequestComment, which needs a body, and the" + + " description of the issue for createIssue and of the commit status for" + + " pullRequestState; a Map or a POJO is sent as its toString(), so marshal it" + + " first. getCommitFile reads the sha from the body when the" + + " CamelGitHubCommitSha header is not set, and the other types read only" + + " headers"), + producerOut = @BodyType(value = Carrier.UNKNOWN, + byOption = { + @BodyType.When(option = "type", value = "CLOSEPULLREQUEST", carriers = Carrier.POJO, + javaType = "org.kohsuke.github.GHPullRequest"), + @BodyType.When(option = "type", value = "PULLREQUESTCOMMENT", + carriers = { Carrier.POJO, Carrier.UNCHANGED }), + @BodyType.When(option = "type", value = "PULLREQUESTSTATE", carriers = Carrier.POJO, + javaType = "org.kohsuke.github.GHCommitStatus"), + @BodyType.When(option = "type", value = "PULLREQUESTFILES", carriers = Carrier.LIST, + javaType = "java.util.List<org.kohsuke.github.GHPullRequestFileDetail>"), + @BodyType.When(option = "type", value = "GETCOMMITFILE", carriers = Carrier.TEXT, + javaType = "java.lang.String"), + @BodyType.When(option = "type", value = "CREATEISSUE", carriers = Carrier.POJO, + javaType = "org.kohsuke.github.GHIssue") }, + description = "The GHPullRequest as read before the close for closePullRequest, the" + + " GHIssueComment for pullRequestComment when the exchange expects a reply" + + " (InOut), otherwise the body is unchanged, the GHCommitStatus for" + + " pullRequestState, a List of GHPullRequestFileDetail for pullRequestFiles," + + " the content of the file as text for getCommitFile, and the GHIssue for" + + " createIssue")) public class GitHub2Endpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { @UriPath diff --git a/components/camel-infinispan/camel-infinispan-embedded/src/generated/resources/META-INF/org/apache/camel/component/infinispan/embedded/infinispan-embedded.json b/components/camel-infinispan/camel-infinispan-embedded/src/generated/resources/META-INF/org/apache/camel/component/infinispan/embedded/infinispan-embedded.json index c50ae628c899..cf0d4383893d 100644 --- a/components/camel-infinispan/camel-infinispan-embedded/src/generated/resources/META-INF/org/apache/camel/component/infinispan/embedded/infinispan-embedded.json +++ b/components/camel-infinispan/camel-infinispan-embedded/src/generated/resources/META-INF/org/apache/camel/component/infinispan/embedded/infinispan-embedded.json @@ -69,6 +69,11 @@ "CamelInfinispanOriginLocal": { "index": 20, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "true if the call originated on the local cache instance; false if originated from a remote one.", "constantName": "org.apache.camel.component.infinispan.InfinispanConstants#ORIGIN_LOCAL" }, "CamelInfinispanCurrentState": { "index": 21, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "True if this event is generated from an existing entry as the listener has Listener.", "constantName": "org.apache.camel.component.infinispan.InfinispanConstants#CURRENT_STATE" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "null" ], "dependsOn": [ "customListener" ], "description": "No body: the event type, the cache name and the key of the entry are in headers, and the value, when the event has one, in the CamelInfinispanEventData header" }, + "producerIn": { "carriers": [ "any" ], "description": "The body is not used: the key, the value and the Map for PUTALL come from the CamelInfinispanKey, CamelInfinispanValue and CamelInfinispanMap headers, or the key and value options" }, + "producerOut": { "carriers": [ "unknown" ], "dependsOn": [ "resultHeader" ], "byOption": [ { "option": "operation", "value": "PUTASYNC", "carriers": [ "pojo" ], "javaType": "java.util.concurrent.CompletableFuture" }, { "option": "operation", "value": "PUTALL", "carriers": [ "unchanged" ] }, { "option": "operation", "value": "PUTALLASYNC", "carriers": [ "pojo" ], "javaType": "java.util.concurrent.CompletableFuture" }, { "option": "operation", "value": "PUTIFABSENTASYNC", "carriers": [ [...] + }, "properties": { "cacheName": { "index": 0, "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 name of the cache to use. Use current to use the existing cache name from the currently configured cached manager. Or use default for the default cache manager name." }, "queryBuilder": { "index": 1, "kind": "parameter", "displayName": "Query Builder", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.infinispan.InfinispanQueryBuilder", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.embedded.InfinispanEmbeddedConfiguration", "configurationField": "configuration", "description": "Specifies the query builder." }, diff --git a/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc b/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc index 6be7f5019d0f..3c9b623f0233 100644 --- a/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc +++ b/components/camel-infinispan/camel-infinispan-embedded/src/main/docs/infinispan-embedded-component.adoc @@ -81,8 +81,8 @@ This section lists all available operations, along with their header information ** `CamelInfinispanLifespanTimeUnit` ** `CamelInfinispanMaxIdleTime` ** `CamelInfinispanMaxIdleTimeUnit` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Put All Operations [cols="40%,60%a", options="header"] @@ -120,8 +120,8 @@ This section lists all available operations, along with their header information * *Required Headers* ** `CamelInfinispanKey` -* *Result Header* -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Contains Value Operation [cols="40%,60%a", options="header"] @@ -146,8 +146,8 @@ This section lists all available operations, along with their header information ** `CamelInfinispanKey` * *Optional Headers*: ** `CamelInfinispanValue` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Replace Operations [cols="40%,60%a", options="header"] @@ -166,8 +166,8 @@ This section lists all available operations, along with their header information ** `CamelInfinispanLifespanTimeUnit` ** `CamelInfinispanMaxIdleTime` ** `CamelInfinispanMaxIdleTimeUnit` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Clear Operations [cols="40%,60%a", options="header"] @@ -184,8 +184,8 @@ This section lists all available operations, along with their header information | `InfinispanOperation.SIZE` | Returns the number of entries in the cache |=== -* *Result Header* -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Stats Operation [cols="40%,60%a", options="header"] @@ -194,8 +194,8 @@ This section lists all available operations, along with their header information | `InfinispanOperation.STATS` | Returns statistics about the cache |=== -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Query Operation [cols="40%,60%a", options="header"] @@ -206,8 +206,8 @@ This section lists all available operations, along with their header information * *Required Headers*: ** `CamelInfinispanQueryBuilder` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option [NOTE] ==== @@ -225,11 +225,13 @@ Write methods like put(key, value) and remove(key) do not return the previous va from("direct:start") .setHeader(InfinispanConstants.OPERATION).constant(InfinispanOperation.PUT) // <1> .setHeader(InfinispanConstants.KEY).constant("123") // <2> - .to("infinispan-embedded:myCacheName?cacheContainer=#cacheContainer"); // <3> + .setHeader(InfinispanConstants.VALUE).constant("Hello") // <3> + .to("infinispan-embedded:myCacheName?cacheContainer=#cacheContainer"); // <4> ---- <1> Set the operation to perform <2> Set the key used to identify the element in the cache -<3> Use the configured cache manager `cacheContainer` from the registry to put an element to the cache named `myCacheName` +<3> Set the value to store: the message body is not used +<4> Use the configured cache manager `cacheContainer` from the registry to put an element to the cache named `myCacheName` -- + It is possible to configure the lifetime and/or the idle time before the entry expires and gets evicted from the cache, as example: diff --git a/components/camel-infinispan/camel-infinispan-embedded/src/main/java/org/apache/camel/component/infinispan/embedded/InfinispanEmbeddedEndpoint.java b/components/camel-infinispan/camel-infinispan-embedded/src/main/java/org/apache/camel/component/infinispan/embedded/InfinispanEmbeddedEndpoint.java index 711209647812..1191173e3e22 100644 --- a/components/camel-infinispan/camel-infinispan-embedded/src/main/java/org/apache/camel/component/infinispan/embedded/InfinispanEmbeddedEndpoint.java +++ b/components/camel-infinispan/camel-infinispan-embedded/src/main/java/org/apache/camel/component/infinispan/embedded/InfinispanEmbeddedEndpoint.java @@ -23,6 +23,9 @@ import org.apache.camel.Producer; import org.apache.camel.component.infinispan.InfinispanComponent; import org.apache.camel.component.infinispan.InfinispanConstants; import org.apache.camel.component.infinispan.InfinispanEndpoint; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -36,6 +39,50 @@ import static org.apache.camel.component.infinispan.InfinispanConstants.SCHEME_E @UriEndpoint(firstVersion = "2.13.0", scheme = SCHEME_EMBEDDED, title = "Infinispan Embedded", syntax = "infinispan-embedded:cacheName", category = { Category.CACHE, Category.CLUSTERING }, headersClass = InfinispanConstants.class) +@BodyTypes(consumerOut = @BodyType(value = Carrier.NULL, dependsOn = "customListener", + description = "No body: the event type, the cache name and the key of the entry are in" + + " headers, and the value, when the event has one, in the" + + " CamelInfinispanEventData header"), + producerIn = @BodyType(value = Carrier.ANY, + description = "The body is not used: the key, the value and the Map for PUTALL come from the" + + " CamelInfinispanKey, CamelInfinispanValue and CamelInfinispanMap headers, or" + + " the key and value options"), + producerOut = @BodyType(value = Carrier.UNKNOWN, dependsOn = "resultHeader", + byOption = { + @BodyType.When(option = "operation", value = "PUTASYNC", carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture"), + @BodyType.When(option = "operation", value = "PUTALL", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "operation", value = "PUTALLASYNC", carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture"), + @BodyType.When(option = "operation", value = "PUTIFABSENTASYNC", + carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture"), + @BodyType.When(option = "operation", value = "CONTAINSKEY", carriers = Carrier.VALUE, + javaType = "java.lang.Boolean"), + @BodyType.When(option = "operation", value = "CONTAINSVALUE", + carriers = Carrier.VALUE, + javaType = "java.lang.Boolean"), + @BodyType.When(option = "operation", value = "REMOVEASYNC", carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture"), + @BodyType.When(option = "operation", value = "REPLACEASYNC", carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture"), + @BodyType.When(option = "operation", value = "SIZE", carriers = Carrier.VALUE, + javaType = "java.lang.Integer"), + @BodyType.When(option = "operation", value = "CLEAR", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "operation", value = "CLEARASYNC", carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture"), + @BodyType.When(option = "operation", value = "QUERY", + carriers = { Carrier.LIST, Carrier.UNCHANGED }), + @BodyType.When(option = "operation", value = "STATS", carriers = Carrier.POJO, + javaType = "org.infinispan.stats.Stats"), + @BodyType.When(option = "operation", value = "COMPUTEASYNC", carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture") }, + description = "The result of the operation, which the CamelInfinispanOperation header can" + + " set: the value for GET, or null when the key is not in the cache, the" + + " previous value for PUT, the default, a Boolean for CONTAINSKEY, an Integer" + + " for SIZE, a List for QUERY and a CompletableFuture for the ASYNC" + + " operations; PUTALL and CLEAR keep the body. With resultHeader the result" + + " goes to that header and the body is kept")) public class InfinispanEmbeddedEndpoint extends InfinispanEndpoint { @UriPath(description = "The name of the cache to use. Use current to use the existing cache name from the currently configured cached manager. Or use default for the default cache manager name.") diff --git a/components/camel-infinispan/camel-infinispan/src/generated/resources/META-INF/org/apache/camel/component/infinispan/remote/infinispan.json b/components/camel-infinispan/camel-infinispan/src/generated/resources/META-INF/org/apache/camel/component/infinispan/remote/infinispan.json index 39e6f3ebde04..d7949aa592fb 100644 --- a/components/camel-infinispan/camel-infinispan/src/generated/resources/META-INF/org/apache/camel/component/infinispan/remote/infinispan.json +++ b/components/camel-infinispan/camel-infinispan/src/generated/resources/META-INF/org/apache/camel/component/infinispan/remote/infinispan.json @@ -78,6 +78,11 @@ "CamelInfinispanEntryVersion": { "index": 16, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Provides access to the version of the created cache entry.", "constantName": "org.apache.camel.component.infinispan.InfinispanConstants#ENTRY_VERSION" }, "CamelInfinispanCommandRetried": { "index": 17, "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "This will be true if the write command that caused this had to be retried again due to a topology change.", "constantName": "org.apache.camel.component.infinispan.InfinispanConstants#COMMAND_RETRIED" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "null" ], "dependsOn": [ "customListener" ], "description": "No body: the event type, the cache name and the key of the entry are in headers, and for the events of a continuous query (queryBuilder) the value in the CamelInfinispanEventData header" }, + "producerIn": { "carriers": [ "any" ], "description": "The body is not used: the key, the value and the Map for PUTALL come from the CamelInfinispanKey, CamelInfinispanValue and CamelInfinispanMap headers, or the key and value options" }, + "producerOut": { "carriers": [ "unknown" ], "dependsOn": [ "resultHeader" ], "byOption": [ { "option": "operation", "value": "PUTASYNC", "carriers": [ "pojo" ], "javaType": "java.util.concurrent.CompletableFuture" }, { "option": "operation", "value": "PUTALL", "carriers": [ "unchanged" ] }, { "option": "operation", "value": "PUTALLASYNC", "carriers": [ "pojo" ], "javaType": "java.util.concurrent.CompletableFuture" }, { "option": "operation", "value": "PUTIFABSENTASYNC", "carriers": [ [...] + }, "properties": { "cacheName": { "index": 0, "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 name of the cache to use. Use current to use the existing cache name from the currently configured cached manager. Or use default for the default cache manager name." }, "hosts": { "index": 1, "kind": "parameter", "displayName": "Hosts", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.infinispan.remote.InfinispanRemoteConfiguration", "configurationField": "configuration", "description": "Specifies the host of the cache on Infinispan instance. Multiple hosts can be separated by semicolon." }, diff --git a/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc b/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc index a6a5b9645c52..0cf7dff60b1f 100644 --- a/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc +++ b/components/camel-infinispan/camel-infinispan/src/main/docs/infinispan-component.adoc @@ -66,8 +66,8 @@ This section lists all available operations, along with their header information ** `CamelInfinispanLifespanTimeUnit` ** `CamelInfinispanMaxIdleTime` ** `CamelInfinispanMaxIdleTimeUnit` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Put All Operations [cols="40%,60%a", options="header"] @@ -106,8 +106,8 @@ The resulting value is returned in the exchange *body*. * *Required Headers* ** `CamelInfinispanKey` -* *Result Header* -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Contains Value Operation [cols="40%,60%a", options="header"] @@ -118,8 +118,8 @@ The resulting value is returned in the exchange *body*. * *Required Headers*: ** `CamelInfinispanValue` -* *Result Header* -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Remove Operations [cols="40%,60%a", options="header"] @@ -133,8 +133,8 @@ The resulting value is returned in the exchange *body*. ** `CamelInfinispanValue` * *Optional Headers*: ** `CamelInfinispanValue` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Replace Operations [cols="40%,60%a", options="header"] @@ -153,8 +153,8 @@ The resulting value is returned in the exchange *body*. ** `CamelInfinispanLifespanTimeUnit` ** `CamelInfinispanMaxIdleTime` ** `CamelInfinispanMaxIdleTimeUnit` -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Clear Operations [cols="40%,60%a", options="header"] @@ -171,8 +171,8 @@ The resulting value is returned in the exchange *body*. | `InfinispanOperation.SIZE` | Returns the number of entries in the cache |=== -* *Result Header* -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Stats Operation [cols="40%,60%a", options="header"] @@ -181,8 +181,8 @@ The resulting value is returned in the exchange *body*. | `InfinispanOperation.STATS` | Returns statistics about the cache |=== -* *Result Header*: -** `CamelInfinispanOperationResult` +* *Result*: +** the message body, or the header named by the `resultHeader` option .Query Operation [cols="40%,60%a", options="header"] @@ -213,11 +213,13 @@ Java:: from("direct:start") .setHeader("CamelInfinispanOperation").constant("PUT") // <1> .setHeader("CamelInfinispanKey").constant("123") // <2> - .to("infinispan:myCacheName?cacheContainer=#cacheContainer"); // <3> + .setHeader("CamelInfinispanValue").constant("Hello") // <3> + .to("infinispan:myCacheName?cacheContainer=#cacheContainer"); // <4> ---- <1> Set the operation to perform <2> Set the key used to identify the element in the cache -<3> Use the configured cache manager `cacheContainer` from the registry to put an element to the cache named `myCacheName` +<3> Set the value to store: the message body is not used +<4> Use the configured cache manager `cacheContainer` from the registry to put an element to the cache named `myCacheName` XML:: + @@ -231,6 +233,9 @@ XML:: <setHeader name="CamelInfinispanKey"> <constant>123</constant> </setHeader> + <setHeader name="CamelInfinispanValue"> + <constant>Hello</constant> + </setHeader> <to uri="infinispan:myCacheName?cacheContainer=#cacheContainer"/> </route> ---- @@ -249,6 +254,9 @@ YAML:: - setHeader: name: CamelInfinispanKey constant: "123" + - setHeader: + name: CamelInfinispanValue + constant: Hello - to: uri: infinispan:myCacheName parameters: diff --git a/components/camel-infinispan/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteEndpoint.java b/components/camel-infinispan/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteEndpoint.java index c5c9c633e0f8..4b566f620f3b 100644 --- a/components/camel-infinispan/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteEndpoint.java +++ b/components/camel-infinispan/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/remote/InfinispanRemoteEndpoint.java @@ -25,6 +25,9 @@ import org.apache.camel.Producer; import org.apache.camel.component.infinispan.InfinispanComponent; import org.apache.camel.component.infinispan.InfinispanConstants; import org.apache.camel.component.infinispan.InfinispanEndpoint; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; @@ -39,6 +42,50 @@ import static org.apache.camel.component.infinispan.InfinispanConstants.SCHEME_I */ @UriEndpoint(firstVersion = "2.13.0", scheme = SCHEME_INFINISPAN, title = "Infinispan", syntax = "infinispan:cacheName", category = { Category.CACHE, Category.CLUSTERING }, headersClass = InfinispanConstants.class) +@BodyTypes(consumerOut = @BodyType(value = Carrier.NULL, dependsOn = "customListener", + description = "No body: the event type, the cache name and the key of the entry are in" + + " headers, and for the events of a continuous query (queryBuilder) the value" + + " in the CamelInfinispanEventData header"), + producerIn = @BodyType(value = Carrier.ANY, + description = "The body is not used: the key, the value and the Map for PUTALL come from the" + + " CamelInfinispanKey, CamelInfinispanValue and CamelInfinispanMap headers, or" + + " the key and value options"), + producerOut = @BodyType(value = Carrier.UNKNOWN, dependsOn = "resultHeader", + byOption = { + @BodyType.When(option = "operation", value = "PUTASYNC", carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture"), + @BodyType.When(option = "operation", value = "PUTALL", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "operation", value = "PUTALLASYNC", carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture"), + @BodyType.When(option = "operation", value = "PUTIFABSENTASYNC", + carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture"), + @BodyType.When(option = "operation", value = "CONTAINSKEY", carriers = Carrier.VALUE, + javaType = "java.lang.Boolean"), + @BodyType.When(option = "operation", value = "CONTAINSVALUE", + carriers = Carrier.VALUE, + javaType = "java.lang.Boolean"), + @BodyType.When(option = "operation", value = "REMOVEASYNC", carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture"), + @BodyType.When(option = "operation", value = "REPLACEASYNC", carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture"), + @BodyType.When(option = "operation", value = "SIZE", carriers = Carrier.VALUE, + javaType = "java.lang.Integer"), + @BodyType.When(option = "operation", value = "CLEAR", carriers = Carrier.UNCHANGED), + @BodyType.When(option = "operation", value = "CLEARASYNC", carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture"), + @BodyType.When(option = "operation", value = "QUERY", + carriers = { Carrier.LIST, Carrier.UNCHANGED }), + @BodyType.When(option = "operation", value = "STATS", carriers = Carrier.POJO, + javaType = "org.infinispan.client.hotrod.ServerStatistics"), + @BodyType.When(option = "operation", value = "COMPUTEASYNC", carriers = Carrier.POJO, + javaType = "java.util.concurrent.CompletableFuture") }, + description = "The result of the operation, which the CamelInfinispanOperation header can" + + " set: the value for GET, the previous value for PUT, the default, which is" + + " null unless the FORCE_RETURN_VALUE flag is set, a Boolean for CONTAINSKEY," + + " an Integer for SIZE, a List for QUERY and a CompletableFuture for the" + + " ASYNC operations; PUTALL and CLEAR keep the body. With resultHeader the" + + " result goes to that header and the body is kept")) public class InfinispanRemoteEndpoint extends InfinispanEndpoint implements EndpointServiceLocation { @UriPath(description = "The name of the cache to use. Use current to use the existing cache name from the currently configured cached manager. Or use default for the default cache manager name.") diff --git a/components/camel-jira/src/generated/resources/META-INF/org/apache/camel/component/jira/jira.json b/components/camel-jira/src/generated/resources/META-INF/org/apache/camel/component/jira/jira.json index 2b0b518a69fe..947280f4bdc1 100644 --- a/components/camel-jira/src/generated/resources/META-INF/org/apache/camel/component/jira/jira.json +++ b/components/camel-jira/src/generated/resources/META-INF/org/apache/camel/component/jira/jira.json @@ -60,6 +60,11 @@ "CamelJiraLinkType": { "index": 17, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of link", "constantName": "org.apache.camel.component.jira.JiraConstants#LINK_TYPE" }, "CamelJiraMinutesSpent": { "index": 18, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "-1", "description": "The minutes spent", "constantName": "org.apache.camel.component.jira.JiraConstants#MINUTES_SPENT" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "pojo", "null" ], "dependsOn": [ "watchedFields" ], "byOption": [ { "option": "sendOnlyUpdatedField", "value": "false", "carriers": [ "pojo" ], "javaType": "com.atlassian.jira.rest.client.api.domain.Issue" }, { "option": "type", "value": "NEWISSUES", "carriers": [ "pojo" ], "javaType": "com.atlassian.jira.rest.client.api.domain.Issue" }, { "option": "type", "value": "NEWCOMMENTS", "carriers": [ "pojo" ], "javaType": "com.atlassian.jira.rest.client.api.d [...] + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "type", "value": "ADDISSUE", "carriers": [ "null", "text", "bytes", "stream", "file" ] }, { "option": "type", "value": "UPDATEISSUE", "carriers": [ "null", "text", "bytes", "stream", "file" ] }, { "option": "type", "value": "TRANSITIONISSUE", "carriers": [ "null", "text", "bytes", "stream", "file" ] }, { "option": "type", "value": "ADDISSUELINK", "carriers": [ "null", "text", "bytes", "stream", "file" ] }, { "option": " [...] + "producerOut": { "carriers": [ "unchanged" ], "byOption": [ { "option": "type", "value": "ADDISSUE", "carriers": [ "pojo" ], "javaType": "com.atlassian.jira.rest.client.api.domain.Issue" }, { "option": "type", "value": "FETCHISSUE", "carriers": [ "pojo" ], "javaType": "com.atlassian.jira.rest.client.api.domain.Issue" }, { "option": "type", "value": "FETCHCOMMENTS", "carriers": [ "list" ], "javaType": "java.util.List<com.atlassian.jira.rest.client.api.domain.Comment>" } ], "descriptio [...] + }, "properties": { "type": { "index": 0, "kind": "path", "displayName": "Type", "group": "common", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.jira.JiraType", "enum": [ "ADDCOMMENT", "ADDISSUE", "ATTACH", "DELETEISSUE", "NEWISSUES", "NEWCOMMENTS", "WATCHUPDATES", "UPDATEISSUE", "TRANSITIONISSUE", "WATCHERS", "ADDISSUELINK", "ADDWORKLOG", "FETCHISSUE", "FETCHCOMMENTS" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "descripti [...] "delay": { "index": 1, "kind": "parameter", "displayName": "Delay", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 6000, "configurationClass": "org.apache.camel.component.jira.JiraConfiguration", "configurationField": "configuration", "description": "Time in milliseconds to elapse for the next poll." }, diff --git a/components/camel-jira/src/main/docs/jira-component.adoc b/components/camel-jira/src/main/docs/jira-component.adoc index 62980d533155..8f47121aa03e 100644 --- a/components/camel-jira/src/main/docs/jira-component.adoc +++ b/components/camel-jira/src/main/docs/jira-component.adoc @@ -238,7 +238,7 @@ Optional: Required: * `CamelJiraIssueKey`: The issue key identifier. -* the body of the exchange is the description. +* the body of the exchange is the text of the comment. === Attach @@ -247,7 +247,8 @@ Only one file should attach per invocation. Required: * `CamelJiraIssueKey`: The issue key identifier. -* body of the exchange should be of type `File` +* the body of the exchange is the file to attach: a `File`, the file of the file consumer, or text, bytes or a stream, +named by the `CamelFileName` header === DeleteIssue @@ -261,7 +262,10 @@ Required: * `CamelJiraIssueKey`: The issue key identifier. * `CamelJiraIssueTransitionId`: The issue transition `id`. -* the body of the exchange is the description. + +Optional: + +* the body of the exchange is a comment to add to the issue after the transition. === UpdateIssue diff --git a/components/camel-jira/src/main/java/org/apache/camel/component/jira/JiraEndpoint.java b/components/camel-jira/src/main/java/org/apache/camel/component/jira/JiraEndpoint.java index aeb9797330d7..b763caabafa1 100644 --- a/components/camel-jira/src/main/java/org/apache/camel/component/jira/JiraEndpoint.java +++ b/components/camel-jira/src/main/java/org/apache/camel/component/jira/JiraEndpoint.java @@ -42,6 +42,9 @@ import org.apache.camel.component.jira.producer.FetchIssueProducer; import org.apache.camel.component.jira.producer.TransitionIssueProducer; import org.apache.camel.component.jira.producer.UpdateIssueProducer; import org.apache.camel.component.jira.producer.WatcherProducer; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.Registry; @@ -78,6 +81,62 @@ import static org.apache.camel.component.jira.JiraConstants.JIRA_REST_CLIENT_FAC */ @UriEndpoint(firstVersion = "3.0", scheme = "jira", title = "Jira", syntax = "jira:type", category = { Category.DOCUMENT }, headersClass = JiraConstants.class) +@BodyTypes(consumerOut = @BodyType(value = { Carrier.POJO, Carrier.NULL }, dependsOn = "watchedFields", + byOption = { + @BodyType.When(option = "sendOnlyUpdatedField", value = "false", + carriers = Carrier.POJO, + javaType = "com.atlassian.jira.rest.client.api.domain.Issue"), + @BodyType.When(option = "type", value = "NEWISSUES", carriers = Carrier.POJO, + javaType = "com.atlassian.jira.rest.client.api.domain.Issue"), + @BodyType.When(option = "type", value = "NEWCOMMENTS", carriers = Carrier.POJO, + javaType = "com.atlassian.jira.rest.client.api.domain.Comment") }, + description = "One message per new Issue (newIssues) or new Comment (newComments)." + + " watchUpdates sends one per watched field that changed, with its new value," + + " such as the Status or the BasicPriority (null when cleared), or the Issue" + + " with sendOnlyUpdatedField=false"), + producerIn = @BodyType(value = Carrier.ANY, + byOption = { + @BodyType.When(option = "type", value = "ADDISSUE", + carriers = { + Carrier.NULL, Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, + Carrier.FILE }), + @BodyType.When(option = "type", value = "UPDATEISSUE", + carriers = { + Carrier.NULL, Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, + Carrier.FILE }), + @BodyType.When(option = "type", value = "TRANSITIONISSUE", + carriers = { + Carrier.NULL, Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, + Carrier.FILE }), + @BodyType.When(option = "type", value = "ADDISSUELINK", + carriers = { + Carrier.NULL, Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, + Carrier.FILE }), + @BodyType.When(option = "type", value = "ADDCOMMENT", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }), + @BodyType.When(option = "type", value = "ADDWORKLOG", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }), + @BodyType.When(option = "type", value = "ATTACH", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }) }, + description = "Read as text: the description for addIssue and updateIssue, the comment for" + + " addComment and addWorkLog, which fail without a body, and an optional" + + " comment for transitionIssue and addIssueLink; a Map or a POJO is sent as" + + " its toString(), so marshal it first. attach uploads a file, or text, bytes" + + " or a stream named by the CamelFileName header. The other types read only" + + " headers"), + producerOut = @BodyType(value = Carrier.UNCHANGED, + byOption = { + @BodyType.When(option = "type", value = "ADDISSUE", carriers = Carrier.POJO, + javaType = "com.atlassian.jira.rest.client.api.domain.Issue"), + @BodyType.When(option = "type", value = "FETCHISSUE", carriers = Carrier.POJO, + javaType = "com.atlassian.jira.rest.client.api.domain.Issue"), + @BodyType.When(option = "type", value = "FETCHCOMMENTS", carriers = Carrier.LIST, + javaType = "java.util.List<com.atlassian.jira.rest.client.api.domain.Comment>") }, + description = "The Issue created for addIssue, the Issue for fetchIssue and the List of its" + + " Comments for fetchComments. The other types leave the body unchanged")) public class JiraEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private static final Logger LOG = LoggerFactory.getLogger(JiraEndpoint.class); diff --git a/components/camel-pqc/src/generated/resources/META-INF/org/apache/camel/component/pqc/pqc.json b/components/camel-pqc/src/generated/resources/META-INF/org/apache/camel/component/pqc/pqc.json index 39a2d8dc3ff6..c3aeb57ed737 100644 --- a/components/camel-pqc/src/generated/resources/META-INF/org/apache/camel/component/pqc/pqc.json +++ b/components/camel-pqc/src/generated/resources/META-INF/org/apache/camel/component/pqc/pqc.json @@ -81,6 +81,10 @@ "CamelPQCHybridEncapsulation": { "index": 21, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "byte[]", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The hybrid encapsulation combining both classical and PQC encapsulations", "constantName": "org.apache.camel.component.pqc.PQCConstants#HYBRID_ENCAPSULATION" }, "CamelPQCHybridVerification": { "index": 22, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The verification result of hybrid signature (both must pass)", "constantName": "org.apache.camel.component.pqc.PQCConstants#HYBRID_VERIFY" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "sign", "carriers": [ "text", "bytes", "stream" ] }, { "option": "operation", "value": "verify", "carriers": [ "text", "bytes", "stream" ] }, { "option": "operation", "value": "hybridSign", "carriers": [ "text", "bytes", "stream" ] }, { "option": "operation", "value": "hybridVerify", "carriers": [ "text", "bytes", "stream" ] }, { "option": "operation", "value": "extractSecretKeyEncapsulation", "car [...] + "producerOut": { "carriers": [ "unchanged" ], "byOption": [ { "option": "operation", "value": "generateSecretKeyEncapsulation", "carriers": [ "pojo" ], "javaType": "org.bouncycastle.jcajce.SecretKeyWithEncapsulation" }, { "option": "operation", "value": "extractSecretKeyEncapsulation", "carriers": [ "pojo" ], "javaType": "org.bouncycastle.jcajce.SecretKeyWithEncapsulation" }, { "option": "operation", "value": "extractSecretKeyFromEncapsulation", "carriers": [ "pojo" ], "javaType": "j [...] + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pqc.PQCConfiguration", "configurationField": "configuration", "description": "Logical name" }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.pqc.PQCOperations", "enum": [ "sign", "verify", "hybridSign", "hybridVerify", "generateSecretKeyEncapsulation", "extractSecretKeyEncapsulation", "extractSecretKeyFromEncapsulation", "hybridGenerateSecretKeyEncapsulation", "hybridExtractSecretKeyEncapsulation", "hybridExtractSecretKeyFromEncapsulation", [...] diff --git a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCEndpoint.java b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCEndpoint.java index 3a78b651d698..a70d51872e1e 100644 --- a/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCEndpoint.java +++ b/components/camel-pqc/src/main/java/org/apache/camel/component/pqc/PQCEndpoint.java @@ -23,6 +23,9 @@ import org.apache.camel.Component; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -35,6 +38,57 @@ import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider; @UriEndpoint(firstVersion = "4.12.0", scheme = "pqc", title = "PQC Algorithms", syntax = "pqc:label", producerOnly = true, category = { Category.SECURITY }, headersClass = PQCConstants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = { + @BodyType.When(option = "operation", value = "sign", + carriers = { Carrier.TEXT, Carrier.BYTES, Carrier.STREAM }), + @BodyType.When(option = "operation", value = "verify", + carriers = { Carrier.TEXT, Carrier.BYTES, Carrier.STREAM }), + @BodyType.When(option = "operation", value = "hybridSign", + carriers = { Carrier.TEXT, Carrier.BYTES, Carrier.STREAM }), + @BodyType.When(option = "operation", value = "hybridVerify", + carriers = { Carrier.TEXT, Carrier.BYTES, Carrier.STREAM }), + @BodyType.When(option = "operation", value = "extractSecretKeyEncapsulation", + carriers = Carrier.POJO, + javaType = "org.bouncycastle.jcajce.SecretKeyWithEncapsulation"), + @BodyType.When(option = "operation", value = "extractSecretKeyFromEncapsulation", + carriers = Carrier.POJO, + javaType = "org.bouncycastle.jcajce.SecretKeyWithEncapsulation"), + @BodyType.When(option = "operation", value = "importKey", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, + Carrier.FILE }) }, + description = "The payload of sign, verify, hybridSign and hybridVerify: bytes or a stream as" + + " they are, text as UTF-8; another body is signed as its text, so marshal it" + + " first. extractSecretKeyEncapsulation and extractSecretKeyFromEncapsulation" + + " take the SecretKeyWithEncapsulation that generateSecretKeyEncapsulation" + + " gives, and importKey the key as bytes, or as text for PEM. The other" + + " operations do not use the body"), + producerOut = @BodyType(value = Carrier.UNCHANGED, + byOption = { + @BodyType.When(option = "operation", value = "generateSecretKeyEncapsulation", + carriers = Carrier.POJO, + javaType = "org.bouncycastle.jcajce.SecretKeyWithEncapsulation"), + @BodyType.When(option = "operation", value = "extractSecretKeyEncapsulation", + carriers = Carrier.POJO, + javaType = "org.bouncycastle.jcajce.SecretKeyWithEncapsulation"), + @BodyType.When(option = "operation", value = "extractSecretKeyFromEncapsulation", + carriers = Carrier.POJO, javaType = "javax.crypto.SecretKey"), + @BodyType.When(option = "operation", value = "hybridGenerateSecretKeyEncapsulation", + carriers = Carrier.POJO, javaType = "javax.crypto.SecretKey"), + @BodyType.When(option = "operation", value = "hybridExtractSecretKeyEncapsulation", + carriers = Carrier.POJO, javaType = "javax.crypto.SecretKey"), + @BodyType.When(option = "operation", + value = "hybridExtractSecretKeyFromEncapsulation", + carriers = Carrier.POJO, javaType = "javax.crypto.SecretKey"), + @BodyType.When(option = "storeExtractedSecretKeyAsHeader", value = "true", + carriers = Carrier.UNCHANGED) }, + description = "Unchanged for the signature and key operations, which set their results in" + + " headers, such as CamelPQCSignature and CamelPQCVerification." + + " generateSecretKeyEncapsulation and extractSecretKeyEncapsulation give a" + + " SecretKeyWithEncapsulation, and the other key encapsulation operations the" + + " SecretKey; with storeExtractedSecretKeyAsHeader=true the key is in the" + + " CamelPQCSecretKey header instead")) public class PQCEndpoint extends DefaultEndpoint { @UriParam diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/CatalogBodyTypes.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/CatalogBodyTypes.java index e3640b1b2253..def082d4063b 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/CatalogBodyTypes.java +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/CatalogBodyTypes.java @@ -249,6 +249,15 @@ final class CatalogBodyTypes { return null; } } + for (String option : side.getDependsOn()) { + String value = set.get(option); + if (value != null && side.getByOption().stream() + .noneMatch(w -> w.getOption().equals(option) && value.equalsIgnoreCase(w.getValue()))) { + // the body depends on this option, and no option value of the side says the body for its value: the + // value another option names does not hold then, such as output=bytes with a resultHandlerFactory + return null; + } + } Answer matched = null; for (OptionBodyTypeModel when : side.getByOption()) { String value = set.get(when.getOption()); diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/TextBodyFlowTest.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/TextBodyFlowTest.java index 333ecc82ed60..0f15009a19dc 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/TextBodyFlowTest.java +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/TextBodyFlowTest.java @@ -1007,6 +1007,78 @@ public class TextBodyFlowTest { .contains("to: file needs the body as text, bytes, a stream or a file, but the body here is parsed data")); } + @Test + public void testTheBodyOfCachesAndSigning() { + // pqc signs text, bytes or a stream, so parsed data must be marshalled first; a caffeine PUT keeps the body, + // so the parsed data is still there for the file producer, while an infinispan GET gives what the cache holds + String yaml = """ + - route: + id: sign + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: pqc:sign?operation=sign + - route: + id: put + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: caffeine-cache:orders?action=PUT&key=1 + - to: file:out + - route: + id: get + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: infinispan:orders?operation=GET&key=1 + - to: file:out + """; + assertThat(lines(yaml)).hasSize(2) + .anySatisfy(m -> assertThat(m).contains("route sign: to: pqc needs the body as text, bytes or a stream")) + .anySatisfy(m -> assertThat(m) + .contains("route put: to: file needs the body as text, bytes, a stream or a file")); + } + + @Test + public void testAnOptionTheBodyDependsOnOutweighsAnotherOption() { + // xslt with output bytes gives bytes, so a field read needs an unmarshal; with a resultHandlerFactory too the + // factory decides the body, and output=bytes no longer says it + String yaml = """ + - route: + id: bytes + from: + uri: file:in + steps: + - to: xslt:order.xsl?output=bytes + - setHeader: + name: id + simple: ${body[id]} + - route: + id: factory + from: + uri: file:in + steps: + - to: xslt:order.xsl?output=bytes&resultHandlerFactory=#myFactory + - setHeader: + name: id + simple: ${body[id]} + """; + assertThat(lines(yaml)).singleElement().satisfies(m -> assertThat(m) + .contains("route bytes: simple reads a field of the body (${body[id]})")); + } + @Test public void testWhatTheComponentMayConfigureSaysNothing() { // the valueDeserializer of kafka and the operation of aws2-sqs can be set on the component, which the route
