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.model; 018 019import javax.xml.bind.annotation.XmlAccessType; 020import javax.xml.bind.annotation.XmlAccessorType; 021import javax.xml.bind.annotation.XmlAttribute; 022import javax.xml.bind.annotation.XmlRootElement; 023import javax.xml.bind.annotation.XmlTransient; 024 025import org.apache.camel.spi.Metadata; 026 027/** 028 * Removes message exchange properties whose name matches a specified pattern 029 */ 030@Metadata(label = "eip,transformation") 031@XmlRootElement(name = "removeProperties") 032@XmlAccessorType(XmlAccessType.FIELD) 033public class RemovePropertiesDefinition extends NoOutputDefinition<RemovePropertiesDefinition> { 034 @XmlAttribute(required = true) 035 private String pattern; 036 @XmlAttribute 037 private String excludePattern; 038 // in XML we cannot use String[] for attributes, so we provide a single 039 // attribute instead 040 @XmlTransient 041 private String[] excludePatterns; 042 043 public RemovePropertiesDefinition() { 044 } 045 046 public RemovePropertiesDefinition(String pattern) { 047 setPattern(pattern); 048 } 049 050 public RemovePropertiesDefinition(String pattern, String... excludePatterns) { 051 setPattern(pattern); 052 setExcludePatterns(excludePatterns); 053 } 054 055 @Override 056 public String toString() { 057 return "removeProperties[" + getPattern() + "]"; 058 } 059 060 @Override 061 public String getShortName() { 062 return "removeProperties"; 063 } 064 065 @Override 066 public String getLabel() { 067 return "removeProperties[" + getPattern() + "]"; 068 } 069 070 /** 071 * Name or pattern of properties to remove. The pattern is matched in the 072 * following order: 1 = exact match 2 = wildcard (pattern ends with a * and 073 * the name starts with the pattern) 3 = regular expression (all of above is 074 * case in-sensitive). 075 */ 076 public void setPattern(String pattern) { 077 this.pattern = pattern; 078 } 079 080 public String getPattern() { 081 return pattern; 082 } 083 084 public String[] getExcludePatterns() { 085 return excludePatterns; 086 } 087 088 /** 089 * Name or pattern of properties to not remove. The pattern is matched in 090 * the following order: 1 = exact match 2 = wildcard (pattern ends with a * 091 * and the name starts with the pattern) 3 = regular expression (all of 092 * above is case in-sensitive). 093 */ 094 public void setExcludePatterns(String[] excludePatterns) { 095 this.excludePatterns = excludePatterns; 096 } 097 098 public String getExcludePattern() { 099 return excludePattern; 100 } 101 102 /** 103 * Name or pattern of properties to not remove. The pattern is matched in 104 * the following order: 1 = exact match 2 = wildcard (pattern ends with a * 105 * and the name starts with the pattern) 3 = regular expression (all of 106 * above is case in-sensitive). 107 */ 108 public void setExcludePattern(String excludePattern) { 109 this.excludePattern = excludePattern; 110 } 111}