Skip to content

Commit

Permalink
CAMEL-21398: migrate the Smooks Data Format from the Camel cartridge …
Browse files Browse the repository at this point in the history
…to the Apache Camel code base (#16111)

* feat(CAMEL-21398): migrate the Smooks Data Format from https://github.com/smooks/smooks-camel-cartridge to the Apache Camel code base

Refs: smooks/smooks-camel-cartridge#211

* fix: add uncommitted file
  • Loading branch information
cjmamo authored Oct 30, 2024
1 parent 53d872a commit 1c7ef32
Show file tree
Hide file tree
Showing 56 changed files with 1,066 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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." },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pgp
protobuf
protobufJackson
rss
smooks
snakeYaml
soap
swiftMt
Expand Down
Original file line number Diff line number Diff line change
@@ -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." }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ setProperty
setVariable
setVariables
simple
smooks
soap
sort
spel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<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": "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<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": "A list holding the configured data formats" }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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." }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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." }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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." }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1858,6 +1858,15 @@ Allows setting multiple variables at the same time.
<xs:documentation xml:lang="en">
<![CDATA[
Evaluates a Camel simple expression.
]]>
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="smooks" type="tns:smooksDataFormat">
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
Transform and bind XML as well as non-XML data using Smooks.
]]>
</xs:documentation>
</xs:annotation>
Expand Down Expand Up @@ -7419,6 +7428,7 @@ down. Default value: false
<xs:element ref="tns:parquetAvro"/>
<xs:element ref="tns:protobuf"/>
<xs:element ref="tns:rss"/>
<xs:element ref="tns:smooks"/>
<xs:element ref="tns:soap"/>
<xs:element ref="tns:swiftMt"/>
<xs:element ref="tns:swiftMx"/>
Expand Down Expand Up @@ -9726,6 +9736,22 @@ value: true
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="smooksDataFormat">
<xs:complexContent>
<xs:extension base="tns:dataFormat">
<xs:sequence/>
<xs:attribute name="smooksConfig" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
Path to the Smooks configuration file.
]]>
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="soapDataFormat">
<xs:complexContent>
<xs:extension base="tns:dataFormat">
Expand Down Expand Up @@ -14590,6 +14616,7 @@ To type used as a target data type in the transformation.
<xs:element ref="tns:parquetAvro"/>
<xs:element ref="tns:protobuf"/>
<xs:element ref="tns:rss"/>
<xs:element ref="tns:smooks"/>
<xs:element ref="tns:soap"/>
<xs:element ref="tns:swiftMt"/>
<xs:element ref="tns:swiftMx"/>
Expand Down Expand Up @@ -16794,6 +16821,7 @@ Set a reference to a custom Expression to use.
<xs:element ref="tns:pgp"/>
<xs:element ref="tns:protobuf"/>
<xs:element ref="tns:rss"/>
<xs:element ref="tns:smooks"/>
<xs:element ref="tns:soap"/>
<xs:element ref="tns:swiftMt"/>
<xs:element ref="tns:swiftMx"/>
Expand Down Expand Up @@ -17597,6 +17625,7 @@ Sets the component name that this definition will apply to.
<xs:element ref="tns:parquetAvro"/>
<xs:element ref="tns:protobuf"/>
<xs:element ref="tns:rss"/>
<xs:element ref="tns:smooks"/>
<xs:element ref="tns:soap"/>
<xs:element ref="tns:swiftMt"/>
<xs:element ref="tns:swiftMx"/>
Expand Down
2 changes: 0 additions & 2 deletions components/camel-smooks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
</dependencyManagement>

<dependencies>

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-support</artifactId>
Expand All @@ -56,7 +55,6 @@
<groupId>org.smooks</groupId>
<artifactId>smooks-core</artifactId>
</dependency>

<dependency>
<groupId>org.smooks.cartridges.edi</groupId>
<artifactId>smooks-edi-cartridge</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}

}

Loading

0 comments on commit 1c7ef32

Please sign in to comment.