01: /****************************************************************
02: * Licensed to the Apache Software Foundation (ASF) under one *
03: * or more contributor license agreements. See the NOTICE file *
04: * distributed with this work for additional information *
05: * regarding copyright ownership. The ASF licenses this file *
06: * to you under the Apache License, Version 2.0 (the *
07: * "License"); you may not use this file except in compliance *
08: * with the License. You may obtain a copy of the License at *
09: * *
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: ****************************************************************/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;
27: import javax.mail.internet.ParseException;
28: import java.util.List;
29: import java.util.ArrayList;
30:
31: /**
32: * This command will send email to the current owner(s) of this mailing list
33: *
34: * @version CVS $Revision: 494012 $ $Date: 2007-01-08 11:23:58 +0100 (Mo, 08 Jan 2007) $
35: * @since 2.2.0
36: */
37: public class Owner extends BaseCommand {
38:
39: protected List m_listOwner = new ArrayList();
40:
41: /**
42: * Perform any required initialization
43: * @param configuration
44: * @throws ConfigurationException
45: */
46: public void init(ICommandListservManager commandListservManager,
47: Configuration configuration) throws ConfigurationException {
48: super .init(commandListservManager, configuration);
49: try {
50: m_listOwner.add(new MailAddress(getCommandListservManager()
51: .getListOwner()));
52: } catch (ParseException e) {
53: throw new ConfigurationException(e.getMessage(), e);
54: }
55: }
56:
57: /**
58: * Process this command to your hearts content
59: * @param mail
60: * @throws MessagingException
61: */
62: public void onCommand(Mail mail) throws MessagingException {
63: getMailetContext().sendMail(mail.getSender(), m_listOwner,
64: mail.getMessage());
65: }
66: }
|