1 /************************************************************************ 2 * Copyright (c) 2000-2006 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; 19 20 import org.apache.james.transport.mailets.listservcommands.IListServCommand; 21 import org.apache.james.services.UsersRepository; 22 import org.apache.james.util.XMLResources; 23 import org.apache.mailet.Mailet; 24 import org.apache.mailet.Mail; 25 import org.apache.mailet.MailAddress; 26 import org.apache.avalon.framework.configuration.ConfigurationException; 27 28 import javax.mail.MessagingException; 29 import java.util.Map; 30 import java.util.Properties; 31 32 /*** 33 * ICommandListservManager is the interface that describes the functionality of any 34 * command based list serv managers. 35 * 36 * In order to obtain a reference to one, you can call: 37 * <pre> 38 * ICommandListservManager mgr = (ICommandListservManager)mailetContext.getAttribute(ICommandListservManager.ID + listName); 39 * </pre> 40 * 41 * @version CVS $Revision: 365582 $ $Date: 2006-01-03 08:51:21 +0000 (mar, 03 gen 2006) $ 42 * @since 2.2.0 43 */ 44 public interface ICommandListservManager extends Mailet { 45 46 public static final String ID = ICommandListservManager.class.getName(); 47 48 /*** 49 * Get the name of this list 50 * @param displayFormat is whether you want a display version of this or not 51 * @return the official display name of this list 52 */ 53 public String getListName(boolean displayFormat); 54 55 /*** 56 * Gets the owner of this list 57 * @return this is an address like listOwner@localhost 58 */ 59 public String getListOwner(); 60 61 /*** 62 * Get the domain of the list 63 * @return a string like localhost 64 */ 65 public String getListDomain(); 66 67 /*** 68 * Get a specific command 69 * @param name case in-sensitive 70 * @return a {@link IListServCommand} if found, null otherwise 71 */ 72 public IListServCommand getCommand(String name); 73 74 /*** 75 * Get all the available commands 76 * @return a map of {@link IListServCommand}s 77 */ 78 public Map getCommands(); 79 80 /*** 81 * Based on the to address get a valid or command or null 82 * @param mailAddress 83 * @return IListServCommand or null 84 */ 85 public IListServCommand getCommandTarget(MailAddress mailAddress); 86 87 /*** 88 * Get the current user repository for this list serv 89 * @return an instance of {@link UsersRepository} that is used for the member list of the list serv 90 */ 91 public UsersRepository getUsersRepository(); 92 93 /*** 94 * An error occurred, send some sort of message to the sender 95 * @param subject the subject of the message to send 96 * @param mail 97 * @param errorMessage 98 */ 99 public void onError(Mail mail, String subject, String errorMessage) throws MessagingException; 100 101 /*** 102 * @return the configuration file for the xml resources 103 */ 104 public String getResourcesFile(); 105 106 /*** 107 * Use this to get standard properties for future calls to {@link org.apache.james.util.XMLResources} 108 * @return properties with the "LIST_NAME" and the "DOMAIN_NAME" properties 109 */ 110 public Properties getStandardProperties(); 111 112 /*** 113 * Initializes an array of resources 114 * @param names such as 'header, footer' etc... 115 * @return an initialized array of XMLResources 116 * @throws org.apache.avalon.framework.configuration.ConfigurationException 117 */ 118 public XMLResources[] initXMLResources(String[] names) throws ConfigurationException; 119 }