This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch lang6 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 29820f377e0c7953643ea09755c474f8f9281d90 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sun Feb 4 11:06:26 2024 +0100 CAMEL-20378: Languages should be thread-safe and be configured only via properties array, all in the same way. --- .../apache/camel/catalog/languages/tokenize.json | 5 +- .../apache/camel/catalog/languages/xtokenize.json | 15 ++--- .../org/apache/camel/catalog/models/tokenize.json | 5 +- .../org/apache/camel/catalog/models/xtokenize.json | 15 ++--- .../apache/camel/catalog/schemas/camel-spring.xsd | 11 +++- .../camel/language/xtokenizer/xtokenize.json | 15 ++--- .../xtokenizer/XMLTokenExpressionIterator.java | 67 ++++++---------------- .../language/xtokenizer/XMLTokenizeLanguage.java | 35 +++-------- .../camel/language/tokenizer/TokenizeLanguage.java | 8 +-- .../org/apache/camel/model/language/xtokenize.json | 15 ++--- .../language/SingleInputExpressionDefinition.java | 1 + .../model/language/XMLTokenizerExpression.java | 50 ++++++++++++++++ .../language/XMLTokenizerExpressionReifier.java | 15 ++--- .../org/apache/camel/language/TokenizerTest.java | 4 +- .../camel/support/builder/ExpressionBuilder.java | 3 +- .../java/org/apache/camel/xml/in/ModelParser.java | 1 + .../java/org/apache/camel/xml/out/ModelWriter.java | 1 + .../org/apache/camel/yaml/out/ModelWriter.java | 1 + .../dsl/yaml/deserializers/ModelDeserializers.java | 14 ++++- .../generated/resources/schema/camelYamlDsl.json | 12 +++- 20 files changed, 167 insertions(+), 126 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/tokenize.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/tokenize.json index 3d8cea09bf2..f9c7aef61d7 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/tokenize.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/tokenize.json @@ -26,9 +26,10 @@ "group": { "index": 7, "kind": "attribute", "displayName": "Group", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To group N parts together, for example to split big files into chunks of 1000 lines. You can use simple language as the group to support dynamic group sizes." }, "groupDelimiter": { "index": 8, "kind": "attribute", "displayName": "Group Delimiter", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the delimiter to use when grouping. If this has not been set then token will be used as the delimiter." }, "skipFirst": { "index": 9, "kind": "attribute", "displayName": "Skip First", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To skip the very first element" }, - "variableName": { "index": 10, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body" }, + "variableName": { "index": 10, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, "headerName": { "index": 11, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, "propertyName": { "index": 12, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "trim": { "index": 13, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "resultType": { "index": 13, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 14, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/xtokenize.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/xtokenize.json index 084cb91f80b..c70f189e3f7 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/xtokenize.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/xtokenize.json @@ -18,12 +18,13 @@ "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "expression": { "index": 1, "kind": "value", "displayName": "Expression", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The expression value in your chosen language syntax" }, - "mode": { "index": 2, "kind": "attribute", "displayName": "Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "i", "w", "u", "t" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "i", "description": "The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted to [...] - "group": { "index": 3, "kind": "attribute", "displayName": "Group", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "description": "To group N parts together" }, - "namespace": { "index": 4, "kind": "element", "displayName": "Namespace", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Injects the XML Namespaces of prefix - uri mappings" }, - "variableName": { "index": 5, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body" }, - "headerName": { "index": 6, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 7, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "trim": { "index": 8, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "resultType": { "index": 2, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "mode": { "index": 3, "kind": "attribute", "displayName": "Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "i", "w", "u", "t" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "i", "description": "The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted to [...] + "group": { "index": 4, "kind": "attribute", "displayName": "Group", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "description": "To group N parts together" }, + "namespace": { "index": 5, "kind": "element", "displayName": "Namespace", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Injects the XML Namespaces of prefix - uri mappings" }, + "variableName": { "index": 6, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body" }, + "headerName": { "index": 7, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 8, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "trim": { "index": 9, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/tokenize.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/tokenize.json index f6c525202bc..506aa385013 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/tokenize.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/tokenize.json @@ -23,9 +23,10 @@ "group": { "index": 7, "kind": "attribute", "displayName": "Group", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To group N parts together, for example to split big files into chunks of 1000 lines. You can use simple language as the group to support dynamic group sizes." }, "groupDelimiter": { "index": 8, "kind": "attribute", "displayName": "Group Delimiter", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the delimiter to use when grouping. If this has not been set then token will be used as the delimiter." }, "skipFirst": { "index": 9, "kind": "attribute", "displayName": "Skip First", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "To skip the very first element" }, - "variableName": { "index": 10, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body" }, + "variableName": { "index": 10, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, "headerName": { "index": 11, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, "propertyName": { "index": 12, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "trim": { "index": 13, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "resultType": { "index": 13, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "trim": { "index": 14, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/xtokenize.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/xtokenize.json index 4fc98b7419d..fe64a44a46c 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/xtokenize.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/xtokenize.json @@ -15,12 +15,13 @@ "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "expression": { "index": 1, "kind": "value", "displayName": "Expression", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The expression value in your chosen language syntax" }, - "mode": { "index": 2, "kind": "attribute", "displayName": "Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "i", "w", "u", "t" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "i", "description": "The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted to [...] - "group": { "index": 3, "kind": "attribute", "displayName": "Group", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "description": "To group N parts together" }, - "namespace": { "index": 4, "kind": "element", "displayName": "Namespace", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Injects the XML Namespaces of prefix - uri mappings" }, - "variableName": { "index": 5, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body" }, - "headerName": { "index": 6, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 7, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "trim": { "index": 8, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "resultType": { "index": 2, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "mode": { "index": 3, "kind": "attribute", "displayName": "Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "i", "w", "u", "t" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "i", "description": "The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted to [...] + "group": { "index": 4, "kind": "attribute", "displayName": "Group", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "description": "To group N parts together" }, + "namespace": { "index": 5, "kind": "element", "displayName": "Namespace", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Injects the XML Namespaces of prefix - uri mappings" }, + "variableName": { "index": 6, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body" }, + "headerName": { "index": 7, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 8, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "trim": { "index": 9, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd index edad93e52b6..4b0cd8c0273 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd @@ -15543,7 +15543,7 @@ set. </xs:complexType> <xs:complexType name="tokenizerExpression"> <xs:simpleContent> - <xs:extension base="tns:singleInputExpressionDefinition"> + <xs:extension base="tns:singleInputTypedExpressionDefinition"> <xs:attribute name="token" type="xs:string" use="required"> <xs:annotation> <xs:documentation xml:lang="en"> @@ -15657,6 +15657,15 @@ expression function. <xs:complexType name="xmlTokenizerExpression"> <xs:simpleContent> <xs:extension base="tns:namespaceAwareExpression"> + <xs:attribute name="resultType" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"> +<![CDATA[ +Sets the class of the result type (type from output). +]]> + </xs:documentation> + </xs:annotation> + </xs:attribute> <xs:attribute name="mode" type="xs:string"> <xs:annotation> <xs:documentation xml:lang="en"> diff --git a/components/camel-stax/src/generated/resources/org/apache/camel/language/xtokenizer/xtokenize.json b/components/camel-stax/src/generated/resources/org/apache/camel/language/xtokenizer/xtokenize.json index 084cb91f80b..c70f189e3f7 100644 --- a/components/camel-stax/src/generated/resources/org/apache/camel/language/xtokenizer/xtokenize.json +++ b/components/camel-stax/src/generated/resources/org/apache/camel/language/xtokenizer/xtokenize.json @@ -18,12 +18,13 @@ "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "expression": { "index": 1, "kind": "value", "displayName": "Expression", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The expression value in your chosen language syntax" }, - "mode": { "index": 2, "kind": "attribute", "displayName": "Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "i", "w", "u", "t" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "i", "description": "The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted to [...] - "group": { "index": 3, "kind": "attribute", "displayName": "Group", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "description": "To group N parts together" }, - "namespace": { "index": 4, "kind": "element", "displayName": "Namespace", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Injects the XML Namespaces of prefix - uri mappings" }, - "variableName": { "index": 5, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body" }, - "headerName": { "index": 6, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 7, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "trim": { "index": 8, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "resultType": { "index": 2, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "mode": { "index": 3, "kind": "attribute", "displayName": "Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "i", "w", "u", "t" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "i", "description": "The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted to [...] + "group": { "index": 4, "kind": "attribute", "displayName": "Group", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "description": "To group N parts together" }, + "namespace": { "index": 5, "kind": "element", "displayName": "Namespace", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Injects the XML Namespaces of prefix - uri mappings" }, + "variableName": { "index": 6, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body" }, + "headerName": { "index": 7, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 8, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "trim": { "index": 9, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/components/camel-stax/src/main/java/org/apache/camel/language/xtokenizer/XMLTokenExpressionIterator.java b/components/camel-stax/src/main/java/org/apache/camel/language/xtokenizer/XMLTokenExpressionIterator.java index 2eb5a2f64e6..f0736642080 100644 --- a/components/camel-stax/src/main/java/org/apache/camel/language/xtokenizer/XMLTokenExpressionIterator.java +++ b/components/camel-stax/src/main/java/org/apache/camel/language/xtokenizer/XMLTokenExpressionIterator.java @@ -21,7 +21,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; -import java.io.StringReader; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.HashMap; @@ -41,6 +40,8 @@ import javax.xml.stream.XMLStreamReader; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; +import org.apache.camel.Expression; +import org.apache.camel.InvalidPayloadException; import org.apache.camel.converter.jaxp.StaxConverter; import org.apache.camel.spi.NamespaceAware; import org.apache.camel.support.ExpressionAdapter; @@ -58,22 +59,17 @@ public class XMLTokenExpressionIterator extends ExpressionAdapter implements Nam protected final String path; protected char mode; protected int group; - protected String headerName; - protected String propertyName; - protected String variableName; + protected Expression source; protected Map<String, String> nsmap; public XMLTokenExpressionIterator(String path, char mode) { - this(path, mode, 1, null, null); + this(null, path, mode); } - public XMLTokenExpressionIterator(String path, char mode, int group, String headerName, String propertyName) { - StringHelper.notEmpty(path, "path"); - this.headerName = headerName; - this.propertyName = propertyName; + public XMLTokenExpressionIterator(Expression source, String path, char mode) { + this.source = source; this.path = path; this.mode = mode; - this.group = group; } @Override @@ -109,30 +105,6 @@ public class XMLTokenExpressionIterator extends ExpressionAdapter implements Nam this.group = group; } - public String getHeaderName() { - return headerName; - } - - public void setHeaderName(String headerName) { - this.headerName = headerName; - } - - public String getPropertyName() { - return propertyName; - } - - public void setPropertyName(String propertyName) { - this.propertyName = propertyName; - } - - public String getVariableName() { - return variableName; - } - - public void setVariableName(String variableName) { - this.variableName = variableName; - } - protected Iterator<?> createIterator(InputStream in, String charset) throws XMLStreamException, UnsupportedEncodingException { return createIterator(new InputStreamReader(in, charset)); @@ -169,32 +141,29 @@ public class XMLTokenExpressionIterator extends ExpressionAdapter implements Nam * @return the evaluated value */ protected Object doEvaluate(Exchange exchange, boolean closeStream) { + InputStream in = null; Reader reader = null; try { - if (headerName != null) { - String val = exchange.getIn().getHeader(headerName, String.class); - reader = new StringReader(val); - } else if (propertyName != null) { - String val = exchange.getProperty(propertyName, String.class); - reader = new StringReader(val); - } else if (variableName != null) { - String val = exchange.getVariable(variableName, String.class); - reader = new StringReader(val); + if (source != null) { + in = source.evaluate(exchange, InputStream.class); } else { - InputStream in = exchange.getIn().getMandatoryBody(InputStream.class); - // use xml stream reader which is capable of handling reading the xml stream - // according to <xml encoding> charset - reader = new XmlStreamReader(in); + in = exchange.getIn().getBody(InputStream.class); + } + if (in == null) { + throw new InvalidPayloadException(exchange, InputStream.class); } + // use xml stream reader which is capable of handling reading the xml stream + // according to <xml encoding> charset + reader = new XmlStreamReader(in); return createIterator(reader); } catch (Exception e) { exchange.setException(e); // must close input stream - IOHelper.close(reader); + IOHelper.close(in, reader); return null; } finally { if (closeStream) { - IOHelper.close(reader); + IOHelper.close(in, reader); } } } diff --git a/components/camel-stax/src/main/java/org/apache/camel/language/xtokenizer/XMLTokenizeLanguage.java b/components/camel-stax/src/main/java/org/apache/camel/language/xtokenizer/XMLTokenizeLanguage.java index 73ef1d1fc21..281b72d4df7 100644 --- a/components/camel-stax/src/main/java/org/apache/camel/language/xtokenizer/XMLTokenizeLanguage.java +++ b/components/camel-stax/src/main/java/org/apache/camel/language/xtokenizer/XMLTokenizeLanguage.java @@ -19,10 +19,8 @@ package org.apache.camel.language.xtokenizer; import java.util.Map; import org.apache.camel.Expression; -import org.apache.camel.Predicate; import org.apache.camel.spi.annotations.Language; -import org.apache.camel.support.ExpressionToPredicateAdapter; -import org.apache.camel.support.LanguageSupport; +import org.apache.camel.support.SingleInputTypedLanguageSupport; import org.apache.camel.support.builder.Namespaces; /** @@ -37,31 +35,14 @@ import org.apache.camel.support.builder.Namespaces; * </ul> */ @Language("xtokenize") -public class XMLTokenizeLanguage extends LanguageSupport { +public class XMLTokenizeLanguage extends SingleInputTypedLanguageSupport { @Override - public Predicate createPredicate(String expression) { - return ExpressionToPredicateAdapter.toPredicate(createExpression(expression)); - } - - @Override - public Expression createExpression(String expression) { - return createExpression(expression, null); - } - - @Override - public Predicate createPredicate(String expression, Object[] properties) { - return ExpressionToPredicateAdapter.toPredicate(createExpression(expression, properties)); - } - - @Override - public Expression createExpression(String expression, Object[] properties) { - Character mode = property(Character.class, properties, 1, "i"); - - XMLTokenExpressionIterator answer = new XMLTokenExpressionIterator(expression, mode); - answer.setHeaderName(property(String.class, properties, 0, null)); - answer.setGroup(property(int.class, properties, 2, 1)); - Object obj = properties[3]; + public Expression createExpression(Expression source, String expression, Object[] properties) { + Character mode = property(Character.class, properties, 4, "i"); + XMLTokenExpressionIterator answer = new XMLTokenExpressionIterator(source, expression, mode); + answer.setGroup(property(int.class, properties, 5, 1)); + Object obj = properties[6]; if (obj != null) { Namespaces ns; if (obj instanceof Namespaces) { @@ -75,8 +56,6 @@ public class XMLTokenizeLanguage extends LanguageSupport { } answer.setNamespaces(ns.getNamespaces()); } - answer.setPropertyName(property(String.class, properties, 4, null)); - answer.setVariableName(property(String.class, properties, 5, null)); if (getCamelContext() != null) { answer.init(getCamelContext()); } diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java index ef4e9705920..8807c806a8f 100644 --- a/core/camel-core-languages/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java +++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java @@ -58,10 +58,6 @@ public class TokenizeLanguage extends SingleInputTypedLanguageSupport { throw new IllegalArgumentException("The option includeTokens requires endToken to be specified."); } - if (type != null && type != Object.class) { - source = ExpressionBuilder.convertToExpression(source, type); - } - Expression answer = null; if (xml) { answer = ExpressionBuilder.tokenizeXMLExpression(source, token, inheritNamespaceTagName); @@ -82,6 +78,10 @@ public class TokenizeLanguage extends SingleInputTypedLanguageSupport { } } + if (type != null && type != Object.class) { + answer = ExpressionBuilder.convertToExpression(answer, type); + } + // if group then wrap answer in group expression if (group != null) { if (xml) { diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/xtokenize.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/xtokenize.json index 4fc98b7419d..fe64a44a46c 100644 --- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/xtokenize.json +++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/xtokenize.json @@ -15,12 +15,13 @@ "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "expression": { "index": 1, "kind": "value", "displayName": "Expression", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The expression value in your chosen language syntax" }, - "mode": { "index": 2, "kind": "attribute", "displayName": "Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "i", "w", "u", "t" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "i", "description": "The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted to [...] - "group": { "index": 3, "kind": "attribute", "displayName": "Group", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "description": "To group N parts together" }, - "namespace": { "index": 4, "kind": "element", "displayName": "Namespace", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Injects the XML Namespaces of prefix - uri mappings" }, - "variableName": { "index": 5, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body" }, - "headerName": { "index": 6, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, - "propertyName": { "index": 7, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, - "trim": { "index": 8, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } + "resultType": { "index": 2, "kind": "attribute", "displayName": "Result Type", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the class of the result type (type from output)" }, + "mode": { "index": 3, "kind": "attribute", "displayName": "Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "i", "w", "u", "t" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "i", "description": "The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted to [...] + "group": { "index": 4, "kind": "attribute", "displayName": "Group", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "description": "To group N parts together" }, + "namespace": { "index": 5, "kind": "element", "displayName": "Namespace", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Injects the XML Namespaces of prefix - uri mappings" }, + "variableName": { "index": 6, "kind": "attribute", "displayName": "Variable Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of variable to use as input, instead of the message body" }, + "headerName": { "index": 7, "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, + "propertyName": { "index": 8, "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "trim": { "index": 9, "kind": "attribute", "displayName": "Trim", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to trim the value to remove leading and trailing whitespaces and line breaks" } } } diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/language/SingleInputExpressionDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/language/SingleInputExpressionDefinition.java index 3d2afe013f9..f3fdb850bc8 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/language/SingleInputExpressionDefinition.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/language/SingleInputExpressionDefinition.java @@ -25,6 +25,7 @@ import org.apache.camel.spi.Metadata; /** * Expression for which the source of the input (body, header or property) can be provided. */ +@Deprecated public abstract class SingleInputExpressionDefinition extends ExpressionDefinition { @XmlAttribute diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/language/XMLTokenizerExpression.java b/core/camel-core-model/src/main/java/org/apache/camel/model/language/XMLTokenizerExpression.java index 5dfed81e3c2..4bb2116b615 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/language/XMLTokenizerExpression.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/language/XMLTokenizerExpression.java @@ -33,6 +33,10 @@ import org.apache.camel.spi.Metadata; @XmlAccessorType(XmlAccessType.FIELD) public class XMLTokenizerExpression extends NamespaceAwareExpression { + @XmlTransient + private Class<?> resultType; + @XmlAttribute(name = "resultType") + private String resultTypeName; @XmlAttribute @Metadata(defaultValue = "i", enums = "i,w,u,t") private String mode; @@ -53,6 +57,8 @@ public class XMLTokenizerExpression extends NamespaceAwareExpression { private XMLTokenizerExpression(Builder builder) { super(builder); + this.resultTypeName = builder.resultTypeName; + this.resultType = builder.resultType; this.mode = builder.mode; this.group = builder.group; } @@ -62,6 +68,30 @@ public class XMLTokenizerExpression extends NamespaceAwareExpression { return "xtokenize"; } + public Class<?> getResultType() { + return resultType; + } + + /** + * Sets the class of the result type (type from output). + * <p/> + * The default result type is NodeSet + */ + public void setResultType(Class<?> resultType) { + this.resultType = resultType; + } + + public String getResultTypeName() { + return resultTypeName; + } + + /** + * Sets the class of the result type (type from output) + */ + public void setResultTypeName(String resultTypeName) { + this.resultTypeName = resultTypeName; + } + public String getMode() { return mode; } @@ -96,9 +126,29 @@ public class XMLTokenizerExpression extends NamespaceAwareExpression { @XmlTransient public static class Builder extends AbstractNamespaceAwareBuilder<Builder, XMLTokenizerExpression> { + private String resultTypeName; + private Class<?> resultType; private String mode; private String group; + /** + * Sets the class of the result type (type from output) + */ + public Builder resultTypeName(String resultTypeName) { + this.resultTypeName = resultTypeName; + return this; + } + + /** + * Sets the class of the result type (type from output). + * <p/> + * The default result type is NodeSet + */ + public Builder resultType(Class<?> resultType) { + this.resultType = resultType; + return this; + } + /** * The extraction mode. The available extraction modes are: * <ul> diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XMLTokenizerExpressionReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XMLTokenizerExpressionReifier.java index a65fc5ca12e..e10c2e27dab 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XMLTokenizerExpressionReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/XMLTokenizerExpressionReifier.java @@ -65,13 +65,14 @@ public class XMLTokenizerExpressionReifier extends ExpressionReifier<XMLTokenize } protected Object[] createProperties() { - Object[] properties = new Object[6]; - properties[0] = parseString(definition.getHeaderName()); - properties[1] = parseString(definition.getMode()); - properties[2] = parseInt(definition.getGroup()); - properties[3] = definition.getNamespaces(); - properties[4] = parseString(definition.getPropertyName()); - properties[5] = parseString(definition.getVariableName()); + Object[] properties = new Object[7]; + properties[0] = definition.getResultType(); + properties[1] = parseString(definition.getVariableName()); + properties[2] = parseString(definition.getHeaderName()); + properties[3] = parseString(definition.getPropertyName()); + properties[4] = parseString(definition.getMode()); + properties[5] = parseInt(definition.getGroup()); + properties[6] = definition.getNamespaces(); return properties; } diff --git a/core/camel-core/src/test/java/org/apache/camel/language/TokenizerTest.java b/core/camel-core/src/test/java/org/apache/camel/language/TokenizerTest.java index 1578fcf98e1..bf48e643372 100644 --- a/core/camel-core/src/test/java/org/apache/camel/language/TokenizerTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/language/TokenizerTest.java @@ -21,7 +21,6 @@ import java.util.List; import org.apache.camel.Exchange; import org.apache.camel.ExchangeTestSupport; import org.apache.camel.Expression; -import org.apache.camel.builder.ExpressionBuilder; import org.apache.camel.language.tokenizer.TokenizeLanguage; import org.junit.jupiter.api.Test; @@ -56,7 +55,8 @@ public class TokenizerTest extends ExchangeTestSupport { Expression tokenizeXML(String tagName, String inheritNamespaceTagName) { TokenizeLanguage language = new TokenizeLanguage(); language.setCamelContext(context); - return language.createExpression(null, new Object[] { null, null, null, null, tagName, null, inheritNamespaceTagName, null, null, true }); + return language.createExpression(null, + new Object[] { null, null, null, null, tagName, null, inheritNamespaceTagName, null, null, true }); } @Override diff --git a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java index 567bd363905..2017ac246e9 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java @@ -2450,7 +2450,8 @@ public class ExpressionBuilder { public void init(CamelContext context) { super.init(context); final Language language = context.resolveLanguage("xtokenize"); - this.exp = language.createExpression(path, new Object[] { headerName, mode, group, namespaces }); + this.exp = language.createExpression(path, + new Object[] { null, null, headerName, null, mode, group, namespaces }); this.exp.init(context); } diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java index 0afa6284ae2..21625a8329e 100644 --- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java +++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java @@ -3024,6 +3024,7 @@ public class ModelParser extends BaseParser { switch (key) { case "group": def.setGroup(val); break; case "mode": def.setMode(val); break; + case "resultType": def.setResultTypeName(val); break; default: return singleInputExpressionDefinitionAttributeHandler().accept(def, key, val); } return true; diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java index 3b2cdc94625..aacf22cb78a 100644 --- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java +++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java @@ -4242,6 +4242,7 @@ public class ModelWriter extends BaseWriter { startElement(name); doWriteSingleInputExpressionDefinitionAttributes(def); doWriteAttribute("mode", def.getMode()); + doWriteAttribute("resultType", def.getResultTypeName()); doWriteAttribute("group", def.getGroup()); doWriteNamespaces(def); doWriteValue(def.getExpression()); diff --git a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java index b7a43a0e430..42bc845b360 100644 --- a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java +++ b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java @@ -4242,6 +4242,7 @@ public class ModelWriter extends BaseWriter { startElement(name); doWriteSingleInputExpressionDefinitionAttributes(def); doWriteAttribute("mode", def.getMode()); + doWriteAttribute("resultType", def.getResultTypeName()); doWriteAttribute("group", def.getGroup()); doWriteNamespaces(def); doWriteValue(def.getExpression()); diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java index 61aa0eab908..6640db37c18 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java @@ -18429,10 +18429,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "inheritNamespaceTagName", type = "string", description = "To inherit namespaces from a root/parent tag name when using XML You can use simple language as the tag name to support dynamic names.", displayName = "Inherit Namespace Tag Name"), @YamlProperty(name = "propertyName", type = "string", description = "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set.", displayName = "Property Name"), @YamlProperty(name = "regex", type = "boolean", description = "If the token is a regular expression pattern. The default value is false", displayName = "Regex"), + @YamlProperty(name = "resultType", type = "string", description = "Sets the class of the result type (type from output)", displayName = "Result Type"), @YamlProperty(name = "skipFirst", type = "boolean", description = "To skip the very first element", displayName = "Skip First"), @YamlProperty(name = "token", type = "string", required = true, description = "The (start) token to use as tokenizer, for example you can use the new line token. You can use simple language as the token to support dynamic tokens.", displayName = "Token"), @YamlProperty(name = "trim", type = "boolean", description = "Whether to trim the value to remove leading and trailing whitespaces and line breaks", displayName = "Trim"), - @YamlProperty(name = "variableName", type = "string", description = "Name of variable to use as input, instead of the message body", displayName = "Variable Name"), + @YamlProperty(name = "variableName", type = "string", description = "Name of variable to use as input, instead of the message body It has as higher precedent if other are set.", displayName = "Variable Name"), @YamlProperty(name = "xml", type = "boolean", description = "Whether the input is XML messages. This option must be set to true if working with XML payloads.", displayName = "Xml") } ) @@ -18501,6 +18502,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setRegex(val); break; } + case "resultType": { + String val = asText(node); + target.setResultTypeName(val); + break; + } case "skipFirst": { String val = asText(node); target.setSkipFirst(val); @@ -20514,6 +20520,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "mode", type = "enum:i,w,u,t", defaultValue = "i", description = "The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted token to its child content t - extracting the text content of the specified element", displayName = "Mode"), @YamlProperty(name = "namespace", type = "array:org.apache.camel.model.PropertyDefinition", description = "Injects the XML Namespaces of prefix - uri mappings", displayName = "Namespace"), @YamlProperty(name = "propertyName", type = "string", description = "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set.", displayName = "Property Name"), + @YamlProperty(name = "resultType", type = "string", description = "Sets the class of the result type (type from output)", displayName = "Result Type"), @YamlProperty(name = "trim", type = "boolean", description = "Whether to trim the value to remove leading and trailing whitespaces and line breaks", displayName = "Trim"), @YamlProperty(name = "variableName", type = "string", description = "Name of variable to use as input, instead of the message body", displayName = "Variable Name") } @@ -20573,6 +20580,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setPropertyName(val); break; } + case "resultType": { + String val = asText(node); + target.setResultTypeName(val); + break; + } case "trim": { String val = asText(node); target.setTrim(val); diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json index 9a5e75a013e..a1f7023b15e 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json @@ -13655,6 +13655,11 @@ "title" : "Regex", "description" : "If the token is a regular expression pattern. The default value is false" }, + "resultType" : { + "type" : "string", + "title" : "Result Type", + "description" : "Sets the class of the result type (type from output)" + }, "skipFirst" : { "type" : "boolean", "title" : "Skip First", @@ -13673,7 +13678,7 @@ "variableName" : { "type" : "string", "title" : "Variable Name", - "description" : "Name of variable to use as input, instead of the message body" + "description" : "Name of variable to use as input, instead of the message body It has as higher precedent if other are set." }, "xml" : { "type" : "boolean", @@ -13799,6 +13804,11 @@ "title" : "Property Name", "description" : "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, + "resultType" : { + "type" : "string", + "title" : "Result Type", + "description" : "Sets the class of the result type (type from output)" + }, "trim" : { "type" : "boolean", "title" : "Trim",