This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch sandbox/camel-3.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 7040dcf09bf4611f0fe3bfe50c10433905507351 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Thu Sep 27 16:22:49 2018 +0200 [CAMEL-12818] Remove unused RouteNode interface and implementations --- .../src/main/java/org/apache/camel/RouteNode.java | 59 ------------- .../org/apache/camel/impl/AggregateRouteNode.java | 57 ------------- .../camel/impl/CamelContextTrackerRegistry.java | 64 --------------- .../org/apache/camel/impl/DefaultRouteNode.java | 96 ---------------------- .../org/apache/camel/impl/DoCatchRouteNode.java | 60 -------------- .../org/apache/camel/impl/DoFinallyRouteNode.java | 54 ------------ .../apache/camel/impl/OnCompletionRouteNode.java | 54 ------------ .../apache/camel/impl/OnExceptionRouteNode.java | 60 -------------- 8 files changed, 504 deletions(-) diff --git a/camel-core/src/main/java/org/apache/camel/RouteNode.java b/camel-core/src/main/java/org/apache/camel/RouteNode.java deleted file mode 100644 index f274e83..0000000 --- a/camel-core/src/main/java/org/apache/camel/RouteNode.java +++ /dev/null @@ -1,59 +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; - -import org.apache.camel.model.ProcessorDefinition; - -/** - * Represents a model of a node in the runtime route path. - * - * @version - */ -public interface RouteNode { - - /** - * Gets the actual processor this node represents. - * - * @return the processor, can be <tt>null</tt> in special cases such as an intercepted node - */ - Processor getProcessor(); - - /** - * Gets the model definition that represents this node - * - * @return the definition, is never <tt>null</tt> - */ - ProcessorDefinition<?> getProcessorDefinition(); - - /** - * Gets a label about this node to be used for tracing or tooling etc. - * - * @param exchange the current exchange - * @return a label for this node - */ - String getLabel(Exchange exchange); - - /** - * Whether this node is abstract (no real processor under the cover). - * <p/> - * Some nodes that represent intermediate steps are abstract, for instance with - * onException, onCompletion or intercept - * - * @return whether this node is abstract or not - */ - boolean isAbstract(); -} diff --git a/camel-core/src/main/java/org/apache/camel/impl/AggregateRouteNode.java b/camel-core/src/main/java/org/apache/camel/impl/AggregateRouteNode.java deleted file mode 100644 index ab854d5..0000000 --- a/camel-core/src/main/java/org/apache/camel/impl/AggregateRouteNode.java +++ /dev/null @@ -1,57 +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.impl; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.RouteNode; -import org.apache.camel.model.AggregateDefinition; -import org.apache.camel.model.ProcessorDefinition; - -/** - * @version - */ -public class AggregateRouteNode implements RouteNode { - - private AggregateDefinition aggregateDefinition; - - public AggregateRouteNode(AggregateDefinition aggregateDefinition) { - this.aggregateDefinition = aggregateDefinition; - } - - public Processor getProcessor() { - return null; - } - - public ProcessorDefinition<?> getProcessorDefinition() { - return null; - } - - public String getLabel(Exchange exchange) { - String expressionString = (aggregateDefinition.getExpression() != null) ? aggregateDefinition.getExpression().getLabel() : ""; - return "aggregate[" + expressionString + "]"; - } - - public boolean isAbstract() { - return true; - } - - @Override - public String toString() { - return "AggregateRouteNode"; - } -} \ No newline at end of file diff --git a/camel-core/src/main/java/org/apache/camel/impl/CamelContextTrackerRegistry.java b/camel-core/src/main/java/org/apache/camel/impl/CamelContextTrackerRegistry.java deleted file mode 100644 index fc044ad..0000000 --- a/camel-core/src/main/java/org/apache/camel/impl/CamelContextTrackerRegistry.java +++ /dev/null @@ -1,64 +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.impl; - -import java.util.LinkedHashSet; -import java.util.Set; - -import org.apache.camel.CamelContext; -import org.apache.camel.spi.CamelContextTracker; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A registry for {@link CamelContextTracker}. - */ -public final class CamelContextTrackerRegistry { - - /** - * The registry singleton - */ - public static final CamelContextTrackerRegistry INSTANCE = new CamelContextTrackerRegistry(); - - private static final Logger LOG = LoggerFactory.getLogger(CamelContextTrackerRegistry.class); - - private final Set<CamelContextTracker> trackers = new LinkedHashSet<>(); - - private CamelContextTrackerRegistry() { - // hide constructor - } - - public synchronized void addTracker(CamelContextTracker tracker) { - trackers.add(tracker); - } - - public synchronized void removeTracker(CamelContextTracker tracker) { - trackers.remove(tracker); - } - - synchronized void contextCreated(CamelContext camelContext) { - for (CamelContextTracker tracker : trackers) { - try { - if (tracker.accept(camelContext)) { - tracker.contextCreated(camelContext); - } - } catch (Exception e) { - LOG.warn("Error calling CamelContext tracker. This exception is ignored.", e); - } - } - } -} diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteNode.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteNode.java deleted file mode 100644 index 247d9b3..0000000 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteNode.java +++ /dev/null @@ -1,96 +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.impl; - -import org.apache.camel.DelegateProcessor; -import org.apache.camel.Exchange; -import org.apache.camel.Expression; -import org.apache.camel.Processor; -import org.apache.camel.RouteNode; -import org.apache.camel.Traceable; -import org.apache.camel.model.ProcessorDefinition; - -/** - * A default implementation of the {@link org.apache.camel.RouteNode} - * - * @version - */ -public class DefaultRouteNode implements RouteNode { - - private Expression expression; - private Processor processor; - private ProcessorDefinition<?> processorDefinition; - - public DefaultRouteNode(ProcessorDefinition<?> processorDefinition, Processor processor) { - this.processor = processor; - this.processorDefinition = processorDefinition; - } - - public DefaultRouteNode(ProcessorDefinition<?> processorDefinition, Expression expression) { - this.processorDefinition = processorDefinition; - this.expression = expression; - } - - public Processor getProcessor() { - return processor; - } - - public ProcessorDefinition<?> getProcessorDefinition() { - return processorDefinition; - } - - public String getLabel(Exchange exchange) { - if (expression != null) { - return expression.evaluate(exchange, String.class); - } - - String label = getTraceLabel(processor); - if (label == null) { - // no label then default to use the definition label - label = processorDefinition.getLabel(); - } - return label; - } - - @SuppressWarnings("deprecation") - private String getTraceLabel(Processor target) { - if (target == null) { - return null; - } - - if (target instanceof Traceable) { - Traceable trace = (Traceable) target; - return trace.getTraceLabel(); - } - - // if we are a delegate then drill down - if (target instanceof DelegateProcessor) { - return getTraceLabel(((DelegateProcessor) target).getProcessor()); - } - - return null; - } - - public boolean isAbstract() { - return processor == null; - } - - @Override - public String toString() { - return "RouteNode[" + processorDefinition + "]"; - } -} diff --git a/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java b/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java deleted file mode 100644 index 1de6b80..0000000 --- a/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java +++ /dev/null @@ -1,60 +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.impl; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.RouteNode; -import org.apache.camel.model.ProcessorDefinition; - -/** - * {@link org.apache.camel.RouteNode} representing do catch. - * - * @version - */ -public class DoCatchRouteNode implements RouteNode { - - public DoCatchRouteNode() { - } - - public Processor getProcessor() { - return null; - } - - public ProcessorDefinition<?> getProcessorDefinition() { - return null; - } - - public String getLabel(Exchange exchange) { - if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) { - return "doCatch[" + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getClass().getSimpleName() + "]"; - } else if (exchange.getException() != null) { - return "doCatch[" + exchange.getException().getClass().getSimpleName() + "]"; - } else { - return "doCatch[]"; - } - } - - public boolean isAbstract() { - return true; - } - - @Override - public String toString() { - return "DoCatchRouteNode"; - } -} \ No newline at end of file diff --git a/camel-core/src/main/java/org/apache/camel/impl/DoFinallyRouteNode.java b/camel-core/src/main/java/org/apache/camel/impl/DoFinallyRouteNode.java deleted file mode 100644 index d1cad28..0000000 --- a/camel-core/src/main/java/org/apache/camel/impl/DoFinallyRouteNode.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.impl; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.RouteNode; -import org.apache.camel.model.ProcessorDefinition; - -/** - * {@link org.apache.camel.RouteNode} representing do finally. - * - * @version - */ -public class DoFinallyRouteNode implements RouteNode { - - public DoFinallyRouteNode() { - } - - public Processor getProcessor() { - return null; - } - - public ProcessorDefinition<?> getProcessorDefinition() { - return null; - } - - public String getLabel(Exchange exchange) { - return "doFinally"; - } - - public boolean isAbstract() { - return true; - } - - @Override - public String toString() { - return "DoFinallyRouteNode"; - } -} \ No newline at end of file diff --git a/camel-core/src/main/java/org/apache/camel/impl/OnCompletionRouteNode.java b/camel-core/src/main/java/org/apache/camel/impl/OnCompletionRouteNode.java deleted file mode 100644 index 1b24cc9..0000000 --- a/camel-core/src/main/java/org/apache/camel/impl/OnCompletionRouteNode.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.impl; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.RouteNode; -import org.apache.camel.model.ProcessorDefinition; - -/** - * {@link org.apache.camel.RouteNode} representing onCompletion. - * - * @version - */ -public class OnCompletionRouteNode implements RouteNode { - - public OnCompletionRouteNode() { - } - - public Processor getProcessor() { - return null; - } - - public ProcessorDefinition<?> getProcessorDefinition() { - return null; - } - - public String getLabel(Exchange exchange) { - return "OnCompletion[" + exchange.getProperty(Exchange.CORRELATION_ID) + "]"; - } - - public boolean isAbstract() { - return true; - } - - @Override - public String toString() { - return "OnCompletionRouteNode"; - } -} \ No newline at end of file diff --git a/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java b/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java deleted file mode 100644 index 85c058a..0000000 --- a/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java +++ /dev/null @@ -1,60 +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.impl; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.RouteNode; -import org.apache.camel.model.ProcessorDefinition; - -/** - * {@link org.apache.camel.RouteNode} representing onException. - * - * @version - */ -public class OnExceptionRouteNode implements RouteNode { - - public OnExceptionRouteNode() { - } - - public Processor getProcessor() { - return null; - } - - public ProcessorDefinition<?> getProcessorDefinition() { - return null; - } - - public String getLabel(Exchange exchange) { - if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) { - return "OnException[" + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getClass().getSimpleName() + "]"; - } else if (exchange.getException() != null) { - return "OnException[" + exchange.getException().getClass().getSimpleName() + "]"; - } else { - return "OnException[]"; - } - } - - public boolean isAbstract() { - return true; - } - - @Override - public String toString() { - return "OnExceptionRouteNode"; - } -} \ No newline at end of file