org.apache.james.transport.matchers
Class GenericRegexMatcher

java.lang.Object
  extended by org.apache.mailet.base.GenericMatcher
      extended by org.apache.james.transport.matchers.GenericRegexMatcher
All Implemented Interfaces:
org.apache.mailet.Matcher, org.apache.mailet.MatcherConfig
Direct Known Subclasses:
FileRegexMatcher, NESSpamCheck

public abstract class GenericRegexMatcher
extends org.apache.mailet.base.GenericMatcher

This is a generic matcher that uses regular expressions. If any of the regular expressions match, the matcher is considered to have matched. This is an abstract class that must be subclassed to feed patterns. Patterns are provided by calling the compile method. A subclass will generally call compile() once during init(), but it could subclass match(), and call it as necessary during message processing (e.g., if a file of expressions changed).


Field Summary
protected  java.lang.Object[][] patterns
           
 
Constructor Summary
GenericRegexMatcher()
           
 
Method Summary
 void compile(java.lang.Object[][] patterns)
           
abstract  void init()
           
 java.util.Collection match(org.apache.mailet.Mail mail)
           
 
Methods inherited from class org.apache.mailet.base.GenericMatcher
destroy, getCondition, getMailetContext, getMatcherConfig, getMatcherInfo, getMatcherName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

patterns

protected java.lang.Object[][] patterns
Constructor Detail

GenericRegexMatcher

public GenericRegexMatcher()
Method Detail

compile

public void compile(java.lang.Object[][] patterns)
             throws org.apache.oro.text.regex.MalformedPatternException
Throws:
org.apache.oro.text.regex.MalformedPatternException

init

public abstract void init()
                   throws javax.mail.MessagingException
Overrides:
init in class org.apache.mailet.base.GenericMatcher
Throws:
javax.mail.MessagingException
See Also:
org.apache.mailet.GenericMatcher#GenericMatcher()

match

public java.util.Collection match(org.apache.mailet.Mail mail)
                           throws javax.mail.MessagingException
Specified by:
match in interface org.apache.mailet.Matcher
Specified by:
match in class org.apache.mailet.base.GenericMatcher
Throws:
javax.mail.MessagingException
See Also:
org.apache.mailet.GenericMatcher#match(Mail)


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.