|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.mailet.GenericMailet
GenericMailet makes writing mailets easier. It provides simple versions of the lifecycle methods init and destroy and of the methods in the MailetConfig interface. GenericMailet also implements the log method, declared in the MailetContext interface.
To write a generic mailet, you need only override the abstract service method.
Constructor Summary | |
GenericMailet()
|
Method Summary | |
void |
destroy()
Called by the mailer container to indicate to a mailet that the mailet is being taken out of service. |
java.lang.String |
getInitParameter(java.lang.String name)
Returns a String containing the value of the named initialization parameter, or null if the parameter does not exist. |
java.util.Iterator |
getInitParameterNames()
Returns the names of the mailet's initialization parameters as an Iterator of String objects, or an empty Iterator if the mailet has no initialization parameters. |
MailetConfig |
getMailetConfig()
Returns this matcher's MailetConfig object. |
MailetContext |
getMailetContext()
Returns a reference to the MailetContext in which this mailet is running. |
java.lang.String |
getMailetInfo()
Returns information about the mailet, such as author, version, and copyright. |
java.lang.String |
getMailetName()
Returns the name of this mailet instance. |
void |
init()
A convenience method which can be overridden so that there's no need to call super.init(config). |
void |
init(MailetConfig newConfig)
Called by the mailet container to indicate to a mailet that the mailet is being placed into service. |
void |
log(java.lang.String message)
Writes the specified message to a mailet log file, prepended by the mailet'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 mailet log file, prepended by the mailet's name. |
abstract void |
service(Mail mail)
Called by the mailet container to allow the mailet 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 GenericMailet()
Method Detail |
public void destroy()
public java.lang.String getInitParameter(java.lang.String name)
This method is supplied for convenience. It gets the value of the named parameter from the mailet's MailetConfig object.
name
- - a String specifying the name of the initialization parameterpublic java.util.Iterator getInitParameterNames()
This method is supplied for convenience. It gets the parameter names from the mailet's MailetConfig object.
public MailetConfig getMailetConfig()
public MailetContext getMailetContext()
public java.lang.String getMailetInfo()
public java.lang.String getMailetName()
public void init(MailetConfig newConfig) throws MailetException
MailetConfig
- config - the MailetConfig object that contains
configutation information for this mailetpublic void init() throws MailetException
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 void service(Mail mail) throws MailetException, javax.mail.MessagingException
mail
- - the Mail object that contains the MimeMessage and
routing information
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |