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     */
017    package org.apache.camel.spi;
018    
019    import java.util.List;
020    
021    import org.apache.camel.RouteNode;
022    import org.apache.camel.model.ProcessorDefinition;
023    
024    /**
025     * Tracing information used by {@link org.apache.camel.processor.interceptor.TraceInterceptor}
026     * so we can trace the exact route path a given {@link org.apache.camel.Exchange} has been processed.
027     *
028     * @version 
029     */
030    public interface TracedRouteNodes {
031    
032        /**
033         * Adds the entry that was intercepted
034         *
035         * @param entry the entry
036         */
037        void addTraced(RouteNode entry);
038    
039        /**
040         * Gets the last node, is <tt>null</tt> if no last exists.
041         *
042         * @return the last node
043         */
044        RouteNode getLastNode();
045    
046        /**
047         * Gets the 2nd last node, is <tt>null</tt> if no last exists.
048         *
049         * @return the 2nd last
050         */
051        RouteNode getSecondLastNode();
052    
053        /**
054         * Gets the current list of nodes, representing the route path the
055         * current {@link org.apache.camel.Exchange} has currently taken.
056         *
057         * @return the node path
058         */
059        List<RouteNode> getNodes();
060    
061        /**
062         * Prepares a new block for tracing.
063         * <p/>
064         * This is needed when you have child block such as a multicast or aggregator
065         */
066        void pushBlock();
067    
068        /**
069         * Pops the last block from tracing.
070         */
071        void popBlock();
072    
073        /**
074         * Clears all traced information
075         */
076        void clear();
077    
078        /**
079         * A private counter that increments, is used to as book keeping how far this
080         * exchange have been intercepted by the general intercept().
081         * <p/>
082         * We need this special book keeping to keep correct order when dealing
083         * with concurrent exchanges being routed in the same route path.
084         *
085         * @param node the intercept node
086         * @return the current count
087         */
088        int getAndIncrementCounter(ProcessorDefinition<?> node);
089    
090    }