FileDocCategorySizeDatePackage
AvalonListservManager.javaAPI DocApache James 2.3.13576Fri Jan 12 12:56:28 GMT 2007org.apache.james.transport.mailets

AvalonListservManager

public class AvalonListservManager extends GenericListservManager
Adds or removes an email address to a listserv.

Sample configuration:
<mailet match="CommandForListserv=james@list.working-dogs.com" class="AvalonListservManager">
<repositoryName>name of user repository configured in UsersStore block </repositoryName>
</mailet>

version
This is $Revision: 494012 $

Fields Summary
private org.apache.james.services.UsersRepository
members
Constructors Summary
Methods Summary
public booleanaddAddress(org.apache.mailet.MailAddress address)
Add an address to the list.

param
address the address to add
return
true if successful, false otherwise

        members.addUser(address.toString(), "");
        return true;
    
public booleanexistsAddress(org.apache.mailet.MailAddress address)

        return members.contains(address.toString());
    
public java.lang.StringgetMailetInfo()
Return a string describing this mailet.

return
a string describing this mailet

        return "AvalonListservManager Mailet";
    
public voidinit()
Initialize the mailet

        ServiceManager compMgr = (ServiceManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
        try {
            UsersStore usersStore = (UsersStore) compMgr.lookup(UsersStore.ROLE);
            String repName = getInitParameter("repositoryName");

            members = (UsersRepository) usersStore.getRepository(repName);
        } catch (ServiceException cnfe) {
            log("Failed to retrieve Store component:" + cnfe.getMessage());
        } catch (Exception e) {
            log("Failed to retrieve Store component:" + e.getMessage());
        }
    
public booleanremoveAddress(org.apache.mailet.MailAddress address)
Remove an address from the list.

param
address the address to remove
return
true if successful, false otherwise

        members.removeUser(address.toString());
        return true;