|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SK.gnome.dwarf.GenericService SK.gnome.dwarf.GenericServer SK.gnome.dwarf.thread.ThreadServer SK.gnome.dwarf.mail.smtp.proc.MailAgent SK.gnome.dwarf.mail.smtp.proc.agent.MessageCheck
Provides agent for general message checking.
This service is intended as a superclass of any mail agent which checks the message correctness, like antispam agents, antivirus agents, and other filtering agents, for example.
The fail methods should be called from a subclass to indicate that the message does not fulfil the agent's criteria for correctness and to interrupt the current checking process.
If a local user and folder name is setup via the setStoreTo(String)
method,
the checked message will be stored to the given local folder prior to throwing an exception
indicating the failure. In this case no DSN notification will be issued by the server for
the failed recipients at all.
Please note that this agent's failure causes all message recipients to be marked as finished.
Field Summary |
Fields inherited from class SK.gnome.dwarf.mail.smtp.proc.MailAgent |
context, required |
Fields inherited from class SK.gnome.dwarf.thread.ThreadServer |
daemon, thread |
Fields inherited from class SK.gnome.dwarf.GenericService |
initParameters, parent |
Fields inherited from interface SK.gnome.dwarf.Service |
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED |
Constructor Summary | |
MessageCheck(java.lang.String name)
|
Method Summary | |
protected void |
fail(MailAgentMessage message,
java.util.Collection recipients,
java.lang.String status,
java.lang.String msg)
Indicates a failed message. |
protected void |
fail(MailAgentMessage message,
java.util.Collection recipients,
java.lang.String status,
java.lang.String msg,
java.lang.Exception exception)
Indicates a failed message. |
protected void |
init(MailAgentContext context)
Initializes the mail agent. |
void |
setFailedState(java.lang.String state)
Sets the final state of the failed messages. |
void |
setStoreTo(java.lang.String target)
Sets the local folder to store the failed messaged to. |
Methods inherited from class SK.gnome.dwarf.mail.smtp.proc.MailAgent |
destroy, filter, init, isRequired, postprocess, preprocess, setRequired, storeMessage |
Methods inherited from class SK.gnome.dwarf.thread.ThreadServer |
enableThread, finish, loop, run, setDaemon, shutdown, start, stop |
Methods inherited from class SK.gnome.dwarf.GenericServer |
addService, addService, getAuthenticator, getLogger, getParameters, getService, getServices, getServices, removeService, report |
Methods inherited from class SK.gnome.dwarf.GenericService |
getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getName, getPrincipal, getShutdownTimeout, getState, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface SK.gnome.dwarf.Service |
getFullName, getName, getState, log, log, login, logout |
Constructor Detail |
public MessageCheck(java.lang.String name)
Method Detail |
public void setStoreTo(java.lang.String target)
The target argument must be in the form of "user/folder name",
where the first part is the local user name nad the second one is a full name of the
folder to store the failed messages to. If the second part is missing, the default
MailFolder.INBOX
folder will be used.
target
- the user/folder stringpublic void setFailedState(java.lang.String state)
It may be either "FAILED" or "REJECTED" string. The second one causes the server to not generate a DSN notification to the failed message's sender.
state
- the failed recipient stateprotected void init(MailAgentContext context) throws MailException
MailAgent
Initializes the contained MailFilter
instances.
init
in class MailAgent
context
- the mail context associated with this agent
MailException
- if an error occuredprotected void fail(MailAgentMessage message, java.util.Collection recipients, java.lang.String status, java.lang.String msg) throws java.io.IOException, MailException, FailedDeliveryException
It calls the fail(MailAgentMessage, Collection, String, String, Exception)
method with the last argument equal to null.
message
- the checked messagerecipients
- the recipient collectionstatus
- the numeric SMTP status code (X.Y.Z)msg
- the SMTP reason phrase
java.io.IOException
- if an I/O error occured
MailException
- if another error occured
FailedDeliveryException
- if the message failsprotected void fail(MailAgentMessage message, java.util.Collection recipients, java.lang.String status, java.lang.String msg, java.lang.Exception exception) throws java.io.IOException, MailException, FailedDeliveryException
If the agent is setup to store the failed messages then the checked message is stored to the
given local folder. After that a FailedDeliveryException
is thrown immediately with the
desired final state, status code and msg reason phrase to indicate the message
failure.
message
- the checked messagerecipients
- the recipient collectionstatus
- the numeric SMTP status code (X.Y.Z)msg
- the SMTP reason phraseexception
- the causing error
java.io.IOException
- if an I/O error occured
MailException
- if another error occured
FailedDeliveryException
- if the message failssetFailedState(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |