This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 006d20c896ceeb3512c744acc79c87373654d069 Author: Claus Ibsen <[email protected]> AuthorDate: Fri Nov 27 16:29:32 2026 +0100 CAMEL-23832: camel-jolt - improve the component and option descriptions This commit rewrites the component description, the texts of 3 component options, 4 endpoint options and 2 headers of jolt, checked against the Camel code and jolt-community-core 1.3.0. The old header texts were only "The resource URI" and "The context", the transformDsl text did not say what spec each type reads, and no text said that both headers are read only with allowTemplateFromHeader or that CamelJoltContext needs a Chainr. Documentation only, no behavior change. The component JSON, the catalog copy, the doc page header and the DSL are regenerated. camel-jolt is marked as done in tasks/component-descriptions.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../org/apache/camel/catalog/components/jolt.json | 20 +++--- .../apache/camel/catalog/docs/jolt-component.adoc | 2 +- .../org/apache/camel/component/jolt/jolt.json | 20 +++--- .../camel-jolt/src/main/docs/jolt-component.adoc | 2 +- .../apache/camel/component/jolt/JoltComponent.java | 28 ++++---- .../apache/camel/component/jolt/JoltConstants.java | 12 +++- .../apache/camel/component/jolt/JoltEndpoint.java | 42 ++++++------ .../component/ComponentsBuilderFactory.java | 2 +- .../component/dsl/JoltComponentBuilderFactory.java | 27 +++++--- .../builder/endpoint/EndpointHeaderBuilders.java | 2 +- .../builder/endpoint/StaticEndpointBuilders.java | 4 +- .../endpoint/dsl/JoltEndpointBuilderFactory.java | 79 ++++++++++++++-------- tasks/component-descriptions.md | 2 +- 13 files changed, 138 insertions(+), 104 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jolt.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jolt.json index 3afafd3bc32a..cfa1be305c17 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jolt.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/jolt.json @@ -3,7 +3,7 @@ "kind": "component", "name": "jolt", "title": "JOLT", - "description": "JSON to JSON transformation using JOLT.", + "description": "Transform JSON to JSON with a JOLT specification.", "deprecated": false, "firstVersion": "2.16.0", "label": "transformation", @@ -24,15 +24,15 @@ "remote": false }, "componentProperties": { - "allowTemplateFromHeader": { "index": 0, "kind": "property", "displayName": "Allow Template From Header", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow to use resource template from header or not (default false). Enabling this allows to specify dynamic templates via message header. However this can be seen as a potential se [...] - "contentCache": { "index": 1, "kind": "property", "displayName": "Content Cache", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Sets whether to use resource content cache or not" }, + "allowTemplateFromHeader": { "index": 0, "kind": "property", "displayName": "Allow Template From Header", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the endpoints read the CamelJoltResourceUri and CamelJoltContext headers. It is the default of the allowTemplateFromHeader option of each endpoint. Enable it only when the headers co [...] + "contentCache": { "index": 1, "kind": "property", "displayName": "Content Cache", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the endpoints keep the content of their spec resource in memory after the first read. It is the default of the contentCache option of each endpoint. Each endpoint builds its JOLT transform from the spec once [...] "lazyStartProducer": { "index": 2, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] "autowiredEnabled": { "index": 3, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] - "transform": { "index": 4, "kind": "property", "displayName": "Transform", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "io.joltcommunity.jolt.Transform", "deprecated": false, "autowired": false, "secret": false, "description": "Explicitly sets the Transform to use. If not set a Transform specified by the transformDsl will be created" } + "transform": { "index": 4, "kind": "property", "displayName": "Transform", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "io.joltcommunity.jolt.Transform", "deprecated": false, "autowired": false, "secret": false, "description": "A JOLT Transform that all endpoints of the component use in place of the transform that they build from their spec. When set, the endpoints do not read their spec resource, and transformDsl and the CamelJoltResour [...] }, "headers": { - "CamelJoltResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The resource URI", "constantName": "org.apache.camel.component.jolt.JoltConstants#JOLT_RESOURCE_URI" }, - "CamelJoltContext": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, Object>", "deprecated": false, "autowired": false, "secret": false, "description": "The context", "constantName": "org.apache.camel.component.jolt.JoltConstants#JOLT_CONTEXT" } + "CamelJoltResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The URI of the spec resource to use instead of the resourceUri of the endpoint, in the same form, such as classpath:, file: or http:. The producer reads it only when allowTemplateFromHeader is true, and removes it from the message. It then uses the endpoint with t [...] + "CamelJoltContext": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, Object>", "deprecated": false, "autowired": false, "secret": false, "description": "A Map of values that the modify-overwrite-beta, modify-default-beta and modify-define-beta operations of the spec can refer to with a caret followed by the key. The producer reads it only when allowTemplateFromHeader is true. The transform must take a con [...] }, "bodyTypes": { "producerIn": { "carriers": [ "map", "list", "text", "bytes", "stream", "file" ], "format": "json", "byOption": [ { "option": "inputType", "value": "JsonString", "carriers": [ "text", "bytes", "stream", "file" ] } ], "description": "Parsed JSON (a Map or a List), or JSON as text, bytes, a stream, a file or a Jackson JsonNode, which is parsed. Text that does not start with { or [ reaches the spec as it is. With inputType=JsonString the body is always parsed as JSON" }, @@ -40,11 +40,11 @@ }, "properties": { "resourceUri": { "index": 0, "kind": "path", "displayName": "Resource Uri", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "supportFileReference": true, "description": "Path to the resource. You can prefix with: classpath, file, http, ref, or bean. classpath, file and http loads the resource using these protocols (classpath is default). ref will lookup the resource in the [...] - "allowTemplateFromHeader": { "index": 1, "kind": "parameter", "displayName": "Allow Template From Header", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow to use resource template from header or not (default false). Enabling this allows to specify dynamic templates via message header. However this can be seen as a potential s [...] + "allowTemplateFromHeader": { "index": 1, "kind": "parameter", "displayName": "Allow Template From Header", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer reads the CamelJoltResourceUri and CamelJoltContext headers. If false, the producer ignores both headers. Enable it only when the headers come from a trusted source." }, "contentCache": { "index": 2, "kind": "parameter", "displayName": "Content Cache", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Sets whether to use resource content cache or not" }, - "inputType": { "index": 3, "kind": "parameter", "displayName": "Input Type", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.jolt.JoltInputOutputType", "enum": [ "Hydrated", "JsonString" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Hydrated", "description": "Specifies if the input is hydrated JSON or a JSON String. With Hydrated, a body that is JSON text (its first non-whitespace character i [...] - "outputType": { "index": 4, "kind": "parameter", "displayName": "Output Type", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.jolt.JoltInputOutputType", "enum": [ "Hydrated", "JsonString" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Hydrated", "description": "Specifies if the output should be hydrated JSON or a JSON String." }, - "transformDsl": { "index": 5, "kind": "parameter", "displayName": "Transform Dsl", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.jolt.JoltTransformType", "enum": [ "Chainr", "Shiftr", "Defaultr", "Removr", "Sortr" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Chainr", "description": "Specifies the Transform DSL of the endpoint resource. If none is specified Chainr will be used." }, + "inputType": { "index": 3, "kind": "parameter", "displayName": "Input Type", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.jolt.JoltInputOutputType", "enum": [ "Hydrated", "JsonString" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Hydrated", "description": "Whether the producer parses the body as JSON or uses it as it is. With Hydrated, a body that is JSON text (its first non-whitespace cha [...] + "outputType": { "index": 4, "kind": "parameter", "displayName": "Output Type", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.jolt.JoltInputOutputType", "enum": [ "Hydrated", "JsonString" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Hydrated", "description": "Whether the producer sets the body to the result of the transform as it is or to its JSON text. With Hydrated, the body is the result [...] + "transformDsl": { "index": 5, "kind": "parameter", "displayName": "Transform Dsl", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.jolt.JoltTransformType", "enum": [ "Chainr", "Shiftr", "Defaultr", "Removr", "Sortr" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Chainr", "description": "The JOLT transform that the producer builds from the spec of resourceUri. Chainr: the spec is a JSON array o [...] "lazyStartProducer": { "index": 6, "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/docs/jolt-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/jolt-component.adoc index 8da1ab42fb52..a287da5fdf7c 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/jolt-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/jolt-component.adoc @@ -2,7 +2,7 @@ :doctitle: JOLT :shortname: jolt :artifactid: camel-jolt -:description: JSON to JSON transformation using JOLT. +:description: Transform JSON to JSON with a JOLT specification. :since: 2.16 :supportlevel: Stable :tabs-sync-option: diff --git a/components/camel-jolt/src/generated/resources/META-INF/org/apache/camel/component/jolt/jolt.json b/components/camel-jolt/src/generated/resources/META-INF/org/apache/camel/component/jolt/jolt.json index 3afafd3bc32a..cfa1be305c17 100644 --- a/components/camel-jolt/src/generated/resources/META-INF/org/apache/camel/component/jolt/jolt.json +++ b/components/camel-jolt/src/generated/resources/META-INF/org/apache/camel/component/jolt/jolt.json @@ -3,7 +3,7 @@ "kind": "component", "name": "jolt", "title": "JOLT", - "description": "JSON to JSON transformation using JOLT.", + "description": "Transform JSON to JSON with a JOLT specification.", "deprecated": false, "firstVersion": "2.16.0", "label": "transformation", @@ -24,15 +24,15 @@ "remote": false }, "componentProperties": { - "allowTemplateFromHeader": { "index": 0, "kind": "property", "displayName": "Allow Template From Header", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow to use resource template from header or not (default false). Enabling this allows to specify dynamic templates via message header. However this can be seen as a potential se [...] - "contentCache": { "index": 1, "kind": "property", "displayName": "Content Cache", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Sets whether to use resource content cache or not" }, + "allowTemplateFromHeader": { "index": 0, "kind": "property", "displayName": "Allow Template From Header", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the endpoints read the CamelJoltResourceUri and CamelJoltContext headers. It is the default of the allowTemplateFromHeader option of each endpoint. Enable it only when the headers co [...] + "contentCache": { "index": 1, "kind": "property", "displayName": "Content Cache", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the endpoints keep the content of their spec resource in memory after the first read. It is the default of the contentCache option of each endpoint. Each endpoint builds its JOLT transform from the spec once [...] "lazyStartProducer": { "index": 2, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] "autowiredEnabled": { "index": 3, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] - "transform": { "index": 4, "kind": "property", "displayName": "Transform", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "io.joltcommunity.jolt.Transform", "deprecated": false, "autowired": false, "secret": false, "description": "Explicitly sets the Transform to use. If not set a Transform specified by the transformDsl will be created" } + "transform": { "index": 4, "kind": "property", "displayName": "Transform", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "io.joltcommunity.jolt.Transform", "deprecated": false, "autowired": false, "secret": false, "description": "A JOLT Transform that all endpoints of the component use in place of the transform that they build from their spec. When set, the endpoints do not read their spec resource, and transformDsl and the CamelJoltResour [...] }, "headers": { - "CamelJoltResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The resource URI", "constantName": "org.apache.camel.component.jolt.JoltConstants#JOLT_RESOURCE_URI" }, - "CamelJoltContext": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, Object>", "deprecated": false, "autowired": false, "secret": false, "description": "The context", "constantName": "org.apache.camel.component.jolt.JoltConstants#JOLT_CONTEXT" } + "CamelJoltResourceUri": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "autowired": false, "secret": false, "description": "The URI of the spec resource to use instead of the resourceUri of the endpoint, in the same form, such as classpath:, file: or http:. The producer reads it only when allowTemplateFromHeader is true, and removes it from the message. It then uses the endpoint with t [...] + "CamelJoltContext": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, Object>", "deprecated": false, "autowired": false, "secret": false, "description": "A Map of values that the modify-overwrite-beta, modify-default-beta and modify-define-beta operations of the spec can refer to with a caret followed by the key. The producer reads it only when allowTemplateFromHeader is true. The transform must take a con [...] }, "bodyTypes": { "producerIn": { "carriers": [ "map", "list", "text", "bytes", "stream", "file" ], "format": "json", "byOption": [ { "option": "inputType", "value": "JsonString", "carriers": [ "text", "bytes", "stream", "file" ] } ], "description": "Parsed JSON (a Map or a List), or JSON as text, bytes, a stream, a file or a Jackson JsonNode, which is parsed. Text that does not start with { or [ reaches the spec as it is. With inputType=JsonString the body is always parsed as JSON" }, @@ -40,11 +40,11 @@ }, "properties": { "resourceUri": { "index": 0, "kind": "path", "displayName": "Resource Uri", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "supportFileReference": true, "description": "Path to the resource. You can prefix with: classpath, file, http, ref, or bean. classpath, file and http loads the resource using these protocols (classpath is default). ref will lookup the resource in the [...] - "allowTemplateFromHeader": { "index": 1, "kind": "parameter", "displayName": "Allow Template From Header", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow to use resource template from header or not (default false). Enabling this allows to specify dynamic templates via message header. However this can be seen as a potential s [...] + "allowTemplateFromHeader": { "index": 1, "kind": "parameter", "displayName": "Allow Template From Header", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer reads the CamelJoltResourceUri and CamelJoltContext headers. If false, the producer ignores both headers. Enable it only when the headers come from a trusted source." }, "contentCache": { "index": 2, "kind": "parameter", "displayName": "Content Cache", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Sets whether to use resource content cache or not" }, - "inputType": { "index": 3, "kind": "parameter", "displayName": "Input Type", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.jolt.JoltInputOutputType", "enum": [ "Hydrated", "JsonString" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Hydrated", "description": "Specifies if the input is hydrated JSON or a JSON String. With Hydrated, a body that is JSON text (its first non-whitespace character i [...] - "outputType": { "index": 4, "kind": "parameter", "displayName": "Output Type", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.jolt.JoltInputOutputType", "enum": [ "Hydrated", "JsonString" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Hydrated", "description": "Specifies if the output should be hydrated JSON or a JSON String." }, - "transformDsl": { "index": 5, "kind": "parameter", "displayName": "Transform Dsl", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.jolt.JoltTransformType", "enum": [ "Chainr", "Shiftr", "Defaultr", "Removr", "Sortr" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Chainr", "description": "Specifies the Transform DSL of the endpoint resource. If none is specified Chainr will be used." }, + "inputType": { "index": 3, "kind": "parameter", "displayName": "Input Type", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.jolt.JoltInputOutputType", "enum": [ "Hydrated", "JsonString" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Hydrated", "description": "Whether the producer parses the body as JSON or uses it as it is. With Hydrated, a body that is JSON text (its first non-whitespace cha [...] + "outputType": { "index": 4, "kind": "parameter", "displayName": "Output Type", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.jolt.JoltInputOutputType", "enum": [ "Hydrated", "JsonString" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Hydrated", "description": "Whether the producer sets the body to the result of the transform as it is or to its JSON text. With Hydrated, the body is the result [...] + "transformDsl": { "index": 5, "kind": "parameter", "displayName": "Transform Dsl", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "org.apache.camel.component.jolt.JoltTransformType", "enum": [ "Chainr", "Shiftr", "Defaultr", "Removr", "Sortr" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "Chainr", "description": "The JOLT transform that the producer builds from the spec of resourceUri. Chainr: the spec is a JSON array o [...] "lazyStartProducer": { "index": 6, "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-jolt/src/main/docs/jolt-component.adoc b/components/camel-jolt/src/main/docs/jolt-component.adoc index 8da1ab42fb52..a287da5fdf7c 100644 --- a/components/camel-jolt/src/main/docs/jolt-component.adoc +++ b/components/camel-jolt/src/main/docs/jolt-component.adoc @@ -2,7 +2,7 @@ :doctitle: JOLT :shortname: jolt :artifactid: camel-jolt -:description: JSON to JSON transformation using JOLT. +:description: Transform JSON to JSON with a JOLT specification. :since: 2.16 :supportlevel: Stable :tabs-sync-option: diff --git a/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltComponent.java b/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltComponent.java index aecf2bfbdf65..97a1a840ca67 100644 --- a/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltComponent.java +++ b/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltComponent.java @@ -28,11 +28,21 @@ import org.apache.camel.support.ResourceHelper; @Component("jolt") public class JoltComponent extends DefaultComponent { - @Metadata(defaultValue = "true", description = "Sets whether to use resource content cache or not") + @Metadata(defaultValue = "true", + description = "Whether the endpoints keep the content of their spec resource in memory after the first read." + + " It is the default of the contentCache option of each endpoint. Each endpoint builds its JOLT" + + " transform from the spec once, at the first exchange, and keeps it, so false does not make it" + + " read a changed spec again.") private boolean contentCache = true; - @Metadata + @Metadata(description = "Whether the endpoints read the CamelJoltResourceUri and CamelJoltContext headers. It is the" + + " default of the allowTemplateFromHeader option of each endpoint. Enable it only when the headers" + + " come from a trusted source.") private boolean allowTemplateFromHeader; - @Metadata(label = "advanced") + @Metadata(label = "advanced", + description = "A JOLT Transform that all endpoints of the component use in place of the transform that they" + + " build from their spec. When set, the endpoints do not read their spec resource, and" + + " transformDsl and the CamelJoltResourceUri header have no effect. To use the CamelJoltContext" + + " header, it must also be a ContextualTransform, such as a Chainr.") private Transform transform; public JoltComponent() { @@ -61,9 +71,6 @@ public class JoltComponent extends DefaultComponent { return contentCache; } - /** - * Sets whether to use resource content cache or not - */ public void setContentCache(boolean contentCache) { this.contentCache = contentCache; } @@ -72,9 +79,6 @@ public class JoltComponent extends DefaultComponent { return transform; } - /** - * Explicitly sets the Transform to use. If not set a Transform specified by the transformDsl will be created - */ public void setTransform(Transform transform) { this.transform = transform; } @@ -83,12 +87,6 @@ public class JoltComponent extends DefaultComponent { return allowTemplateFromHeader; } - /** - * Whether to allow to use resource template from header or not (default false). - * <p> - * Enabling this allows to specify dynamic templates via message header. However this can be seen as a potential - * security vulnerability if the header is coming from a malicious user, so use this with care. - */ public void setAllowTemplateFromHeader(boolean allowTemplateFromHeader) { this.allowTemplateFromHeader = allowTemplateFromHeader; } diff --git a/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltConstants.java b/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltConstants.java index da469cc43c19..8089cf9b2b1b 100644 --- a/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltConstants.java +++ b/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltConstants.java @@ -23,9 +23,17 @@ import org.apache.camel.spi.Metadata; */ public final class JoltConstants { - @Metadata(description = "The resource URI", javaType = "String") + @Metadata(description = "The URI of the spec resource to use instead of the resourceUri of the endpoint, in the same" + + " form, such as classpath:, file: or http:. The producer reads it only when" + + " allowTemplateFromHeader is true, and removes it from the message. It then uses the endpoint" + + " with the same options for that URI.", + javaType = "String") public static final String JOLT_RESOURCE_URI = "CamelJoltResourceUri"; - @Metadata(description = "The context", javaType = "Map<String, Object>") + @Metadata(description = "A Map of values that the modify-overwrite-beta, modify-default-beta and modify-define-beta" + + " operations of the spec can refer to with a caret followed by the key. The" + + " producer reads it only when allowTemplateFromHeader is true. The transform must take a" + + " context: of the transformDsl types only Chainr does, and the others fail the exchange.", + javaType = "Map<String, Object>") public static final String JOLT_CONTEXT = "CamelJoltContext"; private JoltConstants() { diff --git a/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltEndpoint.java b/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltEndpoint.java index 31c22ebe8185..dc3337979c54 100644 --- a/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltEndpoint.java +++ b/components/camel-jolt/src/main/java/org/apache/camel/component/jolt/JoltEndpoint.java @@ -47,7 +47,7 @@ import org.apache.camel.util.ObjectHelper; import tools.jackson.databind.JsonNode; /** - * JSON to JSON transformation using JOLT. + * Transform JSON to JSON with a JOLT specification. */ @UriEndpoint(firstVersion = "2.16.0", scheme = "jolt", title = "JOLT", syntax = "jolt:resourceUri", producerOnly = true, remote = false, category = { Category.TRANSFORMATION }, headersClass = JoltConstants.class) @@ -75,16 +75,31 @@ public class JoltEndpoint extends ResourceEndpoint { private JoltTransform transform; - @UriParam(defaultValue = "Hydrated") + @UriParam(defaultValue = "Hydrated", + description = "Whether the producer sets the body to the result of the transform as it is or to its JSON text." + + " With Hydrated, the body is the result as it is, which is a Map for a JSON object and a List for" + + " a JSON array. With JsonString, the body is the result written as a JSON String.") private JoltInputOutputType outputType; - @UriParam(defaultValue = "Hydrated") + @UriParam(defaultValue = "Hydrated", + description = "Whether the producer parses the body as JSON or uses it as it is. With Hydrated, a body that is" + + " JSON text (its first non-whitespace character is { or [), bytes, a stream or a file is parsed" + + " as JSON, and any other body, such as a Map or a List, is used as it is. With JsonString, the" + + " body is always parsed as JSON. With both types, a Jackson JsonNode body is converted to a Map" + + " or a List.") private JoltInputOutputType inputType; - @UriParam(defaultValue = "Chainr") + @UriParam(defaultValue = "Chainr", + description = "The JOLT transform that the producer builds from the spec of resourceUri. Chainr: the spec is a" + + " JSON array of operations, each with an operation name (such as shift, default, remove, sort," + + " cardinality or modify-overwrite-beta) and its spec. Shiftr, Defaultr and Removr: the spec of" + + " that one operation. Sortr: sorts the keys of the JSON objects and reads no spec. Not used when" + + " the transform option of the component is set.") private JoltTransformType transformDsl = JoltTransformType.Chainr; - @UriParam(defaultValue = "false") + @UriParam(defaultValue = "false", + description = "Whether the producer reads the CamelJoltResourceUri and CamelJoltContext headers. If false, the" + + " producer ignores both headers. Enable it only when the headers come from a trusted source.") private boolean allowTemplateFromHeader; public JoltEndpoint() { @@ -166,9 +181,6 @@ public class JoltEndpoint extends ResourceEndpoint { return outputType; } - /** - * Specifies if the output should be hydrated JSON or a JSON String. - */ public void setOutputType(JoltInputOutputType outputType) { this.outputType = outputType; } @@ -177,11 +189,6 @@ public class JoltEndpoint extends ResourceEndpoint { return inputType; } - /** - * Specifies if the input is hydrated JSON or a JSON String. With Hydrated, a body that is JSON text (its first - * non-whitespace character is { or [), bytes, a stream or a file is parsed as JSON, and any other body, such as a - * Map or a List, is used as it is. With JsonString, the body is always parsed as JSON. - */ public void setInputType(JoltInputOutputType inputType) { this.inputType = inputType; } @@ -190,9 +197,6 @@ public class JoltEndpoint extends ResourceEndpoint { return transformDsl; } - /** - * Specifies the Transform DSL of the endpoint resource. If none is specified <code>Chainr</code> will be used. - */ public void setTransformDsl(JoltTransformType transformType) { this.transformDsl = transformType; } @@ -201,12 +205,6 @@ public class JoltEndpoint extends ResourceEndpoint { return allowTemplateFromHeader; } - /** - * Whether to allow to use resource template from header or not (default false). - * - * Enabling this allows to specify dynamic templates via message header. However this can be seen as a potential - * security vulnerability if the header is coming from a malicious user, so use this with care. - */ public void setAllowTemplateFromHeader(boolean allowTemplateFromHeader) { this.allowTemplateFromHeader = allowTemplateFromHeader; } diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java index 6278c6accb8f..1f4f6e837c77 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java @@ -3006,7 +3006,7 @@ public interface ComponentsBuilderFactory { } /** * JOLT (camel-jolt) - * JSON to JSON transformation using JOLT. + * Transform JSON to JSON with a JOLT specification. * * Category: transformation * Since: 2.16 diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/JoltComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/JoltComponentBuilderFactory.java index fe3ed4ce0fde..21d6e17dc2f8 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/JoltComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/JoltComponentBuilderFactory.java @@ -24,7 +24,7 @@ import org.apache.camel.builder.component.ComponentBuilder; import org.apache.camel.component.jolt.JoltComponent; /** - * JSON to JSON transformation using JOLT. + * Transform JSON to JSON with a JOLT specification. * * Generated by camel build tools - do NOT edit this file! */ @@ -33,7 +33,7 @@ public interface JoltComponentBuilderFactory { /** * JOLT (camel-jolt) - * JSON to JSON transformation using JOLT. + * Transform JSON to JSON with a JOLT specification. * * Category: transformation * Since: 2.16 @@ -52,11 +52,10 @@ public interface JoltComponentBuilderFactory { /** - * Whether to allow to use resource template from header or not (default - * false). Enabling this allows to specify dynamic templates via message - * header. However this can be seen as a potential security - * vulnerability if the header is coming from a malicious user, so use - * this with care. + * Whether the endpoints read the CamelJoltResourceUri and + * CamelJoltContext headers. It is the default of the + * allowTemplateFromHeader option of each endpoint. Enable it only when + * the headers come from a trusted source. * * The option is a: <code>boolean</code> type. * @@ -73,7 +72,11 @@ public interface JoltComponentBuilderFactory { /** - * Sets whether to use resource content cache or not. + * Whether the endpoints keep the content of their spec resource in + * memory after the first read. It is the default of the contentCache + * option of each endpoint. Each endpoint builds its JOLT transform from + * the spec once, at the first exchange, and keeps it, so false does not + * make it read a changed spec again. * * The option is a: <code>boolean</code> type. * @@ -136,8 +139,12 @@ public interface JoltComponentBuilderFactory { } /** - * Explicitly sets the Transform to use. If not set a Transform - * specified by the transformDsl will be created. + * A JOLT Transform that all endpoints of the component use in place of + * the transform that they build from their spec. When set, the + * endpoints do not read their spec resource, and transformDsl and the + * CamelJoltResourceUri header have no effect. To use the + * CamelJoltContext header, it must also be a ContextualTransform, such + * as a Chainr. * * The option is a: * <code>io.joltcommunity.jolt.Transform</code> type. diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointHeaderBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointHeaderBuilders.java index 447fd9e2ea9d..a17a4f200281 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointHeaderBuilders.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointHeaderBuilders.java @@ -2408,7 +2408,7 @@ public class EndpointHeaderBuilders { } /** * JOLT (camel-jolt) - * JSON to JSON transformation using JOLT. + * Transform JSON to JSON with a JOLT specification. * * Category: transformation * Since: 2.16 diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java index 910ab2e3d83c..3b432058e85d 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java @@ -9918,7 +9918,7 @@ public class StaticEndpointBuilders { } /** * JOLT (camel-jolt) - * JSON to JSON transformation using JOLT. + * Transform JSON to JSON with a JOLT specification. * * Category: transformation * Since: 2.16 @@ -9943,7 +9943,7 @@ public class StaticEndpointBuilders { } /** * JOLT (camel-jolt) - * JSON to JSON transformation using JOLT. + * Transform JSON to JSON with a JOLT specification. * * Category: transformation * Since: 2.16 diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JoltEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JoltEndpointBuilderFactory.java index c850c4f8b775..bc18ef67e4ae 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JoltEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JoltEndpointBuilderFactory.java @@ -27,7 +27,7 @@ import org.apache.camel.builder.EndpointProducerBuilder; import org.apache.camel.builder.endpoint.AbstractEndpointBuilder; /** - * JSON to JSON transformation using JOLT. + * Transform JSON to JSON with a JOLT specification. * * Generated by camel build tools - do NOT edit this file! */ @@ -45,11 +45,9 @@ public interface JoltEndpointBuilderFactory { } /** - * Whether to allow to use resource template from header or not (default - * false). Enabling this allows to specify dynamic templates via message - * header. However this can be seen as a potential security - * vulnerability if the header is coming from a malicious user, so use - * this with care. + * Whether the producer reads the CamelJoltResourceUri and + * CamelJoltContext headers. If false, the producer ignores both + * headers. Enable it only when the headers come from a trusted source. * * The option is a: <code>boolean</code> type. * @@ -64,11 +62,9 @@ public interface JoltEndpointBuilderFactory { return this; } /** - * Whether to allow to use resource template from header or not (default - * false). Enabling this allows to specify dynamic templates via message - * header. However this can be seen as a potential security - * vulnerability if the header is coming from a malicious user, so use - * this with care. + * Whether the producer reads the CamelJoltResourceUri and + * CamelJoltContext headers. If false, the producer ignores both + * headers. Enable it only when the headers come from a trusted source. * * The option will be converted to a <code>boolean</code> type. * @@ -113,11 +109,12 @@ public interface JoltEndpointBuilderFactory { return this; } /** - * Specifies if the input is hydrated JSON or a JSON String. With - * Hydrated, a body that is JSON text (its first non-whitespace + * Whether the producer parses the body as JSON or uses it as it is. + * With Hydrated, a body that is JSON text (its first non-whitespace * character is { or [), bytes, a stream or a file is parsed as JSON, * and any other body, such as a Map or a List, is used as it is. With - * JsonString, the body is always parsed as JSON. + * JsonString, the body is always parsed as JSON. With both types, a + * Jackson JsonNode body is converted to a Map or a List. * * The option is a: * <code>org.apache.camel.component.jolt.JoltInputOutputType</code> @@ -134,11 +131,12 @@ public interface JoltEndpointBuilderFactory { return this; } /** - * Specifies if the input is hydrated JSON or a JSON String. With - * Hydrated, a body that is JSON text (its first non-whitespace + * Whether the producer parses the body as JSON or uses it as it is. + * With Hydrated, a body that is JSON text (its first non-whitespace * character is { or [), bytes, a stream or a file is parsed as JSON, * and any other body, such as a Map or a List, is used as it is. With - * JsonString, the body is always parsed as JSON. + * JsonString, the body is always parsed as JSON. With both types, a + * Jackson JsonNode body is converted to a Map or a List. * * The option will be converted to a * <code>org.apache.camel.component.jolt.JoltInputOutputType</code> @@ -155,7 +153,10 @@ public interface JoltEndpointBuilderFactory { return this; } /** - * Specifies if the output should be hydrated JSON or a JSON String. + * Whether the producer sets the body to the result of the transform as + * it is or to its JSON text. With Hydrated, the body is the result as + * it is, which is a Map for a JSON object and a List for a JSON array. + * With JsonString, the body is the result written as a JSON String. * * The option is a: * <code>org.apache.camel.component.jolt.JoltInputOutputType</code> @@ -172,7 +173,10 @@ public interface JoltEndpointBuilderFactory { return this; } /** - * Specifies if the output should be hydrated JSON or a JSON String. + * Whether the producer sets the body to the result of the transform as + * it is or to its JSON text. With Hydrated, the body is the result as + * it is, which is a Map for a JSON object and a List for a JSON array. + * With JsonString, the body is the result written as a JSON String. * * The option will be converted to a * <code>org.apache.camel.component.jolt.JoltInputOutputType</code> @@ -189,8 +193,13 @@ public interface JoltEndpointBuilderFactory { return this; } /** - * Specifies the Transform DSL of the endpoint resource. If none is - * specified Chainr will be used. + * The JOLT transform that the producer builds from the spec of + * resourceUri. Chainr: the spec is a JSON array of operations, each + * with an operation name (such as shift, default, remove, sort, + * cardinality or modify-overwrite-beta) and its spec. Shiftr, Defaultr + * and Removr: the spec of that one operation. Sortr: sorts the keys of + * the JSON objects and reads no spec. Not used when the transform + * option of the component is set. * * The option is a: * <code>org.apache.camel.component.jolt.JoltTransformType</code> type. @@ -206,8 +215,13 @@ public interface JoltEndpointBuilderFactory { return this; } /** - * Specifies the Transform DSL of the endpoint resource. If none is - * specified Chainr will be used. + * The JOLT transform that the producer builds from the spec of + * resourceUri. Chainr: the spec is a JSON array of operations, each + * with an operation name (such as shift, default, remove, sort, + * cardinality or modify-overwrite-beta) and its spec. Shiftr, Defaultr + * and Removr: the spec of that one operation. Sortr: sorts the keys of + * the JSON objects and reads no spec. Not used when the transform + * option of the component is set. * * The option will be converted to a * <code>org.apache.camel.component.jolt.JoltTransformType</code> type. @@ -285,7 +299,7 @@ public interface JoltEndpointBuilderFactory { public interface JoltBuilders { /** * JOLT (camel-jolt) - * JSON to JSON transformation using JOLT. + * Transform JSON to JSON with a JOLT specification. * * Category: transformation * Since: 2.16 @@ -298,7 +312,7 @@ public interface JoltEndpointBuilderFactory { } /** * JOLT (camel-jolt) - * JSON to JSON transformation using JOLT. + * Transform JSON to JSON with a JOLT specification. * * Category: transformation * Since: 2.16 @@ -324,7 +338,7 @@ public interface JoltEndpointBuilderFactory { } /** * JOLT (camel-jolt) - * JSON to JSON transformation using JOLT. + * Transform JSON to JSON with a JOLT specification. * * Category: transformation * Since: 2.16 @@ -363,7 +377,11 @@ public interface JoltEndpointBuilderFactory { public static final JoltHeaderNameBuilder INSTANCE = new JoltHeaderNameBuilder(); /** - * The resource URI. + * The URI of the spec resource to use instead of the resourceUri of the + * endpoint, in the same form, such as classpath:, file: or http:. The + * producer reads it only when allowTemplateFromHeader is true, and + * removes it from the message. It then uses the endpoint with the same + * options for that URI. * * The option is a: {@code String} type. * @@ -375,7 +393,12 @@ public interface JoltEndpointBuilderFactory { return "CamelJoltResourceUri"; } /** - * The context. + * A Map of values that the modify-overwrite-beta, modify-default-beta + * and modify-define-beta operations of the spec can refer to with a + * caret followed by the key. The producer reads it only when + * allowTemplateFromHeader is true. The transform must take a context: + * of the transformDsl types only Chainr does, and the others fail the + * exchange. * * The option is a: {@code Map<String, Object>} type. * diff --git a/tasks/component-descriptions.md b/tasks/component-descriptions.md index b50a4aff0e87..dca0b43dfb03 100644 --- a/tasks/component-descriptions.md +++ b/tasks/component-descriptions.md @@ -235,7 +235,7 @@ or removes its row. | camel-jira | jira | yes | | camel-jms | jms | | | camel-jmx | jmx | yes | -| camel-jolt | jolt | | +| camel-jolt | jolt | yes | | camel-jooq | jooq | yes | | camel-jpa | jpa | | | camel-jsch | scp | yes |
