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 org.apache.camel.Exchange;
020    
021     /**
022      * Interface to allow plug-able implementation to filter header
023      * to and from Camel message.
024      * 
025      * @since 1.5
026      * @version $Revision: 758505 $
027      */
028    public interface HeaderFilterStrategy {
029    
030        public enum Direction { IN, OUT }
031    
032        /**
033         * Applies filtering logic to Camel Message header that is
034         * going to be copied to target message such as CXF and JMS message.
035         * It returns true if the filtering logics return a match.  Otherwise,
036         * it returns false.  A match means the header should be excluded.
037         * 
038         * @param headerName  the header name
039         * @param headerValue the header value
040         * @param exchange the context to perform filtering
041         * @return <tt>true</tt> if this header should be filtered out.
042         */
043        boolean applyFilterToCamelHeaders(String headerName, Object headerValue, Exchange exchange);
044    
045        
046        /**
047         * Applies filtering logic to an external message header such 
048         * as CXF and JMS message that is going to be copied to Camel
049         * message header.
050         * It returns true if the filtering logics return a match.  Otherwise,
051         * it returns false.  A match means the header should be excluded.
052         *  
053         * @param headerName  the header name
054         * @param headerValue the header value
055         * @param exchange the context to perform filtering
056         * @return <tt>true</tt> if this header should be filtered out.
057         */
058        boolean applyFilterToExternalHeaders(String headerName, Object headerValue, Exchange exchange);
059        
060    }