|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 494012 2007-01-08 10:23:58 +0000 (lun, 08 gen 2007) norman $
Constructor Summary | |
---|---|
LinearProcessor()
|
Method Summary | |
---|---|
void |
add(Matcher matcher,
Mailet mailet)
Adds a new Matcher / Mailet pair
to the processor. |
void |
closeProcessorLists()
Closes the processor matcher/mailet list. |
void |
dispose()
The dispose operation is called at the end of a components lifecycle. |
void |
initialize()
|
void |
service(Mail mail)
Processes a single mail message through the chain of matchers and mailets. |
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 initialize()
initialize
in interface org.apache.avalon.framework.activity.Initializable
Initializable.initialize()
public 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
java.lang.Exception
- if an error is encountered during shutdownpublic void add(Matcher matcher, 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(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.
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |