org.peabody.emailprocessor
Class RegexMessageHook

java.lang.Object
  extended by org.peabody.emailprocessor.AbstractMessageHook
      extended by org.peabody.emailprocessor.RegexMessageHook
All Implemented Interfaces:
MessageHook
Direct Known Subclasses:
BounceMessageHook

public abstract class RegexMessageHook
extends AbstractMessageHook

This is a MessageHook that uses a regular expression matched against the entire message (including headers and body). Most simple text-search based message hooks will want to extend from this class.

This class also implements full-text caching of the content of messages so that each Message object is converted to plain text only once, instead of again for each RegexMessageHook.

NOTE: Regular expressions must match the entire message, this means that you will probably want to surround your regex with something like: .*MAIN_REGEX_HERE.*


Field Summary
static int CACHE_REFRESH_PERIOD
           
protected static com.opensymphony.oscache.general.GeneralCacheAdministrator generalCacheAdministrator
           
protected  java.util.regex.Pattern pattern
           
 
Fields inherited from class org.peabody.emailprocessor.AbstractMessageHook
category, id
 
Constructor Summary
RegexMessageHook(java.lang.String aRegex)
          Creates a new instance of RegexMessageHook
RegexMessageHook(java.lang.String aRegex, int aFlags)
           
 
Method Summary
protected abstract  MessageMatch createMessageMatch(javax.mail.Message aMessage, java.lang.String aMessageText, java.util.regex.Matcher aMatcher)
           
 MessageMatch getMatch(javax.mail.Message aMessage)
           
protected  java.util.regex.Pattern getPattern()
           
protected  void setPattern(java.util.regex.Pattern aPattern)
           
 
Methods inherited from class org.peabody.emailprocessor.AbstractMessageHook
getCategory, getId, setCategory, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHE_REFRESH_PERIOD

public static int CACHE_REFRESH_PERIOD

generalCacheAdministrator

protected static com.opensymphony.oscache.general.GeneralCacheAdministrator generalCacheAdministrator

pattern

protected java.util.regex.Pattern pattern
Constructor Detail

RegexMessageHook

public RegexMessageHook(java.lang.String aRegex,
                        int aFlags)

RegexMessageHook

public RegexMessageHook(java.lang.String aRegex)
Creates a new instance of RegexMessageHook

Method Detail

getPattern

protected java.util.regex.Pattern getPattern()

setPattern

protected void setPattern(java.util.regex.Pattern aPattern)

getMatch

public MessageMatch getMatch(javax.mail.Message aMessage)

createMessageMatch

protected abstract MessageMatch createMessageMatch(javax.mail.Message aMessage,
                                                   java.lang.String aMessageText,
                                                   java.util.regex.Matcher aMatcher)