You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/02/27 09:24:06 UTC

[camel] 01/02: CAMEL-19090: Remove deprecated apis in core

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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit e53148b32fb621b475475294f9ff71a8fe869544
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Feb 27 10:21:55 2023 +0100

    CAMEL-19090: Remove deprecated apis in core
---
 .../src/main/java/org/apache/camel/Exchange.java   | 11 ----
 .../docs/modules/eips/pages/serviceCall-eip.adoc   |  2 +-
 .../camel/builder/AdviceWithRouteBuilder.java      | 73 ----------------------
 .../org/apache/camel/impl/DefaultExchangeTest.java |  1 -
 .../org/apache/camel/support/AbstractExchange.java |  6 --
 5 files changed, 1 insertion(+), 92 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/Exchange.java b/core/camel-api/src/main/java/org/apache/camel/Exchange.java
index cbd050a93e5..cbbd6afa137 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Exchange.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Exchange.java
@@ -348,17 +348,6 @@ public interface Exchange {
      */
     Object getProperty(String name);
 
-    /**
-     * Returns a property associated with this exchange by name
-     *
-     * @param  name         the name of the property
-     * @param  defaultValue the default value to return if property was absent
-     * @return              the value of the given property or <tt>defaultValue</tt> if there is no property for the
-     *                      given name
-     */
-    @Deprecated
-    Object getProperty(String name, Object defaultValue);
-
     /**
      * Returns a property associated with this exchange by name and specifying the type required
      *
diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/serviceCall-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/serviceCall-eip.adoc
index a35c749d266..015872f1b5e 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/serviceCall-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/serviceCall-eip.adoc
@@ -6,7 +6,7 @@
 :supportlevel: Stable-deprecated
 :deprecated: *deprecated*
 
-IMPORTANT: The Service Call EIP is deprecated
+IMPORTANT: The Service Call EIP is deprecated in Camel 3.x and removed in Camel 4 onwards.
 
 How can I call a remote service in a distributed system where the service is looked up from a service registry of some sorts?
 
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java b/core/camel-core-model/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java
index 85e18861510..0b62bfad74a 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java
@@ -52,79 +52,6 @@ public abstract class AdviceWithRouteBuilder extends RouteBuilder {
         super(context);
     }
 
-    /**
-     * Advices this route with the route builder using a lambda expression. It can be used as following:
-     *
-     * <pre>
-     * AdviceWithRouteBuilder.adviceWith(context, "myRoute", a ->
-     *     a.weaveAddLast().to("mock:result");
-     * </pre>
-     * <p/>
-     * <b>Important:</b> It is recommended to only advice a given route once (you can of course advice multiple routes).
-     * If you do it multiple times, then it may not work as expected, especially when any kind of error handling is
-     * involved.
-     * <p/>
-     * The advice process will add the interceptors, on exceptions, on completions etc. configured from the route
-     * builder to this route.
-     * <p/>
-     * This is mostly used for testing purpose to add interceptors and the likes to an existing route.
-     * <p/>
-     * Will stop and remove the old route from camel context and add and start this new advised route.
-     *
-     * @param      camelContext the camel context
-     * @param      routeId      either the route id as a string value, or <tt>null</tt> to chose the 1st route, or you
-     *                          can specify a number for the n'th route, or provide the route definition instance
-     *                          directly as well.
-     * @param      builder      the advice with route builder
-     * @return                  a new route which is this route merged with the route builder
-     * @throws     Exception    can be thrown from the route builder
-     * @deprecated              use {@link AdviceWith#adviceWith(CamelContext, Object, ThrowingConsumer)}
-     */
-    @Deprecated
-    public static RouteDefinition adviceWith(
-            CamelContext camelContext, Object routeId, ThrowingConsumer<AdviceWithRouteBuilder, Exception> builder)
-            throws Exception {
-        return AdviceWith.adviceWith(camelContext, routeId, builder);
-    }
-
-    /**
-     * Advices this route with the route builder using a lambda expression. It can be used as following:
-     *
-     * <pre>
-     * AdviceWithRouteBuilder.adviceWith(context, "myRoute", false, a ->
-     *     a.weaveAddLast().to("mock:result");
-     * </pre>
-     * <p/>
-     * <b>Important:</b> It is recommended to only advice a given route once (you can of course advice multiple routes).
-     * If you do it multiple times, then it may not work as expected, especially when any kind of error handling is
-     * involved.
-     * <p/>
-     * The advice process will add the interceptors, on exceptions, on completions etc. configured from the route
-     * builder to this route.
-     * <p/>
-     * This is mostly used for testing purpose to add interceptors and the likes to an existing route.
-     * <p/>
-     * Will stop and remove the old route from camel context and add and start this new advised route.
-     *
-     * @param      camelContext the camel context
-     * @param      routeId      either the route id as a string value, or <tt>null</tt> to chose the 1st route, or you
-     *                          can specify a number for the n'th route, or provide the route definition instance
-     *                          directly as well.
-     * @param      logXml       whether to log the before and after advices routes as XML to the log (this can be turned
-     *                          off to perform faster)
-     * @param      builder      the advice with route builder
-     * @return                  a new route which is this route merged with the route builder
-     * @throws     Exception    can be thrown from the route builder
-     * @deprecated              use {@link AdviceWith#adviceWith(CamelContext, Object, boolean, ThrowingConsumer)}
-     */
-    @Deprecated
-    public static RouteDefinition adviceWith(
-            CamelContext camelContext, Object routeId, boolean logXml,
-            ThrowingConsumer<AdviceWithRouteBuilder, Exception> builder)
-            throws Exception {
-        return AdviceWith.adviceWith(camelContext, routeId, logXml, builder);
-    }
-
     /**
      * Sets the original route to be adviced.
      *
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/DefaultExchangeTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/DefaultExchangeTest.java
index 627d6df8d39..df59c67ac52 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/DefaultExchangeTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/DefaultExchangeTest.java
@@ -145,7 +145,6 @@ public class DefaultExchangeTest extends ExchangeTestSupport {
 
         assertEquals("apple", exchange.getProperty("fruit", String.class));
         assertEquals("apple", exchange.getProperty("fruit", "banana", String.class));
-        assertEquals("banana", exchange.getProperty("beer", "banana"));
         assertEquals("banana", exchange.getProperty("beer", "banana", String.class));
     }
 
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java b/core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java
index ef8bb4e1d12..4029818d797 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/AbstractExchange.java
@@ -292,12 +292,6 @@ class AbstractExchange implements Exchange {
         return answer;
     }
 
-    @Override
-    public Object getProperty(String name, Object defaultValue) {
-        Object answer = getProperty(name);
-        return answer != null ? answer : defaultValue;
-    }
-
     @Override
     @SuppressWarnings("unchecked")
     public <T> T getProperty(String name, Class<T> type) {