|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SK.gnome.dwarf.GenericService SK.gnome.dwarf.mail.smtp.proc.MailFilter
Provides mail filter.
This class decides whether a particular message will be processed by the containing agent.
The abstract filter(MailAgentMessage, Collection)
method matches the message and its
recipients with the given condition, and if it returns a non-empty collection, the message
along with the filtered recipients will be passed to the mail agent processing method. Otherwise,
the message will not be passed to the agent at all.
Derived classes may override the init(MailAgentContext)
and destroy()
methods to easily initialize and destory the mail filters, but they may not forget to call
the inherited original methods in the overriden method body.
Field Summary | |
protected java.lang.String |
condition
The filtering condition. |
protected MailAgentContext |
context
The mail agent context associated with this filter. |
Fields inherited from class SK.gnome.dwarf.GenericService |
initParameters, parent |
Fields inherited from interface SK.gnome.dwarf.Service |
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED |
Constructor Summary | |
MailFilter(java.lang.String name)
Creates a new MailFilter. |
Method Summary | |
protected void |
destroy()
Destroys the mail filter. |
protected abstract java.util.Collection |
filter(MailAgentMessage message,
java.util.Collection recipients)
Filters the given message. |
protected void |
init(MailAgentContext context)
Initializes the mail filter. |
void |
setCondition(java.lang.String condition)
Sets the filtering condition. |
Methods inherited from class SK.gnome.dwarf.GenericService |
getAuthenticator, getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getLogger, getName, getParameters, getPrincipal, getShutdownTimeout, getState, init, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, shutdown, start, stop, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String condition
protected MailAgentContext context
Constructor Detail |
public MailFilter(java.lang.String name)
name
- the filter nameMethod Detail |
public void setCondition(java.lang.String condition)
condition
- the condition stringprotected void init(MailAgentContext context) throws MailException
This method may be overriden by the subclasses as needed.
context
- the mail context associated with this filter
MailException
- if an error occuredprotected void destroy() throws MailException
This method may be overriden by the subclasses as needed.
MailException
- if an error occuredprotected abstract java.util.Collection filter(MailAgentMessage message, java.util.Collection recipients) throws MailException
Matches the message and its recipients with the given condition
. If the matching
process fails, an empty collection is returned. Otherwise, the method returns a collection
of recipients which meets the given condition. If the condition is not based on the message
recipients, the returned collection will contain all message recipients. If the matching is
based on the recipients, the collection will contain only those ones, which actually meets
the recipient-based condition.
Method must return a new Collection object each time it is called.
message
- the queued messagerecipients
- the input collection of recipients
MailException
- if an error occured
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |