|
|||||||||||
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.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 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 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 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,
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(Collection members,
Mail mail)
Returns true if this user is ok to send to the list |
protected boolean |
getBoolean(String attrName,
boolean defValue)
Get a configuration value |
protected CommandListservFooter |
getCommandListservFooter()
Lazy init |
protected ICommandListservManager |
getCommandListservManager()
lazy retrieval |
protected static Object |
getField(Object instance,
String name)
Retrieves a data field, potentially defined by a super class. |
Collection |
getMembers()
|
protected String |
getString(String attrName,
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 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(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 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 String listName
<listName>announce</listName>
protected ICommandListservManager commandListservManager
protected CommandListservFooter commandListservFooter
protected XMLResources xmlResources
XMLResources
protected boolean specificPostersOnly
protected Collection allowedPosters
Constructor Detail |
public CommandListservProcessor()
Method Detail |
public void init() throws MessagingException
init
in class GenericMailet
MessagingException
- if an exception occurs that interrupts the mailet's normal operationpublic void service(Mail mail) throws MessagingException
service
in interface Mailet
service
in class GenericMailet
mail
-
MessagingException
protected void addFooter(Mail mail) throws MessagingException
CommandListservFooter
mail
-
MessagingException
protected void setSubject(MimeMessage message) throws MessagingException
MessagingException
protected MimeMessage prepareListMessage(Mail mail, MailAddress listservAddr) throws MessagingException
mail
- listservAddr
-
MessagingException
protected boolean checkBeenThere(MailAddress listservAddr, Mail mail) throws MessagingException
listservAddr
- mail
-
MessagingException
protected boolean checkAnnouncements(Mail mail) throws IOException, MessagingException
mail
-
IOException
MessagingException
protected boolean checkMembers(Collection members, Mail mail) throws MessagingException
members
- mail
-
MessagingException
public Collection getMembers() throws ParseException
ParseException
protected boolean getBoolean(String attrName, boolean defValue)
attrName
- defValue
-
protected String getString(String attrName, String defValue)
attrName
- defValue
-
protected void initializeResources() throws Exception
Exception
protected void initUsersRepository() throws Exception
Exception
protected ICommandListservManager getCommandListservManager()
protected CommandListservFooter getCommandListservFooter() throws MessagingException
MessagingException
protected static Object getField(Object instance, String name) throws IllegalAccessException
IllegalAccessException
protected void initAllowedPosters(org.apache.avalon.framework.configuration.Configuration configuration) throws Exception
Exception
protected boolean checkAllowedPoster(Mail mail, Collection members) throws MessagingException
mail
-
MessagingException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |