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