You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2020/02/04 16:34:30 UTC

[camel-k-runtime] 01/02: Remove deprecated properties and processors in camel-knative

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

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git

commit 95a704f3998239682fa10a3f41ddcc586202970d
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Tue Feb 4 12:50:35 2020 +0100

    Remove deprecated properties and processors in camel-knative
---
 .../camel/component/knative/KnativeComponent.java  | 10 -----
 .../component/knative/KnativeConfiguration.java    | 16 --------
 .../knative/KnativeConversionProcessor.java        | 46 ----------------------
 .../camel/component/knative/KnativeEndpoint.java   |  3 +-
 4 files changed, 1 insertion(+), 74 deletions(-)

diff --git a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java
index 987ca63..7056f4c 100644
--- a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java
+++ b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java
@@ -103,16 +103,6 @@ public class KnativeComponent extends DefaultComponent {
         configuration.setEnvironment(environment);
     }
 
-    @Deprecated
-    public boolean isJsonSerializationEnabled() {
-        return configuration.isJsonSerializationEnabled();
-    }
-
-    @Deprecated
-    public void setJsonSerializationEnabled(boolean jsonSerializationEnabled) {
-        configuration.setJsonSerializationEnabled(jsonSerializationEnabled);
-    }
-
     public String getCloudEventsSpecVersion() {
         return configuration.getCloudEventsSpecVersion();
     }
diff --git a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConfiguration.java b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConfiguration.java
index 1057782..5add382 100644
--- a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConfiguration.java
+++ b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConfiguration.java
@@ -30,9 +30,6 @@ public class KnativeConfiguration implements Cloneable {
     private KnativeEnvironment environment;
     @UriParam
     private String serviceName;
-    @UriParam(defaultValue = "false")
-    @Deprecated
-    private boolean jsonSerializationEnabled;
     @UriParam(defaultValue = "0.3", enums = "0.1,0.2,0.3")
     private String cloudEventsSpecVersion = CloudEvents.V03.version();
     @UriParam(defaultValue = "org.apache.camel.event")
@@ -98,19 +95,6 @@ public class KnativeConfiguration implements Cloneable {
         this.replyWithCloudEvent = replyWithCloudEvent;
     }
 
-    @Deprecated
-    public boolean isJsonSerializationEnabled() {
-        return jsonSerializationEnabled;
-    }
-
-    /**
-     * Enables automatic serialization to JSON of the produced events.
-     */
-    @Deprecated
-    public void setJsonSerializationEnabled(boolean jsonSerializationEnabled) {
-        this.jsonSerializationEnabled = jsonSerializationEnabled;
-    }
-
     public String getCloudEventsSpecVersion() {
         return cloudEventsSpecVersion;
     }
diff --git a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConversionProcessor.java b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConversionProcessor.java
deleted file mode 100644
index 433fa9e..0000000
--- a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConversionProcessor.java
+++ /dev/null
@@ -1,46 +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.component.knative;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.knative.spi.Knative;
-
-/**
- * Converts objects prior to serializing them to external endpoints or channels
- */
-@Deprecated
-public class KnativeConversionProcessor implements Processor {
-
-    private boolean enabled;
-
-    public KnativeConversionProcessor(boolean enabled) {
-        this.enabled = enabled;
-    }
-
-    @Override
-    public void process(Exchange exchange) throws Exception {
-        if (enabled) {
-            Object body = exchange.getIn().getBody();
-            if (body != null) {
-                byte[] newBody = Knative.MAPPER.writeValueAsBytes(body);
-                exchange.getIn().setBody(newBody);
-                exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/json");
-            }
-        }
-    }
-}
diff --git a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java
index b27b3bb..99b5bf3 100644
--- a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java
+++ b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java
@@ -75,7 +75,6 @@ public class KnativeEndpoint extends DefaultEndpoint {
     public Producer createProducer() throws Exception {
         final KnativeEnvironment.KnativeServiceDefinition service = lookupServiceDefinition(Knative.EndpointKind.sink);
         final Processor ceProcessor = cloudEvent.producer(this, service);
-        final Processor ceConverter = new KnativeConversionProcessor(configuration.isJsonSerializationEnabled());
         final Producer producer = getComponent().getTransport().createProducer(this, createTransportConfiguration(), service);
 
         PropertyBindingSupport.build()
@@ -85,7 +84,7 @@ public class KnativeEndpoint extends DefaultEndpoint {
             .withTarget(producer)
             .bind();
 
-        return new KnativeProducer(this, ceProcessor, ceConverter, e -> e.getMessage().removeHeader("Host"), producer);
+        return new KnativeProducer(this, ceProcessor, e -> e.getMessage().removeHeader("Host"), producer);
     }
 
     @Override