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 <anco...@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";
+    }
+
+}

Reply via email to