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/13 08:30:56 UTC

[camel] 03/05: CAMEL-13408 - Removed Jibx Dataformat from camel-core

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 93aa04a6f1a6849996933b279241e8cc1e2c42a8
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon May 13 09:58:57 2019 +0200

    CAMEL-13408 - Removed Jibx Dataformat from camel-core
---
 .../org/apache/camel/builder/DataFormatClause.java | 15 ----
 .../org/apache/camel/model/MarshalDefinition.java  |  2 -
 .../apache/camel/model/UnmarshalDefinition.java    |  2 -
 .../model/dataformat/DataFormatsDefinition.java    |  1 -
 .../camel/model/dataformat/JibxDataFormat.java     | 84 ----------------------
 .../DataFormatTransformerDefinition.java           |  2 -
 .../reifier/dataformat/JibxDataFormatReifier.java  | 54 --------------
 .../java/org/apache/camel/model/XmlParseTest.java  |  6 --
 .../apache/camel/model/routeWithJibxDataFormat.xml | 30 --------
 9 files changed, 196 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 375db6f..1a81db7 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
@@ -40,7 +40,6 @@ import org.apache.camel.model.dataformat.HL7DataFormat;
 import org.apache.camel.model.dataformat.IcalDataFormat;
 import org.apache.camel.model.dataformat.JacksonXMLDataFormat;
 import org.apache.camel.model.dataformat.JaxbDataFormat;
-import org.apache.camel.model.dataformat.JibxDataFormat;
 import org.apache.camel.model.dataformat.JsonApiDataFormat;
 import org.apache.camel.model.dataformat.JsonDataFormat;
 import org.apache.camel.model.dataformat.JsonLibrary;
