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 package org.apache.james.core; 21 22 import org.apache.mailet.MailetContext; 23 import org.apache.mailet.MatcherConfig; 24 25 /*** 26 * Implements the configuration object for a Matcher. 27 * 28 */ 29 public class MatcherConfigImpl implements MatcherConfig { 30 31 /*** 32 * A String representation of the value for the matching condition 33 */ 34 private String condition; 35 36 /*** 37 * The name of the Matcher 38 */ 39 private String name; 40 41 /*** 42 * The MailetContext associated with the Matcher configuration 43 */ 44 private MailetContext context; 45 46 /*** 47 * The simple condition defined for this matcher, e.g., for 48 * SenderIs=admin@localhost, this would return admin@localhost. 49 * 50 * @return a String containing the value of the initialization parameter 51 */ 52 public String getCondition() { 53 return condition; 54 } 55 56 /*** 57 * Set the simple condition defined for this matcher configuration. 58 */ 59 public void setCondition(String newCondition) { 60 condition = newCondition; 61 } 62 63 /*** 64 * Returns the name of this matcher instance. The name may be provided via server 65 * administration, assigned in the application deployment descriptor, or for 66 * an unregistered (and thus unnamed) matcher instance it will be the matcher's 67 * class name. 68 * 69 * @return the name of the matcher instance 70 */ 71 public String getMatcherName() { 72 return name; 73 } 74 75 /*** 76 * Sets the name of this matcher instance. 77 * 78 * @param newName the name of the matcher instance 79 */ 80 public void setMatcherName(String newName) { 81 name = newName; 82 } 83 84 /*** 85 * Returns a reference to the MailetContext in which the matcher is executing 86 * 87 * @return a MailetContext object, used by the matcher to interact with its 88 * mailet container 89 */ 90 public MailetContext getMailetContext() { 91 return context; 92 } 93 94 /*** 95 * Sets a reference to the MailetContext in which the matcher is executing 96 * 97 * @param newContext a MailetContext object, used by the matcher to interact 98 * with its mailet container 99 */ 100 public void setMailetContext(MailetContext newContext) { 101 context = newContext; 102 } 103 }