diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smooks.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smooks.json index b2844871613ad..b105f895b02c0 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smooks.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smooks.json @@ -29,7 +29,7 @@ "autowiredEnabled": { "index": 2, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." } }, "properties": { - "smooksConfig": { "index": 0, "kind": "path", "displayName": "Smooks Config", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "description": "Smooks XML configuration file" }, + "smooksConfig": { "index": 0, "kind": "path", "displayName": "Smooks Config", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "description": "Path to the Smooks configuration file" }, "reportPath": { "index": 1, "kind": "parameter", "displayName": "Report Path", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "File path to place the generated HTML execution report. The report is a useful tool in the developers arsenal for diagnosing issues or comprehending a transformation. Do not set in production since this is a major performance drain" }, "sendEmptyMessageWhenIdle": { "index": 2, "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." }, "bridgeErrorHandler": { "index": 3, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats.properties index 78c60922b0bcd..1afe6443c8998 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats.properties +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats.properties @@ -32,6 +32,7 @@ pgp protobuf protobufJackson rss +smooks snakeYaml soap swiftMt diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/smooks.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/smooks.json new file mode 100644 index 0000000000000..cb0c68a58c0b4 --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/smooks.json @@ -0,0 +1,22 @@ +{ + "dataformat": { + "kind": "dataformat", + "name": "smooks", + "title": "Smooks", + "description": "Transform and bind XML as well as non-XML data using Smooks.", + "deprecated": false, + "firstVersion": "4.9.0", + "label": "dataformat,transformation,smooks", + "javaType": "org.apache.camel.dataformat.smooks.SmooksDataFormat", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-smooks", + "version": "4.9.0-SNAPSHOT", + "modelName": "smooks", + "modelJavaType": "org.apache.camel.model.dataformat.SmooksDataFormat" + }, + "properties": { + "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" }, + "smooksConfig": { "index": 1, "kind": "attribute", "displayName": "Smooks Config", "group": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Path to the Smooks configuration file." } + } +} diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models.properties index 3b65a58958b9e..e69e1d2f49f17 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models.properties +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models.properties @@ -184,6 +184,7 @@ setProperty setVariable setVariables simple +smooks soap sort spel diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/dataFormats.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/dataFormats.json index 7a5c949c25421..ea2b0bb8013ff 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/dataFormats.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/dataFormats.json @@ -12,6 +12,6 @@ "output": false }, "properties": { - "dataFormats": { "index": 0, "kind": "element", "displayName": "Data Formats", "group": "common", "required": true, "type": "array", "javaType": "java.util.List", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss", "soap", "swiftMt", "swiftMx", "syslog", "tarFile", "thrift", "tidyMarkup", "univocityCsv", "univocityFixed", "univocityTsv", "xmlSecurity", "yaml", "zipDeflater", "zipFile" ], "deprecated": false, "autowired": false, "secret": false, "description": "A list holding the configured data formats" } + "dataFormats": { "index": 0, "kind": "element", "displayName": "Data Formats", "group": "common", "required": true, "type": "array", "javaType": "java.util.List", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss", "smooks", "soap", "swiftMt", "swiftMx", "syslog", "tarFile", "thrift", "tidyMarkup", "univocityCsv", "univocityFixed", "univocityTsv", "xmlSecurity", "yaml", "zipDeflater", "zipFile" ], "deprecated": false, "autowired": false, "secret": false, "description": "A list holding the configured data formats" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/marshal.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/marshal.json index 98f8d55c65b77..ecc749299c3ac 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/marshal.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/marshal.json @@ -15,7 +15,7 @@ "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "description": { "index": 1, "kind": "attribute", "displayName": "Description", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the description of this node" }, "disabled": { "index": 2, "kind": "attribute", "displayName": "Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to disable this EIP from the route during build time. Once an EIP has been disabled then it cannot be enabled later at runtime." }, - "dataFormatType": { "index": 3, "kind": "element", "displayName": "Data Format Type", "group": "common", "required": true, "type": "object", "javaType": "org.apache.camel.model.DataFormatDefinition", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss", "soap", "swiftMt", "swiftMx", "syslog", "tarFile", "thrift", "tidyMarkup", "univocityCsv", "univocityFixed", "univocityTsv", "xmlSecurity", "yaml", "zipDeflater", "zipFile" ], "deprecated": false, "autowired": false, "secret": false, "description": "The data format to be used" }, + "dataFormatType": { "index": 3, "kind": "element", "displayName": "Data Format Type", "group": "common", "required": true, "type": "object", "javaType": "org.apache.camel.model.DataFormatDefinition", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss", "smooks", "soap", "swiftMt", "swiftMx", "syslog", "tarFile", "thrift", "tidyMarkup", "univocityCsv", "univocityFixed", "univocityTsv", "xmlSecurity", "yaml", "zipDeflater", "zipFile" ], "deprecated": false, "autowired": false, "secret": false, "description": "The data format to be used" }, "variableSend": { "index": 4, "kind": "attribute", "displayName": "Variable Send", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a variable as the source for the message body to send. This makes it handy to use variables for user data and to easily control what data to use for sending and receiving. Important: When using send variable then the message body is taken from this variable instead of the current message, however the headers from the message will still be used as well. In other words, the variable is used instead of the message body, but everything else is as usual." }, "variableReceive": { "index": 5, "kind": "attribute", "displayName": "Variable Receive", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a variable to store the received message body (only body, not headers). This makes it handy to use variables for user data and to easily control what data to use for sending and receiving. Important: When using receive variable then the received body is stored only in this variable and not on the current message." } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/smooks.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/smooks.json new file mode 100644 index 0000000000000..841de6ce94d94 --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/smooks.json @@ -0,0 +1,19 @@ +{ + "model": { + "kind": "model", + "name": "smooks", + "title": "Smooks", + "description": "Transform and bind XML as well as non-XML data using Smooks.", + "deprecated": false, + "firstVersion": "4.9.0", + "label": "dataformat,transformation,smooks", + "javaType": "org.apache.camel.model.dataformat.SmooksDataFormat", + "abstract": false, + "input": false, + "output": false + }, + "properties": { + "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" }, + "smooksConfig": { "index": 1, "kind": "attribute", "displayName": "Smooks Config", "group": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Path to the Smooks configuration file." } + } +} diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/unmarshal.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/unmarshal.json index 5a832d4470d2c..fa3b561f0eaf6 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/unmarshal.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/unmarshal.json @@ -15,7 +15,7 @@ "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "description": { "index": 1, "kind": "attribute", "displayName": "Description", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the description of this node" }, "disabled": { "index": 2, "kind": "attribute", "displayName": "Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to disable this EIP from the route during build time. Once an EIP has been disabled then it cannot be enabled later at runtime." }, - "dataFormatType": { "index": 3, "kind": "element", "displayName": "Data Format Type", "group": "common", "required": true, "type": "object", "javaType": "org.apache.camel.model.DataFormatDefinition", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss", "soap", "swiftMt", "swiftMx", "syslog", "tarFile", "thrift", "tidyMarkup", "univocityCsv", "univocityFixed", "univocityTsv", "xmlSecurity", "yaml", "zipDeflater", "zipFile" ], "deprecated": false, "autowired": false, "secret": false, "description": "The data format to be used" }, + "dataFormatType": { "index": 3, "kind": "element", "displayName": "Data Format Type", "group": "common", "required": true, "type": "object", "javaType": "org.apache.camel.model.DataFormatDefinition", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss", "smooks", "soap", "swiftMt", "swiftMx", "syslog", "tarFile", "thrift", "tidyMarkup", "univocityCsv", "univocityFixed", "univocityTsv", "xmlSecurity", "yaml", "zipDeflater", "zipFile" ], "deprecated": false, "autowired": false, "secret": false, "description": "The data format to be used" }, "variableSend": { "index": 4, "kind": "attribute", "displayName": "Variable Send", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a variable as the source for the message body to send. This makes it handy to use variables for user data and to easily control what data to use for sending and receiving. Important: When using send variable then the message body is taken from this variable instead of the current message, however the headers from the message will still be used as well. In other words, the variable is used instead of the message body, but everything else is as usual." }, "variableReceive": { "index": 5, "kind": "attribute", "displayName": "Variable Receive", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a variable to store the received message body (only body, not headers). This makes it handy to use variables for user data and to easily control what data to use for sending and receiving. Important: When using receive variable then the received body is stored only in this variable and not on the current message." }, "allowNullBody": { "index": 6, "kind": "attribute", "displayName": "Allow Null Body", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Indicates whether null is allowed as value of a body to unmarshall." } 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 3a4a3e9447898..f3a8b148b658d 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 @@ -1858,6 +1858,15 @@ Allows setting multiple variables at the same time. + + + + + + + @@ -7419,6 +7428,7 @@ down. Default value: false + @@ -9726,6 +9736,22 @@ value: true + + + + + + + + + + + + + + @@ -14590,6 +14616,7 @@ To type used as a target data type in the transformation. + @@ -16794,6 +16821,7 @@ Set a reference to a custom Expression to use. + @@ -17597,6 +17625,7 @@ Sets the component name that this definition will apply to. + diff --git a/components/camel-smooks/pom.xml b/components/camel-smooks/pom.xml index fc01790ec29eb..d4d5d7709ca8b 100644 --- a/components/camel-smooks/pom.xml +++ b/components/camel-smooks/pom.xml @@ -47,7 +47,6 @@ - org.apache.camel camel-support @@ -56,7 +55,6 @@ org.smooks smooks-core - org.smooks.cartridges.edi smooks-edi-cartridge diff --git a/components/camel-smooks/src/generated/java/org/apache/camel/component/smooks/SmooksDataFormatConfigurer.java b/components/camel-smooks/src/generated/java/org/apache/camel/component/smooks/SmooksDataFormatConfigurer.java new file mode 100644 index 0000000000000..439af9d6e16d9 --- /dev/null +++ b/components/camel-smooks/src/generated/java/org/apache/camel/component/smooks/SmooksDataFormatConfigurer.java @@ -0,0 +1,27 @@ +/* Generated by camel build tools - do NOT edit this file! */ +package org.apache.camel.component.smooks; + +import javax.annotation.processing.Generated; + +import org.apache.camel.CamelContext; +import org.apache.camel.dataformat.smooks.SmooksDataFormat; +import org.apache.camel.spi.GeneratedPropertyConfigurer; +import org.apache.camel.support.component.PropertyConfigurerSupport; + +/** + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.PackageDataFormatMojo") +@SuppressWarnings("unchecked") +public class SmooksDataFormatConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer { + + @Override + public boolean configure(CamelContext camelContext, Object target, String name, Object value, boolean ignoreCase) { + SmooksDataFormat dataformat = (SmooksDataFormat) target; + switch (ignoreCase ? name.toLowerCase() : name) { + default: return false; + } + } + +} + diff --git a/components/camel-smooks/src/generated/java/org/apache/camel/dataformat/smooks/SmooksDataFormatConfigurer.java b/components/camel-smooks/src/generated/java/org/apache/camel/dataformat/smooks/SmooksDataFormatConfigurer.java new file mode 100644 index 0000000000000..4381bae9cefe2 --- /dev/null +++ b/components/camel-smooks/src/generated/java/org/apache/camel/dataformat/smooks/SmooksDataFormatConfigurer.java @@ -0,0 +1,30 @@ +/* Generated by camel build tools - do NOT edit this file! */ +package org.apache.camel.dataformat.smooks; + +import javax.annotation.processing.Generated; +import java.util.HashMap; +import java.util.Map; + +import org.apache.camel.CamelContext; +import org.apache.camel.spi.GeneratedPropertyConfigurer; +import org.apache.camel.support.component.PropertyConfigurerSupport; + +/** + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.PackageDataFormatMojo") +@SuppressWarnings("unchecked") +public class SmooksDataFormatConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer { + + @Override + public boolean configure(CamelContext camelContext, Object target, String name, Object value, boolean ignoreCase) { + SmooksDataFormat dataformat = (SmooksDataFormat) target; + switch (ignoreCase ? name.toLowerCase() : name) { + case "smooksconfig": + case "smooksConfig": dataformat.setSmooksConfig(property(camelContext, java.lang.String.class, value)); return true; + default: return false; + } + } + +} + diff --git a/components/camel-smooks/src/generated/resources/META-INF/org/apache/camel/component/smooks/smooks.json b/components/camel-smooks/src/generated/resources/META-INF/org/apache/camel/component/smooks/smooks.json index b2844871613ad..b105f895b02c0 100644 --- a/components/camel-smooks/src/generated/resources/META-INF/org/apache/camel/component/smooks/smooks.json +++ b/components/camel-smooks/src/generated/resources/META-INF/org/apache/camel/component/smooks/smooks.json @@ -29,7 +29,7 @@ "autowiredEnabled": { "index": 2, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." } }, "properties": { - "smooksConfig": { "index": 0, "kind": "path", "displayName": "Smooks Config", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "description": "Smooks XML configuration file" }, + "smooksConfig": { "index": 0, "kind": "path", "displayName": "Smooks Config", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "description": "Path to the Smooks configuration file" }, "reportPath": { "index": 1, "kind": "parameter", "displayName": "Report Path", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "File path to place the generated HTML execution report. The report is a useful tool in the developers arsenal for diagnosing issues or comprehending a transformation. Do not set in production since this is a major performance drain" }, "sendEmptyMessageWhenIdle": { "index": 2, "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." }, "bridgeErrorHandler": { "index": 3, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored." }, diff --git a/components/camel-smooks/src/generated/resources/META-INF/org/apache/camel/dataformat/smooks/smooks.json b/components/camel-smooks/src/generated/resources/META-INF/org/apache/camel/dataformat/smooks/smooks.json new file mode 100644 index 0000000000000..cb0c68a58c0b4 --- /dev/null +++ b/components/camel-smooks/src/generated/resources/META-INF/org/apache/camel/dataformat/smooks/smooks.json @@ -0,0 +1,22 @@ +{ + "dataformat": { + "kind": "dataformat", + "name": "smooks", + "title": "Smooks", + "description": "Transform and bind XML as well as non-XML data using Smooks.", + "deprecated": false, + "firstVersion": "4.9.0", + "label": "dataformat,transformation,smooks", + "javaType": "org.apache.camel.dataformat.smooks.SmooksDataFormat", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-smooks", + "version": "4.9.0-SNAPSHOT", + "modelName": "smooks", + "modelJavaType": "org.apache.camel.model.dataformat.SmooksDataFormat" + }, + "properties": { + "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" }, + "smooksConfig": { "index": 1, "kind": "attribute", "displayName": "Smooks Config", "group": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Path to the Smooks configuration file." } + } +} diff --git a/components/camel-smooks/src/generated/resources/META-INF/services/org/apache/camel/configurer/smooks-dataformat b/components/camel-smooks/src/generated/resources/META-INF/services/org/apache/camel/configurer/smooks-dataformat new file mode 100644 index 0000000000000..cc79fd7de3a36 --- /dev/null +++ b/components/camel-smooks/src/generated/resources/META-INF/services/org/apache/camel/configurer/smooks-dataformat @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.dataformat.smooks.SmooksDataFormatConfigurer diff --git a/components/camel-smooks/src/generated/resources/META-INF/services/org/apache/camel/dataformat.properties b/components/camel-smooks/src/generated/resources/META-INF/services/org/apache/camel/dataformat.properties new file mode 100644 index 0000000000000..fb35cf2007ac7 --- /dev/null +++ b/components/camel-smooks/src/generated/resources/META-INF/services/org/apache/camel/dataformat.properties @@ -0,0 +1,7 @@ +# Generated by camel build tools - do NOT edit this file! +dataFormats=smooks +groupId=org.apache.camel +artifactId=camel-smooks +version=4.9.0-SNAPSHOT +projectName=Camel :: Smooks :: Parent +projectDescription=Camel Smooks Component diff --git a/components/camel-smooks/src/generated/resources/META-INF/services/org/apache/camel/dataformat/smooks b/components/camel-smooks/src/generated/resources/META-INF/services/org/apache/camel/dataformat/smooks new file mode 100644 index 0000000000000..ac50e4b08b0cc --- /dev/null +++ b/components/camel-smooks/src/generated/resources/META-INF/services/org/apache/camel/dataformat/smooks @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.dataformat.smooks.SmooksDataFormat diff --git a/components/camel-smooks/src/main/docs/smooks-component.adoc b/components/camel-smooks/src/main/docs/smooks-component.adoc index 1b1ff285daa4f..d16e886b26785 100644 --- a/components/camel-smooks/src/main/docs/smooks-component.adoc +++ b/components/camel-smooks/src/main/docs/smooks-component.adoc @@ -21,6 +21,8 @@ Common applications of Smooks include: * enrichment: enrich fragments with data from a database or other data sources. * Java binding: populate POJOs from a source such as CSV, EDI, XML, and other POJOs. +Use the xref:dataformats:smooks-dataformat.adoc[Smooks Data Format] instead of this component when you are primarily interested in transformation and binding; not other Smooks features like routing. + Maven users will need to add the following dependency to their `pom.xml`. [source,xml] @@ -98,4 +100,4 @@ The Smooks component is configured with a mandatory configuration file, which is ---- -The example `` configures Smooks to export the execution result to Camel as a string. Keep in mind that exporting the result as string means that the whole result will be kept in-memory which could cause unexpected performance issues for large payloads. +The example `` configures Smooks to export the execution result to Camel as a string. Keep in mind that exporting the result as string means that the whole result will be kept in-memory which could cause unexpected performance issues for large payloads. \ No newline at end of file diff --git a/components/camel-smooks/src/main/docs/smooks-dataformat.adoc b/components/camel-smooks/src/main/docs/smooks-dataformat.adoc new file mode 100644 index 0000000000000..3f856b4869af9 --- /dev/null +++ b/components/camel-smooks/src/main/docs/smooks-dataformat.adoc @@ -0,0 +1,80 @@ += Smooks DataFormat +:doctitle: Smooks +:shortname: smooks +:artifactid: camel-smooks +:description: Transform and bind XML as well as non-XML data using Smooks. +:since: 4.9 +:supportlevel: Preview +:tabs-sync-option: + +*Since Camel {since}* + +The Smooks Data Format uses https://www.smooks.org/[Smooks] to transform from one data format to another and back again. A configuration for a Smooks Data Format should not allocate system resources because the data format does not close those resources. Use this data format when you are primarily interested in transformation and binding; not other Smooks features like routing. The latter should be accomplished with the xref:components::smooks-component.adoc[Smooks component]. + +Maven users will need to add the following dependency to their `pom.xml` for this data format: + +[source,xml] +---- + + org.apache.camel + camel-smooks + x.x.x + + +---- + +== Usage + +Below is an example of using the Smooks Data Format to unmarshal a CSV into a `java.util.List` of `org.smooks.example.Customer` instances: + +[tabs] +==== +Java:: ++ +[source,java] +---- +from("direct:unmarshal") + .unmarshal().smooks("csv-smooks-unmarshal-config.xml") + .log("Unmarshalled customers: ${body}"); +---- + +YAML:: ++ +[source,yaml] +---- +- from: + uri: direct:unmarshal + steps: + - unmarshal: + smooks: + smooksConfig: csv-smooks-unmarshal-config.xml + - log: "Unmarshalled customers: ${body}" +---- +==== + +The Smooks configuration in `csv-smooks-unmarshal-config.xml` is as follows: + +[source,xml] +---- + + + + + + + + + + + +---- + +== Smooks Data Format Options + +// dataformat options: START +include::partial$dataformat-options.adoc[] +// dataformat options: END + +include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksEndpoint.java b/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksEndpoint.java index f07aa830a47e6..0a854ca1702a3 100644 --- a/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksEndpoint.java +++ b/components/camel-smooks/src/main/java/org/apache/camel/component/smooks/SmooksEndpoint.java @@ -32,7 +32,7 @@ category = { Category.TRANSFORMATION }) public class SmooksEndpoint extends ProcessorEndpoint { - @UriPath(description = "Smooks XML configuration file") + @UriPath(description = "Path to the Smooks configuration file") @Metadata(required = true, supportFileReference = true) private String smooksConfig; diff --git a/components/camel-smooks/src/main/java/org/apache/camel/dataformat/smooks/SmooksDataFormat.java b/components/camel-smooks/src/main/java/org/apache/camel/dataformat/smooks/SmooksDataFormat.java new file mode 100644 index 0000000000000..e3ff53e1235c6 --- /dev/null +++ b/components/camel-smooks/src/main/java/org/apache/camel/dataformat/smooks/SmooksDataFormat.java @@ -0,0 +1,153 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.smooks; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; + +import org.xml.sax.SAXException; + +import org.apache.camel.CamelContext; +import org.apache.camel.CamelContextAware; +import org.apache.camel.Exchange; +import org.apache.camel.TypeConverter; +import org.apache.camel.component.smooks.SmooksComponent; +import org.apache.camel.component.smooks.SmooksProcessor; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.annotations.Dataformat; +import org.apache.camel.support.processor.MarshalProcessor; +import org.apache.camel.support.processor.UnmarshalProcessor; +import org.apache.camel.support.service.ServiceSupport; +import org.smooks.Smooks; +import org.smooks.SmooksFactory; +import org.smooks.api.ExecutionContext; +import org.smooks.api.SmooksException; +import org.smooks.api.io.Sink; +import org.smooks.engine.lookup.ExportsLookup; +import org.smooks.io.payload.Exports; +import org.smooks.io.sink.StringSink; +import org.smooks.io.source.JavaSource; +import org.smooks.io.source.StreamSource; + +/** + * SmooksDataFormat is a Camel data format which is a pluggable transformer capable of transforming from one dataformat + * to another and back again. This means that what is marshaled can be unmarshalled by an instance of this class. + *

+ *

+ * A smooks configuration for a SmooksDataFormat should not utilize Smooks features such as routing that might allocate + * system resources. The reason for this is that there is no functionality in the SmooksDataFormat which will close + * those resources. If you need to use these Smooks features please take a look at the {@link SmooksComponent} or + * {@link SmooksProcessor} as they hook into Camels lifecycle management and will close resources correctly. + *

+ */ +@Dataformat("smooks") +public class SmooksDataFormat extends ServiceSupport implements DataFormat, CamelContextAware { + private Smooks smooks; + private CamelContext camelContext; + private String smooksConfig; + + /** + * Marshals the Object 'fromBody' to an OutputStream 'toStream' + *

+ *

+ * The Camel framework will call this method from {@link MarshalProcessor#process(Exchange)} and it will take care + * of setting the Out Message's body to the bytes written to the toStream OutputStream. + * + * @param exchange The Camel {@link Exchange}. + * @param fromBody The object to be marshalled into the output stream. + * @param toStream The output stream that will be written to. + */ + @Override + public void marshal(final Exchange exchange, final Object fromBody, final OutputStream toStream) throws Exception { + final ExecutionContext executionContext = smooks.createExecutionContext(); + final TypeConverter typeConverter = exchange.getContext().getTypeConverter(); + final JavaSource javaSource = typeConverter.mandatoryConvertTo(JavaSource.class, exchange, fromBody); + final StringSink stringSink = new StringSink(); + smooks.filterSource(executionContext, javaSource, stringSink); + + toStream.write(stringSink.getResult().getBytes(executionContext.getContentEncoding())); + } + + /** + * Unmarshals the fromStream to an Object. + *

+ * The Camel framework will call this method from {@link UnmarshalProcessor#process(Exchange)} and it will take care + * of setting the returned Object on the Out Message's body. + * + * @param exchange The Camel {@link Exchange}. + * @param fromStream The InputStream that will be unmarshalled into an Object instance. + */ + @Override + public Object unmarshal(final Exchange exchange, final InputStream fromStream) { + final ExecutionContext executionContext = smooks.createExecutionContext(); + final Exports exports = smooks.getApplicationContext().getRegistry().lookup(new ExportsLookup()); + final Sink[] sinks = exports.createSinks(); + smooks.filterSource(executionContext, new StreamSource<>(fromStream), sinks); + return getResult(exports, sinks, exchange); + } + + protected Object getResult(final Exports exports, final Sink[] sinks, final Exchange exchange) { + final List objects = Exports.extractSinks(sinks, exports); + if (objects.size() == 1) { + return objects.get(0); + } else { + return objects; + } + } + + @Override + public void setCamelContext(CamelContext camelContext) { + this.camelContext = camelContext; + } + + @Override + public CamelContext getCamelContext() { + return camelContext; + } + + @Override + public void doStart() { + final SmooksFactory smooksFactory + = (SmooksFactory) camelContext.getRegistry().lookupByName(SmooksFactory.class.getName()); + try { + if (smooksFactory != null) { + smooks = smooksFactory.createInstance(smooksConfig); + } else { + smooks = new Smooks(smooksConfig); + } + } catch (IOException | SAXException e) { + throw new SmooksException(e.getMessage(), e); + } + } + + @Override + public void doStop() { + if (smooks != null) { + smooks.close(); + } + } + + public String getSmooksConfig() { + return smooksConfig; + } + + public void setSmooksConfig(String smooksConfig) { + this.smooksConfig = smooksConfig; + } +} diff --git a/components/camel-smooks/src/test/java/org/apache/camel/component/smooks/SmooksProcessorTest.java b/components/camel-smooks/src/test/java/org/apache/camel/component/smooks/SmooksProcessorTest.java index 00da076db18b6..0be3e26f2cd7b 100644 --- a/components/camel-smooks/src/test/java/org/apache/camel/component/smooks/SmooksProcessorTest.java +++ b/components/camel-smooks/src/test/java/org/apache/camel/component/smooks/SmooksProcessorTest.java @@ -65,14 +65,10 @@ public class SmooksProcessorTest extends CamelTestSupport { @EndpointInject(value = "mock:result") private MockEndpoint result; - @Override - protected boolean useJmx() { - return true; - } - - @Override - public boolean isUseRouteBuilder() { - return false; + public SmooksProcessorTest() { + super(); + testConfigurationBuilder.withUseRouteBuilder(false); + testConfigurationBuilder.withJMX(true); } private void assertOneProcessedMessage() throws Exception { diff --git a/components/camel-smooks/src/test/java/org/apache/camel/dataformat/smooks/Customer.java b/components/camel-smooks/src/test/java/org/apache/camel/dataformat/smooks/Customer.java new file mode 100644 index 0000000000000..f98324ec102a4 --- /dev/null +++ b/components/camel-smooks/src/test/java/org/apache/camel/dataformat/smooks/Customer.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.smooks; + +import org.apache.camel.dataformat.smooks.gender.Gender; + +public class Customer { + + private String firstName; + private String lastName; + private Gender gender; + private Integer age; + private String country; + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public Gender getGender() { + return gender; + } + + public void setGender(Gender gender) { + this.gender = gender; + } + + public Integer getAge() { + return age; + } + + public void setAge(Integer age) { + this.age = age; + } +} diff --git a/components/camel-smooks/src/test/java/org/apache/camel/dataformat/smooks/SmooksDataFormatTest.java b/components/camel-smooks/src/test/java/org/apache/camel/dataformat/smooks/SmooksDataFormatTest.java new file mode 100644 index 0000000000000..0c58650fcc4f1 --- /dev/null +++ b/components/camel-smooks/src/test/java/org/apache/camel/dataformat/smooks/SmooksDataFormatTest.java @@ -0,0 +1,126 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.smooks; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import org.apache.camel.Exchange; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.dataformat.smooks.gender.Gender; +import org.apache.camel.impl.DefaultCamelContext; +import org.apache.camel.support.DefaultExchange; +import org.apache.camel.support.processor.MarshalProcessor; +import org.apache.camel.support.processor.UnmarshalProcessor; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.smooks.io.source.JavaSource; +import org.smooks.support.StreamUtils; +import org.xmlunit.builder.DiffBuilder; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; + +public class SmooksDataFormatTest extends CamelTestSupport { + private static final String SMOOKS_CONFIG = "/smooks-config.xml"; + private static final String CUSTOMER_XML = "/xml/customer.xml"; + private static final String EXPECTED_CUSTOMER_XML = "/xml/expected-customer.xml"; + private DefaultCamelContext camelContext; + private SmooksDataFormat dataFormatter; + + public SmooksDataFormatTest() { + super(); + testConfigurationBuilder.withUseRouteBuilder(false); + } + + @BeforeEach + public void beforeEach() { + camelContext = new DefaultCamelContext(); + dataFormatter = new SmooksDataFormat(); + dataFormatter.setSmooksConfig(SMOOKS_CONFIG); + dataFormatter.setCamelContext(camelContext); + dataFormatter.start(); + } + + @AfterEach + public void afterEach() { + dataFormatter.stop(); + } + + @Test + public void unmarshal() throws Exception { + final UnmarshalProcessor unmarshalProcessor = new UnmarshalProcessor(dataFormatter); + final DefaultExchange exchange = new DefaultExchange(camelContext); + exchange.getIn().setBody(getCustomerInputStream(CUSTOMER_XML)); + + unmarshalProcessor.process(exchange); + + assertEquals(Customer.class, exchange.getOut().getBody().getClass()); + } + + @Test + public void marshal() throws Exception { + final MarshalProcessor marshalProcessor = new MarshalProcessor(dataFormatter); + final DefaultExchange exchange = new DefaultExchange(camelContext); + final Customer customer = new Customer(); + customer.setFirstName("John"); + customer.setLastName("Cocktolstol"); + customer.setGender(Gender.Male); + customer.setAge(35); + customer.setCountry("USA"); + + exchange.getIn().setBody(customer, JavaSource.class); + + marshalProcessor.process(exchange); + + assertFalse(DiffBuilder.compare(getCustomerXml(EXPECTED_CUSTOMER_XML)).withTest(exchange.getOut().getBody(String.class)) + .ignoreComments().ignoreWhitespace().build().hasDifferences()); + } + + @Test + public void unmarshalMarshalThroughCamel() throws Exception { + context.addRoutes(new RouteBuilder() { + @Override + public void configure() { + from("direct:a") + .unmarshal().smooks(SMOOKS_CONFIG) + .marshal().smooks(SMOOKS_CONFIG); + } + }); + + context.start(); + + final Exchange exchange + = template.request("direct:a", e -> e.getIn().setBody(getCustomerInputStream(CUSTOMER_XML))); + + assertFalse( + DiffBuilder.compare(getCustomerXml(EXPECTED_CUSTOMER_XML)).withTest(exchange.getMessage().getBody(String.class)) + .ignoreComments().ignoreWhitespace().build().hasDifferences()); + } + + private InputStream getCustomerInputStream(final String resource) { + return getClass().getResourceAsStream(resource); + } + + private String getCustomerXml(final String resource) throws IOException { + return StreamUtils.readStream(new InputStreamReader(getCustomerInputStream(resource))); + } + +} diff --git a/components/camel-smooks/src/test/java/org/apache/camel/dataformat/smooks/gender/Gender.java b/components/camel-smooks/src/test/java/org/apache/camel/dataformat/smooks/gender/Gender.java new file mode 100644 index 0000000000000..92d373f62d1b9 --- /dev/null +++ b/components/camel-smooks/src/test/java/org/apache/camel/dataformat/smooks/gender/Gender.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.dataformat.smooks.gender; + +public enum Gender { + Male, + Female +} diff --git a/components/camel-smooks/src/test/resources/edi-to-xml-smooks-config.xml b/components/camel-smooks/src/test/resources/edi-to-xml-smooks-config.xml index b8fe29dd1f460..94a76f285cba9 100644 --- a/components/camel-smooks/src/test/resources/edi-to-xml-smooks-config.xml +++ b/components/camel-smooks/src/test/resources/edi-to-xml-smooks-config.xml @@ -19,8 +19,7 @@ --> + xmlns:edi="https://www.smooks.org/xsd/smooks/edi-2.0.xsd"> + + + + + + + + + + + + + + + + diff --git a/components/camel-smooks/src/test/resources/xml/customer.xml b/components/camel-smooks/src/test/resources/xml/customer.xml new file mode 100644 index 0000000000000..b4a3409d74ce0 --- /dev/null +++ b/components/camel-smooks/src/test/resources/xml/customer.xml @@ -0,0 +1,25 @@ + + + John + Cocktolstol + Male + 35 + USA + diff --git a/components/camel-smooks/src/test/resources/xml/expected-customer.xml b/components/camel-smooks/src/test/resources/xml/expected-customer.xml new file mode 100644 index 0000000000000..dd5f71af8b9de --- /dev/null +++ b/components/camel-smooks/src/test/resources/xml/expected-customer.xml @@ -0,0 +1,25 @@ + + + John + Cocktolstol + Male + 35 + USA + diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/dataFormats.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/dataFormats.json index 7a5c949c25421..ea2b0bb8013ff 100644 --- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/dataFormats.json +++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/dataFormats.json @@ -12,6 +12,6 @@ "output": false }, "properties": { - "dataFormats": { "index": 0, "kind": "element", "displayName": "Data Formats", "group": "common", "required": true, "type": "array", "javaType": "java.util.List", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss", "soap", "swiftMt", "swiftMx", "syslog", "tarFile", "thrift", "tidyMarkup", "univocityCsv", "univocityFixed", "univocityTsv", "xmlSecurity", "yaml", "zipDeflater", "zipFile" ], "deprecated": false, "autowired": false, "secret": false, "description": "A list holding the configured data formats" } + "dataFormats": { "index": 0, "kind": "element", "displayName": "Data Formats", "group": "common", "required": true, "type": "array", "javaType": "java.util.List", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss", "smooks", "soap", "swiftMt", "swiftMx", "syslog", "tarFile", "thrift", "tidyMarkup", "univocityCsv", "univocityFixed", "univocityTsv", "xmlSecurity", "yaml", "zipDeflater", "zipFile" ], "deprecated": false, "autowired": false, "secret": false, "description": "A list holding the configured data formats" } } } diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/smooks.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/smooks.json new file mode 100644 index 0000000000000..841de6ce94d94 --- /dev/null +++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/smooks.json @@ -0,0 +1,19 @@ +{ + "model": { + "kind": "model", + "name": "smooks", + "title": "Smooks", + "description": "Transform and bind XML as well as non-XML data using Smooks.", + "deprecated": false, + "firstVersion": "4.9.0", + "label": "dataformat,transformation,smooks", + "javaType": "org.apache.camel.model.dataformat.SmooksDataFormat", + "abstract": false, + "input": false, + "output": false + }, + "properties": { + "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" }, + "smooksConfig": { "index": 1, "kind": "attribute", "displayName": "Smooks Config", "group": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Path to the Smooks configuration file." } + } +} diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/marshal.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/marshal.json index 98f8d55c65b77..ecc749299c3ac 100644 --- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/marshal.json +++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/marshal.json @@ -15,7 +15,7 @@ "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "description": { "index": 1, "kind": "attribute", "displayName": "Description", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the description of this node" }, "disabled": { "index": 2, "kind": "attribute", "displayName": "Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to disable this EIP from the route during build time. Once an EIP has been disabled then it cannot be enabled later at runtime." }, - "dataFormatType": { "index": 3, "kind": "element", "displayName": "Data Format Type", "group": "common", "required": true, "type": "object", "javaType": "org.apache.camel.model.DataFormatDefinition", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss", "soap", "swiftMt", "swiftMx", "syslog", "tarFile", "thrift", "tidyMarkup", "univocityCsv", "univocityFixed", "univocityTsv", "xmlSecurity", "yaml", "zipDeflater", "zipFile" ], "deprecated": false, "autowired": false, "secret": false, "description": "The data format to be used" }, + "dataFormatType": { "index": 3, "kind": "element", "displayName": "Data Format Type", "group": "common", "required": true, "type": "object", "javaType": "org.apache.camel.model.DataFormatDefinition", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss", "smooks", "soap", "swiftMt", "swiftMx", "syslog", "tarFile", "thrift", "tidyMarkup", "univocityCsv", "univocityFixed", "univocityTsv", "xmlSecurity", "yaml", "zipDeflater", "zipFile" ], "deprecated": false, "autowired": false, "secret": false, "description": "The data format to be used" }, "variableSend": { "index": 4, "kind": "attribute", "displayName": "Variable Send", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a variable as the source for the message body to send. This makes it handy to use variables for user data and to easily control what data to use for sending and receiving. Important: When using send variable then the message body is taken from this variable instead of the current message, however the headers from the message will still be used as well. In other words, the variable is used instead of the message body, but everything else is as usual." }, "variableReceive": { "index": 5, "kind": "attribute", "displayName": "Variable Receive", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a variable to store the received message body (only body, not headers). This makes it handy to use variables for user data and to easily control what data to use for sending and receiving. Important: When using receive variable then the received body is stored only in this variable and not on the current message." } } diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/unmarshal.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/unmarshal.json index 5a832d4470d2c..fa3b561f0eaf6 100644 --- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/unmarshal.json +++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/unmarshal.json @@ -15,7 +15,7 @@ "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" }, "description": { "index": 1, "kind": "attribute", "displayName": "Description", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the description of this node" }, "disabled": { "index": 2, "kind": "attribute", "displayName": "Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to disable this EIP from the route during build time. Once an EIP has been disabled then it cannot be enabled later at runtime." }, - "dataFormatType": { "index": 3, "kind": "element", "displayName": "Data Format Type", "group": "common", "required": true, "type": "object", "javaType": "org.apache.camel.model.DataFormatDefinition", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss", "soap", "swiftMt", "swiftMx", "syslog", "tarFile", "thrift", "tidyMarkup", "univocityCsv", "univocityFixed", "univocityTsv", "xmlSecurity", "yaml", "zipDeflater", "zipFile" ], "deprecated": false, "autowired": false, "secret": false, "description": "The data format to be used" }, + "dataFormatType": { "index": 3, "kind": "element", "displayName": "Data Format Type", "group": "common", "required": true, "type": "object", "javaType": "org.apache.camel.model.DataFormatDefinition", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss", "smooks", "soap", "swiftMt", "swiftMx", "syslog", "tarFile", "thrift", "tidyMarkup", "univocityCsv", "univocityFixed", "univocityTsv", "xmlSecurity", "yaml", "zipDeflater", "zipFile" ], "deprecated": false, "autowired": false, "secret": false, "description": "The data format to be used" }, "variableSend": { "index": 4, "kind": "attribute", "displayName": "Variable Send", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a variable as the source for the message body to send. This makes it handy to use variables for user data and to easily control what data to use for sending and receiving. Important: When using send variable then the message body is taken from this variable instead of the current message, however the headers from the message will still be used as well. In other words, the variable is used instead of the message body, but everything else is as usual." }, "variableReceive": { "index": 5, "kind": "attribute", "displayName": "Variable Receive", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a variable to store the received message body (only body, not headers). This makes it handy to use variables for user data and to easily control what data to use for sending and receiving. Important: When using receive variable then the received body is stored only in this variable and not on the current message." }, "allowNullBody": { "index": 6, "kind": "attribute", "displayName": "Allow Null Body", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Indicates whether null is allowed as value of a body to unmarshall." } diff --git a/core/camel-core-model/src/generated/resources/META-INF/services/org/apache/camel/model.properties b/core/camel-core-model/src/generated/resources/META-INF/services/org/apache/camel/model.properties index 1e3759b073f2c..5950aa552f2be 100644 --- a/core/camel-core-model/src/generated/resources/META-INF/services/org/apache/camel/model.properties +++ b/core/camel-core-model/src/generated/resources/META-INF/services/org/apache/camel/model.properties @@ -185,6 +185,7 @@ setProperty setVariable setVariables simple +smooks soap sort spel diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/dataformat/jaxb.index b/core/camel-core-model/src/generated/resources/org/apache/camel/model/dataformat/jaxb.index index dea604122396d..75beef25cdb0e 100644 --- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/dataformat/jaxb.index +++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/dataformat/jaxb.index @@ -32,6 +32,7 @@ ParquetAvroDataFormat ProtobufDataFormat ProtobufLibrary RssDataFormat +SmooksDataFormat SoapDataFormat SwiftMtDataFormat SwiftMxDataFormat diff --git a/core/camel-core-model/src/main/java/org/apache/camel/builder/DataFormatBuilderFactory.java b/core/camel-core-model/src/main/java/org/apache/camel/builder/DataFormatBuilderFactory.java index 5e812f095d9ba..71c55d831030f 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/builder/DataFormatBuilderFactory.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/builder/DataFormatBuilderFactory.java @@ -43,6 +43,7 @@ import org.apache.camel.model.dataformat.ParquetAvroDataFormat; import org.apache.camel.model.dataformat.ProtobufDataFormat; import org.apache.camel.model.dataformat.RssDataFormat; +import org.apache.camel.model.dataformat.SmooksDataFormat; import org.apache.camel.model.dataformat.SoapDataFormat; import org.apache.camel.model.dataformat.SwiftMtDataFormat; import org.apache.camel.model.dataformat.SwiftMxDataFormat; @@ -252,6 +253,13 @@ public RssDataFormat.Builder rss() { return new RssDataFormat.Builder(); } + /** + * Uses the Smooks data format + */ + public SmooksDataFormat.Builder smooks() { + return new SmooksDataFormat.Builder(); + } + /** * Uses the Soap v1.1 data format */ diff --git a/core/camel-core-model/src/main/java/org/apache/camel/builder/DataFormatClause.java b/core/camel-core-model/src/main/java/org/apache/camel/builder/DataFormatClause.java index 714845138fc3a..375e35075b677 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/builder/DataFormatClause.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/builder/DataFormatClause.java @@ -53,6 +53,7 @@ import org.apache.camel.model.dataformat.ProtobufDataFormat; import org.apache.camel.model.dataformat.ProtobufLibrary; import org.apache.camel.model.dataformat.RssDataFormat; +import org.apache.camel.model.dataformat.SmooksDataFormat; import org.apache.camel.model.dataformat.SoapDataFormat; import org.apache.camel.model.dataformat.SwiftMtDataFormat; import org.apache.camel.model.dataformat.SwiftMxDataFormat; @@ -829,6 +830,15 @@ public T rss() { return dataFormat(new RssDataFormat()); } + /** + * Uses the Smooks data format + */ + public T smooks(String smooksConfig) { + SmooksDataFormat smooksDataFormat = new SmooksDataFormat(); + smooksDataFormat.setSmooksConfig(smooksConfig); + return dataFormat(smooksDataFormat); + } + /** * Uses the Soap v1.1 data format */ diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/MarshalDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/MarshalDefinition.java index 5ba4ef47167cc..8cf1457554a69 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/MarshalDefinition.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/MarshalDefinition.java @@ -50,6 +50,7 @@ import org.apache.camel.model.dataformat.ParquetAvroDataFormat; import org.apache.camel.model.dataformat.ProtobufDataFormat; import org.apache.camel.model.dataformat.RssDataFormat; +import org.apache.camel.model.dataformat.SmooksDataFormat; import org.apache.camel.model.dataformat.SoapDataFormat; import org.apache.camel.model.dataformat.SwiftMtDataFormat; import org.apache.camel.model.dataformat.SwiftMxDataFormat; @@ -101,6 +102,7 @@ public class MarshalDefinition extends NoOutputDefinition imp @XmlElement(name = "parquetAvro", type = ParquetAvroDataFormat.class), @XmlElement(name = "protobuf", type = ProtobufDataFormat.class), @XmlElement(name = "rss", type = RssDataFormat.class), + @XmlElement(name = "smooks", type = SmooksDataFormat.class), @XmlElement(name = "soap", type = SoapDataFormat.class), @XmlElement(name = "swiftMt", type = SwiftMtDataFormat.class), @XmlElement(name = "swiftMx", type = SwiftMxDataFormat.class), diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/UnmarshalDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/UnmarshalDefinition.java index 6293d3bf84a6f..233ae83aca6ec 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/UnmarshalDefinition.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/UnmarshalDefinition.java @@ -50,6 +50,7 @@ import org.apache.camel.model.dataformat.ParquetAvroDataFormat; import org.apache.camel.model.dataformat.ProtobufDataFormat; import org.apache.camel.model.dataformat.RssDataFormat; +import org.apache.camel.model.dataformat.SmooksDataFormat; import org.apache.camel.model.dataformat.SoapDataFormat; import org.apache.camel.model.dataformat.SwiftMtDataFormat; import org.apache.camel.model.dataformat.SwiftMxDataFormat; @@ -101,6 +102,7 @@ public class UnmarshalDefinition extends NoOutputDefinition @XmlElement(name = "parquetAvro", type = ParquetAvroDataFormat.class), @XmlElement(name = "protobuf", type = ProtobufDataFormat.class), @XmlElement(name = "rss", type = RssDataFormat.class), + @XmlElement(name = "smooks", type = SmooksDataFormat.class), @XmlElement(name = "soap", type = SoapDataFormat.class), @XmlElement(name = "swiftMt", type = SwiftMtDataFormat.class), @XmlElement(name = "swiftMx", type = SwiftMxDataFormat.class), diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java index 58fe96306d5c5..5f81808811cae 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java @@ -71,6 +71,7 @@ public class DataFormatsDefinition implements CopyableDefinition { + + private String smooksConfig; + + /** + * Path to the Smooks configuration file. + */ + public Builder smooksConfig(String smooksConfig) { + this.smooksConfig = smooksConfig; + return this; + } + + @Override + public SmooksDataFormat end() { + return new SmooksDataFormat(this); + } + } +} diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/transformer/DataFormatTransformerDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/transformer/DataFormatTransformerDefinition.java index a9656a330c6b0..f70c865f28b56 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/transformer/DataFormatTransformerDefinition.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/transformer/DataFormatTransformerDefinition.java @@ -50,6 +50,7 @@ import org.apache.camel.model.dataformat.ParquetAvroDataFormat; import org.apache.camel.model.dataformat.ProtobufDataFormat; import org.apache.camel.model.dataformat.RssDataFormat; +import org.apache.camel.model.dataformat.SmooksDataFormat; import org.apache.camel.model.dataformat.SoapDataFormat; import org.apache.camel.model.dataformat.SwiftMtDataFormat; import org.apache.camel.model.dataformat.SwiftMxDataFormat; @@ -103,6 +104,7 @@ public class DataFormatTransformerDefinition extends TransformerDefinition { @XmlElement(name = "parquetAvro", type = ParquetAvroDataFormat.class), @XmlElement(name = "protobuf", type = ProtobufDataFormat.class), @XmlElement(name = "rss", type = RssDataFormat.class), + @XmlElement(name = "smooks", type = SmooksDataFormat.class), @XmlElement(name = "soap", type = SoapDataFormat.class), @XmlElement(name = "swiftMt", type = SwiftMtDataFormat.class), @XmlElement(name = "swiftMx", type = SwiftMxDataFormat.class), diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java index 65097c1298ea2..ce5f94dc2736a 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java @@ -53,6 +53,7 @@ import org.apache.camel.model.dataformat.ParquetAvroDataFormat; import org.apache.camel.model.dataformat.ProtobufDataFormat; import org.apache.camel.model.dataformat.RssDataFormat; +import org.apache.camel.model.dataformat.SmooksDataFormat; import org.apache.camel.model.dataformat.SoapDataFormat; import org.apache.camel.model.dataformat.SwiftMtDataFormat; import org.apache.camel.model.dataformat.SwiftMxDataFormat; @@ -232,6 +233,8 @@ private static DataFormatReifier coreReifier( return new ProtobufDataFormatReifier(camelContext, definition); } else if (definition instanceof RssDataFormat) { return new RssDataFormatReifier(camelContext, definition); + } else if (definition instanceof SmooksDataFormat) { + return new SmooksDataFormatReifier(camelContext, definition); } else if (definition instanceof SoapDataFormat) { return new SoapDataFormatReifier(camelContext, definition); } else if (definition instanceof SyslogDataFormat) { diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/SmooksDataFormatReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/SmooksDataFormatReifier.java new file mode 100644 index 0000000000000..e334e6d90292f --- /dev/null +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/SmooksDataFormatReifier.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.reifier.dataformat; + +import java.util.Map; + +import org.apache.camel.CamelContext; +import org.apache.camel.model.DataFormatDefinition; +import org.apache.camel.model.dataformat.SmooksDataFormat; + +public class SmooksDataFormatReifier extends DataFormatReifier { + + public SmooksDataFormatReifier(CamelContext camelContext, DataFormatDefinition definition) { + super(camelContext, (SmooksDataFormat) definition); + } + + @Override + protected void prepareDataFormatConfig(Map properties) { + properties.put("smooksConfig", definition.getSmooksConfig()); + } + +} diff --git a/core/camel-main/src/generated/resources/org/apache/camel/main/dataformats.properties b/core/camel-main/src/generated/resources/org/apache/camel/main/dataformats.properties index 78c60922b0bcd..1afe6443c8998 100644 --- a/core/camel-main/src/generated/resources/org/apache/camel/main/dataformats.properties +++ b/core/camel-main/src/generated/resources/org/apache/camel/main/dataformats.properties @@ -32,6 +32,7 @@ pgp protobuf protobufJackson rss +smooks snakeYaml soap swiftMt 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 26a24fd39c930..fd7135f06c2a2 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 @@ -2050,6 +2050,12 @@ protected ProtobufDataFormat doParseProtobufDataFormat() throws IOException, Xml protected RssDataFormat doParseRssDataFormat() throws IOException, XmlPullParserException { return doParse(new RssDataFormat(), identifiedTypeAttributeHandler(), noElementHandler(), noValueHandler()); } + protected SmooksDataFormat doParseSmooksDataFormat() throws IOException, XmlPullParserException { + return doParse(new SmooksDataFormat(), (def, key, val) -> switch (key) { + case "smooksConfig": def.setSmooksConfig(val); yield true; + default: yield identifiedTypeAttributeHandler().accept(def, key, val); + }, noElementHandler(), noValueHandler()); + } protected SoapDataFormat doParseSoapDataFormat() throws IOException, XmlPullParserException { return doParse(new SoapDataFormat(), (def, key, val) -> switch (key) { case "contextPath": def.setContextPath(val); yield true; @@ -2889,6 +2895,7 @@ protected DataFormatDefinition doParseDataFormatDefinitionRef(String key) throws case "parquetAvro": return doParseParquetAvroDataFormat(); case "protobuf": return doParseProtobufDataFormat(); case "rss": return doParseRssDataFormat(); + case "smooks": return doParseSmooksDataFormat(); case "soap": return doParseSoapDataFormat(); case "swiftMt": return doParseSwiftMtDataFormat(); case "swiftMx": return doParseSwiftMxDataFormat(); 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 c466059f675a9..a7779645d8d3e 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 @@ -523,6 +523,9 @@ public void writeProtobufDataFormat(ProtobufDataFormat def) throws IOException { public void writeRssDataFormat(RssDataFormat def) throws IOException { doWriteRssDataFormat("rss", def); } + public void writeSmooksDataFormat(SmooksDataFormat def) throws IOException { + doWriteSmooksDataFormat("smooks", def); + } public void writeSoapDataFormat(SoapDataFormat def) throws IOException { doWriteSoapDataFormat("soap", def); } @@ -1173,6 +1176,7 @@ protected void doWriteMarshalDefinition(String name, MarshalDefinition def) thro case "ParquetAvroDataFormat" -> doWriteParquetAvroDataFormat("parquetAvro", (ParquetAvroDataFormat) v); case "ProtobufDataFormat" -> doWriteProtobufDataFormat("protobuf", (ProtobufDataFormat) v); case "RssDataFormat" -> doWriteRssDataFormat("rss", (RssDataFormat) v); + case "SmooksDataFormat" -> doWriteSmooksDataFormat("smooks", (SmooksDataFormat) v); case "SoapDataFormat" -> doWriteSoapDataFormat("soap", (SoapDataFormat) v); case "SwiftMtDataFormat" -> doWriteSwiftMtDataFormat("swiftMt", (SwiftMtDataFormat) v); case "SwiftMxDataFormat" -> doWriteSwiftMxDataFormat("swiftMx", (SwiftMxDataFormat) v); @@ -1922,6 +1926,7 @@ protected void doWriteUnmarshalDefinition(String name, UnmarshalDefinition def) case "ParquetAvroDataFormat" -> doWriteParquetAvroDataFormat("parquetAvro", (ParquetAvroDataFormat) v); case "ProtobufDataFormat" -> doWriteProtobufDataFormat("protobuf", (ProtobufDataFormat) v); case "RssDataFormat" -> doWriteRssDataFormat("rss", (RssDataFormat) v); + case "SmooksDataFormat" -> doWriteSmooksDataFormat("smooks", (SmooksDataFormat) v); case "SoapDataFormat" -> doWriteSoapDataFormat("soap", (SoapDataFormat) v); case "SwiftMtDataFormat" -> doWriteSwiftMtDataFormat("swiftMt", (SwiftMtDataFormat) v); case "SwiftMxDataFormat" -> doWriteSwiftMxDataFormat("swiftMx", (SwiftMxDataFormat) v); @@ -2483,6 +2488,7 @@ protected void doWriteDataFormatsDefinition(String name, DataFormatsDefinition d case "PGPDataFormat" -> doWritePGPDataFormat("pgp", (PGPDataFormat) v); case "ProtobufDataFormat" -> doWriteProtobufDataFormat("protobuf", (ProtobufDataFormat) v); case "RssDataFormat" -> doWriteRssDataFormat("rss", (RssDataFormat) v); + case "SmooksDataFormat" -> doWriteSmooksDataFormat("smooks", (SmooksDataFormat) v); case "SoapDataFormat" -> doWriteSoapDataFormat("soap", (SoapDataFormat) v); case "SwiftMtDataFormat" -> doWriteSwiftMtDataFormat("swiftMt", (SwiftMtDataFormat) v); case "SwiftMxDataFormat" -> doWriteSwiftMxDataFormat("swiftMx", (SwiftMxDataFormat) v); @@ -2737,6 +2743,12 @@ protected void doWriteRssDataFormat(String name, RssDataFormat def) throws IOExc doWriteIdentifiedTypeAttributes(def); endElement(name); } + protected void doWriteSmooksDataFormat(String name, SmooksDataFormat def) throws IOException { + startElement(name); + doWriteIdentifiedTypeAttributes(def); + doWriteAttribute("smooksConfig", def.getSmooksConfig()); + endElement(name); + } protected void doWriteSoapDataFormat(String name, SoapDataFormat def) throws IOException { startElement(name); doWriteIdentifiedTypeAttributes(def); @@ -3588,6 +3600,7 @@ protected void doWriteDataFormatTransformerDefinition(String name, DataFormatTra case "ParquetAvroDataFormat" -> doWriteParquetAvroDataFormat("parquetAvro", (ParquetAvroDataFormat) v); case "ProtobufDataFormat" -> doWriteProtobufDataFormat("protobuf", (ProtobufDataFormat) v); case "RssDataFormat" -> doWriteRssDataFormat("rss", (RssDataFormat) v); + case "SmooksDataFormat" -> doWriteSmooksDataFormat("smooks", (SmooksDataFormat) v); case "SoapDataFormat" -> doWriteSoapDataFormat("soap", (SoapDataFormat) v); case "SwiftMtDataFormat" -> doWriteSwiftMtDataFormat("swiftMt", (SwiftMtDataFormat) v); case "SwiftMxDataFormat" -> doWriteSwiftMxDataFormat("swiftMx", (SwiftMxDataFormat) v); 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 29e5710831853..fcfbc2c9ad8df 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 @@ -523,6 +523,9 @@ public void writeProtobufDataFormat(ProtobufDataFormat def) throws IOException { public void writeRssDataFormat(RssDataFormat def) throws IOException { doWriteRssDataFormat("rss", def); } + public void writeSmooksDataFormat(SmooksDataFormat def) throws IOException { + doWriteSmooksDataFormat("smooks", def); + } public void writeSoapDataFormat(SoapDataFormat def) throws IOException { doWriteSoapDataFormat("soap", def); } @@ -1173,6 +1176,7 @@ protected void doWriteMarshalDefinition(String name, MarshalDefinition def) thro case "ParquetAvroDataFormat" -> doWriteParquetAvroDataFormat("parquetAvro", (ParquetAvroDataFormat) v); case "ProtobufDataFormat" -> doWriteProtobufDataFormat("protobuf", (ProtobufDataFormat) v); case "RssDataFormat" -> doWriteRssDataFormat("rss", (RssDataFormat) v); + case "SmooksDataFormat" -> doWriteSmooksDataFormat("smooks", (SmooksDataFormat) v); case "SoapDataFormat" -> doWriteSoapDataFormat("soap", (SoapDataFormat) v); case "SwiftMtDataFormat" -> doWriteSwiftMtDataFormat("swiftMt", (SwiftMtDataFormat) v); case "SwiftMxDataFormat" -> doWriteSwiftMxDataFormat("swiftMx", (SwiftMxDataFormat) v); @@ -1922,6 +1926,7 @@ protected void doWriteUnmarshalDefinition(String name, UnmarshalDefinition def) case "ParquetAvroDataFormat" -> doWriteParquetAvroDataFormat("parquetAvro", (ParquetAvroDataFormat) v); case "ProtobufDataFormat" -> doWriteProtobufDataFormat("protobuf", (ProtobufDataFormat) v); case "RssDataFormat" -> doWriteRssDataFormat("rss", (RssDataFormat) v); + case "SmooksDataFormat" -> doWriteSmooksDataFormat("smooks", (SmooksDataFormat) v); case "SoapDataFormat" -> doWriteSoapDataFormat("soap", (SoapDataFormat) v); case "SwiftMtDataFormat" -> doWriteSwiftMtDataFormat("swiftMt", (SwiftMtDataFormat) v); case "SwiftMxDataFormat" -> doWriteSwiftMxDataFormat("swiftMx", (SwiftMxDataFormat) v); @@ -2483,6 +2488,7 @@ protected void doWriteDataFormatsDefinition(String name, DataFormatsDefinition d case "PGPDataFormat" -> doWritePGPDataFormat("pgp", (PGPDataFormat) v); case "ProtobufDataFormat" -> doWriteProtobufDataFormat("protobuf", (ProtobufDataFormat) v); case "RssDataFormat" -> doWriteRssDataFormat("rss", (RssDataFormat) v); + case "SmooksDataFormat" -> doWriteSmooksDataFormat("smooks", (SmooksDataFormat) v); case "SoapDataFormat" -> doWriteSoapDataFormat("soap", (SoapDataFormat) v); case "SwiftMtDataFormat" -> doWriteSwiftMtDataFormat("swiftMt", (SwiftMtDataFormat) v); case "SwiftMxDataFormat" -> doWriteSwiftMxDataFormat("swiftMx", (SwiftMxDataFormat) v); @@ -2737,6 +2743,12 @@ protected void doWriteRssDataFormat(String name, RssDataFormat def) throws IOExc doWriteIdentifiedTypeAttributes(def); endElement(name); } + protected void doWriteSmooksDataFormat(String name, SmooksDataFormat def) throws IOException { + startElement(name); + doWriteIdentifiedTypeAttributes(def); + doWriteAttribute("smooksConfig", def.getSmooksConfig()); + endElement(name); + } protected void doWriteSoapDataFormat(String name, SoapDataFormat def) throws IOException { startElement(name); doWriteIdentifiedTypeAttributes(def); @@ -3588,6 +3600,7 @@ protected void doWriteDataFormatTransformerDefinition(String name, DataFormatTra case "ParquetAvroDataFormat" -> doWriteParquetAvroDataFormat("parquetAvro", (ParquetAvroDataFormat) v); case "ProtobufDataFormat" -> doWriteProtobufDataFormat("protobuf", (ProtobufDataFormat) v); case "RssDataFormat" -> doWriteRssDataFormat("rss", (RssDataFormat) v); + case "SmooksDataFormat" -> doWriteSmooksDataFormat("smooks", (SmooksDataFormat) v); case "SoapDataFormat" -> doWriteSoapDataFormat("soap", (SoapDataFormat) v); case "SwiftMtDataFormat" -> doWriteSwiftMtDataFormat("swiftMt", (SwiftMtDataFormat) v); case "SwiftMxDataFormat" -> doWriteSwiftMxDataFormat("swiftMx", (SwiftMxDataFormat) v); diff --git a/docs/components/modules/dataformats/examples/json/smooks.json b/docs/components/modules/dataformats/examples/json/smooks.json new file mode 120000 index 0000000000000..87704161dc952 --- /dev/null +++ b/docs/components/modules/dataformats/examples/json/smooks.json @@ -0,0 +1 @@ +../../../../../../components/camel-smooks/src/generated/resources/META-INF/org/apache/camel/dataformat/smooks/smooks.json \ No newline at end of file diff --git a/docs/components/modules/dataformats/nav.adoc b/docs/components/modules/dataformats/nav.adoc index 1f77edd26cc71..f26fea1a8714e 100644 --- a/docs/components/modules/dataformats/nav.adoc +++ b/docs/components/modules/dataformats/nav.adoc @@ -34,6 +34,7 @@ ** xref:protobuf-dataformat.adoc[Protobuf] ** xref:protobufJackson-dataformat.adoc[Protobuf Jackson] ** xref:rss-dataformat.adoc[RSS] +** xref:smooks-dataformat.adoc[Smooks] ** xref:soap-dataformat.adoc[SOAP] ** xref:swiftMt-dataformat.adoc[SWIFT MT] ** xref:swiftMx-dataformat.adoc[SWIFT MX] diff --git a/docs/components/modules/dataformats/pages/smooks-dataformat.adoc b/docs/components/modules/dataformats/pages/smooks-dataformat.adoc new file mode 120000 index 0000000000000..e1e10d296eb93 --- /dev/null +++ b/docs/components/modules/dataformats/pages/smooks-dataformat.adoc @@ -0,0 +1 @@ +../../../../../components/camel-smooks/src/main/docs/smooks-dataformat.adoc \ No newline at end of file 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 21479d47ce126..e818af3cfa55a 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 @@ -13212,7 +13212,7 @@ public static SmbEndpointBuilderFactory.SmbEndpointBuilder smb(String componentN * Syntax: smooks:smooksConfig * * Path parameter: smooksConfig (required) - * Smooks XML configuration file + * Path to the Smooks configuration file * This option can also be loaded from an existing file, by prefixing with * file: or classpath: followed by the location of the file. * @@ -13234,7 +13234,7 @@ public static SmooksEndpointBuilderFactory.SmooksEndpointBuilder smooks(String p * Syntax: smooks:smooksConfig * * Path parameter: smooksConfig (required) - * Smooks XML configuration file + * Path to the Smooks configuration file * This option can also be loaded from an existing file, by prefixing with * file: or classpath: followed by the location of the file. * diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmooksEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmooksEndpointBuilderFactory.java index 2d76309e86062..387e4e65defad 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmooksEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmooksEndpointBuilderFactory.java @@ -855,7 +855,7 @@ public interface SmooksBuilders { * Syntax: smooks:smooksConfig * * Path parameter: smooksConfig (required) - * Smooks XML configuration file + * Path to the Smooks configuration file * This option can also be loaded from an existing file, by prefixing * with file: or classpath: followed by the location of the file. * @@ -877,7 +877,7 @@ default SmooksEndpointBuilder smooks(String path) { * Syntax: smooks:smooksConfig * * Path parameter: smooksConfig (required) - * Smooks XML configuration file + * Path to the Smooks configuration file * This option can also be loaded from an existing file, by prefixing * with file: or classpath: followed by the location of the file. * 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 e9e1d4df46d83..e6f92c3b3e8b5 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 @@ -164,6 +164,7 @@ import org.apache.camel.model.dataformat.ParquetAvroDataFormat; import org.apache.camel.model.dataformat.ProtobufDataFormat; import org.apache.camel.model.dataformat.RssDataFormat; +import org.apache.camel.model.dataformat.SmooksDataFormat; import org.apache.camel.model.dataformat.SoapDataFormat; import org.apache.camel.model.dataformat.SwiftMtDataFormat; import org.apache.camel.model.dataformat.SwiftMxDataFormat; @@ -3604,6 +3605,7 @@ protected boolean setProperty(DataFormatDefinition target, String propertyKey, @YamlProperty(name = "protobuf", type = "object:org.apache.camel.model.dataformat.ProtobufDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "rss", type = "object:org.apache.camel.model.dataformat.RssDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "scheme", type = "string"), + @YamlProperty(name = "smooks", type = "object:org.apache.camel.model.dataformat.SmooksDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "soap", type = "object:org.apache.camel.model.dataformat.SoapDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "swiftMt", type = "object:org.apache.camel.model.dataformat.SwiftMtDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "swiftMx", type = "object:org.apache.camel.model.dataformat.SwiftMxDataFormat", oneOf = "dataFormatType"), @@ -3771,6 +3773,11 @@ protected boolean setProperty(DataFormatTransformerDefinition target, String pro target.setDataFormatType(val); break; } + case "smooks": { + org.apache.camel.model.dataformat.SmooksDataFormat val = asType(node, org.apache.camel.model.dataformat.SmooksDataFormat.class); + target.setDataFormatType(val); + break; + } case "soap": { org.apache.camel.model.dataformat.SoapDataFormat val = asType(node, org.apache.camel.model.dataformat.SoapDataFormat.class); target.setDataFormatType(val); @@ -3912,6 +3919,7 @@ protected boolean setProperty(DataFormatTransformerDefinition target, String pro @YamlProperty(name = "pgp", type = "object:org.apache.camel.model.dataformat.PGPDataFormat"), @YamlProperty(name = "protobuf", type = "object:org.apache.camel.model.dataformat.ProtobufDataFormat"), @YamlProperty(name = "rss", type = "object:org.apache.camel.model.dataformat.RssDataFormat"), + @YamlProperty(name = "smooks", type = "object:org.apache.camel.model.dataformat.SmooksDataFormat"), @YamlProperty(name = "soap", type = "object:org.apache.camel.model.dataformat.SoapDataFormat"), @YamlProperty(name = "swiftMt", type = "object:org.apache.camel.model.dataformat.SwiftMtDataFormat"), @YamlProperty(name = "swiftMx", type = "object:org.apache.camel.model.dataformat.SwiftMxDataFormat"), @@ -4218,6 +4226,16 @@ protected boolean setProperty(DataFormatsDefinition target, String propertyKey, target.setDataFormats(existing); break; } + case "smooks": { + org.apache.camel.model.dataformat.SmooksDataFormat val = asType(node, org.apache.camel.model.dataformat.SmooksDataFormat.class); + java.util.List existing = target.getDataFormats(); + if (existing == null) { + existing = new java.util.ArrayList<>(); + } + existing.add(val); + target.setDataFormats(existing); + break; + } case "soap": { org.apache.camel.model.dataformat.SoapDataFormat val = asType(node, org.apache.camel.model.dataformat.SoapDataFormat.class); java.util.List existing = target.getDataFormats(); @@ -9690,6 +9708,7 @@ protected boolean setProperty(LoopDefinition target, String propertyKey, @YamlProperty(name = "pgp", type = "object:org.apache.camel.model.dataformat.PGPDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "protobuf", type = "object:org.apache.camel.model.dataformat.ProtobufDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "rss", type = "object:org.apache.camel.model.dataformat.RssDataFormat", oneOf = "dataFormatType"), + @YamlProperty(name = "smooks", type = "object:org.apache.camel.model.dataformat.SmooksDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "soap", type = "object:org.apache.camel.model.dataformat.SoapDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "swiftMt", type = "object:org.apache.camel.model.dataformat.SwiftMtDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "swiftMx", type = "object:org.apache.camel.model.dataformat.SwiftMxDataFormat", oneOf = "dataFormatType"), @@ -9858,6 +9877,11 @@ protected boolean setProperty(MarshalDefinition target, String propertyKey, target.setDataFormatType(val); break; } + case "smooks": { + org.apache.camel.model.dataformat.SmooksDataFormat val = asType(node, org.apache.camel.model.dataformat.SmooksDataFormat.class); + target.setDataFormatType(val); + break; + } case "soap": { org.apache.camel.model.dataformat.SoapDataFormat val = asType(node, org.apache.camel.model.dataformat.SoapDataFormat.class); target.setDataFormatType(val); @@ -17303,6 +17327,51 @@ protected boolean setProperty(SimpleExpression target, String propertyKey, } } + @YamlType( + nodes = "smooks", + types = org.apache.camel.model.dataformat.SmooksDataFormat.class, + order = org.apache.camel.dsl.yaml.common.YamlDeserializerResolver.ORDER_LOWEST - 1, + displayName = "Smooks", + description = "Transform and bind XML as well as non-XML data using Smooks.", + deprecated = false, + properties = { + @YamlProperty(name = "id", type = "string", description = "The id of this node", displayName = "Id"), + @YamlProperty(name = "smooksConfig", type = "string", required = true, description = "Path to the Smooks configuration file.", displayName = "Smooks Config") + } + ) + public static class SmooksDataFormatDeserializer extends YamlDeserializerBase { + public SmooksDataFormatDeserializer() { + super(SmooksDataFormat.class); + } + + @Override + protected SmooksDataFormat newInstance() { + return new SmooksDataFormat(); + } + + @Override + protected boolean setProperty(SmooksDataFormat target, String propertyKey, + String propertyName, Node node) { + propertyKey = org.apache.camel.util.StringHelper.dashToCamelCase(propertyKey); + switch(propertyKey) { + case "id": { + String val = asText(node); + target.setId(val); + break; + } + case "smooksConfig": { + String val = asText(node); + target.setSmooksConfig(val); + break; + } + default: { + return false; + } + } + return true; + } + } + @YamlType( nodes = "soap", inline = true, @@ -20235,6 +20304,7 @@ protected boolean setProperty(UniVocityTsvDataFormat target, String propertyKey, @YamlProperty(name = "pgp", type = "object:org.apache.camel.model.dataformat.PGPDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "protobuf", type = "object:org.apache.camel.model.dataformat.ProtobufDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "rss", type = "object:org.apache.camel.model.dataformat.RssDataFormat", oneOf = "dataFormatType"), + @YamlProperty(name = "smooks", type = "object:org.apache.camel.model.dataformat.SmooksDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "soap", type = "object:org.apache.camel.model.dataformat.SoapDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "swiftMt", type = "object:org.apache.camel.model.dataformat.SwiftMtDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "swiftMx", type = "object:org.apache.camel.model.dataformat.SwiftMxDataFormat", oneOf = "dataFormatType"), @@ -20408,6 +20478,11 @@ protected boolean setProperty(UnmarshalDefinition target, String propertyKey, target.setDataFormatType(val); break; } + case "smooks": { + org.apache.camel.model.dataformat.SmooksDataFormat val = asType(node, org.apache.camel.model.dataformat.SmooksDataFormat.class); + target.setDataFormatType(val); + break; + } case "soap": { org.apache.camel.model.dataformat.SoapDataFormat val = asType(node, org.apache.camel.model.dataformat.SoapDataFormat.class); target.setDataFormatType(val); diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializersResolver.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializersResolver.java index c9d8970a6166c..0af05fb0d297a 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializersResolver.java +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializersResolver.java @@ -487,6 +487,8 @@ public ConstructNode resolve(String id) { case "org.apache.camel.model.SetVariablesDefinition": return new ModelDeserializers.SetVariablesDefinitionDeserializer(); case "simple": return new ModelDeserializers.SimpleExpressionDeserializer(); case "org.apache.camel.model.language.SimpleExpression": return new ModelDeserializers.SimpleExpressionDeserializer(); + case "smooks": return new ModelDeserializers.SmooksDataFormatDeserializer(); + case "org.apache.camel.model.dataformat.SmooksDataFormat": return new ModelDeserializers.SmooksDataFormatDeserializer(); case "soap": return new ModelDeserializers.SoapDataFormatDeserializer(); case "org.apache.camel.model.dataformat.SoapDataFormat": return new ModelDeserializers.SoapDataFormatDeserializer(); case "sort": return new ModelDeserializers.SortDefinitionDeserializer(); 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 1eac4f7ed1f6b..ee14f08d16686 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 @@ -2877,6 +2877,8 @@ "required" : [ "protobuf" ] }, { "required" : [ "rss" ] + }, { + "required" : [ "smooks" ] }, { "required" : [ "soap" ] }, { @@ -3115,6 +3117,14 @@ "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.RssDataFormat" } } + }, { + "type" : "object", + "required" : [ "smooks" ], + "properties" : { + "smooks" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SmooksDataFormat" + } + } }, { "type" : "object", "required" : [ "soap" ], @@ -3282,6 +3292,7 @@ "pgp" : { }, "protobuf" : { }, "rss" : { }, + "smooks" : { }, "soap" : { }, "swiftMt" : { }, "swiftMx" : { }, @@ -7636,6 +7647,7 @@ "pgp" : { }, "protobuf" : { }, "rss" : { }, + "smooks" : { }, "soap" : { }, "swiftMt" : { }, "swiftMx" : { }, @@ -7716,6 +7728,8 @@ "required" : [ "protobuf" ] }, { "required" : [ "rss" ] + }, { + "required" : [ "smooks" ] }, { "required" : [ "soap" ] }, { @@ -7954,6 +7968,14 @@ "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.RssDataFormat" } } + }, { + "type" : "object", + "required" : [ "smooks" ], + "properties" : { + "smooks" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SmooksDataFormat" + } + } }, { "type" : "object", "required" : [ "soap" ], @@ -10609,6 +10631,9 @@ "rss" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.RssDataFormat" }, + "smooks" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SmooksDataFormat" + }, "soap" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SoapDataFormat" }, @@ -11694,6 +11719,25 @@ } } }, + "org.apache.camel.model.dataformat.SmooksDataFormat" : { + "title" : "Smooks", + "description" : "Transform and bind XML as well as non-XML data using Smooks.", + "type" : "object", + "additionalProperties" : false, + "properties" : { + "id" : { + "type" : "string", + "title" : "Id", + "description" : "The id of this node" + }, + "smooksConfig" : { + "type" : "string", + "title" : "Smooks Config", + "description" : "Path to the Smooks configuration file." + } + }, + "required" : [ "smooksConfig" ] + }, "org.apache.camel.model.dataformat.SoapDataFormat" : { "title" : "SOAP", "description" : "Marshal Java objects to SOAP messages and back.", @@ -16127,6 +16171,8 @@ "required" : [ "protobuf" ] }, { "required" : [ "rss" ] + }, { + "required" : [ "smooks" ] }, { "required" : [ "soap" ] }, { @@ -16365,6 +16411,14 @@ "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.RssDataFormat" } } + }, { + "type" : "object", + "required" : [ "smooks" ], + "properties" : { + "smooks" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SmooksDataFormat" + } + } }, { "type" : "object", "required" : [ "soap" ], @@ -16519,6 +16573,7 @@ "pgp" : { }, "protobuf" : { }, "rss" : { }, + "smooks" : { }, "soap" : { }, "swiftMt" : { }, "swiftMx" : { },