public class FilteredMailEventSource extends MailEventSource implements FilteredMailSource
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
filterBody
Regex for filtering on the body or null if not set.
|
protected java.lang.Boolean |
filterFlagAnswered
Whether only mails with the answered flag set to this value should cause an
event.
|
protected java.lang.Boolean |
filterFlagDeleted
Whether only mails with the deleted flag set to this value should cause an
event.
|
protected java.lang.Boolean |
filterFlagDraft
Whether only mails with the draft flag set to this value should cause an
event.
|
protected java.lang.Boolean |
filterFlagFlagged
Whether only mails with the flagged flag set to this value should cause an
event.
|
protected java.lang.Boolean |
filterFlagRecent
Whether only mails with the recent flag set to this value should cause an
event.
|
protected java.lang.Boolean |
filterFlagSeen
Whether only mails with the seen flag set to this value should cause an
event.
|
protected java.lang.Boolean |
filterFlagUser
Whether only mails with the user flag set to this value should cause an
event.
|
protected java.lang.String |
filterFrom
Regex for filtering on the senders or null if not set.
|
protected java.lang.String |
filterSubject
Regex for filtering on the subject or null if not set.
|
protected java.lang.String |
filterTo
Regex for filtering on the recipients or null if not set.
|
protected java.util.regex.Pattern |
patternBody
Pattern for filtering on the body or null if not set.
|
protected java.util.regex.Pattern |
patternFrom
Pattern for filtering on the senders or null if not set.
|
protected java.util.regex.Pattern |
patternSubject
Pattern for filtering on the subject or null if not set.
|
protected java.util.regex.Pattern |
patternTo
Pattern for filtering on the recipients or null if not set.
|
eventManagerURIs, folderName, host, keepConnection, password, pollTime, port, protocol, startPoint, store, timeout, userNameeventType, handlerList, id, lock, logger, sourceType, thread, threadLockCONF_BODY_FILTER, CONF_FLAG_ANSWERED_FILTER, CONF_FLAG_DELETED_FILTER, CONF_FLAG_DRAFT_FILTER, CONF_FLAG_FLAGGED_FILTER, CONF_FLAG_RECENT_FILTER, CONF_FLAG_SEEN_FILTER, CONF_FLAG_USER_FILTER, CONF_FROM_FILTER, CONF_SUBJECT_FILTER, CONF_TO_FILTERCONF_FOLDER, CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_PROTOCOL, CONF_TIMEOUT, CONF_USER_NAMECONF_KEEP_CONNECTIONCONF_POLL_TIME, CONF_START_TIME| Constructor and Description |
|---|
FilteredMailEventSource(Configuration conf,
DefaultEventManager eventManager,
Registry registry)
Default constructor for a plugin of an
EventManager called by
a service registry. |
| Modifier and Type | Method and Description |
|---|---|
protected MailEvent |
createMailEvent(javax.mail.Message message)
Creates a
MailEvent for the designated message. |
protected boolean |
filtersApply(javax.mail.Message message,
boolean all)
Checks whether the configured message filters apply to the designated
message.
|
protected boolean |
filtersApply(javax.mail.Message message,
java.util.regex.Pattern subjectFilter,
java.util.regex.Pattern toFilter,
java.util.regex.Pattern fromFilter,
java.util.regex.Pattern bodyFilter,
java.lang.Boolean answeredFlag,
java.lang.Boolean deletedFlag,
java.lang.Boolean draftFlag,
java.lang.Boolean flaggedFlag,
java.lang.Boolean recentFlag,
java.lang.Boolean seenFlag,
java.lang.Boolean userFlag,
boolean all)
Checks whether the designated message filters apply to the designated
message.
|
protected void |
setConfiguration(Configuration conf,
boolean completed)
Sets the internal fields according to the values of the designated
configuration.
|
checkForAndHandleEvent, close, closeStore, connectToStore, getPollTime, getStartTime, init, nextHandler, openFolder, setConfiguration, terminate, timedOut, verifyConfigurationValuesaddAll, addedHandlerLocked, addedHandlerLocked, addHandler, createPattern, forwardEvent, getEventHandler, getHierarchicalSourceName, getID, getType, maskedInterrupt, maskInterrupt, removeHandler, removingHandlerLocked, replaceValueParams, run, unmaskInterruptclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddAll, addHandler, getEventHandler, getHierarchicalSourceName, getID, getType, removeHandler, setConfigurationprotected java.lang.String filterSubject
protected java.lang.String filterTo
protected java.lang.String filterFrom
protected java.lang.String filterBody
protected java.util.regex.Pattern patternSubject
protected java.util.regex.Pattern patternTo
protected java.util.regex.Pattern patternFrom
protected java.util.regex.Pattern patternBody
protected java.lang.Boolean filterFlagAnswered
protected java.lang.Boolean filterFlagDeleted
protected java.lang.Boolean filterFlagDraft
protected java.lang.Boolean filterFlagFlagged
protected java.lang.Boolean filterFlagRecent
protected java.lang.Boolean filterFlagSeen
protected java.lang.Boolean filterFlagUser
public FilteredMailEventSource(Configuration conf, DefaultEventManager eventManager, Registry registry) throws ConfigurationException
EventManager called by
a service registry.conf - The configuration as provided from the registry.eventManager - The event manager this event source is a plugin of.registry - The registry of this plugin.ConfigurationException - If the configuration is not valid for a
PollingMailSource and a FilteredMailSource, a
ConfigurationException will be thrown.protected void setConfiguration(Configuration conf, boolean completed) throws ConfigurationException
setConfiguration in class MailEventSourceconf - The configuration from which to get the configuration values.completed - Whether the configuration is complete after this setting
and therefore the values should be
verified.ConfigurationException - If there are problems with the
configuration, for instance the configuration does not provide
required values, a ConfigurationException may be
thrown.protected MailEvent createMailEvent(javax.mail.Message message) throws javax.mail.MessagingException, java.io.IOException
MailEvent for the designated message.
Only creates the mail event if the configured filters apply. Otherwise
null will be returned.createMailEvent in class MailEventSourcemessage - The message for which to create a MailEvent.MailEvent created for the designated message.javax.mail.MessagingException - If retrieving the required data from the message
fails, a MessagingException will be thrown.java.io.IOException - Retrieving the (complex) content of the message may
thrown an IOException.protected boolean filtersApply(javax.mail.Message message,
boolean all)
throws javax.mail.MessagingException,
java.io.IOException
all is set to true, all configured filters must
apply, else any filter may apply.message - The message which to check for whether the configured
filters apply.all - Whether all filters need to apply instead of just one.javax.mail.MessagingException - If there are problems accessing the attributes
of the message, a MessagingException will be thrown.java.io.IOException - If there are problems accessing the attributes of the
message or retrieving content, an IOException will
be thrown.protected boolean filtersApply(javax.mail.Message message,
java.util.regex.Pattern subjectFilter,
java.util.regex.Pattern toFilter,
java.util.regex.Pattern fromFilter,
java.util.regex.Pattern bodyFilter,
java.lang.Boolean answeredFlag,
java.lang.Boolean deletedFlag,
java.lang.Boolean draftFlag,
java.lang.Boolean flaggedFlag,
java.lang.Boolean recentFlag,
java.lang.Boolean seenFlag,
java.lang.Boolean userFlag,
boolean all)
throws javax.mail.MessagingException,
java.io.IOException
all is set to true, all configured filters must
apply, else any filter may apply.message - The message which to check for whether the configured
filters apply.subjectFilter - The filter for the message subject.toFilter - The filter for the recipient of the message.fromFilter - The filter for the sender of the message.bodyFilter - The filter for the body of the message.answeredFlag - Whether only mails with the answered flag set to this
value should cause an event.deletedFlag - Whether only mails with the deleted flag set to this
value should cause an event.draftFlag - Whether only mails with the draft flag set to this value
should cause an event.flaggedFlag - Whether only mails with the flagged flag set to this
value should cause an event.recentFlag - Whether only mails with the recent flag set to this value
should cause an event.seenFlag - Whether only mails with the seen flag set to this value
should cause an event.userFlag - Whether only mails with the user flag set to this value
should cause an event.all - Whether all filters need to apply instead of just one.javax.mail.MessagingException - If there are problems accessing the attributes
of the message, a MessagingException will be thrown.java.io.IOException - If there are problems accessing the attributes of the
message or retrieving content, an IOException will
be thrown.