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.avalon.framework.configuration.Configuration;
21: import org.apache.avalon.framework.configuration.ConfigurationException;
22: import org.apache.james.transport.mailets.ICommandListservManager;
23: import org.apache.mailet.Mail;
24:
25: import javax.mail.MessagingException;
26:
27: /**
28: * IListServCommand is the interface that all pluggable list serv commands must implement.
29: * The lifecycle of a IListServCommand will be controlled by the {@link ICommandListservManager}
30: *
31: * <br />
32: * <br />
33: * Requests sent to the CommandListservManager take the form of:
34: * <pre>
35: * <listName>-<commandName>@domain
36: * </pre>
37: * and if the commandName matches the command's name, then the {@link #onCommand} will be invoked.
38: *
39: * <br />
40: * <br />
41: * A typical command is configured:
42: * <pre>
43: * <command name="subscribe" class="Subscribe"/>
44: * </pre>
45: *
46: * <br />
47: * <br />
48: * Typically, IListServCommands will format some text to reply with based off of resource files
49: * and calls to {@link org.apache.james.util.XMLResources#getString}
50: *
51: * This allows you to customize the messages sent by these commands by editing text files and not editing the javacode.
52: *
53: * @version CVS $Revision: 494012 $ $Date: 2007-01-08 11:23:58 +0100 (Mo, 08 Jan 2007) $
54: * @since 2.2.0
55: * @see ICommandListservManager
56: */
57: public interface IListServCommand {
58:
59: /**
60: * The name of this command
61: * specified by the 'name' parameter.
62: * eg:
63: * <pre>
64: * <command name="subscribe" class="Subscribe"/>
65: * </pre>
66: * @return the name of this command
67: */
68: public String getCommandName();
69:
70: /**
71: * Perform any required initialization
72: * @param configuration
73: * @throws ConfigurationException
74: */
75: public void init(ICommandListservManager commandListservManager,
76: Configuration configuration) throws ConfigurationException;
77:
78: /**
79: * Process this command to your hearts content
80: * @param mail
81: * @throws MessagingException
82: */
83: public void onCommand(Mail mail) throws MessagingException;
84: }
|