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