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/05/29 09:36:48 UTC

[camel] branch master updated (7155b5b -> 2db03cf)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 7155b5b  Fixed Camel-Mail Spring Boot Integration test
     new 3f4ed8d  CAMEL-10324 - Camel-CBOR first commit
     new 42f8548  CAMEL-10324 - Camel-CBOR
     new 8678f3a  CAMEL-10324 - Camel-CBOR Added dataformat to core
     new b5cd6f8  CAMEL-10324 - Added CBOR to parent pom
     new 9f20dd7  CAMEL-10324 - Regen
     new f999ea5  CAMEL-10324 - Camel-CBOR added to kit and Spring tests
     new 973a115  CAMEL-10324 - Fixed CS in core
     new 50f5b27  CAMEL-10324 - Fixed CS in Camel-CBOR
     new 0f1c778  CAMEL-10324 - Docs
     new 2db03cf  CAMEL-10324 - A bit better javadoc for the CBOR options

The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 apache-camel/pom.xml                               |  10 ++
 apache-camel/src/main/descriptors/common-bin.xml   |   2 +
 bom/camel-bom/pom.xml                              |  10 ++
 components/camel-cbor/pom.xml                      |  85 ++++++++++
 .../camel-cbor/src/main/docs/cbor-dataformat.adoc  |  81 +++++++++
 .../apache/camel/component/cbor/CBORConstants.java |  25 +++
 .../camel/component/cbor/CBORDataFormat.java       | 186 +++++++++++++++++++++
 .../org/apache/camel/component/cbor/Author.java    |  40 +++++
 .../camel/component/cbor/CBORDataFormatTest.java   |  88 ++++++++++
 .../component/cbor/SpringCBORDataFormatTest.java   |  73 ++++++++
 .../src/test/resources/log4j2.properties           |   0
 .../component/cbor/SpringCBORDataFormatTest.xml    |  61 +++++++
 components/pom.xml                                 |   1 +
 components/readme.adoc                             |   4 +-
 .../org/apache/camel/builder/DataFormatClause.java |  20 +++
 .../org/apache/camel/model/MarshalDefinition.java  |   2 +
 .../apache/camel/model/UnmarshalDefinition.java    |   2 +
 .../camel/model/dataformat/CBORDataFormat.java     | 154 +++++++++++++++++
 .../model/dataformat/DataFormatsDefinition.java    |   1 +
 .../reifier/dataformat/CBORDataFormatReifier.java  |  72 ++++++++
 .../reifier/dataformat/DataFormatReifier.java      |   2 +
 docs/components/modules/ROOT/nav.adoc              |   1 +
 .../modules/ROOT/pages/cbor-dataformat.adoc        |  81 +++++++++
 parent/pom.xml                                     |  10 ++
 .../components-starter/camel-cbor-starter/pom.xml  |  53 ++++++
 .../CBORDataFormatAutoConfiguration.java           | 128 ++++++++++++++
 .../springboot/CBORDataFormatConfiguration.java    | 133 +++++++++++++++
 .../src/main/resources/META-INF/LICENSE.txt        |   0
 .../src/main/resources/META-INF/NOTICE.txt         |   0
 .../src/main/resources/META-INF/spring.factories   |  19 +++
 .../src/main/resources/META-INF/spring.provides    |  17 ++
 platforms/spring-boot/components-starter/pom.xml   |   1 +
 .../camel-spring-boot-dependencies/pom.xml         |  10 ++
 33 files changed, 1371 insertions(+), 1 deletion(-)
 create mode 100644 components/camel-cbor/pom.xml
 create mode 100644 components/camel-cbor/src/main/docs/cbor-dataformat.adoc
 create mode 100644 components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORConstants.java
 create mode 100644 components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORDataFormat.java
 create mode 100644 components/camel-cbor/src/test/java/org/apache/camel/component/cbor/Author.java
 create mode 100644 components/camel-cbor/src/test/java/org/apache/camel/component/cbor/CBORDataFormatTest.java
 create mode 100644 components/camel-cbor/src/test/java/org/apache/camel/component/cbor/SpringCBORDataFormatTest.java
 copy components/{camel-jolt => camel-cbor}/src/test/resources/log4j2.properties (100%)
 create mode 100644 components/camel-cbor/src/test/resources/org/apache/camel/component/cbor/SpringCBORDataFormatTest.xml
 create mode 100644 core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java
 create mode 100644 core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/CBORDataFormatReifier.java
 create mode 100644 docs/components/modules/ROOT/pages/cbor-dataformat.adoc
 create mode 100644 platforms/spring-boot/components-starter/camel-cbor-starter/pom.xml
 create mode 100644 platforms/spring-boot/components-starter/camel-cbor-starter/src/main/java/org/apache/camel/component/cbor/springboot/CBORDataFormatAutoConfiguration.java
 create mode 100644 platforms/spring-boot/components-starter/camel-cbor-starter/src/main/java/org/apache/camel/component/cbor/springboot/CBORDataFormatConfiguration.java
 copy {tooling/maven/camel-package-maven-plugin => platforms/spring-boot/components-starter/camel-cbor-starter}/src/main/resources/META-INF/LICENSE.txt (100%)
 copy {tooling/maven/camel-package-maven-plugin => platforms/spring-boot/components-starter/camel-cbor-starter}/src/main/resources/META-INF/NOTICE.txt (100%)
 create mode 100644 platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/spring.factories
 create mode 100644 platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/spring.provides


[camel] 03/10: CAMEL-10324 - Camel-CBOR Added dataformat to core

Posted by ac...@apache.org.
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.git

commit 8678f3af5dbf937d91e7da8d898fd63d29a7b829
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed May 29 09:13:47 2019 +0200

    CAMEL-10324 - Camel-CBOR Added dataformat to core
---
 .../camel/model/dataformat/CBORDataFormat.java     |  28 +++
 .../reifier/dataformat/CBORDataFormatReifier.java  |  72 ++++++++
 .../reifier/dataformat/DataFormatReifier.java      |   2 +
 .../components-starter/camel-cbor-starter/pom.xml  |  53 ++++++
 .../CBORDataFormatAutoConfiguration.java           | 128 +++++++++++++
 .../springboot/CBORDataFormatConfiguration.java    | 133 ++++++++++++++
 .../src/main/resources/META-INF/LICENSE.txt        | 203 +++++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt         |  11 ++
 .../src/main/resources/META-INF/spring.factories   |  19 ++
 .../src/main/resources/META-INF/spring.provides    |  17 ++
 platforms/spring-boot/components-starter/pom.xml   |   1 +
 11 files changed, 667 insertions(+)

