org.apache.james.jspf.core
Class SPFSession

java.lang.Object
  extended by org.apache.james.jspf.core.SPFSession
All Implemented Interfaces:
MacroData

public class SPFSession
extends java.lang.Object
implements MacroData

This Class is used as a container between the other classes. All necessary values get stored here and get retrieved from here.


Field Summary
static int MAX_DEPTH
          The maximum mechanismn which are allowed to use
 
Constructor Summary
SPFSession(java.lang.String mailFrom, java.lang.String heloDomain, java.lang.String clientIP)
          Build the SPFSession from the given parameters
 
Method Summary
 java.lang.Object getAttribute(java.lang.String key)
          Retrieve a stored attribute
 java.lang.String getClientDomain()
          Get clientDomain (p)
 java.lang.String getCurrentDomain()
          Get current-domain (d)
 java.lang.String getCurrentResult()
          Get the current result
 java.lang.String getCurrentResultExpanded()
           
 java.lang.String getCurrentSenderPart()
          Get current-senderpart (l)
 java.lang.String getExplanation()
          Get the explanation
 java.lang.String getHostName()
          Get sender-domain (h)
 java.lang.String getInAddress()
          Get inAddress (v)
 java.lang.String getIpAddress()
          Get the ipAddress which was used to connect
 java.lang.String getMacroIpAddress()
          Get sending-host (i)
 java.lang.String getMailFrom()
          Get responsible-sender (s)
 java.lang.String getReadableIP()
          Get readableIP (c)
 java.lang.String getReceivingDomain()
          Get receivingDomain (r)
 java.lang.String getSenderDomain()
          Get senderDomain (o)
 long getTimeStamp()
          Get timeStamp (t)
 boolean ignoreExplanation()
          Return true if the explanation should be ignored
 void increaseCurrentDepth()
          Increase the current depth: if we reach maximum calls we must throw a PermErrorException.
 SPFChecker popChecker()
          Remove the SPFChecker on the top and return it.
 void pushChecker(SPFChecker checker)
          Add the given SPFChecker on top of the stack
 java.lang.Object removeAttribute(java.lang.String key)
          Remove the attribute stored under the given key
 void setAttribute(java.lang.String key, java.lang.Object value)
          Sets a new attribute in the session
 void setClientDomain(java.lang.String clientDomain)
          Sets the calculated clientDomain
 void setCurrentDomain(java.lang.String domain)
          Set the currentDomain
 void setCurrentResult(java.lang.String result)
          Set the current result
 void setCurrentResultExpanded(java.lang.String result)
           
 void setExplanation(java.lang.String explanation)
          Set the explanation which will returned when a fail match
 void setIgnoreExplanation(boolean ignoreExplanation)
          Get set to true if the explanation should be ignored
 void setReceivingDomain(java.lang.String receivingDomain)
          Sets the new receiving domain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_DEPTH

public static final int MAX_DEPTH
The maximum mechanismn which are allowed to use

See Also:
Constant Field Values
Constructor Detail

SPFSession

public SPFSession(java.lang.String mailFrom,
                  java.lang.String heloDomain,
                  java.lang.String clientIP)
Build the SPFSession from the given parameters

Parameters:
mailFrom - The emailaddress of the sender
heloDomain - The helo provided by the sender
clientIP - The ipaddress of the client
Method Detail

getCurrentSenderPart

public java.lang.String getCurrentSenderPart()
Description copied from interface: MacroData
Get current-senderpart (l)

Specified by:
getCurrentSenderPart in interface MacroData
Returns:
current-senderpart
See Also:
MacroData.getCurrentSenderPart()

getMailFrom

public java.lang.String getMailFrom()
Description copied from interface: MacroData
Get responsible-sender (s)

Specified by:
getMailFrom in interface MacroData
Returns:
responsible-sender
See Also:
MacroData.getMailFrom()

getHostName

public java.lang.String getHostName()
Description copied from interface: MacroData
Get sender-domain (h)

Specified by:
getHostName in interface MacroData
Returns:
sender-domain
See Also:
MacroData.getHostName()

getCurrentDomain

public java.lang.String getCurrentDomain()
Description copied from interface: MacroData
Get current-domain (d)

Specified by:
getCurrentDomain in interface MacroData
Returns:
current-domain
See Also:
MacroData.getCurrentDomain()

