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 intThe 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)longGet timeStamp (t)booleanReturn true if the explanation should be ignoredvoidIncrease 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) voidpushChecker(SPFChecker checker) Add the given SPFChecker on top of the stackremoveAttribute(String key) Remove the attribute stored under the given keyvoidsetAttribute(String key, Object value) Sets a new attribute in the sessionvoidsetClientDomain(String clientDomain) Sets the calculated clientDomainvoidsetCurrentDomain(String domain) Set the currentDomainvoidsetCurrentResult(String result) Set the current resultvoidsetCurrentResultExpanded(String result) voidsetExplanation(String explanation) Set the explanation which will returned when a fail matchvoidsetIgnoreExplanation(boolean ignoreExplanation) Get set to true if the explanation should be ignoredvoidsetReceivingDomain(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:MacroDataGet current-senderpart (l)- Specified by:
getCurrentSenderPartin interfaceMacroData- Returns:
- current-senderpart
- See Also:
-
getMailFrom
Description copied from interface:MacroDataGet responsible-sender (s)- Specified by:
getMailFromin interfaceMacroData- Returns:
- responsible-sender
- See Also:
-
getHostName
Description copied from interface:MacroDataGet sender-domain (h)- Specified by:
getHostNamein interfaceMacroData- Returns:
- sender-domain
- See Also:
-
getCurrentDomain
Description copied from interface:MacroDataGet current-domain (d)- Specified by:
getCurrentDomainin interfaceMacroData- Returns:
- current-domain
- See Also:
-
getInAddress
Description copied from interface:MacroDataGet inAddress (v)- Specified by:
getInAddressin interfaceMacroData- Returns:
- inAddress
- See Also:
-
getClientDomain
Description copied from interface:MacroDataGet clientDomain (p)- Specified by:
getClientDomainin interfaceMacroData- Returns:
- clientDomain
- See Also:
-
setClientDomain
Sets the calculated clientDomain- Parameters:
clientDomain- the new clientDomain
-
getSenderDomain
Description copied from interface:MacroDataGet senderDomain (o)- Specified by:
getSenderDomainin interfaceMacroData- Returns:
- senderDomain
- See Also:
-
getIpAddress
Get the ipAddress which was used to connect- Returns:
- ipAddres
-
getMacroIpAddress
Description copied from interface:MacroDataGet sending-host (i)- Specified by:
getMacroIpAddressin interfaceMacroData- Returns:
- sending-host
- See Also:
-
getTimeStamp
public long getTimeStamp()Description copied from interface:MacroDataGet timeStamp (t)- Specified by:
getTimeStampin interfaceMacroData- Returns:
- timeStamp
- See Also:
-
getReadableIP
Description copied from interface:MacroDataGet readableIP (c)- Specified by:
getReadableIPin interfaceMacroData- Returns:
- readableIP
- See Also:
-
getReceivingDomain
Description copied from interface:MacroDataGet receivingDomain (r)- Specified by:
getReceivingDomainin 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
-