de.malowa.greylister
Class ClientTask

java.lang.Object
  extended by de.malowa.greylister.ClientTask
All Implemented Interfaces:
StateVisitor, java.lang.Runnable

public class ClientTask
extends java.lang.Object
implements StateVisitor, java.lang.Runnable

The ClientTask is a task which will be run if a WorkerThread is ready to handle this task. The function of the task is to read from the Postfix socket, which client wants to deliver an email. On this information it will determine what to do. This can be ACCEPT, DEFER or BLOCK the email and the result will be communicated back to the Postfix daemon via the Postfix socket. The ClientTask uses the RuleEvaluator to determine the appropriate action.

Author:
Marcel Lohmann

Constructor Summary
ClientTask(java.net.Socket socket)
          Constructor to create a new task which will be run later on.
 
Method Summary
 void handleBlockBeforeGreylist(BlockBeforeGreylistState visitee)
          Callback function when the delivery attempt should be rejected as it is on a calculated blacklist.
 void handleNotOnGreylist(NotOnGreylistState visitee)
          Callback function when the delivery attempt should be deferred as it has not been seen before.
 void handleOnWhitelist(OnWhitelistState visitee)
          Callback function when the delivery attempt should be accepted as it is on the internal whitelist.
 void handlePassBeforeGreylist(PassBeforeGreylistState visitee)
          Callback function when the delivery attempt should be accepted as it is on a calculated whitelist.
 void handlePassedGreylist(PassedGreylistState visitee)
          Callback function when the delivery attempt should be accepted as it has passed the greylisting.
 void handlePassWhileGreylisted(PassWhileGreylistedState visitee)
          Callback function when the delivery attempt should be accepted as it is on a calculated whitelist.
 void handleStillDelayed(StillDelayedState visitee)
          Callback function when the delivery attempt should be deferred again as its delay time has not passed, yet.
 void run()
          The method is executed when the task will be executed and run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientTask

public ClientTask(java.net.Socket socket)
Constructor to create a new task which will be run later on.

Parameters:
socket - to communicate with the Postfix daemon
Method Detail

run

public void run()
The method is executed when the task will be executed and run. It handles all the work.

Specified by:
run in interface java.lang.Runnable

handleNotOnGreylist

public void handleNotOnGreylist(NotOnGreylistState visitee)
Description copied from interface: StateVisitor
Callback function when the delivery attempt should be deferred as it has not been seen before. The attempt will be documented for ongoing delivery attempts.

Specified by:
handleNotOnGreylist in interface StateVisitor
Parameters:
visitee - the state contains all information of the delivery attempt.
See Also:
StateVisitor.handleNotOnGreylist(de.malowa.state.NotOnGreylistState)

handleOnWhitelist

public void handleOnWhitelist(OnWhitelistState visitee)
Description copied from interface: StateVisitor
Callback function when the delivery attempt should be accepted as it is on the internal whitelist.

Specified by:
handleOnWhitelist in interface StateVisitor
Parameters:
visitee - the state contains all information of the delivery attempt.
See Also:
StateVisitor.handleOnWhitelist(de.malowa.state.OnWhitelistState)

handlePassedGreylist

public void handlePassedGreylist(PassedGreylistState visitee)
Description copied from interface: StateVisitor
Callback function when the delivery attempt should be accepted as it has passed the greylisting. In other words the delay time has passed.

Specified by:
handlePassedGreylist in interface StateVisitor
Parameters:
visitee - the state contains all information of the delivery attempt.
See Also:
StateVisitor.handlePassedGreylist(de.malowa.state.PassedGreylistState)

handleStillDelayed

public void handleStillDelayed(StillDelayedState visitee)
Description copied from interface: StateVisitor
Callback function when the delivery attempt should be deferred again as its delay time has not passed, yet.

Specified by:
handleStillDelayed in interface StateVisitor
Parameters:
visitee - the state contains all information of the delivery attempt.
See Also:
StateVisitor.handleStillDelayed(de.malowa.state.StillDelayedState)

handlePassBeforeGreylist

public void handlePassBeforeGreylist(PassBeforeGreylistState visitee)
Description copied from interface: StateVisitor
Callback function when the delivery attempt should be accepted as it is on a calculated whitelist. That means that the delivery attempt should not be delayed at all and must not pass greylisting.

Specified by:
handlePassBeforeGreylist in interface StateVisitor
Parameters:
visitee - the state contains all information of the delivery attempt.
See Also:
StateVisitor.handlePassBeforeGreylist(de.malowa.state.PassBeforeGreylistState)

handlePassWhileGreylisted

public void handlePassWhileGreylisted(PassWhileGreylistedState visitee)
Description copied from interface: StateVisitor
Callback function when the delivery attempt should be accepted as it is on a calculated whitelist. That means that the delay time has not been passed but other indications show that it would pass in the future.

Specified by:
handlePassWhileGreylisted in interface StateVisitor
Parameters:
visitee - the state contains all information of the delivery attempt.
See Also:
StateVisitor.handlePassWhileGreylisted(de.malowa.state.PassWhileGreylistedState)

handleBlockBeforeGreylist

public void handleBlockBeforeGreylist(BlockBeforeGreylistState visitee)
Description copied from interface: StateVisitor
Callback function when the delivery attempt should be rejected as it is on a calculated blacklist. That means that there are strong indications that the delivery attempt originates from a spamming source.

Specified by:
handleBlockBeforeGreylist in interface StateVisitor
Parameters:
visitee - the state contains all information of the delivery attempt.
See Also:
StateVisitor.handleBlockBeforeGreylist(de.malowa.state.BlockBeforeGreylistState)