diff --git a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java
index 01c1405..b7b6216 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java
@@ -38,8 +38,12 @@ public class CBORDataFormat extends DataFormatDefinition {
     @XmlAttribute
     @Metadata(defaultValue = "true")
     private Boolean useDefaultObjectMapper;
+    @XmlAttribute
+    private String unmarshalTypeName;
     @XmlTransient
     private Class<?> unmarshalType;
+    @XmlAttribute
+    private String collectionTypeName;
     @XmlTransient
     private Class<?> collectionType;
     @XmlAttribute
@@ -73,6 +77,17 @@ public class CBORDataFormat extends DataFormatDefinition {
     public void setUseDefaultObjectMapper(Boolean useDefaultObjectMapper) {
         this.useDefaultObjectMapper = useDefaultObjectMapper;
     }
+    
+    public String getUnmarshalTypeName() {
+        return unmarshalTypeName;
+    }
+
+    /**
+     * Class name of the java type to use when unarmshalling
+     */
+    public void setUnmarshalTypeName(String unmarshalTypeName) {
+        this.unmarshalTypeName = unmarshalTypeName;
+    }
 
     public Class<?> getUnmarshalType() {
         return unmarshalType;
@@ -84,6 +99,19 @@ public class CBORDataFormat extends DataFormatDefinition {
     public void setUnmarshalType(Class<?> unmarshalType) {
         this.unmarshalType = unmarshalType;
     }
+    
+    public String getCollectionTypeName() {
+        return collectionTypeName;
+    }
+
+    /**
+     * Refers to a custom collection type to lookup in the registry to use. This
+     * option should rarely be used, but allows to use different collection
+     * types than java.util.Collection based as default.
+     */
+    public void setCollectionTypeName(String collectionTypeName) {
+        this.collectionTypeName = collectionTypeName;
+    }
 
     public Class<?> getCollectionType() {
         return collectionType;
diff --git a/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/CBORDataFormatReifier.java b/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/CBORDataFormatReifier.java
new file mode 100644
index 0000000..5dfcb98
--- /dev/null
+++ b/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/CBORDataFormatReifier.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.reifier.dataformat;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.model.DataFormatDefinition;
+import org.apache.camel.model.dataformat.CBORDataFormat;
+import org.apache.camel.spi.DataFormat;
+
+public class CBORDataFormatReifier extends DataFormatReifier<CBORDataFormat> {
+
+    public CBORDataFormatReifier(DataFormatDefinition definition) {
+        super((CBORDataFormat) definition);
+    }
+
+    @Override
+    protected DataFormat doCreateDataFormat(CamelContext camelContext) {
+        if (definition.getUnmarshalType() == null && definition.getUnmarshalTypeName() != null) {
+            try {
+                definition.setUnmarshalType(camelContext.getClassResolver().resolveMandatoryClass(definition.getUnmarshalTypeName()));
+            } catch (ClassNotFoundException e) {
+                throw RuntimeCamelException.wrapRuntimeCamelException(e);
+            }
+        }
+        if (definition.getCollectionType() == null && definition.getCollectionTypeName() != null) {
+            try {
+                definition.setCollectionType(camelContext.getClassResolver().resolveMandatoryClass(definition.getCollectionTypeName()));
+            } catch (ClassNotFoundException e) {
+                throw RuntimeCamelException.wrapRuntimeCamelException(e);
+            }
+        }
+
+        return super.doCreateDataFormat(camelContext);
+    }
+
+    @Override
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
+        if (definition.getObjectMapper() != null) {
+            // must be a reference value
+            String ref = definition.getObjectMapper().startsWith("#") ? definition.getObjectMapper() : "#" + definition.getObjectMapper();
+            setProperty(camelContext, dataFormat, "xmlMapper", ref);
+        }
+        if (definition.getUnmarshalType() != null) {
+            setProperty(camelContext, dataFormat, "unmarshalType", definition.getUnmarshalType());
+        }
+        if (definition.getCollectionTypeName() != null) {
+            setProperty(camelContext, dataFormat, "collectionType", definition.getCollectionTypeName());
+        }
+        if (definition.getUseList() != null) {
+            setProperty(camelContext, dataFormat, "useList", definition.getUseList());
+        }
+        if (definition.getAllowUnmarshallType() != null) {
+            setProperty(camelContext, dataFormat, "allowUnmarshallType", definition.getAllowUnmarshallType());
+        }
+    }
+
+}
diff --git a/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java b/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java
index df57391..d47eedb 100644
--- a/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java
+++ b/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java
@@ -31,6 +31,7 @@ import org.apache.camel.model.dataformat.Base64DataFormat;
 import org.apache.camel.model.dataformat.BeanioDataFormat;
 import org.apache.camel.model.dataformat.BindyDataFormat;
 import org.apache.camel.model.dataformat.BoonDataFormat;
+import org.apache.camel.model.dataformat.CBORDataFormat;
 import org.apache.camel.model.dataformat.CryptoDataFormat;
 import org.apache.camel.model.dataformat.CsvDataFormat;
 import org.apache.camel.model.dataformat.CustomDataFormat;
@@ -82,6 +83,7 @@ public abstract class DataFormatReifier<T extends DataFormatDefinition> {
         map.put(BeanioDataFormat.class, BeanioDataFormatReifier::new);
         map.put(BindyDataFormat.class, BindyDataFormatReifier::new);
         map.put(BoonDataFormat.class, BoonDataFormatReifier::new);
+        map.put(CBORDataFormat.class, CBORDataFormatReifier::new);
         map.put(CryptoDataFormat.class, CryptoDataFormatReifier::new);
         map.put(CsvDataFormat.class, CsvDataFormatReifier::new);
         map.put(CustomDataFormat.class, CustomDataFormatReifier::new);
diff --git a/platforms/spring-boot/components-starter/camel-cbor-starter/pom.xml b/platforms/spring-boot/components-starter/camel-cbor-starter/pom.xml
new file mode 100644
index 0000000..9029b9f
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-cbor-starter/pom.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components-starter</artifactId>
+    <version>3.0.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>camel-cbor-starter</artifactId>
+  <packaging>jar</packaging>
+  <name>Spring-Boot Starter :: Camel :: CBOR</name>
+  <description>Spring-Boot Starter for Camel Cbor Support</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+      <version>${spring-boot-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-cbor</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <!--START OF GENERATED CODE-->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+    </dependency>
+    <!--END OF GENERATED CODE-->
+  </dependencies>
+</project>
diff --git a/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/java/org/apache/camel/component/cbor/springboot/CBORDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/java/org/apache/camel/component/cbor/springboot/CBORDataFormatAutoConfiguration.java
new file mode 100644
index 0000000..cda8058
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/java/org/apache/camel/component/cbor/springboot/CBORDataFormatAutoConfiguration.java
@@ -0,0 +1,128 @@
+/*
+ * 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.component.cbor.springboot;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Generated;
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.cbor.CBORDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatCustomizer;
+import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
+import org.apache.camel.spring.boot.util.CamelPropertiesHelper;
+import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
+import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
+import org.apache.camel.support.IntrospectionSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@Configuration
+@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class,
+        CBORDataFormatAutoConfiguration.GroupConditions.class})
+@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties({DataFormatConfigurationProperties.class,
+        CBORDataFormatConfiguration.class})
+public class CBORDataFormatAutoConfiguration {
+
+    private static final Logger LOGGER = LoggerFactory
+            .getLogger(CBORDataFormatAutoConfiguration.class);
+    @Autowired
+    private ApplicationContext applicationContext;
+    @Autowired
+    private CamelContext camelContext;
+    @Autowired
+    private CBORDataFormatConfiguration configuration;
+    @Autowired(required = false)
+    private List<DataFormatCustomizer<CBORDataFormat>> customizers;
+
+    static class GroupConditions extends GroupCondition {
+        public GroupConditions() {
+            super("camel.dataformat", "camel.dataformat.cbor");
+        }
+    }
+
+    @Bean(name = "cbor-dataformat-factory")
+    @ConditionalOnMissingBean(CBORDataFormat.class)
+    public DataFormatFactory configureCBORDataFormatFactory() throws Exception {
+        return new DataFormatFactory() {
+            @Override
+            public DataFormat newInstance() {
+                CBORDataFormat dataformat = new CBORDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(CBORDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    CamelPropertiesHelper.setCamelProperties(camelContext,
+                            dataformat, parameters, false);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                if (ObjectHelper.isNotEmpty(customizers)) {
+                    for (DataFormatCustomizer<CBORDataFormat> customizer : customizers) {
+                        boolean useCustomizer = (customizer instanceof HasId)
+                                ? HierarchicalPropertiesEvaluator.evaluate(
+                                        applicationContext.getEnvironment(),
+                                        "camel.dataformat.customizer",
+                                        "camel.dataformat.cbor.customizer",
+                                        ((HasId) customizer).getId())
+                                : HierarchicalPropertiesEvaluator.evaluate(
+                                        applicationContext.getEnvironment(),
+                                        "camel.dataformat.customizer",
+                                        "camel.dataformat.cbor.customizer");
+                        if (useCustomizer) {
+                            LOGGER.debug(
+                                    "Configure dataformat {}, with customizer {}",
+                                    dataformat, customizer);
+                            customizer.customize(dataformat);
+                        }
+                    }
+                }
+                return dataformat;
+            }
+        };
+    }
+}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/java/org/apache/camel/component/cbor/springboot/CBORDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/java/org/apache/camel/component/cbor/springboot/CBORDataFormatConfiguration.java
new file mode 100644
index 0000000..9434ebc
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/java/org/apache/camel/component/cbor/springboot/CBORDataFormatConfiguration.java
@@ -0,0 +1,133 @@
+/*
+ * 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.component.cbor.springboot;
+
+import javax.annotation.Generated;
+import org.apache.camel.spring.boot.DataFormatConfigurationPropertiesCommon;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * CBOR data format is used for unmarshal a CBOR payload to POJO or to marshal
+ * POJO back to CBOR payload.
+ * 
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@ConfigurationProperties(prefix = "camel.dataformat.cbor")
+public class CBORDataFormatConfiguration
+        extends
+            DataFormatConfigurationPropertiesCommon {
+
+    /**
+     * Whether to enable auto configuration of the cbor data format. This is
+     * enabled by default.
+     */
+    private Boolean enabled;
+    /**
+     * Lookup and use the existing CBOR ObjectMapper with the given id when
+     * using Jackson.
+     */
+    private String objectMapper;
+    /**
+     * Whether to lookup and use default Jackson CBOR ObjectMapper from the
+     * registry.
+     */
+    private Boolean useDefaultObjectMapper = true;
+    /**
+     * Class name of the java type to use when unarmshalling
+     */
+    private String unmarshalTypeName;
+    /**
+     * Refers to a custom collection type to lookup in the registry to use. This
+     * option should rarely be used, but allows to use different collection
+     * types than java.util.Collection based as default.
+     */
+    private String collectionTypeName;
+    /**
+     * To unarmshal to a List of Map or a List of Pojo.
+     */
+    private Boolean useList = false;
+    /**
+     * If enabled then Jackson is allowed to attempt to use the
+     * CamelJacksonUnmarshalType header during the unmarshalling. This should
+     * only be enabled when desired to be used.
+     */
+    private Boolean allowUnmarshallType = false;
+    /**
+     * Whether the data format should set the Content-Type header with the type
+     * from the data format if the data format is capable of doing so. For
+     * example application/xml for data formats marshalling to XML, or
+     * application/json for data formats marshalling to JSon etc.
+     */
+    private Boolean contentTypeHeader = false;
+
+    public String getObjectMapper() {
+        return objectMapper;
+    }
+
+    public void setObjectMapper(String objectMapper) {
+        this.objectMapper = objectMapper;
+    }
+
+    public Boolean getUseDefaultObjectMapper() {
+        return useDefaultObjectMapper;
+    }
+
+    public void setUseDefaultObjectMapper(Boolean useDefaultObjectMapper) {
+        this.useDefaultObjectMapper = useDefaultObjectMapper;
+    }
+
+    public String getUnmarshalTypeName() {
+        return unmarshalTypeName;
+    }
+
+    public void setUnmarshalTypeName(String unmarshalTypeName) {
+        this.unmarshalTypeName = unmarshalTypeName;
+    }
+
+    public String getCollectionTypeName() {
+        return collectionTypeName;
+    }
+
+    public void setCollectionTypeName(String collectionTypeName) {
+        this.collectionTypeName = collectionTypeName;
+    }
+
+    public Boolean getUseList() {
+        return useList;
+    }
+
+    public void setUseList(Boolean useList) {
+        this.useList = useList;
+    }
+
+    public Boolean getAllowUnmarshallType() {
+        return allowUnmarshallType;
+    }
+
+    public void setAllowUnmarshallType(Boolean allowUnmarshallType) {
+        this.allowUnmarshallType = allowUnmarshallType;
+    }
+
+    public Boolean getContentTypeHeader() {
+        return contentTypeHeader;
+    }
+
+    public void setContentTypeHeader(Boolean contentTypeHeader) {
+        this.contentTypeHeader = contentTypeHeader;
+    }
+}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/LICENSE.txt b/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
diff --git a/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/NOTICE.txt b/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.
diff --git a/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..65cf8f8
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,19 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+org.apache.camel.component.cbor.springboot.CBORDataFormatAutoConfiguration
diff --git a/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/spring.provides b/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/spring.provides
new file mode 100644
index 0000000..3e35e78
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-cbor-starter/src/main/resources/META-INF/spring.provides
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+provides: camel-cbor
diff --git a/platforms/spring-boot/components-starter/pom.xml b/platforms/spring-boot/components-starter/pom.xml
index a44630a..71214b6 100644
--- a/platforms/spring-boot/components-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/pom.xml
@@ -147,6 +147,7 @@
     <module>camel-browse-starter</module>
     <module>camel-caffeine-starter</module>
     <module>camel-cassandraql-starter</module>
+    <module>camel-cbor-starter</module>
     <module>camel-chatscript-starter</module>
     <module>camel-chunk-starter</module>
     <module>camel-cm-sms-starter</module>


[camel] 06/10: CAMEL-10324 - Camel-CBOR added to kit and Spring tests

Posted by ac...@apache.org.
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.git

commit f999ea58e3225e5890ea8ab200a6aca26ac3d2aa
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed May 29 10:13:48 2019 +0200

    CAMEL-10324 - Camel-CBOR added to kit and Spring tests
---
 .../component/cbor/SpringCBORDataFormatTest.java   | 73 ++++++++++++++++++++++
 .../component/cbor/SpringCBORDataFormatTest.xml    | 61 ++++++++++++++++++
 .../org/apache/camel/builder/DataFormatClause.java | 20 ++++++
 .../org/apache/camel/model/MarshalDefinition.java  |  2 +
 .../apache/camel/model/UnmarshalDefinition.java    |  2 +
 .../model/dataformat/DataFormatsDefinition.java    |  1 +
 6 files changed, 159 insertions(+)

diff --git a/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/SpringCBORDataFormatTest.java b/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/SpringCBORDataFormatTest.java
new file mode 100644
index 0000000..6816b18
--- /dev/null
+++ b/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/SpringCBORDataFormatTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.component.cbor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringCBORDataFormatTest extends CamelSpringTestSupport {
+
+    @Test
+    public void testMarshalAndUnmarshalMap() throws Exception {
+        Map<String, Object> in = new HashMap<>();
+        in.put("name", "Camel");
+
+        MockEndpoint mock = getMockEndpoint("mock:reverse");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isInstanceOf(Map.class);
+        mock.message(0).body().isEqualTo(in);
+
+        Object marshalled = template.requestBody("direct:in", in);
+
+        template.sendBody("direct:back", marshalled);
+
+        mock.assertIsSatisfied();
+    }
+    
+    @Test
+    public void testMarshalAndUnmarshalAuthor() throws Exception {
+        Author auth = new Author();
+        auth.setName("Don");
+        auth.setSurname("Winslow");
+
+        MockEndpoint mock = getMockEndpoint("mock:reverse-auth");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isInstanceOf(Author.class);
+
+        Object marshalled = template.requestBody("direct:in-auth", auth);
+
+        template.sendBody("direct:back-auth", marshalled);
+        
+        Author authReturned = mock.getExchanges().get(0).getIn().getBody(Author.class);
+        assertEquals("Don", authReturned.getName());
+        assertEquals("Winslow", authReturned.getSurname());
+
+        mock.assertIsSatisfied();
+    }
+
+    @Override
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/cbor/SpringCBORDataFormatTest.xml");
+    }
+
+}
diff --git a/components/camel-cbor/src/test/resources/org/apache/camel/component/cbor/SpringCBORDataFormatTest.xml b/components/camel-cbor/src/test/resources/org/apache/camel/component/cbor/SpringCBORDataFormatTest.xml
new file mode 100644
index 0000000..90fb146
--- /dev/null
+++ b/components/camel-cbor/src/test/resources/org/apache/camel/component/cbor/SpringCBORDataFormatTest.xml
@@ -0,0 +1,61 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+    <!-- START SNIPPET: e1 -->
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+
+        <!-- we define the json jackson data formats to be used -->
+        <dataFormats>
+            <cbor id="test" unmarshalTypeName="java.util.Map"></cbor>
+            <cbor id="auth" unmarshalTypeName="org.apache.camel.component.cbor.Author"></cbor>
+        </dataFormats>
+
+        <route>
+            <from uri="direct:in"/>
+            <marshal><custom ref="test"/></marshal>
+        </route>
+        
+        <route>
+            <from uri="direct:back"/>
+            <unmarshal><custom ref="test"/></unmarshal>
+            <to uri="mock:reverse"/>
+        </route>
+        
+        <route>
+            <from uri="direct:in-auth"/>
+            <marshal><custom ref="auth"/></marshal>
+        </route>
+        
+        <route>
+            <from uri="direct:back-auth"/>
+            <unmarshal><custom ref="auth"/></unmarshal>
+            <to uri="mock:reverse-auth"/>
+        </route>
+
+    </camelContext>
+    <!-- END SNIPPET: e1 -->
+
+</beans>
diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
index 1a81db7..aa403b8 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
+++ b/core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
@@ -31,6 +31,7 @@ import org.apache.camel.model.dataformat.BeanioDataFormat;
 import org.apache.camel.model.dataformat.BindyDataFormat;
 import org.apache.camel.model.dataformat.BindyType;
 import org.apache.camel.model.dataformat.BoonDataFormat;
+import org.apache.camel.model.dataformat.CBORDataFormat;
 import org.apache.camel.model.dataformat.CsvDataFormat;
 import org.apache.camel.model.dataformat.CustomDataFormat;
 import org.apache.camel.model.dataformat.FhirJsonDataFormat;
@@ -204,6 +205,25 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
         boon.setUnmarshalType(classType);
         return dataFormat(boon);
     }
+    
+    /**
+     * Uses the CBOR data format
+     */
+    public T cbor() {
+        return dataFormat(new CBORDataFormat());
+    }
+
+    /**
+     * Uses the CBOR data format
+     *
+     * @param unmarshalType
+     *            unmarshal type for cbor type
+     */
+    public T cbor(Class<?> unmarshalType) {
+    	CBORDataFormat cborDataFormat = new CBORDataFormat();
+    	cborDataFormat.setUnmarshalType(unmarshalType);
+        return dataFormat(cborDataFormat);
+    }
 
     /**
      * Uses the CSV data format
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java b/core/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
index db6e473..36a3ae4 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
@@ -29,6 +29,7 @@ import org.apache.camel.model.dataformat.Base64DataFormat;
 import org.apache.camel.model.dataformat.BeanioDataFormat;
 import org.apache.camel.model.dataformat.BindyDataFormat;
 import org.apache.camel.model.dataformat.BoonDataFormat;
+import org.apache.camel.model.dataformat.CBORDataFormat;
 import org.apache.camel.model.dataformat.CryptoDataFormat;
 import org.apache.camel.model.dataformat.CsvDataFormat;
 import org.apache.camel.model.dataformat.CustomDataFormat;
@@ -79,6 +80,7 @@ public class MarshalDefinition extends NoOutputDefinition<MarshalDefinition> {
         @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class),
         @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
         @XmlElement(required = false, name = "boon", type = BoonDataFormat.class),
+        @XmlElement(required = false, name = "cbor", type = CBORDataFormat.class),
         @XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class),
         @XmlElement(required = false, name = "csv", type = CsvDataFormat.class),
         @XmlElement(required = false, name = "custom", type = CustomDataFormat.class),
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java b/core/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
index 2dfd2e2..6c90046 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
@@ -29,6 +29,7 @@ import org.apache.camel.model.dataformat.Base64DataFormat;
 import org.apache.camel.model.dataformat.BeanioDataFormat;
 import org.apache.camel.model.dataformat.BindyDataFormat;
 import org.apache.camel.model.dataformat.BoonDataFormat;
+import org.apache.camel.model.dataformat.CBORDataFormat;
 import org.apache.camel.model.dataformat.CryptoDataFormat;
 import org.apache.camel.model.dataformat.CsvDataFormat;
 import org.apache.camel.model.dataformat.CustomDataFormat;
@@ -79,6 +80,7 @@ public class UnmarshalDefinition extends NoOutputDefinition<UnmarshalDefinition>
         @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class),
         @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
         @XmlElement(required = false, name = "boon", type = BoonDataFormat.class),
+        @XmlElement(required = false, name = "cbor", type = CBORDataFormat.class),
         @XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class),
         @XmlElement(required = false, name = "csv", type = CsvDataFormat.class),
         @XmlElement(required = false, name = "custom", type = CustomDataFormat.class),
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
index 19d2672..139173c 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
@@ -46,6 +46,7 @@ public class DataFormatsDefinition {
         @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class),
         @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
         @XmlElement(required = false, name = "boon", type = BoonDataFormat.class),
+        @XmlElement(required = false, name = "cbor", type = CBORDataFormat.class),
         @XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class),
         @XmlElement(required = false, name = "csv", type = CsvDataFormat.class),
         @XmlElement(required = false, name = "custom", type = CustomDataFormat.class),


[camel] 01/10: CAMEL-10324 - Camel-CBOR first commit

Posted by ac...@apache.org.
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.git

commit 3f4ed8de511d98d7288b0a1caff05d77d3fa8ae5
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed May 29 09:13:06 2019 +0200

    CAMEL-10324 - Camel-CBOR first commit
---
 components/camel-cbor/pom.xml                      |  85 +++++++++++
 .../camel-cbor/src/main/docs/jolt-component.adoc   | 165 ++++++++++++++++++++
 .../apache/camel/component/cbor/CBORConstants.java |  25 +++
 .../camel/component/cbor/CBORDataFormat.java       | 170 +++++++++++++++++++++
 .../org/apache/camel/component/cbor/Author.java    |  22 +++
 .../camel/component/cbor/CBORDataFormatTest.java   |  88 +++++++++++
 .../src/test/resources/log4j2.properties           |  28 ++++
 7 files changed, 583 insertions(+)

diff --git a/components/camel-cbor/pom.xml b/components/camel-cbor/pom.xml
new file mode 100644
index 0000000..78ef74d
--- /dev/null
+++ b/components/camel-cbor/pom.xml
@@ -0,0 +1,85 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>components</artifactId>
+        <groupId>org.apache.camel</groupId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-cbor</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: CBOR</name>
+    <description>Camel Cbor Support</description>
+
+    <properties>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-support</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.dataformat</groupId>
+            <artifactId>jackson-dataformat-cbor</artifactId>
+            <version>${jackson2-version}</version>
+        </dependency>
+
+        <!-- logging -->
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-slf4j-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- testing -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/components/camel-cbor/src/main/docs/jolt-component.adoc b/components/camel-cbor/src/main/docs/jolt-component.adoc
new file mode 100644
index 0000000..bb517e8
--- /dev/null
+++ b/components/camel-cbor/src/main/docs/jolt-component.adoc
@@ -0,0 +1,165 @@
+[[jolt-component]]
+== JOLT Component
+
+*Available as of Camel version 2.16*
+
+The *jolt:* component allows you to process a JSON messages using an
+https://github.com/bazaarvoice/jolt[JOLT] specification. This can be
+ideal when doing JSON to JSON transformation.
+
+Maven users will need to add the following dependency to
+their `pom.xml` for this component:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-jolt</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+ 
+
+### URI format
+
+[source,java]
+-----------------------
+jolt:specName[?options]
+-----------------------
+
+Where *specName* is the classpath-local URI of the specification to
+invoke; or the complete URL of the remote specification
+(eg: file://folder/myfile.vm[file://folder/myfile.json]).
+
+You can append query options to the URI in the following
+format, `?option=value&option=value&...`
+
+### Options
+
+
+
+
+// component options: START
+The JOLT component supports 3 options, which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *transform* (advanced) | Explicitly sets the Transform to use. If not set a Transform specified by the transformDsl will be created |  | Transform
+| *resolveProperty Placeholders* (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean
+| *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
+|===
+// component options: END
+
+
+
+
+
+
+// endpoint options: START
+The JOLT endpoint is configured using URI syntax:
+
+----
+jolt:resourceUri
+----
+
+with the following path and query parameters:
+
+==== Path Parameters (1 parameters):
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *resourceUri* | *Required* Path to the resource. You can prefix with: classpath, file, http, ref, or bean. classpath, file and http loads the resource using these protocols (classpath is default). ref will lookup the resource in the registry. bean will call a method on a bean to be used as the resource. For bean you can specify the method name after dot, eg bean:myBean.myMethod. |  | String
+|===
+
+
+==== Query Parameters (6 parameters):
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *contentCache* (producer) | Sets whether to use resource content cache or not | false | boolean
+| *inputType* (producer) | Specifies if the input is hydrated JSON or a JSON String. | Hydrated | JoltInputOutputType
+| *outputType* (producer) | Specifies if the output should be hydrated JSON or a JSON String. | Hydrated | JoltInputOutputType
+| *transformDsl* (producer) | Specifies the Transform DSL of the endpoint resource. If none is specified Chainr will be used. | Chainr | JoltTransformType
+| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
+| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
+|===
+// endpoint options: END
+// spring-boot-auto-configure options: START
+=== Spring Boot Auto-Configuration
+
+When using Spring Boot make sure to use the following Maven dependency to have support for auto configuration:
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-jolt-starter</artifactId>
+  <version>x.x.x</version>
+  <!-- use the same version as your Camel core version -->
+</dependency>
+----
+
+
+The component supports 4 options, which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *camel.component.jolt.basic-property-binding* | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | Boolean
+| *camel.component.jolt.enabled* | Enable jolt component | true | Boolean
+| *camel.component.jolt.resolve-property-placeholders* | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | Boolean
+| *camel.component.jolt.transform* | Explicitly sets the Transform to use. If not set a Transform specified by the transformDsl will be created. The option is a com.bazaarvoice.jolt.Transform type. |  | String
+|===
+// spring-boot-auto-configure options: END
+
+
+
+
+### Samples
+
+For example you could use something like
+
+[source,java]
+--------------------------------------
+from("activemq:My.Queue").
+  to("jolt:com/acme/MyResponse.json");
+--------------------------------------
+
+And a file based resource:
+
+[source,java]
+---------------------------------------------------------------
+from("activemq:My.Queue").
+  to("jolt:file://myfolder/MyResponse.json?contentCache=true").
+  to("activemq:Another.Queue");
+---------------------------------------------------------------
+
+You can also specify what specification the component should use
+dynamically via a header, so for example:
+
+[source,java]
+---------------------------------------------------------------------
+from("direct:in").
+  setHeader("CamelJoltResourceUri").constant("path/to/my/spec.json").
+  to("jolt:dummy");
+---------------------------------------------------------------------
+
+ 
+
+### See Also
+
+* Configuring Camel
+* Component
+* Endpoint
+* Getting Started
diff --git a/components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORConstants.java b/components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORConstants.java
new file mode 100644
index 0000000..e3b6670
--- /dev/null
+++ b/components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORConstants.java
@@ -0,0 +1,25 @@
+/*
+ * 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.component.cbor;
+
+public final class CBORConstants {
+
+    public static final String UNMARSHAL_TYPE = "CamelCBORUnmarshalType";
+
+    private CBORConstants() {
+    }
+}
diff --git a/components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORDataFormat.java b/components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORDataFormat.java
new file mode 100644
index 0000000..085eb8f
--- /dev/null
+++ b/components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORDataFormat.java
@@ -0,0 +1,170 @@
+package org.apache.camel.component.cbor;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Set;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatName;
+import org.apache.camel.spi.annotations.Dataformat;
+import org.apache.camel.support.service.ServiceSupport;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.CollectionType;
+import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
+
+@Dataformat("cbor")
+public class CBORDataFormat extends ServiceSupport implements DataFormat, DataFormatName {
+
+    private CamelContext camelContext;
+	private ObjectMapper objectMapper;
+    private Class<?> unmarshalType;
+    private boolean useDefaultObjectMapper = true;
+    private boolean allowUnmarshallType;
+    private Class<? extends Collection> collectionType;
+    private boolean useList;
+    
+    /**
+     * Use the default CBOR Jackson {@link ObjectMapper} and {@link Object}
+     */
+    public CBORDataFormat() {
+    }
+    
+    /**
+     * Use the default CBOR Jackson {@link ObjectMapper} and with a custom unmarshal
+     * type
+     *
+     * @param unmarshalType the custom unmarshal type
+     */
+    public CBORDataFormat(ObjectMapper objectMapper, Class<?> unmarshalType) {
+        this.unmarshalType = unmarshalType;
+        this.objectMapper = objectMapper;
+    }
+	
+	@Override
+	public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
+		stream.write(this.objectMapper.writeValueAsBytes(graph));
+	}
+
+	@Override
+	public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
+		Class<?> clazz = unmarshalType;
+        String type = null;
+        if (allowUnmarshallType) {
+            type = exchange.getIn().getHeader(CBORConstants.UNMARSHAL_TYPE, String.class);
+        }
+        if (type != null) {
+            clazz = exchange.getContext().getClassResolver().resolveMandatoryClass(type);
+        }
+        if (collectionType != null) {
+            CollectionType collType = objectMapper.getTypeFactory().constructCollectionType(collectionType, clazz);
+            return this.objectMapper.readValue(stream, collType);
+        } else {
+            return this.objectMapper.readValue(stream, clazz);
+        }
+	}
+
+	@Override
+	public String getDataFormatName() {
+		return "cbor";
+	}
+
+	public ObjectMapper getObjectMapper() {
+		return objectMapper;
+	}
+
+	public void setObjectMapper(ObjectMapper objectMapper) {
+		this.objectMapper = objectMapper;
+	}
+
+	public Class<?> getUnmarshalType() {
+		return unmarshalType;
+	}
+
+	public void setUnmarshalType(Class<?> unmarshalType) {
+		this.unmarshalType = unmarshalType;
+	}
+
+	public boolean isAllowUnmarshallType() {
+		return allowUnmarshallType;
+	}
+
+	public void setAllowUnmarshallType(boolean allowUnmarshallType) {
+		this.allowUnmarshallType = allowUnmarshallType;
+	}
+
+	public Class<? extends Collection> getCollectionType() {
+		return collectionType;
+	}
+
+	public void setCollectionType(Class<? extends Collection> collectionType) {
+		this.collectionType = collectionType;
+	}
+
+	public boolean isUseList() {
+		return useList;
+	}
+
+	public void setUseList(boolean useList) {
+		this.useList = useList;
+	}
+	
+    public boolean isUseDefaultObjectMapper() {
+		return useDefaultObjectMapper;
+	}
+
+	public void setUseDefaultObjectMapper(boolean useDefaultObjectMapper) {
+		this.useDefaultObjectMapper = useDefaultObjectMapper;
+	}
+
+	/**
+     * Uses {@link java.util.ArrayList} when unmarshalling.
+     */
+    public void useList() {
+        setCollectionType(ArrayList.class);
+    }
+
+    /**
+     * Uses {@link java.util.HashMap} when unmarshalling.
+     */
+    public void useMap() {
+        setCollectionType(null);
+        setUnmarshalType(HashMap.class);
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        if (objectMapper == null) {
+            // lookup if there is a single default mapper we can use
+            if (useDefaultObjectMapper && camelContext != null) {
+                Set<ObjectMapper> set = camelContext.getRegistry().findByType(ObjectMapper.class);
+                if (set.size() == 1) {
+                    objectMapper = set.iterator().next();
+                    log.info("Found single ObjectMapper in Registry to use: {}", objectMapper);
+                } else if (set.size() > 1) {
+                    log.debug("Found {} ObjectMapper in Registry cannot use as default as there are more than one instance.", set.size());
+                }
+            }
+            if (objectMapper == null) {
+            	CBORFactory factory = new CBORFactory();
+                objectMapper = new ObjectMapper(factory);
+                log.debug("Creating new ObjectMapper to use: {}", objectMapper);
+            }
+        }
+
+        if (useList) {
+            setCollectionType(ArrayList.class);
+        }
+    }
+
+	@Override
+	protected void doStop() throws Exception {
+		// TODO Auto-generated method stub
+		
+	}
+}
diff --git a/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/Author.java b/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/Author.java
new file mode 100644
index 0000000..a6c2cc4
--- /dev/null
+++ b/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/Author.java
@@ -0,0 +1,22 @@
+package org.apache.camel.component.cbor;
+
+public class Author {
+
+	private String name;
+	private String surname;
+	
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getSurname() {
+		return surname;
+	}
+	public void setSurname(String surname) {
+		this.surname = surname;
+	}
+	
+	
+}
diff --git a/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/CBORDataFormatTest.java b/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/CBORDataFormatTest.java
new file mode 100644
index 0000000..4ca359e
--- /dev/null
+++ b/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/CBORDataFormatTest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.component.cbor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class CBORDataFormatTest extends CamelTestSupport {
+    
+    @Test
+    public void testMarshalAndUnmarshalMap() throws Exception {
+        Map<String, Object> in = new HashMap<>();
+        in.put("name", "Camel");
+
+        MockEndpoint mock = getMockEndpoint("mock:reverse");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isInstanceOf(Map.class);
+        mock.message(0).body().isEqualTo(in);
+
+        Object marshalled = template.requestBody("direct:in", in);
+
+        template.sendBody("direct:back", marshalled);
+
+        mock.assertIsSatisfied();
+    }
+    
+    @Test
+    public void testMarshalAndUnmarshalAuthor() throws Exception {
+        Author auth = new Author();
+        auth.setName("Don");
+        auth.setSurname("Winslow");
+
+        MockEndpoint mock = getMockEndpoint("mock:reverse-auth");
+        mock.expectedMessageCount(1);
+        mock.message(0).body().isInstanceOf(Author.class);
+
+        Object marshalled = template.requestBody("direct:in-auth", auth);
+
+        template.sendBody("direct:back-auth", marshalled);
+        
+        Author authReturned = mock.getExchanges().get(0).getIn().getBody(Author.class);
+        assertEquals("Don", authReturned.getName());
+        assertEquals("Winslow", authReturned.getSurname());
+
+        mock.assertIsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+
+            @Override
+            public void configure() throws Exception {
+                CBORDataFormat format = new CBORDataFormat();
+                format.useMap();
+
+                from("direct:in").marshal(format);
+                from("direct:back").unmarshal(format).to("mock:reverse");
+                
+                CBORDataFormat spec = new CBORDataFormat();
+                spec.setUnmarshalType(Author.class);
+                
+                from("direct:in-auth").marshal(spec);
+                from("direct:back-auth").unmarshal(spec).to("mock:reverse-auth");
+            }
+        };
+    }
+
+}
diff --git a/components/camel-cbor/src/test/resources/log4j2.properties b/components/camel-cbor/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..85ea6dc
--- /dev/null
+++ b/components/camel-cbor/src/test/resources/log4j2.properties
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-jolt-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.stdout.type = Console
+appender.stdout.name = stdout
+appender.stdout.layout.type = PatternLayout
+appender.stdout.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file


[camel] 10/10: CAMEL-10324 - A bit better javadoc for the CBOR options

Posted by ac...@apache.org.
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.git

commit 2db03cf0c0ba202ed0dcb8a272b36dc1ed45ff72
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed May 29 11:27:47 2019 +0200

    CAMEL-10324 - A bit better javadoc for the CBOR options
---
 .../main/java/org/apache/camel/model/dataformat/CBORDataFormat.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java
index 9119295..8a5a82e 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java
@@ -137,8 +137,8 @@ public class CBORDataFormat extends DataFormatDefinition {
     }
 
     /**
-     * If enabled then Jackson is allowed to attempt to use the
-     * CamelJacksonUnmarshalType header during the unmarshalling.
+     * If enabled then Jackson CBOR is allowed to attempt to use the
+     * CamelCBORUnmarshalType header during the unmarshalling.
      * <p/>
      * This should only be enabled when desired to be used.
      */


[camel] 09/10: CAMEL-10324 - Docs

Posted by ac...@apache.org.
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.git

commit 0f1c778e022af55ed4ed1633689caa00ff181bef
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed May 29 11:04:43 2019 +0200

    CAMEL-10324 - Docs
---
 .../camel-cbor/src/main/docs/cbor-dataformat.adoc  |  81 ++++++++++
 .../camel-cbor/src/main/docs/jolt-component.adoc   | 165 ---------------------
 docs/components/modules/ROOT/nav.adoc              |   2 +-
 .../modules/ROOT/pages/cbor-dataformat.adoc        |  81 ++++++++++
 4 files changed, 163 insertions(+), 166 deletions(-)

