|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mailet.GenericMailet
org.apache.james.transport.mailets.CommandListservManager
public class CommandListservManager
CommandListservManager is the default implementation of ICommandListservManager
.
It loads all the configured IListServCommand
s and delegates to them at runtime.
It isn't responsible for procesing messages sent to the main mailing list, but is responsible for
individual commands sent by users, such as: info, subscribe, etc...
Requests sent to the CommandListservManager take the form of:
<listName>-<commandName>@domainIf the command isn't recognized an error will be sent using
onError(org.apache.mailet.Mail, java.lang.String, java.lang.String)
.
<mailet match="CommandListservMatcher=announce@localhost" class="CommandListservManager"> <listName>announce</listName> <displayName>Announce mailing list</displayName> <listOwner>owner@localhost</listOwner> <repositoryName>list-announce</repositoryName> <listDomain>localhost</listDomain> <commandpackages> <commandpackage>org.apache.james.transport.mailets.listservcommands</commandpackage> </commandpackages> <commands> <command name="subscribe" class="Subscribe"/> <command name="subscribe-confirm" class="SubscribeConfirm"/> <command name="unsubscribe" class="UnSubscribe"/> <command name="unsubscribe-confirm" class="UnSubscribeConfirm"/> <command name="error" class="ErrorCommand"/> <command name="owner" class="Owner"/> <command name="info" class="Info"/> </commands> </mailet>
<listName>-<commandName>-<optCommandParam>@domain
Field Summary | |
---|---|
protected java.util.Map |
commandMap
|
protected java.util.List |
commandPackages
|
protected java.lang.String |
displayName
|
protected java.lang.String |
listDomain
|
protected java.lang.String |
listName
|
protected java.lang.String |
listOwner
|
protected UsersRepository |
usersRepository
|
protected XMLResources |
xmlResources
|
Fields inherited from interface org.apache.james.transport.mailets.ICommandListservManager |
---|
ID |
Constructor Summary | |
---|---|
CommandListservManager()
|
Method Summary | |
---|---|
IListServCommand |
getCommand(java.lang.String name)
Get a specific command specified by the 'commands' configuration block. |
protected java.lang.String |
getCommandName(MailAddress mailAddress)
Get the name of the command |
java.util.Map |
getCommands()
Get all the available commands |
IListServCommand |
getCommandTarget(MailAddress mailAddress)
Based on the to address get a valid or command or null |
protected static java.lang.Object |
getField(java.lang.Object instance,
java.lang.String name)
Retrieves a data field, potentially defined by a super class. |
java.lang.String |
getListDomain()
Get the domain of the list specified by the config param: 'listDomain'. |
java.lang.String |
getListName(boolean displayFormat)
Get the name of this list specified by the config param: 'listName'. |
java.lang.String |
getListOwner()
Gets the owner of this list specified by the config param: 'listOwner'. |
java.lang.String |
getResourcesFile()
|
java.util.Properties |
getStandardProperties()
Use this to get standard properties for future calls to XMLResources |
UsersRepository |
getUsersRepository()
Get the current user repository for this list serv |
void |
init()
A convenience method which can be overridden so that there's no need to call super.init(config). |
protected void |
initializeResources()
initialize the resources |
protected void |
initUsersRepository()
Fetch the repository of users |
XMLResources[] |
initXMLResources(java.lang.String[] names)
Initializes an array of resources |
protected void |
loadCommand(java.lang.String commandName,
java.lang.String className,
org.apache.avalon.framework.configuration.Configuration configuration)
Loads and initializes a single command |
protected void |
loadCommandPackages(org.apache.avalon.framework.configuration.Configuration configuration)
loads all of the packages for the commands |
protected void |
loadCommands(org.apache.avalon.framework.configuration.Configuration configuration)
Load an initialize all of the available commands |
void |
onError(Mail mail,
java.lang.String subject,
java.lang.String errorMessage)
An error occurred, send some sort of message |
void |
service(Mail mail)
Called by the mailet container to allow the mailet to process a message. |
Methods inherited from class org.apache.mailet.GenericMailet |
---|
destroy, getInitParameter, getInitParameter, getInitParameterNames, getMailetConfig, getMailetContext, getMailetInfo, getMailetName, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.mailet.Mailet |
---|
destroy, getMailetConfig, getMailetInfo, init |
Field Detail |
---|
protected java.util.Map commandMap
protected java.util.List commandPackages
protected UsersRepository usersRepository
protected java.lang.String listName
protected java.lang.String displayName
protected java.lang.String listOwner
protected java.lang.String listDomain
protected XMLResources xmlResources
Constructor Detail |
---|
public CommandListservManager()
Method Detail |
---|
public java.lang.String getListName(boolean displayFormat)
<listName>announce</listName>
getListName
in interface ICommandListservManager
displayFormat
- is whether you want a display version of this or not
public java.lang.String getListOwner()
<listOwner>owner@localhost</listOwner>
getListOwner
in interface ICommandListservManager
public java.lang.String getListDomain()
<listDomain>localhost</listDomain>
getListDomain
in interface ICommandListservManager
public IListServCommand getCommand(java.lang.String name)
<commands> <command name="subscribe" class="Subscribe"/> <command name="subscribe-confirm" class="SubscribeConfirm"/> <command name="unsubscribe" class="UnSubscribe"/> <command name="unsubscribe-confirm" class="UnSubscribeConfirm"/> <command name="error" class="ErrorCommand"/> <command name="owner" class="Owner"/> <command name="info" class="Info"/> </commands>
getCommand
in interface ICommandListservManager
name
- case in-sensitive
IListServCommand
if found, null otherwisepublic java.util.Map getCommands()
getCommands
in interface ICommandListservManager
IListServCommand
getCommand(java.lang.String)
public UsersRepository getUsersRepository()
getUsersRepository
in interface ICommandListservManager
UsersRepository
that is used for the member list of the list servpublic void onError(Mail mail, java.lang.String subject, java.lang.String errorMessage) throws javax.mail.MessagingException
onError
in interface ICommandListservManager
subject
- the subject of the message to sendmail
- errorMessage
-
javax.mail.MessagingException
public java.lang.String getResourcesFile()
getResourcesFile
in interface ICommandListservManager
public java.util.Properties getStandardProperties()
XMLResources
getStandardProperties
in interface ICommandListservManager
public XMLResources[] initXMLResources(java.lang.String[] names) throws org.apache.avalon.framework.configuration.ConfigurationException
initXMLResources
in interface ICommandListservManager
names
- such as 'header, footer' etc...
org.apache.avalon.framework.configuration.ConfigurationException
public void init() throws javax.mail.MessagingException
GenericMailet
A convenience method which can be overridden so that there's no need to call super.init(config).
Instead of overriding init(MailetConfig), simply override this method and it will be called by GenericMailet.init(MailetConfig config). The MailetConfig object can still be retrieved via getMailetConfig().
init
in class GenericMailet
javax.mail.MessagingException
- if an exception occurs that interrupts the mailet's normal operationpublic IListServCommand getCommandTarget(MailAddress mailAddress)
getCommandTarget
in interface ICommandListservManager
mailAddress
-
public void service(Mail mail) throws javax.mail.MessagingException
Called by the mailet container to allow the mailet to process a message.
This method is declared abstract so subclasses must override it.
service
in interface Mailet
service
in class GenericMailet
mail
- - the Mail object that contains the MimeMessage and
routing information
javax.mail.MessagingException
- - if an exception occurs that interferes with the mailet's normal operation
occurredprotected java.lang.String getCommandName(MailAddress mailAddress)
mailAddress
-
protected void initializeResources() throws java.lang.Exception
java.lang.Exception
protected void initUsersRepository()
protected void loadCommands(org.apache.avalon.framework.configuration.Configuration configuration) throws java.lang.Exception
configuration
-
org.apache.avalon.framework.configuration.ConfigurationException
java.lang.Exception
protected void loadCommand(java.lang.String commandName, java.lang.String className, org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException, java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException
commandName
- className
- configuration
-
org.apache.avalon.framework.configuration.ConfigurationException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
protected void loadCommandPackages(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
configuration
-
org.apache.avalon.framework.configuration.ConfigurationException
protected static java.lang.Object getField(java.lang.Object instance, java.lang.String name) throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |