org.apache.james.protocols.smtp.core.fastfail
Class AbstractGreylistHandler

java.lang.Object
  extended by org.apache.james.protocols.smtp.core.fastfail.AbstractGreylistHandler
All Implemented Interfaces:
RcptHook

public abstract class AbstractGreylistHandler
extends java.lang.Object
implements RcptHook

Abstract base class which implement GreyListing.


Constructor Summary
AbstractGreylistHandler()
           
 
Method Summary
protected abstract  void cleanupAutoWhiteListGreyList(long time)
          Cleanup the autowhitelist
protected abstract  void cleanupGreyList(long time)
          Delete old entries from the Greylist datarecord
 HookResult doRcpt(SMTPSession session, org.apache.mailet.MailAddress sender, org.apache.mailet.MailAddress rcpt)
          Return the HookResult after run the hook
protected abstract  java.util.Iterator<java.lang.String> getGreyListData(java.lang.String ipAddress, java.lang.String sender, java.lang.String recip)
          Get all necessary data for greylisting based on provided triplet
protected abstract  void insertTriplet(java.lang.String ipAddress, java.lang.String sender, java.lang.String recip, int count, long createTime)
          Insert new triplet in the store
 void setAutoWhiteListLifeTime(long autoWhiteListLifeTime)
           
 void setTempBlockTime(long tempBlockTime)
           
 void setUnseenLifeTime(long unseenLifeTime)
           
protected abstract  void updateTriplet(java.lang.String ipAddress, java.lang.String sender, java.lang.String recip, int count, long time)
          Update the triplet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGreylistHandler

public AbstractGreylistHandler()
Method Detail

setUnseenLifeTime

public void setUnseenLifeTime(long unseenLifeTime)

setAutoWhiteListLifeTime

public void setAutoWhiteListLifeTime(long autoWhiteListLifeTime)

setTempBlockTime

public void setTempBlockTime(long tempBlockTime)

getGreyListData

protected abstract java.util.Iterator<java.lang.String> getGreyListData(java.lang.String ipAddress,
                                                                        java.lang.String sender,
                                                                        java.lang.String recip)
                                                                 throws java.lang.Exception
Get all necessary data for greylisting based on provided triplet

Parameters:
ipAddress - The ipAddress of the client
sender - The mailFrom
recip - The rcptTo
Returns:
data The data
Throws:
java.lang.Exception

insertTriplet

protected abstract void insertTriplet(java.lang.String ipAddress,
                                      java.lang.String sender,
                                      java.lang.String recip,
                                      int count,
                                      long createTime)
                               throws java.lang.Exception
Insert new triplet in the store

Parameters:
ipAddress - The ipAddress of the client
sender - The mailFrom
recip - The rcptTo
count - The count
createTime - The createTime
Throws:
SQLException
java.lang.Exception

updateTriplet

protected abstract void updateTriplet(java.lang.String ipAddress,
                                      java.lang.String sender,
                                      java.lang.String recip,
                                      int count,
                                      long time)
                               throws java.lang.Exception
Update the triplet

Parameters:
ipAddress - The ipAddress of the client
sender - The mailFrom
recip - The rcptTo
count - The count
time - the current time in ms
Throws:
java.lang.Exception

cleanupAutoWhiteListGreyList

protected abstract void cleanupAutoWhiteListGreyList(long time)
                                              throws java.lang.Exception
Cleanup the autowhitelist

Parameters:
time - The time which must be reached before delete the records
Throws:
java.lang.Exception

cleanupGreyList

protected abstract void cleanupGreyList(long time)
                                 throws java.lang.Exception
Delete old entries from the Greylist datarecord

Parameters:
time - The time which must be reached before delete the records
Throws:
java.lang.Exception

doRcpt

public HookResult doRcpt(SMTPSession session,
                         org.apache.mailet.MailAddress sender,
                         org.apache.mailet.MailAddress rcpt)
Description copied from interface: RcptHook
Return the HookResult after run the hook

Specified by:
doRcpt in interface RcptHook
Parameters:
session - the SMTPSession
sender - the sender MailAddress
rcpt - the recipient MailAddress
Returns:
HookResult
See Also:
RcptHook.doRcpt(org.apache.james.protocols.smtp.SMTPSession, org.apache.mailet.MailAddress, org.apache.mailet.MailAddress)


Copyright © 2010 The Apache Software Foundation. All Rights Reserved.