|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.james.transport.LinearProcessor
public class LinearProcessor
Implements a processor for mails, directing the mail down the chain of matchers/mailets. SAMPLE CONFIGURATION <processor name="try" onerror="return,log"> <mailet match="RecipientIsLocal" class="LocalDelivery"> </mailet> <mailet match="All" class="RemoteDelivery"> <delayTime>21600000</delayTime> <maxRetries>5</maxRetries> </mailet> </processor> Note that the 'onerror' attribute is not yet supported. As of James v2.2.0a5, 'onerror' functionality is implemented, but it is implemented on the <mailet> tag. The specification is: <mailet match="..." class="..." [onMatchException="{noMatch|matchAll|error|<aProcessorName>}"] [onMailetException="{ignore|error|<aProcessorName>}"]> noMatch: no addresses are considered to match matchAll: all addresses are considered to match error: as before, send the message to the ERROR processor Otherwise, a processor name can be specified, and the message will be sent there.
CVS $Id: LinearProcessor.java 717869 2008-11-15 15:56:18Z rdonkin $
Constructor Summary | |
---|---|
LinearProcessor()
|
Method Summary | |
---|---|
void |
add(org.apache.mailet.Matcher matcher,
org.apache.mailet.Mailet mailet)
Adds a new Matcher / Mailet pair
to the processor. |
void |
closeProcessorLists()
Closes the processor matcher/mailet list. |
void |
configure(org.apache.avalon.framework.configuration.Configuration processorConf)
|
void |
dispose()
The dispose operation is called at the end of a components lifecycle. |
java.util.List |
getMailetConfigs()
retrieve mailet configuration data for introspection |
java.util.List |
getMatcherConfigs()
retrieve matcher configuration data for introspection |
void |
openProcessorList()
Initialize the processor matcher/mailet list. |
void |
service(org.apache.mailet.Mail mail)
Processes a single mail message through the chain of matchers and mailets. |
void |
service(org.apache.avalon.framework.service.ServiceManager comp)
|
void |
setMailetLoader(MailetLoader mailetLoader)
Set the MailetLoader |
void |
setMatchLoader(MatcherLoader matchLoader)
Set the MatcherLoader |
void |
setSpool(SpoolRepository spool)
Set the spool to be used by this LinearProcessor. |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LinearProcessor()
Method Detail |
---|
public void setSpool(SpoolRepository spool)
spool
- the spool to be used by this processor
java.lang.IllegalArgumentException
- when the spool passed in is nullpublic void setMailetLoader(MailetLoader mailetLoader)
setMailetLoader
in interface MailetContainer
mailetLoader
- the MailetLoaderpublic void setMatchLoader(MatcherLoader matchLoader)
setMatchLoader
in interface MailetContainer
matchLoader
- the MatcherLoaderpublic void dispose()
The dispose operation is called at the end of a components lifecycle. Instances of this class use this method to release and destroy any resources that they own.
This implementation disposes of all the mailet instances added to the processor
dispose
in interface org.apache.avalon.framework.activity.Disposable
Disposable.dispose()
public void add(org.apache.mailet.Matcher matcher, org.apache.mailet.Mailet mailet)
Adds a new Matcher
/ Mailet
pair
to the processor. Checks to ensure that the matcher and
mailet passed in are not null. Synchronized to ensure that
the matchers and mailets are kept in sync.
It is an essential part of the contract of the LinearProcessor that a particular matcher/mailet combination be used to terminate the processor chain. This is done by calling the closeProcessorList method.
Once the closeProcessorList has been called any subsequent call to the add method will result in an IllegalStateException.
This method is synchronized to protect against corruption of matcher/mailets lists
matcher
- the new matcher being addedmailet
- the new mailet being added
java.lang.IllegalArgumentException
- when the matcher or mailet passed in is null
java.lang.IllegalStateException
- when this method is called after the processor lists have been closedpublic void closeProcessorLists()
Closes the processor matcher/mailet list.
This method is synchronized to protect against corruption of matcher/mailets lists
java.lang.IllegalStateException
- when this method is called after the processor lists have been closedpublic void service(org.apache.mailet.Mail mail) throws javax.mail.MessagingException
Processes a single mail message through the chain of matchers and mailets.
Calls to this method before setSpool has been called with a non-null argument
will result in an IllegalStateException
.
If the matcher/mailet lists have not been closed by a call to the closeProcessorLists
method then a call to this method will result in an IllegalStateException
.
The end of the matcher/mailet chain must be a matcher that matches all mails and
a mailet that sets every mail to GHOST status. This is necessary to ensure that
mails are removed from the spool in an orderly fashion. The closeProcessorLists method
ensures this.
service
in interface MailProcessor
mail
- the new mail to be processed
java.lang.IllegalStateException
- when this method is called before the processor lists have been closed
or the spool has been initialized
javax.mail.MessagingException
- - if a message or address parsing exception occurs or
an exception that interferes with the mailet's normal operationMailProcessor.service(org.apache.mailet.Mail)
public void openProcessorList()
Initialize the processor matcher/mailet list.
public void configure(org.apache.avalon.framework.configuration.Configuration processorConf) throws org.apache.avalon.framework.configuration.ConfigurationException
configure
in interface org.apache.avalon.framework.configuration.Configurable
org.apache.avalon.framework.configuration.ConfigurationException
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)
public void service(org.apache.avalon.framework.service.ServiceManager comp) throws org.apache.avalon.framework.service.ServiceException
service
in interface org.apache.avalon.framework.service.Serviceable
org.apache.avalon.framework.service.ServiceException
Serviceable.service(ServiceManager)
public java.util.List getMailetConfigs()
MailetContainer
getMailetConfigs
in interface MailetContainer
public java.util.List getMatcherConfigs()
MailetContainer
getMatcherConfigs
in interface MailetContainer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |