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