Package org.apache.james.jspf.core
Class SPFSession
java.lang.Object
org.apache.james.jspf.core.SPFSession
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionstatic final int
The maximum mechanismn which are allowed to use -
Constructor Summary
ConstructorsConstructorDescriptionSPFSession
(String mailFrom, String heloDomain, String clientIP) Build the SPFSession from the given parameters -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(String key) Retrieve a stored attributeGet clientDomain (p)Get current-domain (d)Get the current resultGet current-senderpart (l)Get the explanationGet sender-domain (h)Get inAddress (v)Get the ipAddress which was used to connectGet sending-host (i)Get responsible-sender (s)Get readableIP (c)Get receivingDomain (r)Get senderDomain (o)long
Get timeStamp (t)boolean
Return true if the explanation should be ignoredvoid
Increase the current depth: if we reach maximum calls we must throw a PermErrorException.Remove the SPFChecker on the top and return it.popChecker
(Predicate<SPFChecker> predicate) void
pushChecker
(SPFChecker checker) Add the given SPFChecker on top of the stackremoveAttribute
(String key) Remove the attribute stored under the given keyvoid
setAttribute
(String key, Object value) Sets a new attribute in the sessionvoid
setClientDomain
(String clientDomain) Sets the calculated clientDomainvoid
setCurrentDomain
(String domain) Set the currentDomainvoid
setCurrentResult
(String result) Set the current resultvoid
setCurrentResultExpanded
(String result) void
setExplanation
(String explanation) Set the explanation which will returned when a fail matchvoid
setIgnoreExplanation
(boolean ignoreExplanation) Get set to true if the explanation should be ignoredvoid
setReceivingDomain
(String receivingDomain) Sets the new receiving domaintoString()
-
Field Details
-
MAX_DEPTH
public static final int MAX_DEPTHThe maximum mechanismn which are allowed to use- See Also:
-
-
Constructor Details
-
SPFSession
Build the SPFSession from the given parameters- Parameters:
mailFrom
- The emailaddress of the senderheloDomain
- The helo provided by the senderclientIP
- The ipaddress of the client
-
-
Method Details
-
getCurrentSenderPart
Description copied from interface:MacroData
Get current-senderpart (l)- Specified by:
getCurrentSenderPart
in interfaceMacroData
- Returns:
- current-senderpart
- See Also:
-
getMailFrom
Description copied from interface:MacroData
Get responsible-sender (s)- Specified by:
getMailFrom
in interfaceMacroData
- Returns:
- responsible-sender
- See Also:
-
getHostName
Description copied from interface:MacroData
Get sender-domain (h)- Specified by:
getHostName
in interfaceMacroData
- Returns:
- sender-domain
- See Also:
-
getCurrentDomain
Description copied from interface:MacroData
Get current-domain (d)- Specified by:
getCurrentDomain
in interfaceMacroData
- Returns:
- current-domain
- See Also:
-
getInAddress
Description copied from interface:MacroData
Get inAddress (v)- Specified by:
getInAddress
in interfaceMacroData
- Returns:
- inAddress
- See Also:
-
getClientDomain
Description copied from interface:MacroData
Get clientDomain (p)- Specified by:
getClientDomain
in interfaceMacroData
- Returns:
- clientDomain
- See Also:
-
setClientDomain
Sets the calculated clientDomain- Parameters:
clientDomain
- the new clientDomain
-
getSenderDomain
Description copied from interface:MacroData
Get senderDomain (o)- Specified by:
getSenderDomain
in interfaceMacroData
- Returns:
- senderDomain
- See Also:
-
getIpAddress
Get the ipAddress which was used to connect- Returns:
- ipAddres
-
getMacroIpAddress
Description copied from interface:MacroData
Get sending-host (i)- Specified by:
getMacroIpAddress
in interfaceMacroData
- Returns:
- sending-host
- See Also:
-
getTimeStamp
public long getTimeStamp()Description copied from interface:MacroData
Get timeStamp (t)- Specified by:
getTimeStamp
in interfaceMacroData
- Returns:
- timeStamp
- See Also:
-
getReadableIP
Description copied from interface:MacroData
Get readableIP (c)- Specified by:
getReadableIP
in interfaceMacroData
- Returns:
- readableIP
- See Also:
-
getReceivingDomain
Description copied from interface:MacroData
Get receivingDomain (r)- Specified by:
getReceivingDomain
in interfaceMacroData
- Returns:
- receivingDomain
- See Also:
-
setReceivingDomain
Sets the new receiving domain- Parameters:
receivingDomain
- the new receiving domain
-
increaseCurrentDepth
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
Set the currentDomain- Parameters:
domain
- The current used domain
-
setExplanation
Set the explanation which will returned when a fail match- Parameters:
explanation
- This String is set as explanation
-
getExplanation
Get the explanation- Returns:
- explanation
-
setCurrentResult
Set the current result- Parameters:
result
- result
-
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
Retrieve a stored attribute- Parameters:
key
- the attribute key- Returns:
- the stored attribute
-
setAttribute
Sets a new attribute in the session- Parameters:
key
- attribute keyvalue
- the value for this attribute
-
removeAttribute
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
Add the given SPFChecker on top of the stack- Parameters:
checker
-
-
popChecker
Remove the SPFChecker on the top and return it. If no SPFChecker is left null is returned- Returns:
- the last checker
-
popChecker
-
setCurrentResultExpanded
- Parameters:
result
-
-
getCurrentResultExpanded
- Returns:
- current result converted/expanded
-
toString
-