This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch 8583 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 38585a7ed32b33e9f31356fcb700e89f00feefa7 Author: Claus Ibsen <[email protected]> AuthorDate: Sat Jul 19 14:20:16 2025 +0200 CAMEL-21974: camel-j8583: ISO-8583 data format --- bom/camel-bom/pom.xml | 5 + catalog/camel-allcomponents/pom.xml | 5 + .../apache/camel/catalog/dataformats.properties | 1 + .../apache/camel/catalog/dataformats/j8583.json | 24 +++ .../org/apache/camel/catalog/models.properties | 1 + .../catalog/models/dataFormatTransformer.json | 2 +- .../apache/camel/catalog/models/dataFormats.json | 2 +- .../org/apache/camel/catalog/models/j8583.json | 21 +++ .../org/apache/camel/catalog/models/marshal.json | 2 +- .../org/apache/camel/catalog/models/unmarshal.json | 2 +- .../apache/camel/catalog/schemas/camel-spring.xsd | 47 ++++++ .../apache/camel/catalog/schemas/camel-xml-io.xsd | 47 ++++++ components/camel-j8583/pom.xml | 59 +++++++ .../j8583/J8583DataFormatConfigurer.java | 32 ++++ .../org/apache/camel/dataformat/j8583/j8583.json | 24 +++ .../org/apache/camel/configurer/j8583-dataformat | 2 + .../org/apache/camel/dataformat.properties | 7 + .../services/org/apache/camel/dataformat/j8583 | 2 + .../src/main/docs/j8583-dataformat.adoc | 71 ++++++++ .../camel/dataformat/j8583/J8583Constants.java | 26 +++ .../camel/dataformat/j8583/J8583DataFormat.java | 132 +++++++++++++++ .../dataformat/j8583/J8583DataFormatTest.java | 82 +++++++++ .../src/test/resources/j8583-config.xml | 188 +++++++++++++++++++++ .../src/test/resources/log4j2.properties | 28 +++ .../camel-j8583/src/test/resources/parse1.txt | 2 + .../apache/camel/model/dataformat/dataFormats.json | 2 +- .../org/apache/camel/model/dataformat/j8583.json | 21 +++ .../META-INF/org/apache/camel/model/marshal.json | 2 +- .../model/transformer/dataFormatTransformer.json | 2 +- .../META-INF/org/apache/camel/model/unmarshal.json | 2 +- .../services/org/apache/camel/model.properties | 1 + .../org/apache/camel/model/dataformat/jaxb.index | 1 + .../camel/builder/DataFormatBuilderFactory.java | 8 + .../org/apache/camel/builder/DataFormatClause.java | 17 ++ .../org/apache/camel/model/MarshalDefinition.java | 2 + .../apache/camel/model/UnmarshalDefinition.java | 2 + .../model/dataformat/DataFormatsDefinition.java | 1 + .../camel/model/dataformat/J8583DataFormat.java | 125 ++++++++++++++ .../DataFormatTransformerDefinition.java | 2 + .../reifier/dataformat/DataFormatReifier.java | 2 + .../reifier/dataformat/J8583DataFormatReifier.java | 37 ++++ .../org/apache/camel/main/dataformats.properties | 1 + .../java/org/apache/camel/xml/in/ModelParser.java | 9 + .../java/org/apache/camel/xml/out/ModelWriter.java | 15 ++ .../org/apache/camel/yaml/out/ModelWriter.java | 15 ++ .../modules/dataformats/examples/json/j8583.json | 1 + docs/components/modules/dataformats/nav.adoc | 1 + .../dataformats/pages/j8583-dataformat.adoc | 1 + .../dsl/yaml/deserializers/ModelDeserializers.java | 87 ++++++++++ .../deserializers/ModelDeserializersResolver.java | 2 + .../generated/resources/schema/camelYamlDsl.json | 65 +++++++ parent/pom.xml | 6 + 52 files changed, 1236 insertions(+), 8 deletions(-) diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index f96383aca76..9b209982ff1 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -1067,6 +1067,11 @@ <artifactId>camel-ironmq</artifactId> <version>4.14.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-j8583</artifactId> + <version>4.14.0-SNAPSHOT</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-jackson</artifactId> diff --git a/catalog/camel-allcomponents/pom.xml b/catalog/camel-allcomponents/pom.xml index 9983046e6ac..9210d7a5c46 100644 --- a/catalog/camel-allcomponents/pom.xml +++ b/catalog/camel-allcomponents/pom.xml @@ -931,6 +931,11 @@ <artifactId>camel-ironmq</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-j8583</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-jackson</artifactId> 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 d62e820b8bb..12a4fa062f3 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 @@ -21,6 +21,7 @@ gson gzipDeflater hl7 ical +j8583 jackson jacksonXml jaxb diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/j8583.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/j8583.json new file mode 100644 index 00000000000..6f712697e81 --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/j8583.json @@ -0,0 +1,24 @@ +{ + "dataformat": { + "kind": "dataformat", + "name": "j8583", + "title": "J8583", + "description": "Create, edit and read ISO-8583 messages.", + "deprecated": false, + "firstVersion": "4.14.0", + "label": "dataformat,transformation", + "javaType": "org.apache.camel.dataformat.j8583.J8583DataFormat", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-j8583", + "version": "4.14.0-SNAPSHOT", + "modelName": "j8583", + "modelJavaType": "org.apache.camel.model.dataformat.J8583DataFormat" + }, + "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" }, + "configFile": { "index": 1, "kind": "attribute", "displayName": "Config File", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "j8583-config.xml", "description": "The j8583 configuration file to load from classpath" }, + "isoType": { "index": 2, "kind": "attribute", "displayName": "Iso Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The default ISO-Type to use" }, + "allowAutoWiredMessageFormat": { "index": 3, "kind": "attribute", "displayName": "Allow Auto Wired Message Format", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to auto-discover J8583 MessageFormat from the registry" } + } +} 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 0ce8d255658..8612c4c6e3c 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 @@ -78,6 +78,7 @@ inputType intercept interceptFrom interceptSendToEndpoint +j8583 jacksonXml java jaxb diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/dataFormatTransformer.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/dataFormatTransformer.json index 90a3339ce27..1a912599912 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/dataFormatTransformer.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/dataFormatTransformer.json @@ -12,7 +12,7 @@ "output": false }, "properties": { - "dataFormatType": { "index": 0, "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", "fory", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss" [...] + "dataFormatType": { "index": 0, "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", "fory", "grok", "gzipDeflater", "hl7", "ical", "j8583", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobu [...] "scheme": { "index": 1, "kind": "attribute", "displayName": "Scheme", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Set a scheme name supported by the transformer. If you specify 'csv', the transformer will be picked up for all of 'csv' from\/to Java transformation. Note that the scheme matching is performed only when no exactly matched transformer exists." }, "name": { "index": 2, "kind": "attribute", "displayName": "Name", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Set the transformer name under which the transformer gets referenced when specifying the input\/output data type on routes. If you specify a transformer name that matches a data type scheme like 'csv' the transformer will be picked up for all of 'csv:' from\/t [...] "fromType": { "index": 3, "kind": "attribute", "displayName": "From Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Set the 'from' data type name. If you specify 'xml:XYZ', the transformer will be picked up if source type is 'xml:XYZ'. If you specify just 'xml', the transformer matches with all of 'xml' source type like 'xml:ABC' or 'xml:DEF'." }, 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 4eb58384efd..000f5209195 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<org.apache.camel.model.DataFormatDefinition>", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "fory", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf [...] + "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", "fory", "grok", "gzipDeflater", "hl7", "ical", "j8583", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", [...] } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/j8583.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/j8583.json new file mode 100644 index 00000000000..4e2e4abef68 --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/j8583.json @@ -0,0 +1,21 @@ +{ + "model": { + "kind": "model", + "name": "j8583", + "title": "J8583", + "description": "Create, edit and read ISO-8583 messages.", + "deprecated": false, + "firstVersion": "4.14.0", + "label": "dataformat,transformation", + "javaType": "org.apache.camel.model.dataformat.J8583DataFormat", + "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" }, + "configFile": { "index": 1, "kind": "attribute", "displayName": "Config File", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "j8583-config.xml", "description": "The j8583 configuration file to load from classpath" }, + "isoType": { "index": 2, "kind": "attribute", "displayName": "Iso Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The default ISO-Type to use" }, + "allowAutoWiredMessageFormat": { "index": 3, "kind": "attribute", "displayName": "Allow Auto Wired Message Format", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to auto-discover J8583 MessageFormat from the registry" } + } +} 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 1125fc01435..7f879e83377 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", "dfdl", "fhirJson", "fhirXml", "flatpack", "fory", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf [...] + "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", "dfdl", "fhirJson", "fhirXml", "flatpack", "fory", "grok", "gzipDeflater", "hl7", "ical", "j8583", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", [...] "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 tak [...] "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 th [...] } 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 6de9ae5e296..754602d255e 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", "dfdl", "fhirJson", "fhirXml", "flatpack", "fory", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf [...] + "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", "dfdl", "fhirJson", "fhirXml", "flatpack", "fory", "grok", "gzipDeflater", "hl7", "ical", "j8583", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", [...] "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 tak [...] "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 th [...] "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 a4e34965759..b4c3788a55b 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 @@ -792,6 +792,15 @@ Intercepts incoming messages <xs:documentation xml:lang="en"> <![CDATA[ Intercepts messages being sent to an endpoint +]]> + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="j8583" type="tns:j8583DataFormat"> + <xs:annotation> + <xs:documentation xml:lang="en"> +<![CDATA[ +Create, edit and read ISO-8583 messages. ]]> </xs:documentation> </xs:annotation> @@ -7555,6 +7564,7 @@ messages, or any custom logic needed before the looping executes. <xs:element ref="tns:gzipDeflater"/> <xs:element ref="tns:hl7"/> <xs:element ref="tns:ical"/> + <xs:element ref="tns:j8583"/> <xs:element ref="tns:jacksonXml"/> <xs:element ref="tns:jaxb"/> <xs:element ref="tns:json"/> @@ -8990,6 +9000,40 @@ Whether to validate the HL7 message Is by default true. Default value: true <xs:documentation xml:lang="en"> <![CDATA[ Whether to validate. Default value: false +]]> + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="j8583DataFormat"> + <xs:complexContent> + <xs:extension base="tns:dataFormat"> + <xs:sequence/> + <xs:attribute name="configFile" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"> +<![CDATA[ +The j8583 configuration file to load from classpath. Default value: j8583-config.xml +]]> + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="isoType" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"> +<![CDATA[ +The default ISO-Type to use. +]]> + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="allowAutoWiredMessageFormat" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"> +<![CDATA[ +Whether to auto-discover J8583 MessageFormat from the registry. Default value: true ]]> </xs:documentation> </xs:annotation> @@ -14844,6 +14888,7 @@ To type used as a target data type in the transformation. <xs:element ref="tns:gzipDeflater"/> <xs:element ref="tns:hl7"/> <xs:element ref="tns:ical"/> + <xs:element ref="tns:j8583"/> <xs:element ref="tns:jacksonXml"/> <xs:element ref="tns:jaxb"/> <xs:element ref="tns:json"/> @@ -17117,6 +17162,7 @@ Set a reference to a custom Expression to use. <xs:element ref="tns:gzipDeflater"/> <xs:element ref="tns:hl7"/> <xs:element ref="tns:ical"/> + <xs:element ref="tns:j8583"/> <xs:element ref="tns:jacksonXml"/> <xs:element ref="tns:jaxb"/> <xs:element ref="tns:json"/> @@ -17967,6 +18013,7 @@ Set the 'to' data type name. If you specify 'json:XYZ', the transformer will be <xs:element ref="tns:gzipDeflater"/> <xs:element ref="tns:hl7"/> <xs:element ref="tns:ical"/> + <xs:element ref="tns:j8583"/> <xs:element ref="tns:jacksonXml"/> <xs:element ref="tns:jaxb"/> <xs:element ref="tns:json"/> diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd index 88a0d37a2f1..7176fb76b9d 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd @@ -747,6 +747,15 @@ Intercepts incoming messages <xs:documentation xml:lang="en"> <![CDATA[ Intercepts messages being sent to an endpoint +]]> + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="j8583" type="tns:j8583DataFormat"> + <xs:annotation> + <xs:documentation xml:lang="en"> +<![CDATA[ +Create, edit and read ISO-8583 messages. ]]> </xs:documentation> </xs:annotation> @@ -6228,6 +6237,7 @@ messages, or any custom logic needed before the looping executes. <xs:element ref="tns:gzipDeflater"/> <xs:element ref="tns:hl7"/> <xs:element ref="tns:ical"/> + <xs:element ref="tns:j8583"/> <xs:element ref="tns:jacksonXml"/> <xs:element ref="tns:jaxb"/> <xs:element ref="tns:json"/> @@ -7663,6 +7673,40 @@ Whether to validate the HL7 message Is by default true. Default value: true <xs:documentation xml:lang="en"> <![CDATA[ Whether to validate. Default value: false +]]> + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="j8583DataFormat"> + <xs:complexContent> + <xs:extension base="tns:dataFormat"> + <xs:sequence/> + <xs:attribute name="configFile" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"> +<![CDATA[ +The j8583 configuration file to load from classpath. Default value: j8583-config.xml +]]> + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="isoType" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"> +<![CDATA[ +The default ISO-Type to use. +]]> + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="allowAutoWiredMessageFormat" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"> +<![CDATA[ +Whether to auto-discover J8583 MessageFormat from the registry. Default value: true ]]> </xs:documentation> </xs:annotation> @@ -13538,6 +13582,7 @@ To type used as a target data type in the transformation. <xs:element ref="tns:gzipDeflater"/> <xs:element ref="tns:hl7"/> <xs:element ref="tns:ical"/> + <xs:element ref="tns:j8583"/> <xs:element ref="tns:jacksonXml"/> <xs:element ref="tns:jaxb"/> <xs:element ref="tns:json"/> @@ -15811,6 +15856,7 @@ Set a reference to a custom Expression to use. <xs:element ref="tns:gzipDeflater"/> <xs:element ref="tns:hl7"/> <xs:element ref="tns:ical"/> + <xs:element ref="tns:j8583"/> <xs:element ref="tns:jacksonXml"/> <xs:element ref="tns:jaxb"/> <xs:element ref="tns:json"/> @@ -16661,6 +16707,7 @@ Set the 'to' data type name. If you specify 'json:XYZ', the transformer will be <xs:element ref="tns:gzipDeflater"/> <xs:element ref="tns:hl7"/> <xs:element ref="tns:ical"/> + <xs:element ref="tns:j8583"/> <xs:element ref="tns:jacksonXml"/> <xs:element ref="tns:jaxb"/> <xs:element ref="tns:json"/> diff --git a/components/camel-j8583/pom.xml b/components/camel-j8583/pom.xml new file mode 100644 index 00000000000..b8ab7b47239 --- /dev/null +++ b/components/camel-j8583/pom.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components</artifactId> + <version>4.14.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-j8583</artifactId> + <packaging>jar</packaging> + <name>Camel :: j8583</name> + <description>Camel j8583 support</description> + + <dependencies> + + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-support</artifactId> + </dependency> + <dependency> + <groupId>net.sf.j8583</groupId> + <artifactId>j8583</artifactId> + <version>${j8583-version}</version> + </dependency> + + <!-- testing --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-spring-junit5</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + +</project> diff --git a/components/camel-j8583/src/generated/java/org/apache/camel/dataformat/j8583/J8583DataFormatConfigurer.java b/components/camel-j8583/src/generated/java/org/apache/camel/dataformat/j8583/J8583DataFormatConfigurer.java new file mode 100644 index 00000000000..b63f3db445d --- /dev/null +++ b/components/camel-j8583/src/generated/java/org/apache/camel/dataformat/j8583/J8583DataFormatConfigurer.java @@ -0,0 +1,32 @@ +/* Generated by camel build tools - do NOT edit this file! */ +package org.apache.camel.dataformat.j8583; + +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 J8583DataFormatConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer { + + @Override + public boolean configure(CamelContext camelContext, Object target, String name, Object value, boolean ignoreCase) { + J8583DataFormat dataformat = (J8583DataFormat) target; + switch (ignoreCase ? name.toLowerCase() : name) { + case "configfile": + case "configFile": dataformat.setConfigFile(property(camelContext, java.lang.String.class, value)); return true; + case "isotype": + case "isoType": dataformat.setIsoType(property(camelContext, java.lang.String.class, value)); return true; + default: return false; + } + } + +} + diff --git a/components/camel-j8583/src/generated/resources/META-INF/org/apache/camel/dataformat/j8583/j8583.json b/components/camel-j8583/src/generated/resources/META-INF/org/apache/camel/dataformat/j8583/j8583.json new file mode 100644 index 00000000000..6f712697e81 --- /dev/null +++ b/components/camel-j8583/src/generated/resources/META-INF/org/apache/camel/dataformat/j8583/j8583.json @@ -0,0 +1,24 @@ +{ + "dataformat": { + "kind": "dataformat", + "name": "j8583", + "title": "J8583", + "description": "Create, edit and read ISO-8583 messages.", + "deprecated": false, + "firstVersion": "4.14.0", + "label": "dataformat,transformation", + "javaType": "org.apache.camel.dataformat.j8583.J8583DataFormat", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-j8583", + "version": "4.14.0-SNAPSHOT", + "modelName": "j8583", + "modelJavaType": "org.apache.camel.model.dataformat.J8583DataFormat" + }, + "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" }, + "configFile": { "index": 1, "kind": "attribute", "displayName": "Config File", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "j8583-config.xml", "description": "The j8583 configuration file to load from classpath" }, + "isoType": { "index": 2, "kind": "attribute", "displayName": "Iso Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The default ISO-Type to use" }, + "allowAutoWiredMessageFormat": { "index": 3, "kind": "attribute", "displayName": "Allow Auto Wired Message Format", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to auto-discover J8583 MessageFormat from the registry" } + } +} diff --git a/components/camel-j8583/src/generated/resources/META-INF/services/org/apache/camel/configurer/j8583-dataformat b/components/camel-j8583/src/generated/resources/META-INF/services/org/apache/camel/configurer/j8583-dataformat new file mode 100644 index 00000000000..8c073e27b8f --- /dev/null +++ b/components/camel-j8583/src/generated/resources/META-INF/services/org/apache/camel/configurer/j8583-dataformat @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.dataformat.j8583.J8583DataFormatConfigurer diff --git a/components/camel-j8583/src/generated/resources/META-INF/services/org/apache/camel/dataformat.properties b/components/camel-j8583/src/generated/resources/META-INF/services/org/apache/camel/dataformat.properties new file mode 100644 index 00000000000..2327097995a --- /dev/null +++ b/components/camel-j8583/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=j8583 +groupId=org.apache.camel +artifactId=camel-j8583 +version=4.14.0-SNAPSHOT +projectName=Camel :: j8583 +projectDescription=Camel j8583 support diff --git a/components/camel-j8583/src/generated/resources/META-INF/services/org/apache/camel/dataformat/j8583 b/components/camel-j8583/src/generated/resources/META-INF/services/org/apache/camel/dataformat/j8583 new file mode 100644 index 00000000000..f818742e3da --- /dev/null +++ b/components/camel-j8583/src/generated/resources/META-INF/services/org/apache/camel/dataformat/j8583 @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.dataformat.j8583.J8583DataFormat diff --git a/components/camel-j8583/src/main/docs/j8583-dataformat.adoc b/components/camel-j8583/src/main/docs/j8583-dataformat.adoc new file mode 100644 index 00000000000..3fde9854b3c --- /dev/null +++ b/components/camel-j8583/src/main/docs/j8583-dataformat.adoc @@ -0,0 +1,71 @@ += J8583 DataFormat +:doctitle: J8583 +:shortname: j8583 +:artifactid: camel-j8583 +:description: Create, edit and read ISO-8583 messages. +:since: 4.14 +:supportlevel: Preview +:tabs-sync-option: +//Manually maintained attributes +:camel-spring-boot-name: j8583 + +*Since Camel {since}* + +ISO8583 is a message format used for credit card transactions, banking and other commercial interaction between different systems. +It has an ASCII variant and a binary one, and it is somewhat convoluted and difficult to implement. + +This j8583 data format supports reading and writing ISO-8583 messages. + +== J8583 Options + + +// dataformat options: START +include::partial$dataformat-options.adoc[] +// dataformat options: END + +== Example + +The J8583 parser can be configured using `j8583-config.xml` configuration file that should be located +in `src/main/resources` so it can be loaded from the classpath. + +This configuration file should contain the support ISO-8583 mappings. + +=== Specifying ISO-Type per message + +The data format requires to know the ISO-Type of the message to understand how to parse the data. +A default ISO-Type can be configured on the data format. However, you can use a custom header with id `CamelJ8583IsoType` +on the Exchange message to override and specify another ISO-Type, such as: + +[source,java] +---- +from("direct:payment") + .setHeader("CamelJ8583IsoType", constant("0200")) + .unmarshal().j8583() + .to("bean:payment"); +---- + +== More Information + +Find more information see the http://j8583.sourceforge.net/[J8583 project] +and the https://bitbucket.org/chochos/j8583/src/master/[J8583 source code]. + +== Dependencies + +To use Fory in your camel routes, you need to add the dependency +on *camel-j8583* which implements this data format. + +If you use maven, you could add the following to your `pom.xml`, +substituting the version number for the latest and greatest release. + +[source,xml] +---------------------------------------------------------- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-j8583</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +---------------------------------------------------------- + + +include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-j8583/src/main/java/org/apache/camel/dataformat/j8583/J8583Constants.java b/components/camel-j8583/src/main/java/org/apache/camel/dataformat/j8583/J8583Constants.java new file mode 100644 index 00000000000..814c17defc6 --- /dev/null +++ b/components/camel-j8583/src/main/java/org/apache/camel/dataformat/j8583/J8583Constants.java @@ -0,0 +1,26 @@ +/* + * 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.j8583; + +import org.apache.camel.spi.Metadata; + +public final class J8583Constants { + + @Metadata(description = "The ISO-Type", javaType = "String") + public static final String ISO_TYPE = "CamelJ8583IsoType"; + +} diff --git a/components/camel-j8583/src/main/java/org/apache/camel/dataformat/j8583/J8583DataFormat.java b/components/camel-j8583/src/main/java/org/apache/camel/dataformat/j8583/J8583DataFormat.java new file mode 100644 index 00000000000..59351282182 --- /dev/null +++ b/components/camel-j8583/src/main/java/org/apache/camel/dataformat/j8583/J8583DataFormat.java @@ -0,0 +1,132 @@ +/* + * 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.j8583; + +import java.io.InputStream; +import java.io.OutputStream; + +import com.solab.iso8583.IsoMessage; +import com.solab.iso8583.MessageFactory; +import org.apache.camel.CamelContext; +import org.apache.camel.CamelContextAware; +import org.apache.camel.Exchange; +import org.apache.camel.spi.DataFormat; +import org.apache.camel.spi.DataFormatName; +import org.apache.camel.spi.Metadata; +import org.apache.camel.spi.annotations.Dataformat; +import org.apache.camel.support.CamelContextHelper; +import org.apache.camel.support.service.ServiceSupport; + +/** + * Create, edit and read ISO-8583 messages. + */ +@Dataformat("j8583") +@Metadata(firstVersion = "4.14.0", title = "J8583") +public class J8583DataFormat extends ServiceSupport implements DataFormat, DataFormatName, CamelContextAware { + + private CamelContext camelContext; + private MessageFactory messageFactory; + private String configFile; + private boolean allowAutoWiredMessageFormat = true; + private String isoType; + + @Override + public CamelContext getCamelContext() { + return camelContext; + } + + @Override + public void setCamelContext(CamelContext camelContext) { + this.camelContext = camelContext; + } + + @Override + public String getDataFormatName() { + return "j8583"; + } + + @Override + public void marshal(final Exchange exchange, final Object graph, final OutputStream stream) throws Exception { + IsoMessage iso = exchange.getContext().getTypeConverter().mandatoryConvertTo(IsoMessage.class, exchange, graph); + byte[] data = iso.writeData(); + if (data != null && data.length > 0) { + stream.write(data); + } + } + + @Override + public Object unmarshal(Exchange exchange, InputStream stream) throws Exception { + byte[] data = camelContext.getTypeConverter().mandatoryConvertTo(byte[].class, exchange, stream); + int len = -1; + // hex-based to int + String iType = exchange.getMessage().getHeader(J8583Constants.ISO_TYPE, isoType, String.class); + int i = Integer.parseUnsignedInt(iType, 16); + String type = messageFactory.getIsoHeader(i); + if (type != null) { + len = type.length(); + } + if (len == -1) { + throw new IllegalArgumentException( + "IsoType " + iType + " is not known in the MessageFactory configuration file."); + } + return messageFactory.parseMessage(data, len); + } + + public MessageFactory getMessageFactory() { + return messageFactory; + } + + public void setMessageFactory(MessageFactory messageFactory) { + this.messageFactory = messageFactory; + } + + public String getConfigFile() { + return configFile; + } + + public void setConfigFile(String configFile) { + this.configFile = configFile; + } + + public String getIsoType() { + return isoType; + } + + public void setIsoType(String isoType) { + this.isoType = isoType; + } + + @Override + protected void doInit() throws Exception { + super.doInit(); + + if (messageFactory == null) { + if (allowAutoWiredMessageFormat) { + messageFactory = CamelContextHelper.findSingleByType(camelContext, MessageFactory.class); + } + if (messageFactory == null) { + messageFactory = new MessageFactory(); + if (configFile == null) { + configFile = "j8583-config.xml"; + } + } + if (configFile != null) { + messageFactory.setConfigPath(configFile); + } + } + } +} diff --git a/components/camel-j8583/src/test/java/org/apache/camel/dataformat/j8583/J8583DataFormatTest.java b/components/camel-j8583/src/test/java/org/apache/camel/dataformat/j8583/J8583DataFormatTest.java new file mode 100644 index 00000000000..1840fafe1d9 --- /dev/null +++ b/components/camel-j8583/src/test/java/org/apache/camel/dataformat/j8583/J8583DataFormatTest.java @@ -0,0 +1,82 @@ +/* + * 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.j8583; + +import java.io.File; +import java.math.BigDecimal; + +import com.solab.iso8583.IsoMessage; +import com.solab.iso8583.IsoValue; +import com.solab.iso8583.MessageFactory; +import org.apache.camel.RoutesBuilder; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import static com.solab.iso8583.IsoType.AMOUNT; + +public class J8583DataFormatTest extends CamelTestSupport { + + @Test + public void testUnmarshal() throws Exception { + getMockEndpoint("mock:result").expectedMessageCount(1); + getMockEndpoint("mock:result").message(0).body().isInstanceOf(IsoMessage.class); + + template.sendBody("direct:unmarshal", new File("src/test/resources/parse1.txt")); + + MockEndpoint.assertIsSatisfied(context); + } + + @Test + public void testMarshal() throws Exception { + getMockEndpoint("mock:result").expectedMessageCount(1); + + MessageFactory mf = new MessageFactory(); + mf.setConfigPath("j8583-config.xml"); + + IsoMessage iso + = mf.parseMessage(context.getTypeConverter().convertTo(byte[].class, new File("src/test/resources/parse1.txt")), + "ISO015000055".getBytes().length); + template.sendBody("direct:marshal", iso); + + MockEndpoint.assertIsSatisfied(context); + } + + @Override + protected RoutesBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:unmarshal").unmarshal().j8583("0210") + .process(e -> { + IsoMessage iso = (IsoMessage) e.getMessage().getBody(); + Assertions.assertNotNull(iso); + IsoValue v = iso.getAt(4); + Assertions.assertNotNull(v); + Assertions.assertEquals(AMOUNT, v.getType()); + Assertions.assertTrue(v.getValue() instanceof BigDecimal); + Assertions.assertEquals("30.00", v.getValue().toString()); + }) + .to("mock:result"); + + from("direct:marshal").marshal().j8583("0210").to("mock:result"); + } + }; + } +} diff --git a/components/camel-j8583/src/test/resources/j8583-config.xml b/components/camel-j8583/src/test/resources/j8583-config.xml new file mode 100644 index 00000000000..11b1060ce92 --- /dev/null +++ b/components/camel-j8583/src/test/resources/j8583-config.xml @@ -0,0 +1,188 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<!DOCTYPE j8583-config PUBLIC "-//J8583//DTD CONFIG 1.0//EN" + "http://j8583.sourceforge.net/j8583.dtd"> +<j8583-config> + <!-- This is a test config file --> + + <!-- These are the ISO headers to be prepended to the message types specified --> + <header type="0200">ISO015000050</header> + <header type="0210">ISO015000055</header> + <header type="0400" ref="0200" /> + <header type="0410" ref="0210" /> + <header type="0800">ISO015000015</header> + <header type="0810" ref="0800"/> + <header type="0280" binary="true">ffffffff</header> + + <!-- The client example uses this to create requests --> + <template type="0200"> + <field num="3" type="NUMERIC" length="6">650000</field> + <field num="32" type="LLVAR">456</field> + <field num="35" type="LLVAR">4591700012340000=</field> + <field num="43" type="ALPHA" length="40">SOLABTEST TEST-3 DF MX</field> + <field num="48" type="LLLVAR">Life, the Universe, and Everything|42</field> + <field num="49" type="ALPHA" length="3">484</field> + <field num="60" type="LLLVAR">B456PRO1+000</field> + <field num="61" type="LLLVAR"> 1234P vamos a meter más de 90 caracteres en este campo para comprobar si hay algun error en el parseo del mismo. Esta definido como un LLLVAR aqui por lo tanto esto debe caber sin problemas; las guias de parseo de 200 y 210 tienen LLLVAR en campo 61 tambien.</field> + <field num="100" type="LLVAR">999</field> + <field num="102" type="LLVAR">ABCD</field> + </template> + + <template type="0300"> + <field num="4" type="DATE4">0125</field> + <field num="5" type="DATE6">730125</field> + <field num="6" type="DATE10">0125213456</field> + <field num="7" type="DATE12">730125213456</field> + <field num="8" type="DATE14">19730125213456</field> + <field num="9" type="DATE_EXP">2506</field> + <field num="10" type="TIME">213456</field> + <field num="11" type="TIME" tz="America/Mexico_City">213456</field> + <field num="12" type="DATE10" tz="EET">0125213456</field> + </template> + + <!-- The server example uses this to create the responses + we only need a few fields because the rest are copied from the request --> + <template type="0210"> + <field num="60" type="LLLVAR">Fixed data from template</field> + <field num="70" type="ALPHA" length="3">ABC</field> + <field num="90" type="ALPHA" length="42">Field of length 42</field> + <field num="100" type="LLVAR">Fixed field</field> + <field num="102" type="LLVAR">Another fixed field</field> + <field num="126" type="LLLVAR">...and yet another fixed field.</field> + </template> + + <template type="0400" extends="0200"> + <field num="90" type="ALPHA" length="42">BLA</field> + <field num="102" type="exclude" /> + </template> + + <template type="0600"> + <field num="4" type="AMOUNT">1234</field> + <field num="11" type="NUMERIC" length="6">123</field> + <field num="41" type="BINARY" length="8">abcdef</field> + <field num="42" type="BINARY" length="4">abcde</field> + <field num="43" type="ALPHA" length="40">Field of length 40</field> + <field num="62" type="LLBIN">0123456789abcdef620123456789abcd</field> + <field num="63" type="LLBIN">01234567863</field> + <field num="64" type="LLLBIN">0123456789abcdef640123456789abcd</field> + <field num="65" type="LLLBIN">01234567865</field> + <field num="102" type="LLLVAR">Field of type LLLVAR</field> + </template> + <template type="0280"> + <field num="3" type="NUMERIC" length="2">99</field> + </template> + + <!-- The server example uses this to read the requests --> + <parse type="0200"> + <field num="3" type="NUMERIC" length="6" /> + <field num="4" type="AMOUNT" /> + <field num="7" type="DATE10" /> + <field num="11" type="NUMERIC" length="6" /> + <field num="12" type="TIME" /> + <field num="13" type="DATE4" /> + <field num="15" type="DATE4" /> + <field num="17" type="DATE_EXP" /> + <field num="32" type="LLVAR" /> + <field num="35" type="LLVAR" /> + <field num="37" type="NUMERIC" length="12" /> + <field num="41" type="ALPHA" length="16" /> + <field num="43" type="ALPHA" length="40" /> + <field num="48" type="LLLVAR" /> + <field num="49" type="ALPHA" length="3" /> + <field num="60" type="LLLVAR" /> + <field num="61" type="LLLVAR" /> + <field num="100" type="LLVAR" /> + <field num="102" type="LLVAR" /> + </parse> + + <!-- The client example uses this to read the responses --> + <parse type="0210"> + <field num="3" type="NUMERIC" length="6" /> + <field num="4" type="AMOUNT" /> + <field num="7" type="DATE10" /> + <field num="11" type="NUMERIC" length="6" /> + <field num="12" type="TIME" /> + <field num="13" type="DATE4" /> + <field num="15" type="DATE4" /> + <field num="17" type="DATE_EXP" /> + <field num="32" type="LLVAR" /> + <field num="35" type="LLVAR" /> + <field num="37" type="NUMERIC" length="12" /> + <field num="38" type="NUMERIC" length="6" /> + <field num="39" type="NUMERIC" length="2" /> + <field num="41" type="ALPHA" length="16" /> + <field num="43" type="ALPHA" length="40" /> + <field num="48" type="LLLVAR" /> + <field num="49" type="ALPHA" length="3" /> + <field num="60" type="LLLVAR" /> + <field num="61" type="LLLVAR" /> + <field num="70" type="ALPHA" length="3" /> + <field num="90" type="ALPHA" length="42" /> + <field num="100" type="LLVAR" /> + <field num="102" type="LLVAR" /> + <field num="126" type="LLLVAR" /> + </parse> + + <!-- this is for binary tests (message encoding AND fields) --> + <parse type="0600"> + <field num="4" type="AMOUNT" /> + <field num="7" type="DATE10" /> + <field num="11" type="NUMERIC" length="6" /> + <field num="41" type="BINARY" length="8" /> + <field num="42" type="BINARY" length="4" /> + <field num="43" type="ALPHA" length="40" /> + <field num="62" type="LLBIN" /> + <field num="63" type="LLBIN" /> + <field num="64" type="LLLBIN" /> + <field num="65" type="LLLBIN" /> + <field num="102" type="LLLVAR" /> + </parse> + + <parse type="0800"> + <field num="3" type="ALPHA" length="6">123456</field> + <field num="12" type="DATE4">1231</field> + <field num="17" type="DATE4">1231</field> + </parse> + + <parse type="0810" extends="0800"> + <field num="17" type="exclude"/> + <field num="39" type="ALPHA" length="2"/> + </parse> + + <parse type="0201"> + <field num="3" type="NUMERIC" length="19" /> + </parse> + <parse type="0202"> + <field num="3" type="NUMERIC" length="22" /> + </parse> + <parse type="0280"> + <field num="3" type="NUMERIC" length="2" /> + </parse> + <parse type="0281"> + <field num="3" type="LLBCDBIN"/> + </parse> + <parse type="0282"> + <field num="3" type="LLLBCDBIN"/> + </parse> + <parse type="0283"> + <field num="3" type="LLLLBCDBIN"/> + </parse> + +</j8583-config> diff --git a/components/camel-j8583/src/test/resources/log4j2.properties b/components/camel-j8583/src/test/resources/log4j2.properties new file mode 100644 index 00000000000..decd07b08e4 --- /dev/null +++ b/components/camel-j8583/src/test/resources/log4j2.properties @@ -0,0 +1,28 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +appender.file.type = File +appender.file.name = file +appender.file.fileName = target/camel-j8583-test.log +appender.file.layout.type = PatternLayout +appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +appender.out.type = Console +appender.out.name = out +appender.out.layout.type = PatternLayout +appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +rootLogger.level = DEBUG +rootLogger.appenderRef.file.ref = file diff --git a/components/camel-j8583/src/test/resources/parse1.txt b/components/camel-j8583/src/test/resources/parse1.txt new file mode 100644 index 00000000000..f4a8fb20d00 --- /dev/null +++ b/components/camel-j8583/src/test/resources/parse1.txt @@ -0,0 +1,2 @@ +ISO0250000550210B23A80012EA080180000000014000004650000000000003000042813054746877112594604280428081103123173766123456123456=00123442579114472300614209027600TéSTSOLAB áéÃóú üñÑ TEST-3 DF MX484012B123P®O1+000013 0000P0312304ABCD040ABCD8123477547 + 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 4eb58384efd..000f5209195 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<org.apache.camel.model.DataFormatDefinition>", "oneOf": [ "asn1", "avro", "barcode", "base64", "beanio", "bindy", "cbor", "crypto", "csv", "custom", "fhirJson", "fhirXml", "flatpack", "fory", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf [...] + "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", "fory", "grok", "gzipDeflater", "hl7", "ical", "j8583", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", [...] } } diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/j8583.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/j8583.json new file mode 100644 index 00000000000..4e2e4abef68 --- /dev/null +++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/j8583.json @@ -0,0 +1,21 @@ +{ + "model": { + "kind": "model", + "name": "j8583", + "title": "J8583", + "description": "Create, edit and read ISO-8583 messages.", + "deprecated": false, + "firstVersion": "4.14.0", + "label": "dataformat,transformation", + "javaType": "org.apache.camel.model.dataformat.J8583DataFormat", + "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" }, + "configFile": { "index": 1, "kind": "attribute", "displayName": "Config File", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "j8583-config.xml", "description": "The j8583 configuration file to load from classpath" }, + "isoType": { "index": 2, "kind": "attribute", "displayName": "Iso Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The default ISO-Type to use" }, + "allowAutoWiredMessageFormat": { "index": 3, "kind": "attribute", "displayName": "Allow Auto Wired Message Format", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to auto-discover J8583 MessageFormat from the registry" } + } +} 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 1125fc01435..7f879e83377 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", "dfdl", "fhirJson", "fhirXml", "flatpack", "fory", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf [...] + "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", "dfdl", "fhirJson", "fhirXml", "flatpack", "fory", "grok", "gzipDeflater", "hl7", "ical", "j8583", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", [...] "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 tak [...] "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 th [...] } diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/transformer/dataFormatTransformer.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/transformer/dataFormatTransformer.json index 90a3339ce27..1a912599912 100644 --- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/transformer/dataFormatTransformer.json +++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/transformer/dataFormatTransformer.json @@ -12,7 +12,7 @@ "output": false }, "properties": { - "dataFormatType": { "index": 0, "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", "fory", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf", "rss" [...] + "dataFormatType": { "index": 0, "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", "fory", "grok", "gzipDeflater", "hl7", "ical", "j8583", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobu [...] "scheme": { "index": 1, "kind": "attribute", "displayName": "Scheme", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Set a scheme name supported by the transformer. If you specify 'csv', the transformer will be picked up for all of 'csv' from\/to Java transformation. Note that the scheme matching is performed only when no exactly matched transformer exists." }, "name": { "index": 2, "kind": "attribute", "displayName": "Name", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Set the transformer name under which the transformer gets referenced when specifying the input\/output data type on routes. If you specify a transformer name that matches a data type scheme like 'csv' the transformer will be picked up for all of 'csv:' from\/t [...] "fromType": { "index": 3, "kind": "attribute", "displayName": "From Type", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Set the 'from' data type name. If you specify 'xml:XYZ', the transformer will be picked up if source type is 'xml:XYZ'. If you specify just 'xml', the transformer matches with all of 'xml' source type like 'xml:ABC' or 'xml:DEF'." }, 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 6de9ae5e296..754602d255e 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", "dfdl", "fhirJson", "fhirXml", "flatpack", "fory", "grok", "gzipDeflater", "hl7", "ical", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", "protobuf [...] + "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", "dfdl", "fhirJson", "fhirXml", "flatpack", "fory", "grok", "gzipDeflater", "hl7", "ical", "j8583", "jacksonXml", "jaxb", "json", "jsonApi", "lzf", "mimeMultipart", "parquetAvro", "pgp", [...] "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 tak [...] "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 th [...] "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 a8b0d33e722..1eb858821a0 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 @@ -79,6 +79,7 @@ inputType intercept interceptFrom interceptSendToEndpoint +j8583 jacksonXml java jaxb 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 831e27c61ed..3c01272c4a0 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 @@ -21,6 +21,7 @@ GrokDataFormat GzipDeflaterDataFormat HL7DataFormat IcalDataFormat +J8583DataFormat JacksonXMLDataFormat JaxbDataFormat JsonApiDataFormat 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 5ed906dff66..a0144702bf3 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 @@ -35,6 +35,7 @@ import org.apache.camel.model.dataformat.GrokDataFormat; import org.apache.camel.model.dataformat.GzipDeflaterDataFormat; import org.apache.camel.model.dataformat.HL7DataFormat; import org.apache.camel.model.dataformat.IcalDataFormat; +import org.apache.camel.model.dataformat.J8583DataFormat; import org.apache.camel.model.dataformat.JacksonXMLDataFormat; import org.apache.camel.model.dataformat.JaxbDataFormat; import org.apache.camel.model.dataformat.JsonApiDataFormat; @@ -199,6 +200,13 @@ public final class DataFormatBuilderFactory { return new IcalDataFormat.Builder(); } + /** + * Uses the J8583 data format + */ + public J8583DataFormat.Builder j8583() { + return new J8583DataFormat.Builder(); + } + /** * Uses the Jackson XML 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 d2abb864ec5..647e5fa7666 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 @@ -42,6 +42,7 @@ import org.apache.camel.model.dataformat.GrokDataFormat; import org.apache.camel.model.dataformat.GzipDeflaterDataFormat; import org.apache.camel.model.dataformat.HL7DataFormat; import org.apache.camel.model.dataformat.IcalDataFormat; +import org.apache.camel.model.dataformat.J8583DataFormat; import org.apache.camel.model.dataformat.JacksonXMLDataFormat; import org.apache.camel.model.dataformat.JaxbDataFormat; import org.apache.camel.model.dataformat.JsonApiDataFormat; @@ -382,6 +383,22 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> { return dataFormat(ical); } + /** + * Use the J8583 data format + */ + public T j8583() { + return dataFormat(new J8583DataFormat()); + } + + /** + * Use the J8583 data format + */ + public T j8583(String isoType) { + J8583DataFormat df = new J8583DataFormat(); + df.setIsoType(isoType); + return dataFormat(df); + } + /** * Uses the LZF deflater 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 79a9953cb6d..2649f3be1d4 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 @@ -42,6 +42,7 @@ import org.apache.camel.model.dataformat.GrokDataFormat; import org.apache.camel.model.dataformat.GzipDeflaterDataFormat; import org.apache.camel.model.dataformat.HL7DataFormat; import org.apache.camel.model.dataformat.IcalDataFormat; +import org.apache.camel.model.dataformat.J8583DataFormat; import org.apache.camel.model.dataformat.JacksonXMLDataFormat; import org.apache.camel.model.dataformat.JaxbDataFormat; import org.apache.camel.model.dataformat.JsonApiDataFormat; @@ -97,6 +98,7 @@ public class MarshalDefinition extends NoOutputDefinition<MarshalDefinition> imp @XmlElement(name = "gzipDeflater", type = GzipDeflaterDataFormat.class), @XmlElement(name = "hl7", type = HL7DataFormat.class), @XmlElement(name = "ical", type = IcalDataFormat.class), + @XmlElement(name = "j8583", type = J8583DataFormat.class), @XmlElement(name = "jacksonXml", type = JacksonXMLDataFormat.class), @XmlElement(name = "jaxb", type = JaxbDataFormat.class), @XmlElement(name = "json", type = JsonDataFormat.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 536b25c8495..704cde2488c 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 @@ -42,6 +42,7 @@ import org.apache.camel.model.dataformat.GrokDataFormat; import org.apache.camel.model.dataformat.GzipDeflaterDataFormat; import org.apache.camel.model.dataformat.HL7DataFormat; import org.apache.camel.model.dataformat.IcalDataFormat; +import org.apache.camel.model.dataformat.J8583DataFormat; import org.apache.camel.model.dataformat.JacksonXMLDataFormat; import org.apache.camel.model.dataformat.JaxbDataFormat; import org.apache.camel.model.dataformat.JsonApiDataFormat; @@ -97,6 +98,7 @@ public class UnmarshalDefinition extends NoOutputDefinition<UnmarshalDefinition> @XmlElement(name = "gzipDeflater", type = GzipDeflaterDataFormat.class), @XmlElement(name = "hl7", type = HL7DataFormat.class), @XmlElement(name = "ical", type = IcalDataFormat.class), + @XmlElement(name = "j8583", type = J8583DataFormat.class), @XmlElement(name = "jacksonXml", type = JacksonXMLDataFormat.class), @XmlElement(name = "jaxb", type = JaxbDataFormat.class), @XmlElement(name = "json", type = JsonDataFormat.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 74ab4828caa..521d0505305 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 @@ -62,6 +62,7 @@ public class DataFormatsDefinition implements CopyableDefinition<DataFormatsDefi @XmlElement(name = "gzipDeflater", type = GzipDeflaterDataFormat.class), @XmlElement(name = "hl7", type = HL7DataFormat.class), @XmlElement(name = "ical", type = IcalDataFormat.class), + @XmlElement(name = "j8583", type = J8583DataFormat.class), @XmlElement(name = "jacksonXml", type = JacksonXMLDataFormat.class), @XmlElement(name = "jaxb", type = JaxbDataFormat.class), @XmlElement(name = "json", type = JsonDataFormat.class), diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/J8583DataFormat.java b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/J8583DataFormat.java new file mode 100644 index 00000000000..4e83a8f4cc1 --- /dev/null +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/J8583DataFormat.java @@ -0,0 +1,125 @@ +/* + * 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.model.dataformat; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlTransient; + +import org.apache.camel.builder.DataFormatBuilder; +import org.apache.camel.model.DataFormatDefinition; +import org.apache.camel.spi.Metadata; + +/** + * Create, edit and read ISO-8583 messages. + */ +@Metadata(firstVersion = "4.14.0", label = "dataformat,transformation", title = "J8583") +@XmlRootElement(name = "j8583") +@XmlAccessorType(XmlAccessType.FIELD) +public class J8583DataFormat extends DataFormatDefinition { + + @XmlAttribute + @Metadata(description = "The j8583 configuration file to load from classpath", defaultValue = "j8583-config.xml") + private String configFile; + @XmlAttribute + @Metadata(description = "The default ISO-Type to use") + private String isoType; + @XmlAttribute + @Metadata(label = "advanced", description = "Whether to auto-discover J8583 MessageFormat from the registry", + defaultValue = "true", + javaType = "java.lang.Boolean") + private String allowAutoWiredMessageFormat; + + public J8583DataFormat() { + super("j8583"); + } + + public J8583DataFormat(J8583DataFormat source) { + super(source); + this.configFile = source.configFile; + this.isoType = source.isoType; + this.allowAutoWiredMessageFormat = source.allowAutoWiredMessageFormat; + } + + private J8583DataFormat(Builder builder) { + this.configFile = builder.configFile; + this.isoType = builder.isoType; + this.allowAutoWiredMessageFormat = builder.allowAutoWiredMessageFormat; + } + + @Override + public J8583DataFormat copyDefinition() { + return new J8583DataFormat(this); + } + + public String getConfigFile() { + return configFile; + } + + public void setConfigFile(String configFile) { + this.configFile = configFile; + } + + public String getIsoType() { + return isoType; + } + + public void setIsoType(String isoType) { + this.isoType = isoType; + } + + public String getAllowAutoWiredMessageFormat() { + return allowAutoWiredMessageFormat; + } + + public void setAllowAutoWiredMessageFormat(String allowAutoWiredMessageFormat) { + this.allowAutoWiredMessageFormat = allowAutoWiredMessageFormat; + } + + /** + * {@code Builder} is a specific builder for {@link J8583DataFormat}. + */ + @XmlTransient + public static class Builder implements DataFormatBuilder<J8583DataFormat> { + + private String configFile; + private String isoType; + private String allowAutoWiredMessageFormat; + + public Builder configFile(String configFile) { + this.configFile = configFile; + return this; + } + + public Builder isoType(String isoType) { + this.isoType = isoType; + return this; + } + + public Builder allowAutoWiredMessageFormat(String allowAutoWiredMessageFormat) { + this.allowAutoWiredMessageFormat = allowAutoWiredMessageFormat; + return this; + } + + @Override + public J8583DataFormat end() { + return new J8583DataFormat(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 86ea836025a..95f3c843c38 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 @@ -41,6 +41,7 @@ import org.apache.camel.model.dataformat.GrokDataFormat; import org.apache.camel.model.dataformat.GzipDeflaterDataFormat; import org.apache.camel.model.dataformat.HL7DataFormat; import org.apache.camel.model.dataformat.IcalDataFormat; +import org.apache.camel.model.dataformat.J8583DataFormat; import org.apache.camel.model.dataformat.JacksonXMLDataFormat; import org.apache.camel.model.dataformat.JaxbDataFormat; import org.apache.camel.model.dataformat.JsonApiDataFormat; @@ -97,6 +98,7 @@ public class DataFormatTransformerDefinition extends TransformerDefinition { @XmlElement(name = "gzipDeflater", type = GzipDeflaterDataFormat.class), @XmlElement(name = "hl7", type = HL7DataFormat.class), @XmlElement(name = "ical", type = IcalDataFormat.class), + @XmlElement(name = "j8583", type = J8583DataFormat.class), @XmlElement(name = "jacksonXml", type = JacksonXMLDataFormat.class), @XmlElement(name = "jaxb", type = JaxbDataFormat.class), @XmlElement(name = "json", type = JsonDataFormat.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 ad2af7ad3dd..38899e427c5 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 @@ -174,6 +174,8 @@ public abstract class DataFormatReifier<T extends DataFormatDefinition> extends return new HL7DataFormatReifier(camelContext, definition); } else if (definition instanceof IcalDataFormat) { return new IcalDataFormatReifier(camelContext, definition); + } else if (definition instanceof J8583DataFormat) { + return new J8583DataFormatReifier(camelContext, definition); } else if (definition instanceof JacksonXMLDataFormat) { return new JacksonXMLDataFormatReifier(camelContext, definition); } else if (definition instanceof JaxbDataFormat) { diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/J8583DataFormatReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/J8583DataFormatReifier.java new file mode 100644 index 00000000000..317aea73f19 --- /dev/null +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/J8583DataFormatReifier.java @@ -0,0 +1,37 @@ +/* + * 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.J8583DataFormat; + +public class J8583DataFormatReifier extends DataFormatReifier<J8583DataFormat> { + + public J8583DataFormatReifier(CamelContext camelContext, DataFormatDefinition definition) { + super(camelContext, (J8583DataFormat) definition); + } + + @Override + protected void prepareDataFormatConfig(Map<String, Object> properties) { + properties.put("configFile", definition.getConfigFile()); + properties.put("isoType", definition.getIsoType()); + properties.put("allowAutoWiredMessageFormat", definition.getAllowAutoWiredMessageFormat()); + } +} 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 d62e820b8bb..12a4fa062f3 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 @@ -21,6 +21,7 @@ gson gzipDeflater hl7 ical +j8583 jackson jacksonXml jaxb 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 d02a342474d..076033c62d1 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 @@ -1968,6 +1968,14 @@ public class ModelParser extends BaseParser { default: yield identifiedTypeAttributeHandler().accept(def, key, val); }, noElementHandler(), noValueHandler()); } + protected J8583DataFormat doParseJ8583DataFormat() throws IOException, XmlPullParserException { + return doParse(new J8583DataFormat(), (def, key, val) -> switch (key) { + case "allowAutoWiredMessageFormat": def.setAllowAutoWiredMessageFormat(val); yield true; + case "configFile": def.setConfigFile(val); yield true; + case "isoType": def.setIsoType(val); yield true; + default: yield identifiedTypeAttributeHandler().accept(def, key, val); + }, noElementHandler(), noValueHandler()); + } protected JacksonXMLDataFormat doParseJacksonXMLDataFormat() throws IOException, XmlPullParserException { return doParse(new JacksonXMLDataFormat(), (def, key, val) -> switch (key) { case "allowJmsType": def.setAllowJmsType(val); yield true; @@ -2958,6 +2966,7 @@ public class ModelParser extends BaseParser { case "gzipDeflater": return doParseGzipDeflaterDataFormat(); case "hl7": return doParseHL7DataFormat(); case "ical": return doParseIcalDataFormat(); + case "j8583": return doParseJ8583DataFormat(); case "jacksonXml": return doParseJacksonXMLDataFormat(); case "jaxb": return doParseJaxbDataFormat(); case "jsonApi": return doParseJsonApiDataFormat(); 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 0e28133c7a9..b811e5fdf45 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 @@ -499,6 +499,9 @@ public class ModelWriter extends BaseWriter { public void writeIcalDataFormat(IcalDataFormat def) throws IOException { doWriteIcalDataFormat("ical", def); } + public void writeJ8583DataFormat(J8583DataFormat def) throws IOException { + doWriteJ8583DataFormat("j8583", def); + } public void writeJacksonXMLDataFormat(JacksonXMLDataFormat def) throws IOException { doWriteJacksonXMLDataFormat("jacksonXml", def); } @@ -1220,6 +1223,7 @@ public class ModelWriter extends BaseWriter { case "GzipDeflaterDataFormat" -> doWriteGzipDeflaterDataFormat("gzipDeflater", (GzipDeflaterDataFormat) v); case "HL7DataFormat" -> doWriteHL7DataFormat("hl7", (HL7DataFormat) v); case "IcalDataFormat" -> doWriteIcalDataFormat("ical", (IcalDataFormat) v); + case "J8583DataFormat" -> doWriteJ8583DataFormat("j8583", (J8583DataFormat) v); case "JacksonXMLDataFormat" -> doWriteJacksonXMLDataFormat("jacksonXml", (JacksonXMLDataFormat) v); case "JaxbDataFormat" -> doWriteJaxbDataFormat("jaxb", (JaxbDataFormat) v); case "JsonDataFormat" -> doWriteJsonDataFormat("json", (JsonDataFormat) v); @@ -1980,6 +1984,7 @@ public class ModelWriter extends BaseWriter { case "GzipDeflaterDataFormat" -> doWriteGzipDeflaterDataFormat("gzipDeflater", (GzipDeflaterDataFormat) v); case "HL7DataFormat" -> doWriteHL7DataFormat("hl7", (HL7DataFormat) v); case "IcalDataFormat" -> doWriteIcalDataFormat("ical", (IcalDataFormat) v); + case "J8583DataFormat" -> doWriteJ8583DataFormat("j8583", (J8583DataFormat) v); case "JacksonXMLDataFormat" -> doWriteJacksonXMLDataFormat("jacksonXml", (JacksonXMLDataFormat) v); case "JaxbDataFormat" -> doWriteJaxbDataFormat("jaxb", (JaxbDataFormat) v); case "JsonDataFormat" -> doWriteJsonDataFormat("json", (JsonDataFormat) v); @@ -2542,6 +2547,7 @@ public class ModelWriter extends BaseWriter { case "GzipDeflaterDataFormat" -> doWriteGzipDeflaterDataFormat("gzipDeflater", (GzipDeflaterDataFormat) v); case "HL7DataFormat" -> doWriteHL7DataFormat("hl7", (HL7DataFormat) v); case "IcalDataFormat" -> doWriteIcalDataFormat("ical", (IcalDataFormat) v); + case "J8583DataFormat" -> doWriteJ8583DataFormat("j8583", (J8583DataFormat) v); case "JacksonXMLDataFormat" -> doWriteJacksonXMLDataFormat("jacksonXml", (JacksonXMLDataFormat) v); case "JaxbDataFormat" -> doWriteJaxbDataFormat("jaxb", (JaxbDataFormat) v); case "JsonDataFormat" -> doWriteJsonDataFormat("json", (JsonDataFormat) v); @@ -2663,6 +2669,14 @@ public class ModelWriter extends BaseWriter { doWriteAttribute("validating", def.getValidating(), null); endElement(name); } + protected void doWriteJ8583DataFormat(String name, J8583DataFormat def) throws IOException { + startElement(name); + doWriteIdentifiedTypeAttributes(def); + doWriteAttribute("allowAutoWiredMessageFormat", def.getAllowAutoWiredMessageFormat(), "true"); + doWriteAttribute("isoType", def.getIsoType(), null); + doWriteAttribute("configFile", def.getConfigFile(), "j8583-config.xml"); + endElement(name); + } protected void doWriteJacksonXMLDataFormat(String name, JacksonXMLDataFormat def) throws IOException { startElement(name); doWriteIdentifiedTypeAttributes(def); @@ -3677,6 +3691,7 @@ public class ModelWriter extends BaseWriter { case "GzipDeflaterDataFormat" -> doWriteGzipDeflaterDataFormat("gzipDeflater", (GzipDeflaterDataFormat) v); case "HL7DataFormat" -> doWriteHL7DataFormat("hl7", (HL7DataFormat) v); case "IcalDataFormat" -> doWriteIcalDataFormat("ical", (IcalDataFormat) v); + case "J8583DataFormat" -> doWriteJ8583DataFormat("j8583", (J8583DataFormat) v); case "JacksonXMLDataFormat" -> doWriteJacksonXMLDataFormat("jacksonXml", (JacksonXMLDataFormat) v); case "JaxbDataFormat" -> doWriteJaxbDataFormat("jaxb", (JaxbDataFormat) v); case "JsonDataFormat" -> doWriteJsonDataFormat("json", (JsonDataFormat) 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 a53c5c4e591..4aab5e6c4ff 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 @@ -499,6 +499,9 @@ public class ModelWriter extends BaseWriter { public void writeIcalDataFormat(IcalDataFormat def) throws IOException { doWriteIcalDataFormat("ical", def); } + public void writeJ8583DataFormat(J8583DataFormat def) throws IOException { + doWriteJ8583DataFormat("j8583", def); + } public void writeJacksonXMLDataFormat(JacksonXMLDataFormat def) throws IOException { doWriteJacksonXMLDataFormat("jacksonXml", def); } @@ -1220,6 +1223,7 @@ public class ModelWriter extends BaseWriter { case "GzipDeflaterDataFormat" -> doWriteGzipDeflaterDataFormat("gzipDeflater", (GzipDeflaterDataFormat) v); case "HL7DataFormat" -> doWriteHL7DataFormat("hl7", (HL7DataFormat) v); case "IcalDataFormat" -> doWriteIcalDataFormat("ical", (IcalDataFormat) v); + case "J8583DataFormat" -> doWriteJ8583DataFormat("j8583", (J8583DataFormat) v); case "JacksonXMLDataFormat" -> doWriteJacksonXMLDataFormat("jacksonXml", (JacksonXMLDataFormat) v); case "JaxbDataFormat" -> doWriteJaxbDataFormat("jaxb", (JaxbDataFormat) v); case "JsonDataFormat" -> doWriteJsonDataFormat("json", (JsonDataFormat) v); @@ -1980,6 +1984,7 @@ public class ModelWriter extends BaseWriter { case "GzipDeflaterDataFormat" -> doWriteGzipDeflaterDataFormat("gzipDeflater", (GzipDeflaterDataFormat) v); case "HL7DataFormat" -> doWriteHL7DataFormat("hl7", (HL7DataFormat) v); case "IcalDataFormat" -> doWriteIcalDataFormat("ical", (IcalDataFormat) v); + case "J8583DataFormat" -> doWriteJ8583DataFormat("j8583", (J8583DataFormat) v); case "JacksonXMLDataFormat" -> doWriteJacksonXMLDataFormat("jacksonXml", (JacksonXMLDataFormat) v); case "JaxbDataFormat" -> doWriteJaxbDataFormat("jaxb", (JaxbDataFormat) v); case "JsonDataFormat" -> doWriteJsonDataFormat("json", (JsonDataFormat) v); @@ -2542,6 +2547,7 @@ public class ModelWriter extends BaseWriter { case "GzipDeflaterDataFormat" -> doWriteGzipDeflaterDataFormat("gzipDeflater", (GzipDeflaterDataFormat) v); case "HL7DataFormat" -> doWriteHL7DataFormat("hl7", (HL7DataFormat) v); case "IcalDataFormat" -> doWriteIcalDataFormat("ical", (IcalDataFormat) v); + case "J8583DataFormat" -> doWriteJ8583DataFormat("j8583", (J8583DataFormat) v); case "JacksonXMLDataFormat" -> doWriteJacksonXMLDataFormat("jacksonXml", (JacksonXMLDataFormat) v); case "JaxbDataFormat" -> doWriteJaxbDataFormat("jaxb", (JaxbDataFormat) v); case "JsonDataFormat" -> doWriteJsonDataFormat("json", (JsonDataFormat) v); @@ -2663,6 +2669,14 @@ public class ModelWriter extends BaseWriter { doWriteAttribute("validating", def.getValidating(), null); endElement(name); } + protected void doWriteJ8583DataFormat(String name, J8583DataFormat def) throws IOException { + startElement(name); + doWriteIdentifiedTypeAttributes(def); + doWriteAttribute("allowAutoWiredMessageFormat", def.getAllowAutoWiredMessageFormat(), "true"); + doWriteAttribute("isoType", def.getIsoType(), null); + doWriteAttribute("configFile", def.getConfigFile(), "j8583-config.xml"); + endElement(name); + } protected void doWriteJacksonXMLDataFormat(String name, JacksonXMLDataFormat def) throws IOException { startElement(name); doWriteIdentifiedTypeAttributes(def); @@ -3677,6 +3691,7 @@ public class ModelWriter extends BaseWriter { case "GzipDeflaterDataFormat" -> doWriteGzipDeflaterDataFormat("gzipDeflater", (GzipDeflaterDataFormat) v); case "HL7DataFormat" -> doWriteHL7DataFormat("hl7", (HL7DataFormat) v); case "IcalDataFormat" -> doWriteIcalDataFormat("ical", (IcalDataFormat) v); + case "J8583DataFormat" -> doWriteJ8583DataFormat("j8583", (J8583DataFormat) v); case "JacksonXMLDataFormat" -> doWriteJacksonXMLDataFormat("jacksonXml", (JacksonXMLDataFormat) v); case "JaxbDataFormat" -> doWriteJaxbDataFormat("jaxb", (JaxbDataFormat) v); case "JsonDataFormat" -> doWriteJsonDataFormat("json", (JsonDataFormat) v); diff --git a/docs/components/modules/dataformats/examples/json/j8583.json b/docs/components/modules/dataformats/examples/json/j8583.json new file mode 120000 index 00000000000..2ee11354d65 --- /dev/null +++ b/docs/components/modules/dataformats/examples/json/j8583.json @@ -0,0 +1 @@ +../../../../../../components/camel-j8583/src/generated/resources/META-INF/org/apache/camel/dataformat/j8583/j8583.json \ No newline at end of file diff --git a/docs/components/modules/dataformats/nav.adoc b/docs/components/modules/dataformats/nav.adoc index 1e94462890a..11b42b77e34 100644 --- a/docs/components/modules/dataformats/nav.adoc +++ b/docs/components/modules/dataformats/nav.adoc @@ -21,6 +21,7 @@ ** xref:gzipDeflater-dataformat.adoc[GZip Deflater] ** xref:hl7-dataformat.adoc[HL7] ** xref:ical-dataformat.adoc[iCal] +** xref:j8583-dataformat.adoc[J8583] ** xref:jacksonXml-dataformat.adoc[Jackson XML] ** xref:jaxb-dataformat.adoc[JAXB] ** xref:fastjson-dataformat.adoc[JSON Fastjson] diff --git a/docs/components/modules/dataformats/pages/j8583-dataformat.adoc b/docs/components/modules/dataformats/pages/j8583-dataformat.adoc new file mode 120000 index 00000000000..b4414434e6d --- /dev/null +++ b/docs/components/modules/dataformats/pages/j8583-dataformat.adoc @@ -0,0 +1 @@ +../../../../../components/camel-j8583/src/main/docs/j8583-dataformat.adoc \ No newline at end of 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 a17a97a1b04..9f711af6d2a 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 @@ -155,6 +155,7 @@ import org.apache.camel.model.dataformat.GrokDataFormat; import org.apache.camel.model.dataformat.GzipDeflaterDataFormat; import org.apache.camel.model.dataformat.HL7DataFormat; import org.apache.camel.model.dataformat.IcalDataFormat; +import org.apache.camel.model.dataformat.J8583DataFormat; import org.apache.camel.model.dataformat.JacksonXMLDataFormat; import org.apache.camel.model.dataformat.JaxbDataFormat; import org.apache.camel.model.dataformat.JsonApiDataFormat; @@ -3508,6 +3509,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "gzipDeflater", type = "object:org.apache.camel.model.dataformat.GzipDeflaterDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "hl7", type = "object:org.apache.camel.model.dataformat.HL7DataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "ical", type = "object:org.apache.camel.model.dataformat.IcalDataFormat", oneOf = "dataFormatType"), + @YamlProperty(name = "j8583", type = "object:org.apache.camel.model.dataformat.J8583DataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "jacksonXml", type = "object:org.apache.camel.model.dataformat.JacksonXMLDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "jaxb", type = "object:org.apache.camel.model.dataformat.JaxbDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "json", type = "object:org.apache.camel.model.dataformat.JsonDataFormat", oneOf = "dataFormatType"), @@ -3648,6 +3650,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setDataFormatType(val); break; } + case "j8583": { + org.apache.camel.model.dataformat.J8583DataFormat val = asType(node, org.apache.camel.model.dataformat.J8583DataFormat.class); + target.setDataFormatType(val); + break; + } case "jacksonXml": { org.apache.camel.model.dataformat.JacksonXMLDataFormat val = asType(node, org.apache.camel.model.dataformat.JacksonXMLDataFormat.class); target.setDataFormatType(val); @@ -3827,6 +3834,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "gzipDeflater", type = "object:org.apache.camel.model.dataformat.GzipDeflaterDataFormat"), @YamlProperty(name = "hl7", type = "object:org.apache.camel.model.dataformat.HL7DataFormat"), @YamlProperty(name = "ical", type = "object:org.apache.camel.model.dataformat.IcalDataFormat"), + @YamlProperty(name = "j8583", type = "object:org.apache.camel.model.dataformat.J8583DataFormat"), @YamlProperty(name = "jacksonXml", type = "object:org.apache.camel.model.dataformat.JacksonXMLDataFormat"), @YamlProperty(name = "jaxb", type = "object:org.apache.camel.model.dataformat.JaxbDataFormat"), @YamlProperty(name = "json", type = "object:org.apache.camel.model.dataformat.JsonDataFormat"), @@ -4054,6 +4062,16 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setDataFormats(existing); break; } + case "j8583": { + org.apache.camel.model.dataformat.J8583DataFormat val = asType(node, org.apache.camel.model.dataformat.J8583DataFormat.class); + java.util.List<org.apache.camel.model.DataFormatDefinition> existing = target.getDataFormats(); + if (existing == null) { + existing = new java.util.ArrayList<>(); + } + existing.add(val); + target.setDataFormats(existing); + break; + } case "jacksonXml": { org.apache.camel.model.dataformat.JacksonXMLDataFormat val = asType(node, org.apache.camel.model.dataformat.JacksonXMLDataFormat.class); java.util.List<org.apache.camel.model.DataFormatDefinition> existing = target.getDataFormats(); @@ -7537,6 +7555,63 @@ public final class ModelDeserializers extends YamlDeserializerSupport { } } + @YamlType( + nodes = "j8583", + types = org.apache.camel.model.dataformat.J8583DataFormat.class, + order = org.apache.camel.dsl.yaml.common.YamlDeserializerResolver.ORDER_LOWEST - 1, + displayName = "J8583", + description = "Create, edit and read ISO-8583 messages.", + deprecated = false, + properties = { + @YamlProperty(name = "allowAutoWiredMessageFormat", type = "boolean", description = "Whether to auto-discover J8583 MessageFormat from the registry", displayName = "Allow Auto Wired Message Format"), + @YamlProperty(name = "configFile", type = "string", defaultValue = "j8583-config.xml", description = "The j8583 configuration file to load from classpath", displayName = "Config File"), + @YamlProperty(name = "id", type = "string", description = "The id of this node", displayName = "Id"), + @YamlProperty(name = "isoType", type = "string", description = "The default ISO-Type to use", displayName = "Iso Type") + } + ) + public static class J8583DataFormatDeserializer extends YamlDeserializerBase<J8583DataFormat> { + public J8583DataFormatDeserializer() { + super(J8583DataFormat.class); + } + + @Override + protected J8583DataFormat newInstance() { + return new J8583DataFormat(); + } + + @Override + protected boolean setProperty(J8583DataFormat target, String propertyKey, + String propertyName, Node node) { + propertyKey = org.apache.camel.util.StringHelper.dashToCamelCase(propertyKey); + switch(propertyKey) { + case "allowAutoWiredMessageFormat": { + String val = asText(node); + target.setAllowAutoWiredMessageFormat(val); + break; + } + case "configFile": { + String val = asText(node); + target.setConfigFile(val); + break; + } + case "id": { + String val = asText(node); + target.setId(val); + break; + } + case "isoType": { + String val = asText(node); + target.setIsoType(val); + break; + } + default: { + return false; + } + } + return true; + } + } + @YamlType( nodes = "jacksonXml", types = org.apache.camel.model.dataformat.JacksonXMLDataFormat.class, @@ -9659,6 +9734,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "hl7", type = "object:org.apache.camel.model.dataformat.HL7DataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "ical", type = "object:org.apache.camel.model.dataformat.IcalDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "id", type = "string", description = "Sets the id of this node", displayName = "Id"), + @YamlProperty(name = "j8583", type = "object:org.apache.camel.model.dataformat.J8583DataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "jacksonXml", type = "object:org.apache.camel.model.dataformat.JacksonXMLDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "jaxb", type = "object:org.apache.camel.model.dataformat.JaxbDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "json", type = "object:org.apache.camel.model.dataformat.JsonDataFormat", oneOf = "dataFormatType"), @@ -9803,6 +9879,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setDataFormatType(val); break; } + case "j8583": { + org.apache.camel.model.dataformat.J8583DataFormat val = asType(node, org.apache.camel.model.dataformat.J8583DataFormat.class); + target.setDataFormatType(val); + break; + } case "jacksonXml": { org.apache.camel.model.dataformat.JacksonXMLDataFormat val = asType(node, org.apache.camel.model.dataformat.JacksonXMLDataFormat.class); target.setDataFormatType(val); @@ -19882,6 +19963,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "hl7", type = "object:org.apache.camel.model.dataformat.HL7DataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "ical", type = "object:org.apache.camel.model.dataformat.IcalDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "id", type = "string", description = "Sets the id of this node", displayName = "Id"), + @YamlProperty(name = "j8583", type = "object:org.apache.camel.model.dataformat.J8583DataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "jacksonXml", type = "object:org.apache.camel.model.dataformat.JacksonXMLDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "jaxb", type = "object:org.apache.camel.model.dataformat.JaxbDataFormat", oneOf = "dataFormatType"), @YamlProperty(name = "json", type = "object:org.apache.camel.model.dataformat.JsonDataFormat", oneOf = "dataFormatType"), @@ -20031,6 +20113,11 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setDataFormatType(val); break; } + case "j8583": { + org.apache.camel.model.dataformat.J8583DataFormat val = asType(node, org.apache.camel.model.dataformat.J8583DataFormat.class); + target.setDataFormatType(val); + break; + } case "jacksonXml": { org.apache.camel.model.dataformat.JacksonXMLDataFormat val = asType(node, org.apache.camel.model.dataformat.JacksonXMLDataFormat.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 aff887f78a3..1f4f0a5d189 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 @@ -175,6 +175,8 @@ public final class ModelDeserializersResolver implements YamlDeserializerResolve case "org.apache.camel.model.InterceptFromDefinition": return new ModelDeserializers.InterceptFromDefinitionDeserializer(); case "interceptSendToEndpoint": return new ModelDeserializers.InterceptSendToEndpointDefinitionDeserializer(); case "org.apache.camel.model.InterceptSendToEndpointDefinition": return new ModelDeserializers.InterceptSendToEndpointDefinitionDeserializer(); + case "j8583": return new ModelDeserializers.J8583DataFormatDeserializer(); + case "org.apache.camel.model.dataformat.J8583DataFormat": return new ModelDeserializers.J8583DataFormatDeserializer(); case "jacksonXml": return new ModelDeserializers.JacksonXMLDataFormatDeserializer(); case "org.apache.camel.model.dataformat.JacksonXMLDataFormat": return new ModelDeserializers.JacksonXMLDataFormatDeserializer(); case "java": return new ModelDeserializers.JavaExpressionDeserializer(); 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 edf7f365b4b..3f30b8f3b85 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 @@ -2869,6 +2869,8 @@ "required" : [ "hl7" ] }, { "required" : [ "ical" ] + }, { + "required" : [ "j8583" ] }, { "required" : [ "jacksonXml" ] }, { @@ -3065,6 +3067,14 @@ "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.IcalDataFormat" } } + }, { + "type" : "object", + "required" : [ "j8583" ], + "properties" : { + "j8583" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.J8583DataFormat" + } + } }, { "type" : "object", "required" : [ "jacksonXml" ], @@ -3312,6 +3322,7 @@ "gzipDeflater" : { }, "hl7" : { }, "ical" : { }, + "j8583" : { }, "jacksonXml" : { }, "jaxb" : { }, "json" : { }, @@ -7791,6 +7802,7 @@ "gzipDeflater" : { }, "hl7" : { }, "ical" : { }, + "j8583" : { }, "jacksonXml" : { }, "jaxb" : { }, "json" : { }, @@ -7866,6 +7878,8 @@ "required" : [ "hl7" ] }, { "required" : [ "ical" ] + }, { + "required" : [ "j8583" ] }, { "required" : [ "jacksonXml" ] }, { @@ -8062,6 +8076,14 @@ "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.IcalDataFormat" } } + }, { + "type" : "object", + "required" : [ "j8583" ], + "properties" : { + "j8583" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.J8583DataFormat" + } + } }, { "type" : "object", "required" : [ "jacksonXml" ], @@ -10649,6 +10671,9 @@ "ical" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.IcalDataFormat" }, + "j8583" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.J8583DataFormat" + }, "jacksonXml" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.JacksonXMLDataFormat" }, @@ -11139,6 +11164,35 @@ } } }, + "org.apache.camel.model.dataformat.J8583DataFormat" : { + "title" : "J8583", + "description" : "Create, edit and read ISO-8583 messages.", + "type" : "object", + "additionalProperties" : false, + "properties" : { + "allowAutoWiredMessageFormat" : { + "type" : "boolean", + "title" : "Allow Auto Wired Message Format", + "description" : "Whether to auto-discover J8583 MessageFormat from the registry" + }, + "configFile" : { + "type" : "string", + "title" : "Config File", + "description" : "The j8583 configuration file to load from classpath", + "default" : "j8583-config.xml" + }, + "id" : { + "type" : "string", + "title" : "Id", + "description" : "The id of this node" + }, + "isoType" : { + "type" : "string", + "title" : "Iso Type", + "description" : "The default ISO-Type to use" + } + } + }, "org.apache.camel.model.dataformat.JacksonXMLDataFormat" : { "title" : "Jackson XML", "description" : "Unmarshal an XML payloads to POJOs and back using XMLMapper extension of Jackson.", @@ -16407,6 +16461,8 @@ "required" : [ "hl7" ] }, { "required" : [ "ical" ] + }, { + "required" : [ "j8583" ] }, { "required" : [ "jacksonXml" ] }, { @@ -16595,6 +16651,14 @@ "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.IcalDataFormat" } } + }, { + "type" : "object", + "required" : [ "j8583" ], + "properties" : { + "j8583" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.J8583DataFormat" + } + } }, { "type" : "object", "required" : [ "jacksonXml" ], @@ -16836,6 +16900,7 @@ "gzipDeflater" : { }, "hl7" : { }, "ical" : { }, + "j8583" : { }, "jacksonXml" : { }, "jaxb" : { }, "json" : { }, diff --git a/parent/pom.xml b/parent/pom.xml index 7815bc27aaa..0b294786f75 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -175,6 +175,7 @@ <geronimo-j2ee-management-spec-version>1.1</geronimo-j2ee-management-spec-version> <geronimo-jcdi-1.0-spec-version>1.0</geronimo-jcdi-1.0-spec-version> <geronimo-jcdi-1.1-spec-version>1.0</geronimo-jcdi-1.1-spec-version> + <j8583-version>3.0.0</j8583-version> <jakarta-jms-api-version>3.1.0</jakarta-jms-api-version> <jakarta-persistence-api-version>3.2.0</jakarta-persistence-api-version> <jakarta-json-api-version>2.1.3</jakarta-json-api-version> @@ -1580,6 +1581,11 @@ <artifactId>camel-ironmq</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-j8583</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-jackson</artifactId>
