From 47dbb116b327b7ffdf99e1c9a2f1356f73403549 Mon Sep 17 00:00:00 2001 From: cjmamo <823038+cjmamo@users.noreply.github.com> Date: Thu, 15 Aug 2024 21:43:55 +0200 Subject: [PATCH] refactor: deprecate obsolete classes (#222) Refs: https://github.com/smooks/smooks-camel-cartridge/issues/211 --- README.adoc | 10 +++++++--- .../cartridges/camel/component/SmooksComponent.java | 1 + .../cartridges/camel/component/SmooksEndpoint.java | 9 +++++---- .../cartridges/camel/converters/ResultConverter.java | 1 + .../cartridges/camel/converters/SourceConverter.java | 1 + .../cartridges/camel/processor/SmooksProcessor.java | 1 + 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.adoc b/README.adoc index 7cde290..595a6c9 100644 --- a/README.adoc +++ b/README.adoc @@ -40,12 +40,14 @@ The above configuration shows routing using the `+beanId+` attribute. It is also == Apache Camel Integration -Integrating Smooks from Apache Camel lets you to access all the features of Smooks from within Camel. You can take an existing Smooks configuration and use this in your Camel routes using one of the options that are described in this chapter. +Integrating Smooks from Apache Camel lets you access all the features of Smooks from within Camel. You can take an existing Smooks configuration and use this in your Camel routes using one of the options that are described in this chapter. Using Smooks in Camel can be done in three ways: === SmooksComponent +WARNING: SmooksComponent is deprecated and superseded by the https://camel.apache.org/components/next/smooks-component.html[Camel Smooks Component]. + The `+SmooksComponent+` is a Camel https://camel.apache.org/component.html[Component] which can used when you want to process the Camel Message Body using Smooks. You can do this by adding a route in your Camel route configuration: [source,java] @@ -82,7 +84,9 @@ from("direct:unmarshal") === SmooksProcessor -Using `+SmooksProcessor+` gives you full control over Smooks, for example if you want to programatically create the underlying Smooks instance you’d use `+SmooksProcessor+`. When using `+SmooksProcessor+`, you can pass a Smooks instance to its constructor and prior to that programmatically configure Smooks. +WARNING: SmooksProcessor is deprecated and superseded by the https://camel.apache.org/components/next/smooks-component.html[Camel Smooks Component]. + +Using `+SmooksProcessor+` gives you full control over Smooks, for example if you want to programmatically create the underlying Smooks instance you’d use `+SmooksProcessor+`. When using `+SmooksProcessor+`, you can pass a Smooks instance to its constructor and prior to that programmatically configure Smooks. Below is an example of using the `+SmooksProcessor+` in a Camel route: @@ -112,7 +116,7 @@ from("file://input?noop=true") .to("mock:result"); ---- -TIP: See the https://github.com/smooks/smooks-examples/tree/v1.0.5/camel[Apache Camel examples] in the examples page. +TIP: See the https://github.com/smooks/smooks-examples/tree/v2/camel[Apache Camel examples] in the examples page. == Maven Coordinates diff --git a/src/main/java/org/smooks/cartridges/camel/component/SmooksComponent.java b/src/main/java/org/smooks/cartridges/camel/component/SmooksComponent.java index 2636530..6d84b9a 100644 --- a/src/main/java/org/smooks/cartridges/camel/component/SmooksComponent.java +++ b/src/main/java/org/smooks/cartridges/camel/component/SmooksComponent.java @@ -61,6 +61,7 @@ * @author Christian Mueller * @author Daniel Bevenius */ +@Deprecated(forRemoval = true, since = "2.0.0-RC5") public class SmooksComponent extends DefaultComponent { protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception { SmooksProcessor smooksProcessor = new SmooksProcessor(remaining, getCamelContext()); diff --git a/src/main/java/org/smooks/cartridges/camel/component/SmooksEndpoint.java b/src/main/java/org/smooks/cartridges/camel/component/SmooksEndpoint.java index 9c15627..08df4b7 100644 --- a/src/main/java/org/smooks/cartridges/camel/component/SmooksEndpoint.java +++ b/src/main/java/org/smooks/cartridges/camel/component/SmooksEndpoint.java @@ -56,17 +56,18 @@ * * @author Daniel Bevenius */ +@Deprecated(forRemoval = true, since = "2.0.0-RC5") public class SmooksEndpoint extends ProcessorEndpoint implements Service { - private final SmooksProcessor smooksProcesor; + private final SmooksProcessor smooksProcessor; public SmooksEndpoint(String endpointUri, Component component, SmooksProcessor processor) { super(endpointUri, component, processor); - this.smooksProcesor = processor; + this.smooksProcessor = processor; } public void start() { try { - smooksProcesor.start(); + smooksProcessor.start(); } catch (Exception e) { throw new SmooksException(e.getMessage(), e); } @@ -74,7 +75,7 @@ public void start() { public void stop() { try { - smooksProcesor.stop(); + smooksProcessor.stop(); } catch (Exception e) { throw new SmooksException(e.getMessage(), e); } diff --git a/src/main/java/org/smooks/cartridges/camel/converters/ResultConverter.java b/src/main/java/org/smooks/cartridges/camel/converters/ResultConverter.java index df57d3d..96433b6 100644 --- a/src/main/java/org/smooks/cartridges/camel/converters/ResultConverter.java +++ b/src/main/java/org/smooks/cartridges/camel/converters/ResultConverter.java @@ -65,6 +65,7 @@ * @author Daniel Bevenius */ @Converter(generateLoader = true) +@Deprecated(forRemoval = true, since = "2.0.0-RC5") public class ResultConverter { public static final String SMOOKS_RESULT_KEY = "SmooksResultKeys"; diff --git a/src/main/java/org/smooks/cartridges/camel/converters/SourceConverter.java b/src/main/java/org/smooks/cartridges/camel/converters/SourceConverter.java index a902641..5c3c277 100644 --- a/src/main/java/org/smooks/cartridges/camel/converters/SourceConverter.java +++ b/src/main/java/org/smooks/cartridges/camel/converters/SourceConverter.java @@ -60,6 +60,7 @@ * @author Daniel Bevenius */ @Converter(generateLoader = true) +@Deprecated(forRemoval = true, since = "2.0.0-RC5") public class SourceConverter { private SourceConverter() { } diff --git a/src/main/java/org/smooks/cartridges/camel/processor/SmooksProcessor.java b/src/main/java/org/smooks/cartridges/camel/processor/SmooksProcessor.java index 399c1ab..cbd871e 100644 --- a/src/main/java/org/smooks/cartridges/camel/processor/SmooksProcessor.java +++ b/src/main/java/org/smooks/cartridges/camel/processor/SmooksProcessor.java @@ -78,6 +78,7 @@ * @author Christian Mueller * @author Daniel Bevenius */ +@Deprecated(forRemoval = true, since = "2.0.0-RC5") public class SmooksProcessor implements Processor, Service, CamelContextAware { public static final String SMOOKS_EXECUTION_CONTEXT = "CamelSmooksExecutionContext"; public static final String CAMEL_CHARACTER_ENCODING = "CamelCharsetName";