001: /****************************************************************
002: * Licensed to the Apache Software Foundation (ASF) under one *
003: * or more contributor license agreements. See the NOTICE file *
004: * distributed with this work for additional information *
005: * regarding copyright ownership. The ASF licenses this file *
006: * to you under the Apache License, Version 2.0 (the *
007: * "License"); you may not use this file except in compliance *
008: * with the License. You may obtain a copy of the License at *
009: * *
010: * http://www.apache.org/licenses/LICENSE-2.0 *
011: * *
012: * Unless required by applicable law or agreed to in writing, *
013: * software distributed under the License is distributed on an *
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
015: * KIND, either express or implied. See the License for the *
016: * specific language governing permissions and limitations *
017: * under the License. *
018: ****************************************************************/package org.apache.james.core;
019:
020: import org.apache.mailet.MailetContext;
021: import org.apache.mailet.MatcherConfig;
022:
023: /**
024: * Implements the configuration object for a Matcher.
025: *
026: */
027: public class MatcherConfigImpl implements MatcherConfig {
028:
029: /**
030: * A String representation of the value for the matching condition
031: */
032: private String condition;
033:
034: /**
035: * The name of the Matcher
036: */
037: private String name;
038:
039: /**
040: * The MailetContext associated with the Matcher configuration
041: */
042: private MailetContext context;
043:
044: /**
045: * The simple condition defined for this matcher, e.g., for
046: * SenderIs=admin@localhost, this would return admin@localhost.
047: *
048: * @return a String containing the value of the initialization parameter
049: */
050: public String getCondition() {
051: return condition;
052: }
053:
054: /**
055: * Set the simple condition defined for this matcher configuration.
056: */
057: public void setCondition(String newCondition) {
058: condition = newCondition;
059: }
060:
061: /**
062: * Returns the name of this matcher instance. The name may be provided via server
063: * administration, assigned in the application deployment descriptor, or for
064: * an unregistered (and thus unnamed) matcher instance it will be the matcher's
065: * class name.
066: *
067: * @return the name of the matcher instance
068: */
069: public String getMatcherName() {
070: return name;
071: }
072:
073: /**
074: * Sets the name of this matcher instance.
075: *
076: * @param newName the name of the matcher instance
077: */
078: public void setMatcherName(String newName) {
079: name = newName;
080: }
081:
082: /**
083: * Returns a reference to the MailetContext in which the matcher is executing
084: *
085: * @return a MailetContext object, used by the matcher to interact with its
086: * mailet container
087: */
088: public MailetContext getMailetContext() {
089: return context;
090: }
091:
092: /**
093: * Sets a reference to the MailetContext in which the matcher is executing
094: *
095: * @param newContext a MailetContext object, used by the matcher to interact
096: * with its mailet container
097: */
098: public void setMailetContext(MailetContext newContext) {
099: context = newContext;
100: }
101: }
|