|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.mailet.GenericMailet org.apache.james.transport.mailets.CommandListservProcessor
public class CommandListservProcessor
CommandListservProcessor processes messages intended for the list serv mailing list.
For command handling, see CommandListservManager
This class is based on the existing list serv processor shipped with James.
To configure the CommandListservProcessor place this configuratin in the root processor:
<mailet match="RecipientIs=announce@localhost" class="CommandListservProcessor"> <membersonly>false</membersonly> <attachmentsallowed>true</attachmentsallowed> <replytolist>true</replytolist> <repositoryName>list-announce</repositoryName> <subjectprefix>Announce</subjectprefix> <autobracket>true</autobracket> <listOwner>owner@localhost</listOwner> <listName>announce</listName> </mailet>
Field Summary | |
---|---|
protected java.util.Collection |
allowedPosters
|
protected boolean |
attachmentsAllowed
Whether attachments can be sent to the list specified by the config param: 'attachmentsallowed'. |
protected boolean |
autoBracket
Whether the subject prefix should be bracketed with '[' and ']' specified by the config param: 'autoBracket'. |
protected CommandListservFooter |
commandListservFooter
Mailet that will add the footer to the message |
protected ICommandListservManager |
commandListservManager
The list serv manager |
protected java.lang.String |
listName
Name of the mailing list specified by the config param: 'listName'. |
protected MailAddress |
listOwner
The list owner specified by the config param: 'listOwner'. |
protected boolean |
membersOnly
Whether only members can post to the list specified by the config param: 'membersonly'. |
protected boolean |
replyToList
Whether the reply-to header should be set to the list address specified by the config param: 'replytolist'. |
protected boolean |
specificPostersOnly
|
protected java.lang.String |
subjectPrefix
A String to prepend to the subject of the message when it is sent to the list specified by the config param: 'subjectPrefix'. |
protected UsersRepository |
usersRepository
The repository containing the users on this list specified by the config param: 'repositoryName'. |
protected XMLResources |
xmlResources
|
Constructor Summary | |
---|---|
CommandListservProcessor()
|
Method Summary | |
---|---|
protected void |
addFooter(Mail mail)
Add the footer using CommandListservFooter |
protected boolean |
checkAllowedPoster(Mail mail,
java.util.Collection members)
Returns true if this user is ok to send to the list |
protected boolean |
checkAnnouncements(Mail mail)
Returns true if this is ok to send to the list |
protected boolean |
checkBeenThere(MailAddress listservAddr,
Mail mail)
return true if this is ok, false otherwise Check if the X-been-there header is set to the listserv's name (the address). |
protected boolean |
checkMembers(java.util.Collection members,
Mail mail)
Returns true if this user is ok to send to the list |
protected boolean |
getBoolean(java.lang.String attrName,
boolean defValue)
Get a configuration value |
protected CommandListservFooter |
getCommandListservFooter()
Lazy init |
protected ICommandListservManager |
getCommandListservManager()
lazy retrieval |
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.util.Collection |
getMembers()
|
protected java.lang.String |
getString(java.lang.String attrName,
java.lang.String defValue)
Get a configuration value |
void |
init()
Initialize the mailet |
protected void |
initAllowedPosters(org.apache.avalon.framework.configuration.Configuration configuration)
|
protected void |
initializeResources()
initialize the resources |
protected void |
initUsersRepository()
Fetch the repository of users |
protected javax.mail.internet.MimeMessage |
prepareListMessage(Mail mail,
MailAddress listservAddr)
Create a new message with some set headers |
void |
service(Mail mail)
A message was sent to the list serv. |
protected void |
setSubject(javax.mail.internet.MimeMessage 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 |
Field Detail |
---|
protected boolean membersOnly
<membersonly>false</membersonly>Defaults to false
protected boolean attachmentsAllowed
<attachmentsallowed>true</attachmentsallowed>Defaults to true
protected boolean replyToList
<replytolist>true</replytolist>Defaults to true
protected java.lang.String subjectPrefix
<subjectPrefix>MyList</subjectPrefix>For example: MyList
protected boolean autoBracket
<autoBracket>true</autoBracket>Defaults to true
protected UsersRepository usersRepository
<repositoryName>list-announce</repositoryName>
protected MailAddress listOwner
<listOwner>owner@localhost</listOwner>
protected java.lang.String listName
<listName>announce</listName>
protected ICommandListservManager commandListservManager
protected CommandListservFooter commandListservFooter
protected XMLResources xmlResources
XMLResources
protected boolean specificPostersOnly
protected java.util.Collection allowedPosters
Constructor Detail |
---|
public CommandListservProcessor()
Method Detail |
---|
public void init() throws javax.mail.MessagingException
init
in class GenericMailet
javax.mail.MessagingException
- if an exception occurs that interrupts the mailet's normal operationpublic void service(Mail mail) throws javax.mail.MessagingException
service
in interface Mailet
service
in class GenericMailet
mail
-
javax.mail.MessagingException
protected void addFooter(Mail mail) throws javax.mail.MessagingException
CommandListservFooter
mail
-
javax.mail.MessagingException
protected void setSubject(javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
javax.mail.MessagingException
protected javax.mail.internet.MimeMessage prepareListMessage(Mail mail, MailAddress listservAddr) throws javax.mail.MessagingException
mail
- listservAddr
-
javax.mail.MessagingException
protected boolean checkBeenThere(MailAddress listservAddr, Mail mail) throws javax.mail.MessagingException
listservAddr
- mail
-
javax.mail.MessagingException
protected boolean checkAnnouncements(Mail mail) throws java.io.IOException, javax.mail.MessagingException
mail
-
java.io.IOException
javax.mail.MessagingException
protected boolean checkMembers(java.util.Collection members, Mail mail) throws javax.mail.MessagingException
members
- mail
-
javax.mail.MessagingException
public java.util.Collection getMembers() throws javax.mail.internet.ParseException
javax.mail.internet.ParseException
protected boolean getBoolean(java.lang.String attrName, boolean defValue)
attrName
- defValue
-
protected java.lang.String getString(java.lang.String attrName, java.lang.String defValue)
attrName
- defValue
-
protected void initializeResources() throws java.lang.Exception
java.lang.Exception
protected void initUsersRepository() throws java.lang.Exception
java.lang.Exception
protected ICommandListservManager getCommandListservManager()
protected CommandListservFooter getCommandListservFooter() throws javax.mail.MessagingException
javax.mail.MessagingException
protected static java.lang.Object getField(java.lang.Object instance, java.lang.String name) throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
protected void initAllowedPosters(org.apache.avalon.framework.configuration.Configuration configuration) throws java.lang.Exception
java.lang.Exception
protected boolean checkAllowedPoster(Mail mail, java.util.Collection members) throws javax.mail.MessagingException
mail
-
javax.mail.MessagingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |