View Javadoc

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  package org.apache.mailet;
22  
23  import java.util.Iterator;
24  
25  /**
26   * A mailet configuration object used by the mailet container to pass
27   * information to a mailet during initialization.
28   * <p>
29   * The configuration information consists of mailet-specific initialization
30   * parameters in a set of name/value pairs, and a MailetContext object
31   * which allows the mailet to interact with the mailet container.
32   *
33   */
34  public interface MailetConfig {
35  
36      /**
37       * Returns the value of the named initialization parameter,
38       * or null if the parameter does not exist.
39       *
40       * @param name the name of the initialization parameter
41       * @return the value of the initialization parameter, or null
42       */
43      String getInitParameter(String name);
44  
45      /**
46       * Returns the names of the mailet's initialization parameters as an
47       * Iterator of String objects, or an empty Iterator if the mailet has
48       * no initialization parameters.
49       *
50       * @return an Iterator of String objects containing the names of the
51       *      mailet's initialization parameters
52       */
53      Iterator getInitParameterNames();
54  
55      /**
56       * Returns a reference to the MailetContext in which the mailet is
57       * executing.
58       *
59       * @return a MailetContext object which can be used by the mailet
60       *      to interact with the mailet container
61       */
62      MailetContext getMailetContext();
63  
64      /**
65       * Returns the name of this mailet instance. The name may be provided via
66       * server administration, assigned in the application deployment descriptor,
67       * or, for an unregistered (and thus unnamed) mailet instance, it will be
68       * the mailet's class name.
69       *
70       * @return the name of the mailet instance
71       */
72      String getMailetName();
73  }