Class SPFSession

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

public class SPFSession extends 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 Details

    • MAX_DEPTH

      public static final int MAX_DEPTH
      The maximum mechanismn which are allowed to use
      See Also:
  • Constructor Details

    • SPFSession

      public SPFSession(String mailFrom, String heloDomain, 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 Details

    • getCurrentSenderPart

      public String getCurrentSenderPart()
      Description copied from interface: MacroData
      Get current-senderpart (l)
      Specified by:
      getCurrentSenderPart in interface MacroData
      Returns:
      current-senderpart
      See Also:
    • getMailFrom

      public String getMailFrom()
      Description copied from interface: MacroData
      Get responsible-sender (s)
      Specified by:
      getMailFrom in interface MacroData
      Returns:
      responsible-sender
      See Also:
    • getHostName

      public String getHostName()
      Description copied from interface: MacroData
      Get sender-domain (h)
      Specified by:
      getHostName in interface MacroData
      Returns:
      sender-domain
      See Also:
    • getCurrentDomain

      public String getCurrentDomain()
      Description copied from interface: MacroData
      Get current-domain (d)
      Specified by:
      getCurrentDomain in interface MacroData
      Returns:
      current-domain
      See Also:
    • getInAddress

      public String getInAddress()
      Description copied from interface: MacroData
      Get inAddress (v)
      Specified by:
      getInAddress in interface MacroData
      Returns:
      inAddress
      See Also:
    • getClientDomain

      public String getClientDomain()
      Description copied from interface: MacroData
      Get clientDomain (p)
      Specified by:
      getClientDomain in interface MacroData
      Returns:
      clientDomain
      See Also:
    • setClientDomain

      public void setClientDomain(String clientDomain)
      Sets the calculated clientDomain
      Parameters:
      clientDomain - the new clientDomain
    • getSenderDomain

      public String getSenderDomain()
      Description copied from interface: MacroData
      Get senderDomain (o)
      Specified by:
      getSenderDomain in interface MacroData
      Returns:
      senderDomain
      See Also:
    • getIpAddress

      public String getIpAddress()
      Get the ipAddress which was used to connect
      Returns:
      ipAddres
    • getMacroIpAddress

      public String getMacroIpAddress()
      Description copied from interface: MacroData
      Get sending-host (i)
      Specified by:
      getMacroIpAddress in interface MacroData
      Returns:
      sending-host
      See Also:
    • getTimeStamp

      public long getTimeStamp()
      Description copied from interface: MacroData
      Get timeStamp (t)
      Specified by:
      getTimeStamp in interface MacroData
      Returns:
      timeStamp
      See Also:
    • getReadableIP

      public String getReadableIP()
      Description copied from interface: MacroData
      Get readableIP (c)
      Specified by:
      getReadableIP in interface MacroData
      Returns:
      readableIP
      See Also:
    • getReceivingDomain

      public String getReceivingDomain()
      Description copied from interface: MacroData
      Get receivingDomain (r)
      Specified by:
      getReceivingDomain in interface MacroData
      Returns:
      receivingDomain
      See Also:
    • setReceivingDomain

      public void setReceivingDomain(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(String domain)
      Set the currentDomain
      Parameters:
      domain - The current used domain
    • setExplanation

      public void setExplanation(String explanation)
      Set the explanation which will returned when a fail match
      Parameters:
      explanation - This String is set as explanation
    • getExplanation

      public String getExplanation()
      Get the explanation
      Returns:
      explanation
    • setCurrentResult

      public void setCurrentResult(String result)
      Set the current result
      Parameters:
      result - result
    • getCurrentResult

      public 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 Object getAttribute(String key)
      Retrieve a stored attribute
      Parameters:
      key - the attribute key
      Returns:
      the stored attribute
    • setAttribute

      public void setAttribute(String key, Object value)
      Sets a new attribute in the session
      Parameters:
      key - attribute key
      value - the value for this attribute
    • removeAttribute

      public Object removeAttribute(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
    • popChecker

      public SPFChecker popChecker(Predicate<SPFChecker> predicate)
    • setCurrentResultExpanded

      public void setCurrentResultExpanded(String result)
      Parameters:
      result -
    • getCurrentResultExpanded

      public String getCurrentResultExpanded()
      Returns:
      current result converted/expanded
    • toString

      public String toString()
      Overrides:
      toString in class Object