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