diff --git a/components/camel-cbor/src/main/docs/cbor-dataformat.adoc b/components/camel-cbor/src/main/docs/cbor-dataformat.adoc
new file mode 100644
index 0000000..aa2a57a
--- /dev/null
+++ b/components/camel-cbor/src/main/docs/cbor-dataformat.adoc
@@ -0,0 +1,81 @@
+[[cbor-dataformat]]
+== CBOR DataFormat
+
+*Available as of Camel version 3.0*
+
+CBOR is a Data Format which uses the
+http://wiki.fasterxml.com/JacksonHome/[Jackson library] with the
+https://github.com/FasterXML/jackson-dataformats-binary/tree/master/cbor[CBOR extension]
+to unmarshal a CBOR payload into Java objects or to marshal Java objects
+into a CBOR payload.
+
+[source,java]
+-------------------------------
+from("activemq:My.Queue").
+  unmarshal().cbor().
+  to("mqseries:Another.Queue");
+-------------------------------
+
+### CBOR Options
+
+// dataformat options: START
+The CBOR dataformat supports 7 options, which are listed below.
+
+
+
+[width="100%",cols="2s,1m,1m,6",options="header"]
+|===
+| Name | Default | Java Type | Description
+| objectMapper |  | String | Lookup and use the existing CBOR ObjectMapper with the given id when using Jackson.
+| useDefaultObjectMapper | true | Boolean | Whether to lookup and use default Jackson CBOR ObjectMapper from the registry.
+| unmarshalTypeName |  | String | Class name of the java type to use when unarmshalling
+| collectionTypeName |  | String | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default.
+| useList | false | Boolean | To unarmshal to a List of Map or a List of Pojo.
+| allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
+| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
+|===
+// dataformat options: END
+// spring-boot-auto-configure options: START
+=== Spring Boot Auto-Configuration
+
+When using Spring Boot make sure to use the following Maven dependency to have support for auto configuration:
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-cbor-starter</artifactId>
+  <version>x.x.x</version>
+  <!-- use the same version as your Camel core version -->
+</dependency>
+----
+
+
+The component supports 8 options, which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *camel.dataformat.cbor.allow-unmarshall-type* | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. | false | Boolean
+| *camel.dataformat.cbor.collection-type-name* | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default. |  | String
+| *camel.dataformat.cbor.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
+| *camel.dataformat.cbor.enabled* | Whether to enable auto configuration of the cbor data format. This is enabled by default. |  | Boolean
+| *camel.dataformat.cbor.object-mapper* | Lookup and use the existing CBOR ObjectMapper with the given id when using Jackson. |  | String
+| *camel.dataformat.cbor.unmarshal-type-name* | Class name of the java type to use when unarmshalling |  | String
+| *camel.dataformat.cbor.use-default-object-mapper* | Whether to lookup and use default Jackson CBOR ObjectMapper from the registry. | true | Boolean
+| *camel.dataformat.cbor.use-list* | To unarmshal to a List of Map or a List of Pojo. | false | Boolean
+|===
+// spring-boot-auto-configure options: END
+
+### Dependencies
+
+[source,java]
+-------------------------------------
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-cbor</artifactId>
+  <version>x.x.x</version>
+</dependency>
+-------------------------------------
diff --git a/components/camel-cbor/src/main/docs/jolt-component.adoc b/components/camel-cbor/src/main/docs/jolt-component.adoc
deleted file mode 100644
index bb517e8..0000000
--- a/components/camel-cbor/src/main/docs/jolt-component.adoc
+++ /dev/null
@@ -1,165 +0,0 @@
-[[jolt-component]]
-== JOLT Component
-
-*Available as of Camel version 2.16*
-
-The *jolt:* component allows you to process a JSON messages using an
-https://github.com/bazaarvoice/jolt[JOLT] specification. This can be
-ideal when doing JSON to JSON transformation.
-
-Maven users will need to add the following dependency to
-their `pom.xml` for this component:
-
-[source,xml]
-------------------------------------------------------------
-<dependency>
-    <groupId>org.apache.camel</groupId>
-    <artifactId>camel-jolt</artifactId>
-    <version>x.x.x</version>
-    <!-- use the same version as your Camel core version -->
-</dependency>
-------------------------------------------------------------
-
- 
-
-### URI format
-
-[source,java]
------------------------
-jolt:specName[?options]
------------------------
-
-Where *specName* is the classpath-local URI of the specification to
-invoke; or the complete URL of the remote specification
-(eg: file://folder/myfile.vm[file://folder/myfile.json]).
-
-You can append query options to the URI in the following
-format, `?option=value&option=value&...`
-
-### Options
-
-
-
-
-// component options: START
-The JOLT component supports 3 options, which are listed below.
-
-
-
-[width="100%",cols="2,5,^1,2",options="header"]
-|===
-| Name | Description | Default | Type
-| *transform* (advanced) | Explicitly sets the Transform to use. If not set a Transform specified by the transformDsl will be created |  | Transform
-| *resolveProperty Placeholders* (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean
-| *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
-|===
-// component options: END
-
-
-
-
-
-
-// endpoint options: START
-The JOLT endpoint is configured using URI syntax:
-
-----
-jolt:resourceUri
-----
-
-with the following path and query parameters:
-
-==== Path Parameters (1 parameters):
-
-
-[width="100%",cols="2,5,^1,2",options="header"]
-|===
-| Name | Description | Default | Type
-| *resourceUri* | *Required* Path to the resource. You can prefix with: classpath, file, http, ref, or bean. classpath, file and http loads the resource using these protocols (classpath is default). ref will lookup the resource in the registry. bean will call a method on a bean to be used as the resource. For bean you can specify the method name after dot, eg bean:myBean.myMethod. |  | String
-|===
-
-
-==== Query Parameters (6 parameters):
-
-
-[width="100%",cols="2,5,^1,2",options="header"]
-|===
-| Name | Description | Default | Type
-| *contentCache* (producer) | Sets whether to use resource content cache or not | false | boolean
-| *inputType* (producer) | Specifies if the input is hydrated JSON or a JSON String. | Hydrated | JoltInputOutputType
-| *outputType* (producer) | Specifies if the output should be hydrated JSON or a JSON String. | Hydrated | JoltInputOutputType
-| *transformDsl* (producer) | Specifies the Transform DSL of the endpoint resource. If none is specified Chainr will be used. | Chainr | JoltTransformType
-| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
-| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
-|===
-// endpoint options: END
-// spring-boot-auto-configure options: START
-=== Spring Boot Auto-Configuration
-
-When using Spring Boot make sure to use the following Maven dependency to have support for auto configuration:
-
-[source,xml]
-----
-<dependency>
-  <groupId>org.apache.camel</groupId>
-  <artifactId>camel-jolt-starter</artifactId>
-  <version>x.x.x</version>
-  <!-- use the same version as your Camel core version -->
-</dependency>
-----
-
-
-The component supports 4 options, which are listed below.
-
-
-
-[width="100%",cols="2,5,^1,2",options="header"]
-|===
-| Name | Description | Default | Type
-| *camel.component.jolt.basic-property-binding* | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | Boolean
-| *camel.component.jolt.enabled* | Enable jolt component | true | Boolean
-| *camel.component.jolt.resolve-property-placeholders* | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | Boolean
-| *camel.component.jolt.transform* | Explicitly sets the Transform to use. If not set a Transform specified by the transformDsl will be created. The option is a com.bazaarvoice.jolt.Transform type. |  | String
-|===
-// spring-boot-auto-configure options: END
-
-
-
-
-### Samples
-
-For example you could use something like
-
-[source,java]
---------------------------------------
-from("activemq:My.Queue").
-  to("jolt:com/acme/MyResponse.json");
---------------------------------------
-
-And a file based resource:
-
-[source,java]
----------------------------------------------------------------
-from("activemq:My.Queue").
-  to("jolt:file://myfolder/MyResponse.json?contentCache=true").
-  to("activemq:Another.Queue");
----------------------------------------------------------------
-
-You can also specify what specification the component should use
-dynamically via a header, so for example:
-
-[source,java]
----------------------------------------------------------------------
-from("direct:in").
-  setHeader("CamelJoltResourceUri").constant("path/to/my/spec.json").
-  to("jolt:dummy");
----------------------------------------------------------------------
-
- 
-
-### See Also
-
-* Configuring Camel
-* Component
-* Endpoint
-* Getting Started
diff --git a/docs/components/modules/ROOT/nav.adoc b/docs/components/modules/ROOT/nav.adoc
index 2069e15..b95c954 100644
--- a/docs/components/modules/ROOT/nav.adoc
+++ b/docs/components/modules/ROOT/nav.adoc
@@ -58,7 +58,7 @@
 * xref:caffeine-cache-component.adoc[Caffeine Cache Component]
 * xref:caffeine-loadcache-component.adoc[Caffeine LoadCache Component]
 * xref:cql-component.adoc[Cassandra CQL Component]
-* xref:jolt-component.adoc[JOLT Component]
+* xref:cbor-dataformat.adoc[CBOR DataFormat]
 * xref:cdi.adoc[Camel CDI]
 * xref:chatscript-component.adoc[ChatScript Component]
 * xref:chunk-component.adoc[Chunk Component]
diff --git a/docs/components/modules/ROOT/pages/cbor-dataformat.adoc b/docs/components/modules/ROOT/pages/cbor-dataformat.adoc
new file mode 100644
index 0000000..aa2a57a
--- /dev/null
+++ b/docs/components/modules/ROOT/pages/cbor-dataformat.adoc
@@ -0,0 +1,81 @@
+[[cbor-dataformat]]
+== CBOR DataFormat
+
+*Available as of Camel version 3.0*
+
+CBOR is a Data Format which uses the
+http://wiki.fasterxml.com/JacksonHome/[Jackson library] with the
+https://github.com/FasterXML/jackson-dataformats-binary/tree/master/cbor[CBOR extension]
+to unmarshal a CBOR payload into Java objects or to marshal Java objects
+into a CBOR payload.
+
+[source,java]
+-------------------------------
+from("activemq:My.Queue").
+  unmarshal().cbor().
+  to("mqseries:Another.Queue");
+-------------------------------
+
+### CBOR Options
+
+// dataformat options: START
+The CBOR dataformat supports 7 options, which are listed below.
+
+
+
+[width="100%",cols="2s,1m,1m,6",options="header"]
+|===
+| Name | Default | Java Type | Description
+| objectMapper |  | String | Lookup and use the existing CBOR ObjectMapper with the given id when using Jackson.
+| useDefaultObjectMapper | true | Boolean | Whether to lookup and use default Jackson CBOR ObjectMapper from the registry.
+| unmarshalTypeName |  | String | Class name of the java type to use when unarmshalling
+| collectionTypeName |  | String | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default.
+| useList | false | Boolean | To unarmshal to a List of Map or a List of Pojo.
+| allowUnmarshallType | false | Boolean | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used.
+| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
+|===
+// dataformat options: END
+// spring-boot-auto-configure options: START
+=== Spring Boot Auto-Configuration
+
+When using Spring Boot make sure to use the following Maven dependency to have support for auto configuration:
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-cbor-starter</artifactId>
+  <version>x.x.x</version>
+  <!-- use the same version as your Camel core version -->
+</dependency>
+----
+
+
+The component supports 8 options, which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *camel.dataformat.cbor.allow-unmarshall-type* | If enabled then Jackson is allowed to attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. This should only be enabled when desired to be used. | false | Boolean
+| *camel.dataformat.cbor.collection-type-name* | Refers to a custom collection type to lookup in the registry to use. This option should rarely be used, but allows to use different collection types than java.util.Collection based as default. |  | String
+| *camel.dataformat.cbor.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
+| *camel.dataformat.cbor.enabled* | Whether to enable auto configuration of the cbor data format. This is enabled by default. |  | Boolean
+| *camel.dataformat.cbor.object-mapper* | Lookup and use the existing CBOR ObjectMapper with the given id when using Jackson. |  | String
+| *camel.dataformat.cbor.unmarshal-type-name* | Class name of the java type to use when unarmshalling |  | String
+| *camel.dataformat.cbor.use-default-object-mapper* | Whether to lookup and use default Jackson CBOR ObjectMapper from the registry. | true | Boolean
+| *camel.dataformat.cbor.use-list* | To unarmshal to a List of Map or a List of Pojo. | false | Boolean
+|===
+// spring-boot-auto-configure options: END
+
+### Dependencies
+
+[source,java]
+-------------------------------------
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-cbor</artifactId>
+  <version>x.x.x</version>
+</dependency>
+-------------------------------------


[camel] 08/10: CAMEL-10324 - Fixed CS in Camel-CBOR

Posted by ac...@apache.org.
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.git

commit 50f5b27670f8ca18b68ab3ad1e529465b648c882
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed May 29 10:26:15 2019 +0200

    CAMEL-10324 - Fixed CS in Camel-CBOR
---
 .../camel/component/cbor/CBORDataFormat.java       | 146 ++++++++++++---------
 .../org/apache/camel/component/cbor/Author.java    |  52 +++++---
 2 files changed, 116 insertions(+), 82 deletions(-)

diff --git a/components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORDataFormat.java b/components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORDataFormat.java
index 085eb8f..b91ae11 100644
--- a/components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORDataFormat.java
+++ b/components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORDataFormat.java
@@ -1,3 +1,19 @@
+/*
+ * 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.component.cbor;
 
 import java.io.InputStream;
@@ -7,6 +23,10 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Set;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.CollectionType;
+import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.spi.DataFormat;
@@ -14,30 +34,26 @@ import org.apache.camel.spi.DataFormatName;
 import org.apache.camel.spi.annotations.Dataformat;
 import org.apache.camel.support.service.ServiceSupport;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.type.CollectionType;
-import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
-
 @Dataformat("cbor")
 public class CBORDataFormat extends ServiceSupport implements DataFormat, DataFormatName {
 
     private CamelContext camelContext;
-	private ObjectMapper objectMapper;
+    private ObjectMapper objectMapper;
     private Class<?> unmarshalType;
     private boolean useDefaultObjectMapper = true;
     private boolean allowUnmarshallType;
     private Class<? extends Collection> collectionType;
     private boolean useList;
-    
+
     /**
      * Use the default CBOR Jackson {@link ObjectMapper} and {@link Object}
      */
     public CBORDataFormat() {
     }
-    
+
     /**
-     * Use the default CBOR Jackson {@link ObjectMapper} and with a custom unmarshal
-     * type
+     * Use the default CBOR Jackson {@link ObjectMapper} and with a custom
+     * unmarshal type
      *
      * @param unmarshalType the custom unmarshal type
      */
@@ -45,15 +61,15 @@ public class CBORDataFormat extends ServiceSupport implements DataFormat, DataFo
         this.unmarshalType = unmarshalType;
         this.objectMapper = objectMapper;
     }
-	
-	@Override
-	public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
-		stream.write(this.objectMapper.writeValueAsBytes(graph));
-	}
 
-	@Override
-	public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
-		Class<?> clazz = unmarshalType;
+    @Override
+    public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
+        stream.write(this.objectMapper.writeValueAsBytes(graph));
+    }
+
+    @Override
+    public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
+        Class<?> clazz = unmarshalType;
         String type = null;
         if (allowUnmarshallType) {
             type = exchange.getIn().getHeader(CBORConstants.UNMARSHAL_TYPE, String.class);
@@ -67,62 +83,62 @@ public class CBORDataFormat extends ServiceSupport implements DataFormat, DataFo
         } else {
             return this.objectMapper.readValue(stream, clazz);
         }
-	}
+    }
+
+    @Override
+    public String getDataFormatName() {
+        return "cbor";
+    }
 
-	@Override
-	public String getDataFormatName() {
-		return "cbor";
-	}
+    public ObjectMapper getObjectMapper() {
+        return objectMapper;
+    }
 
-	public ObjectMapper getObjectMapper() {
-		return objectMapper;
-	}
+    public void setObjectMapper(ObjectMapper objectMapper) {
+        this.objectMapper = objectMapper;
+    }
 
-	public void setObjectMapper(ObjectMapper objectMapper) {
-		this.objectMapper = objectMapper;
-	}
+    public Class<?> getUnmarshalType() {
+        return unmarshalType;
+    }
 
-	public Class<?> getUnmarshalType() {
-		return unmarshalType;
-	}
+    public void setUnmarshalType(Class<?> unmarshalType) {
+        this.unmarshalType = unmarshalType;
+    }
 
-	public void setUnmarshalType(Class<?> unmarshalType) {
-		this.unmarshalType = unmarshalType;
-	}
+    public boolean isAllowUnmarshallType() {
+        return allowUnmarshallType;
+    }
 
-	public boolean isAllowUnmarshallType() {
-		return allowUnmarshallType;
-	}
+    public void setAllowUnmarshallType(boolean allowUnmarshallType) {
+        this.allowUnmarshallType = allowUnmarshallType;
+    }
 
-	public void setAllowUnmarshallType(boolean allowUnmarshallType) {
-		this.allowUnmarshallType = allowUnmarshallType;
-	}
+    public Class<? extends Collection> getCollectionType() {
+        return collectionType;
+    }
 
-	public Class<? extends Collection> getCollectionType() {
-		return collectionType;
-	}
+    public void setCollectionType(Class<? extends Collection> collectionType) {
+        this.collectionType = collectionType;
+    }
 
-	public void setCollectionType(Class<? extends Collection> collectionType) {
-		this.collectionType = collectionType;
-	}
+    public boolean isUseList() {
+        return useList;
+    }
 
-	public boolean isUseList() {
-		return useList;
-	}
+    public void setUseList(boolean useList) {
+        this.useList = useList;
+    }
 
-	public void setUseList(boolean useList) {
-		this.useList = useList;
-	}
-	
     public boolean isUseDefaultObjectMapper() {
-		return useDefaultObjectMapper;
-	}
+        return useDefaultObjectMapper;
+    }
 
-	public void setUseDefaultObjectMapper(boolean useDefaultObjectMapper) {
-		this.useDefaultObjectMapper = useDefaultObjectMapper;
-	}
+    public void setUseDefaultObjectMapper(boolean useDefaultObjectMapper) {
+        this.useDefaultObjectMapper = useDefaultObjectMapper;
+    }
 
-	/**
+    /**
      * Uses {@link java.util.ArrayList} when unmarshalling.
      */
     public void useList() {
@@ -151,7 +167,7 @@ public class CBORDataFormat extends ServiceSupport implements DataFormat, DataFo
                 }
             }
             if (objectMapper == null) {
-            	CBORFactory factory = new CBORFactory();
+                CBORFactory factory = new CBORFactory();
                 objectMapper = new ObjectMapper(factory);
                 log.debug("Creating new ObjectMapper to use: {}", objectMapper);
             }
@@ -162,9 +178,9 @@ public class CBORDataFormat extends ServiceSupport implements DataFormat, DataFo
         }
     }
 
-	@Override
-	protected void doStop() throws Exception {
-		// TODO Auto-generated method stub
-		
-	}
+    @Override
+    protected void doStop() throws Exception {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/Author.java b/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/Author.java
index a6c2cc4..464b283 100644
--- a/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/Author.java
+++ b/components/camel-cbor/src/test/java/org/apache/camel/component/cbor/Author.java
@@ -1,22 +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.component.cbor;
 
 public class Author {
 
-	private String name;
-	private String surname;
-	
-	public String getName() {
-		return name;
-	}
-	public void setName(String name) {
-		this.name = name;
-	}
-	public String getSurname() {
-		return surname;
-	}
-	public void setSurname(String surname) {
-		this.surname = surname;
-	}
-	
-	
+    private String name;
+    private String surname;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getSurname() {
+        return surname;
+    }
+
+    public void setSurname(String surname) {
+        this.surname = surname;
+    }
+
 }


[camel] 07/10: CAMEL-10324 - Fixed CS in core

Posted by ac...@apache.org.
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.git

commit 973a1153252ed321eac4e362497c6c1a2f853e4c
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed May 29 10:21:08 2019 +0200

    CAMEL-10324 - Fixed CS in core
---
 .../src/main/java/org/apache/camel/builder/DataFormatClause.java      | 4 ++--
 .../main/java/org/apache/camel/model/dataformat/CBORDataFormat.java   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
index aa403b8..91a0766 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
+++ b/core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
@@ -220,8 +220,8 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
      *            unmarshal type for cbor type
      */
     public T cbor(Class<?> unmarshalType) {
-    	CBORDataFormat cborDataFormat = new CBORDataFormat();
-    	cborDataFormat.setUnmarshalType(unmarshalType);
+        CBORDataFormat cborDataFormat = new CBORDataFormat();
+        cborDataFormat.setUnmarshalType(unmarshalType);
         return dataFormat(cborDataFormat);
     }
 
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java
index b7b6216..9119295 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java
@@ -29,7 +29,7 @@ import org.apache.camel.spi.Metadata;
  * CBOR data format is used for unmarshal a CBOR payload to POJO or to marshal
  * POJO back to CBOR payload.
  */
-@Metadata(firstVersion = "3.0.0",label = "dataformat,transformation,json", title = "CBOR")
+@Metadata(firstVersion = "3.0.0", label = "dataformat,transformation,json", title = "CBOR")
 @XmlRootElement(name = "cbor")
 @XmlAccessorType(XmlAccessType.FIELD)
 public class CBORDataFormat extends DataFormatDefinition {


[camel] 04/10: CAMEL-10324 - Added CBOR to parent pom

Posted by ac...@apache.org.
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.git

commit b5cd6f8475c563f04ce6ee2d2bacf81b108fe222
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed May 29 09:30:19 2019 +0200

    CAMEL-10324 - Added CBOR to parent pom
---
 components/camel-cbor/pom.xml |  2 +-
 parent/pom.xml                | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/components/camel-cbor/pom.xml b/components/camel-cbor/pom.xml
index 78ef74d..62c1e76 100644
--- a/components/camel-cbor/pom.xml
+++ b/components/camel-cbor/pom.xml
@@ -77,7 +77,7 @@
         <!-- testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test</artifactId>
+            <artifactId>camel-test-spring</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git a/parent/pom.xml b/parent/pom.xml
index 37b58d6..483c6df 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -1104,6 +1104,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-cbor</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-cdi</artifactId>
         <version>${project.version}</version>
       </dependency>
@@ -2643,6 +2648,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-cbor-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-chatscript-starter</artifactId>
         <version>${project.version}</version>
       </dependency>


[camel] 05/10: CAMEL-10324 - Regen

Posted by ac...@apache.org.
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.git

commit 9f20dd7131aa11b927e84e1ca2af36ab8dfeebab
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed May 29 09:55:15 2019 +0200

    CAMEL-10324 - Regen
---
 apache-camel/pom.xml                                           |  5 +++++
 components/readme.adoc                                         |  4 +++-
 docs/components/modules/ROOT/nav.adoc                          |  1 +
 .../spring-boot-dm/camel-spring-boot-dependencies/pom.xml      | 10 ++++++++++
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 432ef61..44237a3 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -1842,6 +1842,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-cbor-starter</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-chatscript-starter</artifactId>
       <version>${project.version}</version>
     </dependency>
diff --git a/components/readme.adoc b/components/readme.adoc
index ebbbf5f..2a619d6 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -902,7 +902,7 @@ Number of Components: 296 in 233 JAR artifacts (0 deprecated)
 ==== Data Formats
 
 // dataformats: START
-Number of Data Formats: 43 in 35 JAR artifacts (0 deprecated)
+Number of Data Formats: 44 in 36 JAR artifacts (0 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |===
@@ -926,6 +926,8 @@ Number of Data Formats: 43 in 35 JAR artifacts (0 deprecated)
 
 | link:camel-boon/src/main/docs/boon-dataformat.adoc[Boon] (camel-boon) | 2.16 | Boon data format is used for unmarshal a JSon payload to POJO or to marshal POJO back to JSon payload.
 
+| link:camel-cbor/src/main/docs/cbor-dataformat.adoc[CBOR] (camel-cbor) | 3.0 | CBOR data format is used for unmarshal a CBOR payload to POJO or to marshal POJO back to CBOR payload.
+
 | link:camel-crypto/src/main/docs/crypto-dataformat.adoc[Crypto (Java Cryptographic Extension)] (camel-crypto) | 2.3 | Crypto data format is used for encrypting and decrypting of messages using Java Cryptographic Extension.
 
 | link:camel-csv/src/main/docs/csv-dataformat.adoc[CSV] (camel-csv) | 1.3 | The CSV data format is used for handling CSV payloads.
diff --git a/docs/components/modules/ROOT/nav.adoc b/docs/components/modules/ROOT/nav.adoc
index 405ef71..2069e15 100644
--- a/docs/components/modules/ROOT/nav.adoc
+++ b/docs/components/modules/ROOT/nav.adoc
@@ -58,6 +58,7 @@
 * xref:caffeine-cache-component.adoc[Caffeine Cache Component]
 * xref:caffeine-loadcache-component.adoc[Caffeine LoadCache Component]
 * xref:cql-component.adoc[Cassandra CQL Component]
+* xref:jolt-component.adoc[JOLT Component]
 * xref:cdi.adoc[Camel CDI]
 * xref:chatscript-component.adoc[ChatScript Component]
 * xref:chunk-component.adoc[Chunk Component]
diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
index 0423976..7d7ff5c 100644
--- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
+++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
@@ -753,6 +753,16 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-cbor</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-cbor-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-cdi</artifactId>
         <version>${project.version}</version>
       </dependency>


[camel] 02/10: CAMEL-10324 - Camel-CBOR

Posted by ac...@apache.org.
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.git

commit 42f854843d71e3796f9be46ccdab0a19bdb7e0e7
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed May 29 09:13:30 2019 +0200

    CAMEL-10324 - Camel-CBOR
---
 apache-camel/pom.xml                               |   5 +
 apache-camel/src/main/descriptors/common-bin.xml   |   2 +
 bom/camel-bom/pom.xml                              |  10 ++
 components/pom.xml                                 |   1 +
 .../camel/model/dataformat/CBORDataFormat.java     | 126 +++++++++++++++++++++
 5 files changed, 144 insertions(+)

diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index c1ec489..432ef61 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -338,6 +338,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-cbor</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-cdi</artifactId>
       <version>${project.version}</version>
     </dependency>
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index 9e43763..d2edfd0 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -89,6 +89,7 @@
         <include>org.apache.camel:camel-browse</include>
         <include>org.apache.camel:camel-caffeine</include>
         <include>org.apache.camel:camel-cassandraql</include>
+        <include>org.apache.camel:camel-cbor</include>
         <include>org.apache.camel:camel-cdi</include>
         <include>org.apache.camel:camel-chatscript</include>
         <include>org.apache.camel:camel-chunk</include>
@@ -427,6 +428,7 @@
         <include>org.apache.camel:camel-browse-starter</include>
         <include>org.apache.camel:camel-caffeine-starter</include>
         <include>org.apache.camel:camel-cassandraql-starter</include>
+        <include>org.apache.camel:camel-cbor-starter</include>
         <include>org.apache.camel:camel-chatscript-starter</include>
         <include>org.apache.camel:camel-chunk-starter</include>
         <include>org.apache.camel:camel-cm-sms-starter</include>
diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml
index 0eaf5ef..4a1ed0b 100644
--- a/bom/camel-bom/pom.xml
+++ b/bom/camel-bom/pom.xml
@@ -538,6 +538,16 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-cbor</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-cbor-starter</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-cdi</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git a/components/pom.xml b/components/pom.xml
index 61f2e74..d49c9b3 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -130,6 +130,7 @@
         <module>camel-braintree</module>
         <module>camel-caffeine</module>
         <module>camel-cassandraql</module>
+        <module>camel-cbor</module>
         <module>camel-cdi</module>
         <module>camel-chatscript</module>
         <module>camel-chunk</module>
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java
new file mode 100644
index 0000000..01c1405
--- /dev/null
+++ b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/CBORDataFormat.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.model.dataformat;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.apache.camel.model.DataFormatDefinition;
+import org.apache.camel.spi.Metadata;
+
+/**
+ * CBOR data format is used for unmarshal a CBOR payload to POJO or to marshal
+ * POJO back to CBOR payload.
+ */
+@Metadata(firstVersion = "3.0.0",label = "dataformat,transformation,json", title = "CBOR")
+@XmlRootElement(name = "cbor")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class CBORDataFormat extends DataFormatDefinition {
+    @XmlAttribute
+    private String objectMapper;
+    @XmlAttribute
+    @Metadata(defaultValue = "true")
+    private Boolean useDefaultObjectMapper;
+    @XmlTransient
+    private Class<?> unmarshalType;
+    @XmlTransient
+    private Class<?> collectionType;
+    @XmlAttribute
+    private Boolean useList;
+    @XmlAttribute
+    private Boolean allowUnmarshallType;
+
+    public CBORDataFormat() {
+        super("cbor");
+    }
+
+    public String getObjectMapper() {
+        return objectMapper;
+    }
+
+    /**
+     * Lookup and use the existing CBOR ObjectMapper with the given id when using
+     * Jackson.
+     */
+    public void setObjectMapper(String objectMapper) {
+        this.objectMapper = objectMapper;
+    }
+
+    public Boolean getUseDefaultObjectMapper() {
+        return useDefaultObjectMapper;
+    }
+
+    /**
+     * Whether to lookup and use default Jackson CBOR ObjectMapper from the registry.
+     */
+    public void setUseDefaultObjectMapper(Boolean useDefaultObjectMapper) {
+        this.useDefaultObjectMapper = useDefaultObjectMapper;
+    }
+
+    public Class<?> getUnmarshalType() {
+        return unmarshalType;
+    }
+
+    /**
+     * Class of the java type to use when unarmshalling
+     */
+    public void setUnmarshalType(Class<?> unmarshalType) {
+        this.unmarshalType = unmarshalType;
+    }
+
+    public Class<?> getCollectionType() {
+        return collectionType;
+    }
+
+    public void setCollectionType(Class<?> collectionType) {
+        this.collectionType = collectionType;
+    }
+
+    public Boolean getUseList() {
+        return useList;
+    }
+
+    /**
+     * To unarmshal to a List of Map or a List of Pojo.
+     */
+    public void setUseList(Boolean useList) {
+        this.useList = useList;
+    }
+
+    public Boolean getAllowUnmarshallType() {
+        return allowUnmarshallType;
+    }
+
+    /**
+     * If enabled then Jackson is allowed to attempt to use the
+     * CamelJacksonUnmarshalType header during the unmarshalling.
+     * <p/>
+     * This should only be enabled when desired to be used.
+     */
+    public void setAllowUnmarshallType(Boolean allowUnmarshallType) {
+        this.allowUnmarshallType = allowUnmarshallType;
+    }
+
+    @Override
+    public String getDataFormatName() {
+        return "cbor";
+    }
+
+}