|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.mailet.GenericMatcher
public abstract class GenericMatcher
GenericMatcher implements the Matcher and MatcherConfig interfaces.
GenericMatcher makes writing matchers easier. It provides simple versions of the lifecycle methods init and destroy and of the methods in the MatcherConfig interface. GenericMatcher also implements the log method, declared in the MatcherContext interface.
To write a generic matcher, you need only override the abstract match method.
Constructor Summary | |
---|---|
GenericMatcher()
|
Method Summary | |
---|---|
void |
destroy()
Called by the mailet container to indicate to a matcher that the matcher is being taken out of service. |
java.lang.String |
getCondition()
Returns a String containing the value of the named initialization parameter, or null if the parameter does not exist. |
MailetContext |
getMailetContext()
Returns a reference to the MailetContext in which this matcher is running. |
MatcherConfig |
getMatcherConfig()
Returns this matcher's MatcherConfig object. |
java.lang.String |
getMatcherInfo()
Returns information about the matcher, such as author, version, and copyright. |
java.lang.String |
getMatcherName()
Returns the name of this matcher instance. |
void |
init()
A convenience method which can be overridden so that there's no need to call super.init(config). |
void |
init(MatcherConfig newConfig)
Called by the matcher container to indicate to a matcher that the matcher is being placed into service. |
void |
log(java.lang.String message)
Writes the specified message to a matcher log file, prepended by the matcher's name. |
void |
log(java.lang.String message,
java.lang.Throwable t)
Writes an explanatory message and a stack trace for a given Throwable exception to the matcher log file, prepended by the matcher's name. |
abstract java.util.Collection |
match(Mail mail)
Called by the matcher container to allow the matcher to process a message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericMatcher()
Method Detail |
---|
public void destroy()
destroy
in interface Matcher
public java.lang.String getCondition()
Returns a String containing the value of the named initialization parameter, or null if the parameter does not exist.
This method is supplied for convenience. It gets the value of the named parameter from the matcher's MatcherConfig object.
getCondition
in interface MatcherConfig
public MatcherConfig getMatcherConfig()
getMatcherConfig
in interface Matcher
public MailetContext getMailetContext()
getMailetContext
in interface MatcherConfig
public java.lang.String getMatcherInfo()
getMatcherInfo
in interface Matcher
public java.lang.String getMatcherName()
getMatcherName
in interface MatcherConfig
public void init(MatcherConfig newConfig) throws javax.mail.MessagingException
Called by the matcher container to indicate to a matcher that the matcher is being placed into service.
This implementation stores the MatcherConfig object it receives from the matcher container for alter use. When overriding this form of the method, call super.init(config).
init
in interface Matcher
MatcherConfig
- config - the MatcherConfig object that contains
configutation information for this matcher
javax.mail.MessagingException
- if an exception occurs that interrupts the matcher's normal operationpublic void init() throws javax.mail.MessagingException
A convenience method which can be overridden so that there's no need to call super.init(config).
Instead of overriding init(MatcherConfig), simply override this method and it will be called by GenericMatcher.init(MatcherConfig config). The MatcherConfig object can still be retrieved via getMatcherConfig().
MatcherException
- if an exception occurs that interrupts the matcher's normal operation
javax.mail.MessagingException
public void log(java.lang.String message)
msg
- - a String specifying the message to be written to the log filepublic void log(java.lang.String message, java.lang.Throwable t)
message
- - a String that describes the error or exceptiont
- - the java.lang.Throwable error or exceptionpublic abstract java.util.Collection match(Mail mail) throws javax.mail.MessagingException
Called by the matcher container to allow the matcher to process a message.
This method is declared abstract so subclasses must override it.
match
in interface Matcher
mail
- - the Mail object that contains the MimeMessage and
routing information
javax.mail.MessagingException
- - if an exception occurs that interferes with the mailet's normal operation
occurred
MessagingException
- - if an message or address parsing exception occurs or
an exception that interferes with the matcher's normal operation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |