1 /**************************************************************** 2 * Licensed to the Apache Software Foundation (ASF) under one * 3 * or more contributor license agreements. See the NOTICE file * 4 * distributed with this work for additional information * 5 * regarding copyright ownership. The ASF licenses this file * 6 * to you under the Apache License, Version 2.0 (the * 7 * "License"); you may not use this file except in compliance * 8 * with the License. You may obtain a copy of the License at * 9 * * 10 * http://www.apache.org/licenses/LICENSE-2.0 * 11 * * 12 * Unless required by applicable law or agreed to in writing, * 13 * software distributed under the License is distributed on an * 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * 15 * KIND, either express or implied. See the License for the * 16 * specific language governing permissions and limitations * 17 * under the License. * 18 ****************************************************************/ 19 20 21 22 package org.apache.james.transport; 23 24 import org.apache.mailet.MailetContext; 25 import org.apache.mailet.MatcherConfig; 26 27 /** 28 * Implements the configuration object for a Matcher. 29 * 30 */ 31 public class MatcherConfigImpl implements MatcherConfig { 32 33 /** 34 * A String representation of the value for the matching condition 35 */ 36 private String condition; 37 38 /** 39 * The name of the Matcher 40 */ 41 private String name; 42 43 /** 44 * The MailetContext associated with the Matcher configuration 45 */ 46 private MailetContext context; 47 48 /** 49 * The simple condition defined for this matcher, e.g., for 50 * SenderIs=admin@localhost, this would return admin@localhost. 51 * 52 * @return a String containing the value of the initialization parameter 53 */ 54 public String getCondition() { 55 return condition; 56 } 57 58 /** 59 * Set the simple condition defined for this matcher configuration. 60 */ 61 public void setCondition(String newCondition) { 62 condition = newCondition; 63 } 64 65 /** 66 * Returns the name of this matcher instance. The name may be provided via server 67 * administration, assigned in the application deployment descriptor, or for 68 * an unregistered (and thus unnamed) matcher instance it will be the matcher's 69 * class name. 70 * 71 * @return the name of the matcher instance 72 */ 73 public String getMatcherName() { 74 return name; 75 } 76 77 /** 78 * Sets the name of this matcher instance. 79 * 80 * @param newName the name of the matcher instance 81 */ 82 public void setMatcherName(String newName) { 83 name = newName; 84 } 85 86 /** 87 * Returns a reference to the MailetContext in which the matcher is executing 88 * 89 * @return a MailetContext object, used by the matcher to interact with its 90 * mailet container 91 */ 92 public MailetContext getMailetContext() { 93 return context; 94 } 95 96 /** 97 * Sets a reference to the MailetContext in which the matcher is executing 98 * 99 * @param newContext a MailetContext object, used by the matcher to interact 100 * with its mailet container 101 */ 102 public void setMailetContext(MailetContext newContext) { 103 context = newContext; 104 } 105 }