@@ -538,20 +537,6 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
     }
 
     /**
-     * Uses the JiBX data format.
-     */
-    public T jibx() {
-        return dataFormat(new JibxDataFormat());
-    }
-
-    /**
-     * Uses the JiBX data format with unmarshall class.
-     */
-    public T jibx(Class<?> unmarshallClass) {
-        return dataFormat(new JibxDataFormat(unmarshallClass));
-    }
-
-    /**
      * Uses the JSON data format using the XStream json library
      */
     public T json() {
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 cf229f2..db6e473 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
@@ -40,7 +40,6 @@ import org.apache.camel.model.dataformat.HL7DataFormat;
 import org.apache.camel.model.dataformat.IcalDataFormat;
 import org.apache.camel.model.dataformat.JacksonXMLDataFormat;
 import org.apache.camel.model.dataformat.JaxbDataFormat;
-import org.apache.camel.model.dataformat.JibxDataFormat;
 import org.apache.camel.model.dataformat.JsonApiDataFormat;
 import org.apache.camel.model.dataformat.JsonDataFormat;
 import org.apache.camel.model.dataformat.LZFDataFormat;
@@ -91,7 +90,6 @@ public class MarshalDefinition extends NoOutputDefinition<MarshalDefinition> {
         @XmlElement(required = false, name = "ical", type = IcalDataFormat.class),
         @XmlElement(required = false, name = "jacksonxml", type = JacksonXMLDataFormat.class),
         @XmlElement(required = false, name = "jaxb", type = JaxbDataFormat.class),
-        @XmlElement(required = false, name = "jibx", type = JibxDataFormat.class),
         @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
         @XmlElement(required = false, name = "jsonApi", type = JsonApiDataFormat.class),
         @XmlElement(required = false, name = "lzf", type = LZFDataFormat.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 18a6bba0..2dfd2e2 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
@@ -40,7 +40,6 @@ import org.apache.camel.model.dataformat.HL7DataFormat;
 import org.apache.camel.model.dataformat.IcalDataFormat;
 import org.apache.camel.model.dataformat.JacksonXMLDataFormat;
 import org.apache.camel.model.dataformat.JaxbDataFormat;
-import org.apache.camel.model.dataformat.JibxDataFormat;
 import org.apache.camel.model.dataformat.JsonApiDataFormat;
 import org.apache.camel.model.dataformat.JsonDataFormat;
 import org.apache.camel.model.dataformat.LZFDataFormat;
@@ -91,7 +90,6 @@ public class UnmarshalDefinition extends NoOutputDefinition<UnmarshalDefinition>
         @XmlElement(required = false, name = "ical", type = IcalDataFormat.class),
         @XmlElement(required = false, name = "jacksonxml", type = JacksonXMLDataFormat.class),
         @XmlElement(required = false, name = "jaxb", type = JaxbDataFormat.class),
-        @XmlElement(required = false, name = "jibx", type = JibxDataFormat.class),
         @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
         @XmlElement(required = false, name = "jsonApi", type = JsonApiDataFormat.class),
         @XmlElement(required = false, name = "lzf", type = LZFDataFormat.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 bb1b063..19d2672 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
@@ -57,7 +57,6 @@ public class DataFormatsDefinition {
         @XmlElement(required = false, name = "ical", type = IcalDataFormat.class),
         @XmlElement(required = false, name = "jacksonxml", type = JacksonXMLDataFormat.class),
         @XmlElement(required = false, name = "jaxb", type = JaxbDataFormat.class),
-        @XmlElement(required = false, name = "jibx", type = JibxDataFormat.class),
         @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
         @XmlElement(required = false, name = "jsonApi", type = JsonApiDataFormat.class),
         @XmlElement(required = false, name = "lzf", type = LZFDataFormat.class),
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
deleted file mode 100644
index 56a69d3..0000000
--- a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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;
-
-/**
- * JiBX data format is used for unmarshal a XML payload to POJO or to marshal POJO back to XML payload.
- */
-@Metadata(firstVersion = "2.6.0", label = "dataformat,transformation,xml", title = "JiBX")
-@XmlRootElement(name = "jibx")
-@XmlAccessorType(XmlAccessType.NONE)
-public class JibxDataFormat extends DataFormatDefinition {
-    @XmlAttribute(name = "unmarshallClass")
-    private String unmarshallTypeName;
-    @XmlAttribute
-    private String bindingName;
-    @XmlTransient
-    private Class<?> unmarshallClass;
-
-    public JibxDataFormat() {
-        super("jibx");
-    }
-
-    public JibxDataFormat(Class<?> unmarshallClass) {
-        this();
-        setUnmarshallClass(unmarshallClass);
-    }
-
-    public Class<?> getUnmarshallClass() {
-        return unmarshallClass;
-    }
-
-    /**
-     * Class use when unmarshalling from XML to Java.
-     */
-    public void setUnmarshallClass(Class<?> unmarshallClass) {
-        this.unmarshallClass = unmarshallClass;
-    }
-
-    public String getUnmarshallTypeName() {
-        return unmarshallTypeName;
-    }
-
-    /**
-     * Class name to use when unmarshalling from XML to Java.
-     */
-    public void setUnmarshallTypeName(String unmarshallTypeName) {
-        this.unmarshallTypeName = unmarshallTypeName;
-    }
-
-    public String getBindingName() {
-        return bindingName;
-    }
-
-    /**
-     * To use a custom binding factory
-     */
-    public void setBindingName(String bindingName) {
-        this.bindingName = bindingName;
-    }
-
-}
\ No newline at end of file
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/transformer/DataFormatTransformerDefinition.java b/core/camel-core/src/main/java/org/apache/camel/model/transformer/DataFormatTransformerDefinition.java
index d515d0b..4172779 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/transformer/DataFormatTransformerDefinition.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/transformer/DataFormatTransformerDefinition.java
@@ -42,7 +42,6 @@ import org.apache.camel.model.dataformat.HL7DataFormat;
 import org.apache.camel.model.dataformat.IcalDataFormat;
 import org.apache.camel.model.dataformat.JacksonXMLDataFormat;
 import org.apache.camel.model.dataformat.JaxbDataFormat;
-import org.apache.camel.model.dataformat.JibxDataFormat;
 import org.apache.camel.model.dataformat.JsonApiDataFormat;
 import org.apache.camel.model.dataformat.JsonDataFormat;
 import org.apache.camel.model.dataformat.LZFDataFormat;
@@ -98,7 +97,6 @@ public class DataFormatTransformerDefinition extends TransformerDefinition {
         @XmlElement(required = false, name = "ical", type = IcalDataFormat.class),
         @XmlElement(required = false, name = "jacksonxml", type = JacksonXMLDataFormat.class),
         @XmlElement(required = false, name = "jaxb", type = JaxbDataFormat.class),
-        @XmlElement(required = false, name = "jibx", type = JibxDataFormat.class),
         @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
         @XmlElement(required = false, name = "jsonApi", type = JsonApiDataFormat.class),
         @XmlElement(required = false, name = "lzf", type = LZFDataFormat.class),
diff --git a/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/JibxDataFormatReifier.java b/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/JibxDataFormatReifier.java
deleted file mode 100644
index 3e01397..0000000
--- a/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/JibxDataFormatReifier.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.JibxDataFormat;
-import org.apache.camel.spi.DataFormat;
-
-public class JibxDataFormatReifier extends DataFormatReifier<JibxDataFormat> {
-
-    public JibxDataFormatReifier(DataFormatDefinition definition) {
-        super((JibxDataFormat) definition);
-    }
-
-    @Override
-    protected DataFormat doCreateDataFormat(CamelContext camelContext) {
-        if (definition.getUnmarshallClass() == null && definition.getUnmarshallTypeName() != null) {
-            try {
-                definition.setUnmarshallClass(camelContext.getClassResolver().resolveMandatoryClass(definition.getUnmarshallTypeName()));
-            } catch (ClassNotFoundException e) {
-                throw RuntimeCamelException.wrapRuntimeCamelException(e);
-            }
-        }
-
-        return super.createDataFormat(camelContext);
-    }
-
-    @Override
-    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
-        if (definition.getUnmarshallClass() != null) {
-            setProperty(camelContext, dataFormat, "unmarshallClass", definition.getUnmarshallClass());
-        }
-        if (definition.getBindingName() != null) {
-            setProperty(camelContext, dataFormat, "bindingName", definition.getBindingName());
-        }
-    }
-
-}
diff --git a/core/camel-core/src/test/java/org/apache/camel/model/XmlParseTest.java b/core/camel-core/src/test/java/org/apache/camel/model/XmlParseTest.java
index 403e122..4c2a383 100644
--- a/core/camel-core/src/test/java/org/apache/camel/model/XmlParseTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/model/XmlParseTest.java
@@ -270,12 +270,6 @@ public class XmlParseTest extends XmlTestSupport {
     }
 
     @Test
-    public void testParseJibxDataFormat() throws Exception {
-        RouteDefinition route = assertOneRoute("routeWithJibxDataFormat.xml");
-        assertFrom(route, "seda:a");
-    }
-
-    @Test
     public void testParseXMLSecurityDataFormat() throws Exception {
         RouteDefinition route = assertOneRoute("routeWithXMLSecurityDataFormat.xml");
         assertFrom(route, "seda:a");
diff --git a/core/camel-core/src/test/resources/org/apache/camel/model/routeWithJibxDataFormat.xml b/core/camel-core/src/test/resources/org/apache/camel/model/routeWithJibxDataFormat.xml
deleted file mode 100644
index 3b13f41..0000000
--- a/core/camel-core/src/test/resources/org/apache/camel/model/routeWithJibxDataFormat.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
-
--->
-<routes id="camel" xmlns="http://camel.apache.org/schema/spring">
-    <route>
-        <from uri="seda:a"/>
-        <pipeline>
-            <marshal>
-                <jibx/>
-            </marshal>
-            <to uri="seda:b"/>
-        </pipeline>
-    </route>
-</routes>