You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2020/03/05 10:07:12 UTC
[camel-quarkus] 02/02: Fix #785 JacksonXML support
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 056c964566f73c53a7e827651780d8643257cfb9
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Thu Mar 5 09:18:42 2020 +0100
Fix #785 JacksonXML support
---
.../pages/list-of-camel-quarkus-extensions.adoc | 4 +-
extensions/jacksonxml/deployment/pom.xml | 79 ++++++++++++++++++++
.../jacksonxml/deployment/JacksonxmlProcessor.java | 21 ++----
extensions/{support => jacksonxml}/pom.xml | 41 ++++++-----
extensions/jacksonxml/runtime/pom.xml | 86 ++++++++++++++++++++++
.../main/resources/META-INF/quarkus-extension.yaml | 29 ++++++++
extensions/pom.xml | 1 +
extensions/readme.adoc | 4 +-
.../jackson-dataformat-xml/deployment/pom.xml | 70 ++++++++++++++++++
.../JacksonDataformatXmlSupportProcessor.java | 80 ++++++++++++++++++++
.../support/{ => jackson-dataformat-xml}/pom.xml | 24 ++----
.../support/jackson-dataformat-xml/runtime/pom.xml | 74 +++++++++++++++++++
.../main/resources/META-INF/quarkus-extension.yaml | 30 ++++++++
extensions/support/pom.xml | 1 +
integration-tests/dataformats-json/pom.xml | 6 +-
.../dataformats/json/JsonDataformatsResource.java | 18 +++++
.../dataformats/json/JsonDataformatsRoute.java | 9 +++
.../component/dataformats/json/model/PojoA.java | 4 +
.../dataformats/json/JsonComponentsTest.java | 23 ++++++
pom.xml | 1 +
poms/bom-deployment/pom.xml | 10 +++
poms/bom/pom.xml | 20 +++++
22 files changed, 582 insertions(+), 53 deletions(-)
diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index bc90dd6..22b4047 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -243,7 +243,7 @@ Number of Camel components: 71 in 61 JAR artifacts (0 deprecated)
== Camel Data Formats
// dataformats: START
-Number of Camel data formats: 19 in 15 JAR artifacts (0 deprecated)
+Number of Camel data formats: 20 in 16 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -267,6 +267,8 @@ Number of Camel data formats: 19 in 15 JAR artifacts (0 deprecated)
| link:https://camel.apache.org/components/latest/ical-dataformat.html[iCal] (camel-quarkus-ical) | 1.0.0-M5 | The iCal dataformat is used for working with iCalendar messages.
+| link:https://camel.apache.org/components/latest/jacksonxml-dataformat.html[JacksonXML] (camel-quarkus-jacksonxml) | 1.0.0-M5 | JacksonXML data format is used for unmarshal a XML payload to POJO or to marshal POJO back to XML payload.
+
| link:https://camel.apache.org/components/latest/json-gson-dataformat.html[JSon GSon] (camel-quarkus-gson) | 1.0.0-M4 | JSon data format is used for unmarshal a JSon payload to POJO or to marshal POJO back to JSon payload.
| link:https://camel.apache.org/components/latest/json-jackson-dataformat.html[JSon Jackson] (camel-quarkus-jackson) | 0.3.0 | JSon data format is used for unmarshal a JSon payload to POJO or to marshal POJO back to JSon payload.
diff --git a/extensions/jacksonxml/deployment/pom.xml b/extensions/jacksonxml/deployment/pom.xml
new file mode 100644
index 0000000..5572479
--- /dev/null
+++ b/extensions/jacksonxml/deployment/pom.xml
@@ -0,0 +1,79 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jacksonxml-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-jacksonxml-deployment</artifactId>
+ <name>Camel Quarkus :: Jackson XML :: Deployment</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-jackson-dataformat-xml-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jacksonxml</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/model/PojoA.java b/extensions/jacksonxml/deployment/src/main/java/org/apache/camel/quarkus/component/jacksonxml/deployment/JacksonxmlProcessor.java
similarity index 69%
copy from integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/model/PojoA.java
copy to extensions/jacksonxml/deployment/src/main/java/org/apache/camel/quarkus/component/jacksonxml/deployment/JacksonxmlProcessor.java
index 1ede06f..fd8594f 100644
--- a/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/model/PojoA.java
+++ b/extensions/jacksonxml/deployment/src/main/java/org/apache/camel/quarkus/component/jacksonxml/deployment/JacksonxmlProcessor.java
@@ -14,23 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.component.dataformats.json.model;
+package org.apache.camel.quarkus.component.jacksonxml.deployment;
-import io.quarkus.runtime.annotations.RegisterForReflection;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
-@RegisterForReflection
-public class PojoA {
+class JacksonxmlProcessor {
- private String name;
+ private static final String FEATURE = "camel-jacksonxml";
- public PojoA() {
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
}
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
}
diff --git a/extensions/support/pom.xml b/extensions/jacksonxml/pom.xml
similarity index 54%
copy from extensions/support/pom.xml
copy to extensions/jacksonxml/pom.xml
index a6ef979..8007ca3 100644
--- a/extensions/support/pom.xml
+++ b/extensions/jacksonxml/pom.xml
@@ -17,33 +17,34 @@
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/xsd/maven-4.0.0.xsd">
-
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-extensions</artifactId>
+ <artifactId>camel-quarkus-build-parent</artifactId>
<version>1.1.0-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent/pom.xml</relativePath>
</parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>camel-quarkus-support-extensions</artifactId>
- <name>Camel Quarkus :: Support</name>
+ <artifactId>camel-quarkus-jacksonxml-parent</artifactId>
+ <name>Camel Quarkus :: Jackson XML</name>
<packaging>pom</packaging>
<modules>
- <module>ahc</module>
- <module>aws</module>
- <module>common</module>
- <module>commons-logging</module>
- <module>consul-client</module>
- <module>httpclient</module>
- <module>jetty</module>
- <module>policy</module>
- <module>retrofit</module>
- <module>spring</module>
- <module>xstream</module>
- <module>xml</module>
- <module>xalan</module>
+ <module>deployment</module>
+ <module>runtime</module>
</modules>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-bom-deployment</artifactId>
+ <version>${quarkus.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
</project>
diff --git a/extensions/jacksonxml/runtime/pom.xml b/extensions/jacksonxml/runtime/pom.xml
new file mode 100644
index 0000000..fbe805b
--- /dev/null
+++ b/extensions/jacksonxml/runtime/pom.xml
@@ -0,0 +1,86 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jacksonxml-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-jacksonxml</artifactId>
+ <name>Camel Quarkus :: Jackson XML :: Runtime</name>
+
+ <properties>
+ <firstVersion>1.0.0-M5</firstVersion>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-jackson-dataformat-xml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jacksonxml</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-bootstrap-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/extensions/jacksonxml/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/jacksonxml/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..254a821
--- /dev/null
+++ b/extensions/jacksonxml/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,29 @@
+#
+# 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.
+#
+
+---
+name: "Camel Quarkus Jackson XML"
+description: "Camel Jackson XML support"
+metadata:
+ keywords:
+ - "camel"
+ - "jackson"
+ - "xml"
+ - "dataformat"
+ guide: "https://quarkus.io/guides/camel"
+ categories:
+ - "integration"
\ No newline at end of file
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 5afa046..d3f5e7f 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -81,6 +81,7 @@
<module>ical</module>
<module>infinispan</module>
<module>jackson</module>
+ <module>jacksonxml</module>
<module>jdbc</module>
<module>jira</module>
<module>jms</module>
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index 67bae4e..5196d75 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -231,7 +231,7 @@ Number of Camel components: 71 in 61 JAR artifacts (0 deprecated)
== Camel Data Formats
// dataformats: START
-Number of Camel data formats: 19 in 15 JAR artifacts (0 deprecated)
+Number of Camel data formats: 20 in 16 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -255,6 +255,8 @@ Number of Camel data formats: 19 in 15 JAR artifacts (0 deprecated)
| link:https://camel.apache.org/components/latest/ical-dataformat.html[iCal] (camel-quarkus-ical) | 1.0.0-M5 | The iCal dataformat is used for working with iCalendar messages.
+| link:https://camel.apache.org/components/latest/jacksonxml-dataformat.html[JacksonXML] (camel-quarkus-jacksonxml) | 1.0.0-M5 | JacksonXML data format is used for unmarshal a XML payload to POJO or to marshal POJO back to XML payload.
+
| link:https://camel.apache.org/components/latest/json-gson-dataformat.html[JSon GSon] (camel-quarkus-gson) | 1.0.0-M4 | JSon data format is used for unmarshal a JSon payload to POJO or to marshal POJO back to JSon payload.
| link:https://camel.apache.org/components/latest/json-jackson-dataformat.html[JSon Jackson] (camel-quarkus-jackson) | 0.3.0 | JSon data format is used for unmarshal a JSon payload to POJO or to marshal POJO back to JSon payload.
diff --git a/extensions/support/jackson-dataformat-xml/deployment/pom.xml b/extensions/support/jackson-dataformat-xml/deployment/pom.xml
new file mode 100644
index 0000000..1dc04b4
--- /dev/null
+++ b/extensions/support/jackson-dataformat-xml/deployment/pom.xml
@@ -0,0 +1,70 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-jackson-dataformat-xml-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-support-jackson-dataformat-xml-deployment</artifactId>
+ <name>Camel Quarkus :: Support Jackson Dataformat XML :: Deployment</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-jackson-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-jackson-dataformat-xml</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/extensions/support/jackson-dataformat-xml/deployment/src/main/java/org/apache/camel/quarkus/support/jackson/datafromat/xml/deployment/JacksonDataformatXmlSupportProcessor.java b/extensions/support/jackson-dataformat-xml/deployment/src/main/java/org/apache/camel/quarkus/support/jackson/datafromat/xml/deployment/JacksonDataformatXmlSupportProcessor.java
new file mode 100644
index 0000000..2052542
--- /dev/null
+++ b/extensions/support/jackson-dataformat-xml/deployment/src/main/java/org/apache/camel/quarkus/support/jackson/datafromat/xml/deployment/JacksonDataformatXmlSupportProcessor.java
@@ -0,0 +1,80 @@
+/*
+ * 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.quarkus.support.jackson.datafromat.xml.deployment;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.stream.Stream;
+
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import com.ctc.wstx.shaded.msv.org_isorelax.verifier.VerifierFactoryLoader;
+import com.ctc.wstx.shaded.msv.relaxng_datatype.DatatypeLibraryFactory;
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.ObjectCodec;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.DeploymentClassLoaderBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import io.quarkus.deployment.util.ServiceUtil;
+import org.codehaus.stax2.validation.XMLValidationSchemaFactory;
+
+public class JacksonDataformatXmlSupportProcessor {
+
+ private static final String FEATURE = "camel-support-jackson-dataformat-xml";
+ static final String SERVICES_PREFIX = "META-INF/services/";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ void serviceProviders(BuildProducer<ServiceProviderBuildItem> serviceProviders,
+ final DeploymentClassLoaderBuildItem classLoader) {
+ Stream.concat(
+ Stream.of(
+ JsonFactory.class,
+ ObjectCodec.class,
+ VerifierFactoryLoader.class,
+ DatatypeLibraryFactory.class,
+ XMLEventFactory.class,
+ XMLInputFactory.class,
+ XMLOutputFactory.class)
+ .map(Class::getName),
+ Stream.of(
+ XMLValidationSchemaFactory.INTERNAL_ID_SCHEMA_DTD,
+ XMLValidationSchemaFactory.INTERNAL_ID_SCHEMA_RELAXNG,
+ XMLValidationSchemaFactory.INTERNAL_ID_SCHEMA_W3C,
+ XMLValidationSchemaFactory.INTERNAL_ID_SCHEMA_TREX)
+ .map(schemaId -> XMLValidationSchemaFactory.class.getName() + "." + schemaId))
+ .forEach(serviceName -> {
+ try {
+ final Set<String> names = ServiceUtil.classNamesNamedIn(classLoader.getClassLoader(),
+ SERVICES_PREFIX + serviceName);
+ serviceProviders.produce(new ServiceProviderBuildItem(serviceName, new ArrayList<>(names)));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ });
+ }
+
+}
diff --git a/extensions/support/pom.xml b/extensions/support/jackson-dataformat-xml/pom.xml
similarity index 68%
copy from extensions/support/pom.xml
copy to extensions/support/jackson-dataformat-xml/pom.xml
index a6ef979..f672bec 100644
--- a/extensions/support/pom.xml
+++ b/extensions/support/jackson-dataformat-xml/pom.xml
@@ -21,29 +21,19 @@
<parent>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-extensions</artifactId>
+ <artifactId>camel-quarkus-build-parent</artifactId>
<version>1.1.0-SNAPSHOT</version>
+ <relativePath>../../../poms/build-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>camel-quarkus-support-extensions</artifactId>
- <name>Camel Quarkus :: Support</name>
+ <artifactId>camel-quarkus-support-jackson-dataformat-xml-parent</artifactId>
+ <name>Camel Quarkus :: Support Jackson Dataformat XML</name>
<packaging>pom</packaging>
-
<modules>
- <module>ahc</module>
- <module>aws</module>
- <module>common</module>
- <module>commons-logging</module>
- <module>consul-client</module>
- <module>httpclient</module>
- <module>jetty</module>
- <module>policy</module>
- <module>retrofit</module>
- <module>spring</module>
- <module>xstream</module>
- <module>xml</module>
- <module>xalan</module>
+ <module>deployment</module>
+ <module>runtime</module>
</modules>
+
</project>
diff --git a/extensions/support/jackson-dataformat-xml/runtime/pom.xml b/extensions/support/jackson-dataformat-xml/runtime/pom.xml
new file mode 100644
index 0000000..a22398a
--- /dev/null
+++ b/extensions/support/jackson-dataformat-xml/runtime/pom.xml
@@ -0,0 +1,74 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-jackson-dataformat-xml-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-support-jackson-dataformat-xml</artifactId>
+ <name>Camel Quarkus :: Support Jackson Dataformat XML :: Runtime</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-jackson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-bootstrap-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/extensions/support/jackson-dataformat-xml/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/support/jackson-dataformat-xml/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..eb0685c
--- /dev/null
+++ b/extensions/support/jackson-dataformat-xml/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+
+---
+name: "Camel Quarkus Support Jackson Dataformat XML"
+description: "Camel Quarkus Support Jackson Dataformat XML"
+metadata:
+ unlisted: true
+ keywords:
+ - "camel"
+ - "jackson"
+ - "dataformat"
+ - "xml"
+ guide: "https://quarkus.io/guides/camel"
+ categories:
+ - "integration"
\ No newline at end of file
diff --git a/extensions/support/pom.xml b/extensions/support/pom.xml
index a6ef979..babf30e 100644
--- a/extensions/support/pom.xml
+++ b/extensions/support/pom.xml
@@ -38,6 +38,7 @@
<module>commons-logging</module>
<module>consul-client</module>
<module>httpclient</module>
+ <module>jackson-dataformat-xml</module>
<module>jetty</module>
<module>policy</module>
<module>retrofit</module>
diff --git a/integration-tests/dataformats-json/pom.xml b/integration-tests/dataformats-json/pom.xml
index 6bfb4de..88f9f26 100644
--- a/integration-tests/dataformats-json/pom.xml
+++ b/integration-tests/dataformats-json/pom.xml
@@ -36,7 +36,7 @@
<!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. -->
<!-- Please update rule whenever you change the dependencies of this module by running -->
<!-- mvn process-resources -Pformat from the root directory -->
- <mvnd.builder.rule>camel-quarkus-core-xml-deployment,camel-quarkus-direct-deployment,camel-quarkus-gson-deployment,camel-quarkus-jackson-deployment,camel-quarkus-johnzon-deployment,camel-quarkus-log-deployment,camel-quarkus-support-policy-deployment,camel-quarkus-vm-deployment</mvnd.builder.rule>
+ <mvnd.builder.rule>camel-quarkus-core-xml-deployment,camel-quarkus-direct-deployment,camel-quarkus-gson-deployment,camel-quarkus-jackson-deployment,camel-quarkus-jacksonxml-deployment,camel-quarkus-johnzon-deployment,camel-quarkus-log-deployment,camel-quarkus-support-policy-deployment,camel-quarkus-vm-deployment</mvnd.builder.rule>
</properties>
<dependencies>
@@ -68,6 +68,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-johnzon</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jacksonxml</artifactId>
+ </dependency>
<dependency>
<groupId>io.quarkus</groupId>
diff --git a/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/JsonDataformatsResource.java b/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/JsonDataformatsResource.java
index efeecab..35a7778 100644
--- a/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/JsonDataformatsResource.java
+++ b/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/JsonDataformatsResource.java
@@ -30,6 +30,7 @@ import javax.ws.rs.core.MediaType;
import org.apache.camel.CamelContext;
import org.apache.camel.ConsumerTemplate;
import org.apache.camel.ProducerTemplate;
+import org.apache.camel.quarkus.component.dataformats.json.model.PojoA;
import org.jboss.logging.Logger;
@Path("/dataformats-json")
@@ -107,4 +108,21 @@ public class JsonDataformatsResource {
return answer;
}
+
+ @Path("jacksonxml/marshal")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.TEXT_XML)
+ public String jacksonXmlMarshal(PojoA pojo) {
+ return producerTemplate.requestBody("direct:jacksonxml-marshal", pojo, String.class);
+ }
+
+ @Path("jacksonxml/unmarshal")
+ @POST
+ @Consumes(MediaType.TEXT_XML)
+ @Produces(MediaType.APPLICATION_JSON)
+ public PojoA jacksonXmlMarshal(String body) {
+ return producerTemplate.requestBody("direct:jacksonxml-unmarshal", body, PojoA.class);
+ }
+
}
diff --git a/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/JsonDataformatsRoute.java b/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/JsonDataformatsRoute.java
index 02d83ce..dc3a1ae 100644
--- a/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/JsonDataformatsRoute.java
+++ b/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/JsonDataformatsRoute.java
@@ -73,6 +73,15 @@ public class JsonDataformatsRoute extends RouteBuilder {
}));
configureJsonRoutes(JsonLibrary.Gson, gsonDummyObjectDataFormat, new GsonDataFormat(PojoA.class),
new GsonDataFormat(PojoB.class));
+
+ from("direct:jacksonxml-marshal")
+ .marshal()
+ .jacksonxml(true);
+
+ from("direct:jacksonxml-unmarshal")
+ .unmarshal()
+ .jacksonxml(PojoA.class);
+
}
public void configureJsonRoutes(JsonLibrary library, DataFormat dummyObjectDataFormat, DataFormat pojoADataFormat,
diff --git a/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/model/PojoA.java b/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/model/PojoA.java
index 1ede06f..f6c2fab 100644
--- a/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/model/PojoA.java
+++ b/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/model/PojoA.java
@@ -26,6 +26,10 @@ public class PojoA {
public PojoA() {
}
+ public PojoA(String name) {
+ this.name = name;
+ }
+
public String getName() {
return name;
}
diff --git a/integration-tests/dataformats-json/src/test/java/org/apache/camel/quarkus/component/dataformats/json/JsonComponentsTest.java b/integration-tests/dataformats-json/src/test/java/org/apache/camel/quarkus/component/dataformats/json/JsonComponentsTest.java
index 6fbe380..44c7ab3 100644
--- a/integration-tests/dataformats-json/src/test/java/org/apache/camel/quarkus/component/dataformats/json/JsonComponentsTest.java
+++ b/integration-tests/dataformats-json/src/test/java/org/apache/camel/quarkus/component/dataformats/json/JsonComponentsTest.java
@@ -24,6 +24,8 @@ import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import org.apache.camel.quarkus.component.dataformats.json.model.AnotherObject;
+import org.apache.camel.quarkus.component.dataformats.json.model.PojoA;
+import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
@@ -99,4 +101,25 @@ public class JsonComponentsTest {
.then()
.body("dummyString", is(object.getDummyString()));
}
+
+ @Test
+ void jacksonXml() {
+ final String xml = "<PojoA>\n <name>Joe</name>\n</PojoA>\n";
+ final String json = JsonbBuilder.create().toJson(new PojoA("Joe"));
+ RestAssured.given()
+ .contentType(ContentType.JSON)
+ .body(json)
+ .post("/dataformats-json/jacksonxml/marshal")
+ .then()
+ .statusCode(200)
+ .body(equalTo(xml));
+
+ RestAssured.given()
+ .contentType("text/xml")
+ .body(xml)
+ .post("/dataformats-json/jacksonxml/unmarshal")
+ .then()
+ .statusCode(200)
+ .body(equalTo(json));
+ }
}
diff --git a/pom.xml b/pom.xml
index 9936cfb..9013464 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,6 +46,7 @@
<hapi.version>4.1.0</hapi.version>
<quarkus.version>1.3.0.Alpha2</quarkus.version>
<httpmime.version>4.1.3</httpmime.version>
+ <jackson.version>2.10.2</jackson.version>
<jetty.version>9.4.18.v20190429</jetty.version>
<xstream.version>1.4.11</xstream.version>
<httpclient.cache.version>4.5.5</httpclient.cache.version>
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index b9a432d..e43ec56 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -276,6 +276,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jacksonxml-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jdbc-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
@@ -466,6 +471,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-jackson-dataformat-xml-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-jetty-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index f74b193..b19536c 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -340,6 +340,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-jacksonxml</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-jdbc</artifactId>
<version>${camel.version}</version>
</dependency>
@@ -876,6 +881,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jacksonxml</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jdbc</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
@@ -1071,6 +1081,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-jackson-dataformat-xml</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-jetty</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
@@ -1172,6 +1187,11 @@
<version>${hapi.version}</version>
</dependency>
<dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>