getInAddress

public java.lang.String getInAddress()
Description copied from interface: MacroData
Get inAddress (v)

Specified by:
getInAddress in interface MacroData
Returns:
inAddress
See Also:
MacroData.getInAddress()

getClientDomain

public java.lang.String getClientDomain()
Description copied from interface: MacroData
Get clientDomain (p)

Specified by:
getClientDomain in interface MacroData
Returns:
clientDomain
See Also:
MacroData.getClientDomain()

setClientDomain

public void setClientDomain(java.lang.String clientDomain)
Sets the calculated clientDomain

Parameters:
clientDomain - the new clientDomain

getSenderDomain

public java.lang.String getSenderDomain()
Description copied from interface: MacroData
Get senderDomain (o)

Specified by:
getSenderDomain in interface MacroData
Returns:
senderDomain
See Also:
MacroData.getSenderDomain()

getIpAddress

public java.lang.String getIpAddress()
Get the ipAddress which was used to connect

Returns:
ipAddres

getMacroIpAddress

public java.lang.String getMacroIpAddress()
Description copied from interface: MacroData
Get sending-host (i)

Specified by:
getMacroIpAddress in interface MacroData
Returns:
sending-host
See Also:
MacroData.getMacroIpAddress()

getTimeStamp

public long getTimeStamp()
Description copied from interface: MacroData
Get timeStamp (t)

Specified by:
getTimeStamp in interface MacroData
Returns:
timeStamp
See Also:
MacroData.getTimeStamp()

getReadableIP

public java.lang.String getReadableIP()
Description copied from interface: MacroData
Get readableIP (c)

Specified by:
getReadableIP in interface MacroData
Returns:
readableIP
See Also:
MacroData.getReadableIP()

getReceivingDomain

public java.lang.String getReceivingDomain()
Description copied from interface: MacroData
Get receivingDomain (r)

Specified by:
getReceivingDomain in interface MacroData
Returns:
receivingDomain
See Also:
MacroData.getReceivingDomain()

setReceivingDomain

public void setReceivingDomain(java.lang.String receivingDomain)
Sets the new receiving domain

Parameters:
receivingDomain - the new receiving domain

increaseCurrentDepth

public void increaseCurrentDepth()
                          throws PermErrorException
Increase the current depth: if we reach maximum calls we must throw a PermErrorException. See SPF-RFC Section 10.1. Processing Limits

Throws:
PermErrorException

setCurrentDomain

public void setCurrentDomain(java.lang.String domain)
Set the currentDomain

Parameters:
domain - The current used domain

setExplanation

public void setExplanation(java.lang.String explanation)
Set the explanation which will returned when a fail match

Parameters:
explanation - This String is set as explanation

getExplanation

public java.lang.String getExplanation()
Get the explanation

Returns:
explanation

setCurrentResult

public void setCurrentResult(java.lang.String result)
Set the current result

Parameters:
result - result

getCurrentResult

public java.lang.String getCurrentResult()
Get the current result

Returns:
current result

setIgnoreExplanation

public void setIgnoreExplanation(boolean ignoreExplanation)
Get set to true if the explanation should be ignored

Parameters:
ignoreExplanation - true or false

ignoreExplanation

public boolean ignoreExplanation()
Return true if the explanation should be ignored

Returns:
true of false

getAttribute

public java.lang.Object getAttribute(java.lang.String key)
Retrieve a stored attribute

Parameters:
key - the attribute key
Returns:
the stored attribute

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)
Sets a new attribute in the session

Parameters:
key - attribute key
value - the value for this attribute

removeAttribute

public java.lang.Object removeAttribute(java.lang.String key)
Remove the attribute stored under the given key

Parameters:
key - the key of the attribute
Returns:
object the attribute which was stored with the key

pushChecker

public void pushChecker(SPFChecker checker)
Add the given SPFChecker on top of the stack

Parameters:
checker -

popChecker

public SPFChecker popChecker()
Remove the SPFChecker on the top and return it. If no SPFChecker is left null is returned

Returns:
the last checker

setCurrentResultExpanded

public void setCurrentResultExpanded(java.lang.String result)
Parameters:
result -

getCurrentResultExpanded

public java.lang.String getCurrentResultExpanded()
Returns:
current result converted/expanded


Copyright © 2006-2009 The Apache Software Foundation. All Rights Reserved.