KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > transport > mailets > listservcommands > Owner


1 /***********************************************************************
2  * Copyright (c) 2000-2004 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.transport.mailets.listservcommands;
19
20 import org.apache.mailet.Mail;
21 import org.apache.mailet.MailAddress;
22 import org.apache.avalon.framework.configuration.ConfigurationException;
23 import org.apache.avalon.framework.configuration.Configuration;
24 import org.apache.james.transport.mailets.ICommandListservManager;
25
26 import javax.mail.MessagingException JavaDoc;
27 import javax.mail.internet.ParseException JavaDoc;
28 import java.util.List JavaDoc;
29 import java.util.ArrayList JavaDoc;
30
31 /**
32  * This command will send email to the current owner(s) of this mailing list
33  *
34  * @version CVS $Revision: 1.1.2.3 $ $Date: 2004/03/15 03:54:20 $
35  * @since 2.2.0
36  */

37 public class Owner extends BaseCommand {
38
39     protected List JavaDoc m_listOwner = new ArrayList JavaDoc();
40
41     /**
42      * Perform any required initialization
43      * @param configuration
44      * @throws ConfigurationException
45      */

46     public void init(ICommandListservManager commandListservManager, Configuration configuration) throws ConfigurationException {
47         super.init(commandListservManager, configuration);
48         try {
49             m_listOwner.add(new MailAddress(getCommandListservManager().getListOwner()));
50         } catch (ParseException JavaDoc e) {
51             throw new ConfigurationException(e.getMessage(), e);
52         }
53     }
54
55     /**
56      * Process this command to your hearts content
57      * @param mail
58      * @throws MessagingException
59      */

60     public void onCommand(Mail mail) throws MessagingException JavaDoc {
61         getMailetContext().sendMail(mail.getSender(), m_listOwner, mail.getMessage());
62     }
63 }
64
Popular Tags