001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.camel.spi;
018
019import java.util.List;
020
021import org.apache.camel.Exchange;
022import org.apache.camel.RouteNode;
023import org.apache.camel.model.ProcessorDefinition;
024
025/**
026 * Tracing information used by {@link org.apache.camel.processor.interceptor.TraceInterceptor}
027 * so we can trace the exact route path a given {@link org.apache.camel.Exchange} has been processed.
028 *
029 * @deprecated use {@link Exchange#MESSAGE_HISTORY} instead.
030 */
031@Deprecated
032public interface TracedRouteNodes {
033
034    /**
035     * Adds the entry that was intercepted
036     *
037     * @param entry the entry
038     */
039    void addTraced(RouteNode entry);
040
041    /**
042     * Gets the last node, is <tt>null</tt> if no last exists.
043     *
044     * @return the last node
045     */
046    RouteNode getLastNode();
047
048    /**
049     * Gets the 2nd last node, is <tt>null</tt> if no last exists.
050     *
051     * @return the 2nd last
052     */
053    RouteNode getSecondLastNode();
054
055    /**
056     * Gets the current list of nodes, representing the route path the
057     * current {@link org.apache.camel.Exchange} has currently taken.
058     *
059     * @return the node path
060     */
061    List<RouteNode> getNodes();
062
063    /**
064     * Prepares a new block for tracing.
065     * <p/>
066     * This is needed when you have child block such as a multicast or aggregator
067     */
068    void pushBlock();
069
070    /**
071     * Pops the last block from tracing.
072     */
073    void popBlock();
074
075    /**
076     * Clears all traced information
077     */
078    void clear();
079
080    /**
081     * A private counter that increments, is used to as book keeping how far this
082     * exchange have been intercepted by the general intercept().
083     * <p/>
084     * We need this special book keeping to keep correct order when dealing
085     * with concurrent exchanges being routed in the same route path.
086     *
087     * @param node the intercept node
088     * @return the current count
089     */
090    int getAndIncrementCounter(ProcessorDefinition<?> node);
091
092}