You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/11/19 13:36:33 UTC
[camel-quarkus] branch master updated: Add Dozer component extension
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 2e77246 Add Dozer component extension
2e77246 is described below
commit 2e772465ea8612b14f8b9505c7aade3af5989362
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Nov 19 10:01:29 2019 +0000
Add Dozer component extension
fixes #435
---
docs/modules/ROOT/pages/extensions/dozer.adoc | 31 ++++
.../pages/list-of-camel-quarkus-extensions.adoc | 5 +-
extensions/dozer/deployment/pom.xml | 79 +++++++++
.../component/dozer/deployment/DozerProcessor.java | 179 +++++++++++++++++++++
extensions/dozer/pom.xml | 39 +++++
extensions/dozer/runtime/pom.xml | 112 +++++++++++++
.../quarkus/component/dozer/CamelDozerConfig.java | 33 ++++
.../component/dozer/CamelDozerRecorder.java | 34 ++++
.../dozer/graal/DozerOSGiSubstitutions.java | 113 +++++++++++++
.../main/resources/META-INF/quarkus-extension.yaml | 27 ++++
extensions/pom.xml | 1 +
extensions/readme.adoc | 5 +-
integration-tests/dozer/pom.xml | 136 ++++++++++++++++
.../quarkus/component/dozer/it/DozerResource.java | 74 +++++++++
.../quarkus/component/dozer/it/DozerRoutes.java | 40 +++++
.../component/dozer/it/model/CustomerA.java | 71 ++++++++
.../component/dozer/it/model/CustomerB.java | 90 +++++++++++
.../src/main/resources/application.properties | 21 +++
.../src/main/resources/expression-mapping.xml | 35 ++++
.../dozer/src/main/resources/simple-mapping.xml | 35 ++++
.../dozer/src/main/resources/variable-mapping.xml | 42 +++++
.../camel/quarkus/component/dozer/it/DozerIT.java | 24 +++
.../quarkus/component/dozer/it/DozerTest.java | 66 ++++++++
integration-tests/pom.xml | 1 +
poms/bom-deployment/pom.xml | 5 +
poms/bom/pom.xml | 10 ++
26 files changed, 1306 insertions(+), 2 deletions(-)
diff --git a/docs/modules/ROOT/pages/extensions/dozer.adoc b/docs/modules/ROOT/pages/extensions/dozer.adoc
new file mode 100644
index 0000000..07f6e05
--- /dev/null
+++ b/docs/modules/ROOT/pages/extensions/dozer.adoc
@@ -0,0 +1,31 @@
+[[dozer]]
+= Dozer Extension
+
+*Since Camel Quarkus 0.5.0*
+
+The Dozer component provides the ability to map between Java beans using the http://camel.apache.org/dozer-type-conversion.html[Dozer] mapping framework.
+
+Maven users will need to add the following dependency to their `pom.xml` for this extension.
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dozer</artifactId>
+</dependency>
+------------------------------------------------------------
+
+== Usage
+
+The extension provides support for the Camel https://camel.apache.org/components/latest/dozer-component.html[Dozer Component].
+
+=== Configuration
+
+The Dozer extension can automatically register a `DozerBeanMapperConfiguration` bean with the Camel registry which references your mapping files.
+
+Use the following configuration property to specify the location(s) of your Dozer mapping configuration files.
+
+[source,properties]
+----
+quarkus.camel.dozer.mapping-files = dozerMappings.xml,file:foo/bar/custom-mappings.xml,http://foo/bar/mapping.xml
+----
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 85dc749..7c98c1b 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -6,7 +6,7 @@ As of Camel Quarkus {camel-quarkus-last-release} the following Camel artifacts a
== Camel Components
// components: START
-Number of Camel components: 38 in 33 JAR artifacts (0 deprecated)
+Number of Camel components: 39 in 34 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -42,6 +42,9 @@ Number of Camel components: 38 in 33 JAR artifacts (0 deprecated)
| link:https://camel.apache.org/components/latest/direct-component.html[Direct] (camel-quarkus-direct) +
`direct:name` | 0.2 | The direct component provides direct, synchronous call to another endpoint from the same CamelContext.
+| xref:extensions/dozer.adoc[Dozer] (camel-quarkus-dozer) +
+`dozer:name` | 0.5 | The dozer component provides the ability to map between Java beans using the Dozer mapping library.
+
| link:https://camel.apache.org/components/latest/exec-component.html[Exec] (camel-quarkus-exec) +
`exec:executable` | 0.4 | The exec component can be used to execute OS system commands.
diff --git a/extensions/dozer/deployment/pom.xml b/extensions/dozer/deployment/pom.xml
new file mode 100644
index 0000000..f380eaf
--- /dev/null
+++ b/extensions/dozer/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-dozer-parent</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-dozer-deployment</artifactId>
+ <name>Camel Quarkus :: Dozer :: 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-jaxb-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dozer</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/extensions/dozer/deployment/src/main/java/org/apache/camel/quarkus/component/dozer/deployment/DozerProcessor.java b/extensions/dozer/deployment/src/main/java/org/apache/camel/quarkus/component/dozer/deployment/DozerProcessor.java
new file mode 100644
index 0000000..9b9dd89
--- /dev/null
+++ b/extensions/dozer/deployment/src/main/java/org/apache/camel/quarkus/component/dozer/deployment/DozerProcessor.java
@@ -0,0 +1,179 @@
+/*
+ * 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.component.dozer.deployment;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+
+import java.io.File;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.Date;
+
+import com.github.dozermapper.core.builder.model.jaxb.AllowedExceptionsDefinition;
+import com.github.dozermapper.core.builder.model.jaxb.ClassDefinition;
+import com.github.dozermapper.core.builder.model.jaxb.ConfigurationDefinition;
+import com.github.dozermapper.core.builder.model.jaxb.ConverterTypeDefinition;
+import com.github.dozermapper.core.builder.model.jaxb.CopyByReferencesDefinition;
+import com.github.dozermapper.core.builder.model.jaxb.CustomConvertersDefinition;
+import com.github.dozermapper.core.builder.model.jaxb.FieldDefinition;
+import com.github.dozermapper.core.builder.model.jaxb.FieldDefinitionDefinition;
+import com.github.dozermapper.core.builder.model.jaxb.FieldExcludeDefinition;
+import com.github.dozermapper.core.builder.model.jaxb.FieldType;
+import com.github.dozermapper.core.builder.model.jaxb.MappingDefinition;
+import com.github.dozermapper.core.builder.model.jaxb.MappingsDefinition;
+import com.github.dozermapper.core.builder.model.jaxb.Relationship;
+import com.github.dozermapper.core.builder.model.jaxb.Type;
+import com.github.dozermapper.core.builder.model.jaxb.VariableDefinition;
+import com.github.dozermapper.core.builder.model.jaxb.VariablesDefinition;
+import com.sun.el.ExpressionFactoryImpl;
+
+import org.apache.camel.component.dozer.CustomMapper;
+import org.apache.camel.component.dozer.DozerConfiguration;
+import org.apache.camel.component.dozer.ExpressionMapper;
+import org.apache.camel.component.dozer.VariableMapper;
+import org.apache.camel.converter.dozer.DozerBeanMapperConfiguration;
+import org.apache.camel.converter.dozer.DozerThreadContextClassLoader;
+import org.apache.camel.quarkus.component.dozer.CamelDozerConfig;
+import org.apache.camel.quarkus.component.dozer.CamelDozerRecorder;
+import org.apache.camel.quarkus.core.deployment.CamelBeanBuildItem;
+
+class DozerProcessor {
+
+ private static final String FEATURE = "camel-dozer";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ void configureCamelDozer(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
+ BuildProducer<NativeImageResourceBuildItem> nativeImage,
+ CamelDozerConfig camelDozerConfig) {
+
+ // Add user Dozer mapping files to the image
+ camelDozerConfig.mappingFiles
+ .stream()
+ .map(this::mappingPathToURI)
+ // No scheme means classpath URI
+ .filter(uri -> uri.getScheme() == null)
+ .map(uri -> new NativeImageResourceBuildItem(uri.getPath()))
+ .forEach(nativeImage::produce);
+
+ // Add Dozer JAXB resources to the image
+ nativeImage.produce(new NativeImageResourceBuildItem(
+ "dtd/bean-mapping.dtd",
+ "dtd/bean-mapping-6.0.0.dtd",
+ "dtd/bean-mapping-6.2.0.dtd",
+ "schema/bean-mapping.xsd",
+ "schema/bean-mapping-6.0.0.xsd",
+ "schema/bean-mapping-6.2.0.xsd",
+ "com/github/dozermapper/core/builder/model/jaxb/jaxb.index"));
+
+ reflectiveClass.produce(new ReflectiveClassBuildItem(false, false,
+ BigDecimal[].class,
+ BigInteger[].class,
+ Boolean[].class,
+ Byte[].class,
+ Calendar[].class,
+ Character[].class,
+ Class[].class,
+ Date[].class,
+ java.sql.Date[].class,
+ Double[].class,
+ File[].class,
+ Float[].class,
+ Integer[].class,
+ Long[].class,
+ Object[].class,
+ Short[].class,
+ String[].class,
+ Time[].class,
+ Timestamp[].class,
+ URL[].class,
+ DozerThreadContextClassLoader.class,
+ ExpressionFactoryImpl.class));
+
+ reflectiveClass.produce(
+ new ReflectiveClassBuildItem(false, false,
+ "com.github.dozermapper.core.builder.model.jaxb.package-info",
+ "com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl"));
+
+ reflectiveClass.produce(new ReflectiveClassBuildItem(true, false,
+ CustomMapper.class,
+ DozerConfiguration.class,
+ ExpressionMapper.class,
+ VariableMapper.class));
+
+ reflectiveClass.produce(new ReflectiveClassBuildItem(true, true,
+ AllowedExceptionsDefinition.class,
+ ClassDefinition.class,
+ ConfigurationDefinition.class,
+ ConverterTypeDefinition.class,
+ CopyByReferencesDefinition.class,
+ CustomConvertersDefinition.class,
+ FieldDefinition.class,
+ FieldDefinitionDefinition.class,
+ FieldExcludeDefinition.class,
+ FieldType.class,
+ MappingDefinition.class,
+ MappingsDefinition.class,
+ Relationship.class,
+ Type.class,
+ VariableDefinition.class,
+ VariablesDefinition.class));
+ }
+
+ @Record(ExecutionTime.STATIC_INIT)
+ @BuildStep
+ CamelBeanBuildItem configureCamelDozerBeanMappings(BuildProducer<CamelBeanBuildItem> camelBeanBuildItemBuildProducer,
+ CamelDozerConfig camelDozerConfig,
+ CamelDozerRecorder camelDozerRecorder) {
+
+ CamelBeanBuildItem camelBeanBuildItem = null;
+
+ if (!camelDozerConfig.mappingFiles.isEmpty()) {
+ // Bind DozerBeanMapperConfiguration to the Camel registry for the user provided Dozer mapping files
+ camelBeanBuildItem = new CamelBeanBuildItem(
+ "dozerBeanMappingConfiguration",
+ DozerBeanMapperConfiguration.class.getName(),
+ camelDozerRecorder.createDozerBeanMapperConfiguration(camelDozerConfig.mappingFiles));
+ }
+
+ return camelBeanBuildItem;
+ }
+
+ private URI mappingPathToURI(String mappingPath) {
+ try {
+ return new URI(mappingPath);
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/extensions/dozer/pom.xml b/extensions/dozer/pom.xml
new file mode 100644
index 0000000..4cf5ebb
--- /dev/null
+++ b/extensions/dozer/pom.xml
@@ -0,0 +1,39 @@
+<?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-build-parent</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-dozer-parent</artifactId>
+ <name>Camel Quarkus :: Dozer</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/dozer/runtime/pom.xml b/extensions/dozer/runtime/pom.xml
new file mode 100644
index 0000000..19c9515
--- /dev/null
+++ b/extensions/dozer/runtime/pom.xml
@@ -0,0 +1,112 @@
+<?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-dozer-parent</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-dozer</artifactId>
+ <name>Camel Quarkus :: Dozer :: Runtime</name>
+
+ <properties>
+ <firstVersion>0.5.0</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</groupId>
+ <artifactId>camel-dozer</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>javax.el-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.glassfish</groupId>
+ <artifactId>javax.el</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-jaxb</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.activation</groupId>
+ <artifactId>jakarta.activation-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish</groupId>
+ <artifactId>jakarta.el</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.oracle.substratevm</groupId>
+ <artifactId>svm</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/dozer/runtime/src/main/java/org/apache/camel/quarkus/component/dozer/CamelDozerConfig.java b/extensions/dozer/runtime/src/main/java/org/apache/camel/quarkus/component/dozer/CamelDozerConfig.java
new file mode 100644
index 0000000..3617649
--- /dev/null
+++ b/extensions/dozer/runtime/src/main/java/org/apache/camel/quarkus/component/dozer/CamelDozerConfig.java
@@ -0,0 +1,33 @@
+/*
+ * 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.component.dozer;
+
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
+
+import java.util.List;
+
+@ConfigRoot(name = "camel.dozer", phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED)
+public class CamelDozerConfig {
+
+ /**
+ * A comma separated list of Dozer XML mapping configuration file URIs.
+ */
+ @ConfigItem
+ public List<String> mappingFiles;
+}
diff --git a/extensions/dozer/runtime/src/main/java/org/apache/camel/quarkus/component/dozer/CamelDozerRecorder.java b/extensions/dozer/runtime/src/main/java/org/apache/camel/quarkus/component/dozer/CamelDozerRecorder.java
new file mode 100644
index 0000000..68ff9aa
--- /dev/null
+++ b/extensions/dozer/runtime/src/main/java/org/apache/camel/quarkus/component/dozer/CamelDozerRecorder.java
@@ -0,0 +1,34 @@
+/*
+ * 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.component.dozer;
+
+import io.quarkus.runtime.RuntimeValue;
+import io.quarkus.runtime.annotations.Recorder;
+
+import java.util.List;
+
+import org.apache.camel.converter.dozer.DozerBeanMapperConfiguration;
+
+@Recorder
+public class CamelDozerRecorder {
+
+ public RuntimeValue<DozerBeanMapperConfiguration> createDozerBeanMapperConfiguration(List<String> mappingFiles) {
+ DozerBeanMapperConfiguration dozerBeanMapperConfiguration = new DozerBeanMapperConfiguration();
+ dozerBeanMapperConfiguration.setMappingFiles(mappingFiles);
+ return new RuntimeValue<>(dozerBeanMapperConfiguration);
+ }
+}
diff --git a/extensions/dozer/runtime/src/main/java/org/apache/camel/quarkus/component/dozer/graal/DozerOSGiSubstitutions.java b/extensions/dozer/runtime/src/main/java/org/apache/camel/quarkus/component/dozer/graal/DozerOSGiSubstitutions.java
new file mode 100644
index 0000000..4e88f3b
--- /dev/null
+++ b/extensions/dozer/runtime/src/main/java/org/apache/camel/quarkus/component/dozer/graal/DozerOSGiSubstitutions.java
@@ -0,0 +1,113 @@
+/*
+ * 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.component.dozer.graal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import com.github.dozermapper.core.DozerBeanMapperBuilder;
+import com.github.dozermapper.core.builder.xml.SchemaLSResourceResolver;
+import com.github.dozermapper.core.config.BeanContainer;
+import com.github.dozermapper.core.util.DefaultClassLoader;
+import com.github.dozermapper.core.util.DozerClassLoader;
+import com.github.dozermapper.core.util.RuntimeUtils;
+import com.oracle.svm.core.annotate.Alias;
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+
+final class DozerOSGiSubstitutions {
+
+}
+
+@TargetClass(RuntimeUtils.class)
+final class SubstituteRuntimeUtils {
+
+ @Substitute
+ public static boolean isOSGi() {
+ return false;
+ }
+}
+
+@TargetClass(DozerBeanMapperBuilder.class)
+final class SubstituteDozerBeanMapperBuilder {
+
+ @Alias
+ private DozerClassLoader fluentDefinedClassLoader;
+
+ @Substitute
+ private DozerClassLoader getClassLoader() {
+ // Substituted method impl without unwanted references to OSGiClassLoader
+ if (fluentDefinedClassLoader == null) {
+ return new DefaultClassLoader(DozerBeanMapperBuilder.class.getClassLoader());
+ } else {
+ return fluentDefinedClassLoader;
+ }
+ }
+}
+
+@TargetClass(SchemaLSResourceResolver.class)
+final class SubstituteSchemaLSResourceResolver {
+
+ @Alias
+ private BeanContainer beanContainer;
+
+ @Substitute
+ private InputStream resolveFromClassPath(String systemId) throws IOException, URISyntaxException {
+ // Substituted method impl without unwanted references to OSGi Bundle & Activator
+
+ InputStream source;
+
+ String xsdPath;
+ URI uri = new URI(systemId);
+ if (uri.getScheme().equalsIgnoreCase("file")) {
+ xsdPath = uri.toString();
+ } else {
+ xsdPath = uri.getPath();
+ if (xsdPath.charAt(0) == '/') {
+ xsdPath = xsdPath.substring(1);
+ }
+ }
+
+ ClassLoader localClassLoader = getClass().getClassLoader();
+
+ //Attempt to find within this JAR
+ URL url = localClassLoader.getResource(xsdPath);
+ if (url == null) {
+ //Attempt to find via user defined class loader
+ DozerClassLoader dozerClassLoader = beanContainer.getClassLoader();
+
+ url = dozerClassLoader.loadResource(xsdPath);
+ }
+
+ if (url == null) {
+ throw new IOException(
+ "Could not resolve bean-mapping XML Schema [" + systemId + "]: not found in classpath; " + xsdPath);
+ }
+
+ try {
+ source = url.openStream();
+ } catch (IOException ex) {
+ throw new IOException(
+ "Could not resolve bean-mapping XML Schema [" + systemId + "]: not found in classpath; " + xsdPath, ex);
+ }
+
+ return source;
+ }
+}
diff --git a/extensions/dozer/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/dozer/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..62aa7ac
--- /dev/null
+++ b/extensions/dozer/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,27 @@
+#
+# 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 Dozer"
+description: "Camel Dozer support"
+metadata:
+ keywords:
+ - "camel"
+ - "dozer"
+ 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 7b8e6b6..8488311 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -54,6 +54,7 @@
<module>csv</module>
<module>dataformat</module>
<module>direct</module>
+ <module>dozer</module>
<module>exec</module>
<module>fhir</module>
<module>file</module>
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index 29ef433..ab8ea51 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -5,7 +5,7 @@ Apache Camel Quarkus supports the following Camel artifacts as Quarkus Extension
== Camel Components
// components: START
-Number of Camel components: 38 in 33 JAR artifacts (0 deprecated)
+Number of Camel components: 39 in 34 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -41,6 +41,9 @@ Number of Camel components: 38 in 33 JAR artifacts (0 deprecated)
| link:https://camel.apache.org/components/latest/direct-component.html[Direct] (camel-quarkus-direct) +
`direct:name` | 0.2 | The direct component provides direct, synchronous call to another endpoint from the same CamelContext.
+| xref:extensions/dozer.adoc[Dozer] (camel-quarkus-dozer) +
+`dozer:name` | 0.5 | The dozer component provides the ability to map between Java beans using the Dozer mapping library.
+
| link:https://camel.apache.org/components/latest/exec-component.html[Exec] (camel-quarkus-exec) +
`exec:executable` | 0.4 | The exec component can be used to execute OS system commands.
diff --git a/integration-tests/dozer/pom.xml b/integration-tests/dozer/pom.xml
new file mode 100644
index 0000000..d5382f8
--- /dev/null
+++ b/integration-tests/dozer/pom.xml
@@ -0,0 +1,136 @@
+<?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-integration-tests</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-dozer</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: Dozer</name>
+ <description>Integration tests for Camel Quarkus Dozer extension</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dozer</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy-jsonb</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <systemProperties>
+ <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>native-image</id>
+ <goals>
+ <goal>native-image</goal>
+ </goals>
+ <configuration>
+ <reportErrorsAtRuntime>false</reportErrorsAtRuntime>
+ <cleanupServer>true</cleanupServer>
+ <enableHttpsUrlHandler>true</enableHttpsUrlHandler>
+ <enableServer>false</enableServer>
+ <dumpProxies>false</dumpProxies>
+ <graalvmHome>${graalvmHome}</graalvmHome>
+ <enableJni>true</enableJni>
+ <enableAllSecurityServices>true</enableAllSecurityServices>
+ <disableReports>true</disableReports>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/integration-tests/dozer/src/main/java/org/apache/camel/quarkus/component/dozer/it/DozerResource.java b/integration-tests/dozer/src/main/java/org/apache/camel/quarkus/component/dozer/it/DozerResource.java
new file mode 100644
index 0000000..75e2ae9
--- /dev/null
+++ b/integration-tests/dozer/src/main/java/org/apache/camel/quarkus/component/dozer/it/DozerResource.java
@@ -0,0 +1,74 @@
+/*
+ * 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.component.dozer.it;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.quarkus.component.dozer.it.model.CustomerA;
+import org.apache.camel.quarkus.component.dozer.it.model.CustomerB;
+
+@Path("/dozer")
+@ApplicationScoped
+public class DozerResource {
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Path("/map")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public CustomerB dozerMap() {
+ return producerTemplate.requestBody("direct:mapWithEndpoint", createCustomerA(), CustomerB.class);
+ }
+
+ @Path("/map/using/converter")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public CustomerB dozerMapWithConverter() {
+ return producerTemplate.requestBody("direct:mapWithConverter", createCustomerA(), CustomerB.class);
+ }
+
+ @Path("/map/using/variable")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public CustomerB dozerMapWithVariable() {
+ return producerTemplate.requestBody("direct:mapWithVariable", createCustomerA(), CustomerB.class);
+ }
+
+ @Path("/map/using/expression")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public CustomerB dozerMapWithExpression() {
+ Map<String, Object> headers = new HashMap<>();
+ headers.put("firstName", "Camel");
+ headers.put("lastName", "Quarkus");
+ return producerTemplate.requestBodyAndHeaders("direct:mapWithExpression", createCustomerA(), headers, CustomerB.class);
+ }
+
+ private CustomerA createCustomerA() {
+ return new CustomerA("Peter", "Post", "Camel Street", "12345");
+ }
+}
diff --git a/integration-tests/dozer/src/main/java/org/apache/camel/quarkus/component/dozer/it/DozerRoutes.java b/integration-tests/dozer/src/main/java/org/apache/camel/quarkus/component/dozer/it/DozerRoutes.java
new file mode 100644
index 0000000..9508b40
--- /dev/null
+++ b/integration-tests/dozer/src/main/java/org/apache/camel/quarkus/component/dozer/it/DozerRoutes.java
@@ -0,0 +1,40 @@
+/*
+ * 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.component.dozer.it;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.converter.dozer.DozerTypeConverterLoader;
+import org.apache.camel.quarkus.component.dozer.it.model.CustomerB;
+
+public class DozerRoutes extends RouteBuilder {
+
+ @Override
+ public void configure() throws Exception {
+ new DozerTypeConverterLoader(getContext());
+
+ from("direct:mapWithConverter").convertBodyTo(CustomerB.class);
+
+ from("direct:mapWithEndpoint")
+ .to("dozer:simpleMapping?mappingFile=simple-mapping.xml&targetModel=org.apache.camel.quarkus.component.dozer.it.model.CustomerB");
+
+ from("direct:mapWithVariable")
+ .to("dozer:variableMapping?mappingFile=variable-mapping.xml&targetModel=org.apache.camel.quarkus.component.dozer.it.model.CustomerB");
+
+ from("direct:mapWithExpression")
+ .to("dozer:expressionMapping?mappingFile=expression-mapping.xml&targetModel=org.apache.camel.quarkus.component.dozer.it.model.CustomerB");
+ }
+}
diff --git a/integration-tests/dozer/src/main/java/org/apache/camel/quarkus/component/dozer/it/model/CustomerA.java b/integration-tests/dozer/src/main/java/org/apache/camel/quarkus/component/dozer/it/model/CustomerA.java
new file mode 100644
index 0000000..139fb56
--- /dev/null
+++ b/integration-tests/dozer/src/main/java/org/apache/camel/quarkus/component/dozer/it/model/CustomerA.java
@@ -0,0 +1,71 @@
+/*
+ * 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.component.dozer.it.model;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+@RegisterForReflection
+public class CustomerA {
+
+ private String firstName;
+ private String lastName;
+ private String street;
+ private String zip;
+
+ public CustomerA() {
+ }
+
+ public CustomerA(String firstName, String lastName, String street, String zip) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.street = street;
+ this.zip = zip;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ public String getZip() {
+ return zip;
+ }
+
+ public void setZip(String zip) {
+ this.zip = zip;
+ }
+
+}
diff --git a/integration-tests/dozer/src/main/java/org/apache/camel/quarkus/component/dozer/it/model/CustomerB.java b/integration-tests/dozer/src/main/java/org/apache/camel/quarkus/component/dozer/it/model/CustomerB.java
new file mode 100644
index 0000000..bb1da97
--- /dev/null
+++ b/integration-tests/dozer/src/main/java/org/apache/camel/quarkus/component/dozer/it/model/CustomerB.java
@@ -0,0 +1,90 @@
+/*
+ * 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.component.dozer.it.model;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+@RegisterForReflection
+public class CustomerB {
+
+ private String firstName;
+ private String lastName;
+ private Address address;
+
+ public CustomerB() {
+ }
+
+ public CustomerB(String firstName, String lastName, Address address) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.address = address;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public Address getAddress() {
+ return address;
+ }
+
+ public void setAddress(Address address) {
+ this.address = address;
+ }
+
+ public static class Address {
+
+ private String street;
+ private String zip;
+
+ public Address() {
+ }
+
+ public Address(String street, String zip) {
+ this.street = street;
+ this.zip = zip;
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ public String getZip() {
+ return zip;
+ }
+
+ public void setZip(String zip) {
+ this.zip = zip;
+ }
+ }
+}
diff --git a/integration-tests/dozer/src/main/resources/application.properties b/integration-tests/dozer/src/main/resources/application.properties
new file mode 100644
index 0000000..44bc84c
--- /dev/null
+++ b/integration-tests/dozer/src/main/resources/application.properties
@@ -0,0 +1,21 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# Quarkus - Camel Dozer
+#
+quarkus.camel.dozer.mapping-files=simple-mapping.xml,variable-mapping.xml,expression-mapping.xml
diff --git a/integration-tests/dozer/src/main/resources/expression-mapping.xml b/integration-tests/dozer/src/main/resources/expression-mapping.xml
new file mode 100644
index 0000000..3651e13
--- /dev/null
+++ b/integration-tests/dozer/src/main/resources/expression-mapping.xml
@@ -0,0 +1,35 @@
+<!--
+
+ 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.
+
+-->
+<mappings xmlns="http://dozermapper.github.io/schema/bean-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://dozermapper.github.io/schema/bean-mapping http://dozermapper.github.io/schema/bean-mapping.xsd">
+
+ <mapping>
+ <class-a>org.apache.camel.component.dozer.ExpressionMapper</class-a>
+ <class-b>org.apache.camel.quarkus.component.dozer.it.model.CustomerB</class-b>
+ <field custom-converter-id="_expressionMapping" custom-converter-param="simple:\${header.firstName}">
+ <a>expression</a>
+ <b>firstName</b>
+ </field>
+ <field custom-converter-id="_expressionMapping" custom-converter-param="simple:\${header.lastName}">
+ <a>expression</a>
+ <b>lastName</b>
+ </field>
+ </mapping>
+
+</mappings>
diff --git a/integration-tests/dozer/src/main/resources/simple-mapping.xml b/integration-tests/dozer/src/main/resources/simple-mapping.xml
new file mode 100644
index 0000000..9bd0d19
--- /dev/null
+++ b/integration-tests/dozer/src/main/resources/simple-mapping.xml
@@ -0,0 +1,35 @@
+<!--
+
+ 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.
+
+-->
+<mappings xmlns="http://dozermapper.github.io/schema/bean-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://dozermapper.github.io/schema/bean-mapping http://dozermapper.github.io/schema/bean-mapping.xsd">
+
+ <mapping>
+ <class-a>org.apache.camel.quarkus.component.dozer.it.model.CustomerA</class-a>
+ <class-b>org.apache.camel.quarkus.component.dozer.it.model.CustomerB</class-b>
+ <field>
+ <a>street</a>
+ <b>address.street</b>
+ </field>
+ <field>
+ <a>zip</a>
+ <b>address.zip</b>
+ </field>
+ </mapping>
+
+</mappings>
diff --git a/integration-tests/dozer/src/main/resources/variable-mapping.xml b/integration-tests/dozer/src/main/resources/variable-mapping.xml
new file mode 100644
index 0000000..dd363a6
--- /dev/null
+++ b/integration-tests/dozer/src/main/resources/variable-mapping.xml
@@ -0,0 +1,42 @@
+<!--
+
+ 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.
+
+-->
+<mappings xmlns="http://dozermapper.github.io/schema/bean-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://dozermapper.github.io/schema/bean-mapping http://dozermapper.github.io/schema/bean-mapping.xsd">
+
+ <configuration>
+ <variables>
+ <variable name="FIRST_NAME">Camel</variable>
+ <variable name="LAST_NAME">Quarkus</variable>
+ </variables>
+ </configuration>
+
+ <mapping>
+ <class-a>org.apache.camel.component.dozer.VariableMapper</class-a>
+ <class-b>org.apache.camel.quarkus.component.dozer.it.model.CustomerB</class-b>
+ <field custom-converter-id="_variableMapping" custom-converter-param="${FIRST_NAME}">
+ <a>literal</a>
+ <b>firstName</b>
+ </field>
+ <field custom-converter-id="_variableMapping" custom-converter-param="${LAST_NAME}">
+ <a>literal</a>
+ <b>lastName</b>
+ </field>
+ </mapping>
+
+</mappings>
diff --git a/integration-tests/dozer/src/test/java/org/apache/camel/quarkus/component/dozer/it/DozerIT.java b/integration-tests/dozer/src/test/java/org/apache/camel/quarkus/component/dozer/it/DozerIT.java
new file mode 100644
index 0000000..d83647b
--- /dev/null
+++ b/integration-tests/dozer/src/test/java/org/apache/camel/quarkus/component/dozer/it/DozerIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.component.dozer.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class DozerIT extends DozerTest {
+
+}
diff --git a/integration-tests/dozer/src/test/java/org/apache/camel/quarkus/component/dozer/it/DozerTest.java b/integration-tests/dozer/src/test/java/org/apache/camel/quarkus/component/dozer/it/DozerTest.java
new file mode 100644
index 0000000..65b1e8c
--- /dev/null
+++ b/integration-tests/dozer/src/test/java/org/apache/camel/quarkus/component/dozer/it/DozerTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.component.dozer.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+
+import org.junit.jupiter.api.Test;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+@QuarkusTest
+class DozerTest {
+
+ @Test
+ public void testDozerTypeConverter() {
+ RestAssured.get("/dozer/map/using/converter")
+ .then()
+ .statusCode(200)
+ .body("address", notNullValue(),
+ "address.zip", is("12345"),
+ "address.street", is("Camel Street"));
+ }
+
+ @Test
+ public void testDozerEndpoint() {
+ RestAssured.get("/dozer/map")
+ .then()
+ .statusCode(200)
+ .body("address", notNullValue(),
+ "address.zip", is("12345"),
+ "address.street", is("Camel Street"));
+ }
+
+ @Test
+ public void testDozerVariableMapper() {
+ RestAssured.get("/dozer/map/using/variable")
+ .then()
+ .statusCode(200)
+ .body("firstName", is("Camel"),
+ "lastName", is("Quarkus"));
+ }
+
+ @Test
+ public void testDozerExpressionMapper() {
+ RestAssured.get("/dozer/map/using/expression")
+ .then()
+ .statusCode(200)
+ .body("firstName", is("Camel"),
+ "lastName", is("Quarkus"));
+ }
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 06a4732..ec0dff5 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -80,6 +80,7 @@
<module>controlbus</module>
<module>csv</module>
<module>dataformat</module>
+ <module>dozer</module>
<module>exec</module>
<module>fhir</module>
<module>file</module>
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index 1ffa119..8ae8e05 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -155,6 +155,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dozer-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-exec-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 1fa3b90..f7fe4c3 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -136,6 +136,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-dozer</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-exec</artifactId>
<version>${camel.version}</version>
</dependency>
@@ -450,6 +455,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-dozer</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-exec</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>