|
|||||||||||
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
Implements a processor for mails, directing the mail down the chain of matchers/mailets.
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(MailImpl 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
IllegalArgumentException
- when the spool passed in is nullpublic void initialize()
initialize
in interface 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 Disposable
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
IllegalArgumentException
- when the matcher or mailet passed in is null
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
IllegalStateException
- when this method is called after the processor lists have been closedpublic void service(MailImpl mail) throws 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
IllegalStateException
- when this method is called before the processor lists have been closed
or the spool has been initialized
MessagingException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |