org.apache.james.jspf.terms
Class AMechanism

java.lang.Object
  extended by org.apache.james.jspf.terms.GenericMechanism
      extended by org.apache.james.jspf.terms.AMechanism
All Implemented Interfaces:
LogEnabled, MacroExpandEnabled, SPFChecker, SPFCheckerDNSResponseListener, ConfigurationEnabled, Mechanism
Direct Known Subclasses:
MXMechanism

public class AMechanism
extends GenericMechanism
implements SPFCheckerDNSResponseListener

This class represent the a mechanism


Field Summary
static java.lang.String REGEX
          ABNF: A = "a" [ ":" domain-spec ] [ dual-cidr-length ]
 
Fields inherited from class org.apache.james.jspf.terms.GenericMechanism
DUAL_CIDR_LENGTH_REGEX, IP4_CIDR_LENGTH_REGEX, IP6_CIDR_LENGTH_REGEX, log, macroExpand
 
Constructor Summary
AMechanism()
           
 
Method Summary
 boolean checkAddressList(IPAddr checkAddress, java.util.List addressList, int cidr)
          Check if the given ipaddress array contains the provided ip.
 DNSLookupContinuation checkSPF(SPFSession spfData)
          Run check for SPF with the given values.
 void config(Configuration params)
          Configuration
 java.util.List getAAAARecords(java.lang.String strServer)
          Retrieve a list of AAAA records
 java.util.List getARecords(java.lang.String strServer)
          Get a list of IPAddr's for a server
protected  int getIp4cidr()
           
protected  int getIp6cidr()
           
 DNSLookupContinuation onDNSResponse(DNSResponse response, SPFSession spfSession)
          Continue the check for SPF with the given values and the given DNSResponse
 java.lang.String toString()
           
protected  java.lang.String toString(java.lang.String mechKey)
           
 
Methods inherited from class org.apache.james.jspf.terms.GenericMechanism
enableLogging, enableMacroExpand, expandHost, getDomain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REGEX

public static final java.lang.String REGEX
ABNF: A = "a" [ ":" domain-spec ] [ dual-cidr-length ]

See Also:
Constant Field Values
Constructor Detail

AMechanism

public AMechanism()
Method Detail

checkSPF

public DNSLookupContinuation checkSPF(SPFSession spfData)
                               throws PermErrorException,
                                      TempErrorException,
                                      NeutralException,
                                      NoneException
Description copied from interface: SPFChecker
Run check for SPF with the given values.

Specified by:
checkSPF in interface SPFChecker
Parameters:
spfData - The SPF1Data which should be used to run the check
Throws:
PermErrorException - Get thrown if an error was detected
TempErrorException - Get thrown if a DNS problem was detected
NeutralException - Get thrown if the result should be neutral
NoneException - Get thrown if no Record was found
See Also:
SPFChecker.checkSPF(org.apache.james.jspf.core.SPFSession)

config

public void config(Configuration params)
            throws PermErrorException
Description copied from interface: ConfigurationEnabled
Configuration

Specified by:
config in interface ConfigurationEnabled
Overrides:
config in class GenericMechanism
Parameters:
params - the ConfigurationMatch which should used
Throws:
PermErrorException - get thrown if a PermError should returned
See Also:
GenericMechanism.config(Configuration)

checkAddressList

public boolean checkAddressList(IPAddr checkAddress,
                                java.util.List addressList,
                                int cidr)
                         throws PermErrorException
Check if the given ipaddress array contains the provided ip.

Parameters:
checkAddress - The ip wich should be contained in the given ArrayList
addressList - The ip ArrayList.
Returns:
true or false
Throws:
PermErrorException

getIp4cidr

protected int getIp4cidr()
Returns:
Returns the ip4cidr.

getIp6cidr

protected int getIp6cidr()
Returns:
Returns the ip6cidr.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

toString

protected java.lang.String toString(java.lang.String mechKey)
See Also:
Object.toString()

getAAAARecords

public java.util.List getAAAARecords(java.lang.String strServer)
Retrieve a list of AAAA records


getARecords

public java.util.List getARecords(java.lang.String strServer)
Get a list of IPAddr's for a server

Parameters:
strServer - The hostname or ipAddress whe should get the A-Records for
Returns:
The ipAddresses

onDNSResponse

public DNSLookupContinuation onDNSResponse(DNSResponse response,
                                           SPFSession spfSession)
                                    throws PermErrorException,
                                           TempErrorException,
                                           NoneException,
                                           NeutralException
Description copied from interface: SPFCheckerDNSResponseListener
Continue the check for SPF with the given values and the given DNSResponse

Specified by:
onDNSResponse in interface SPFCheckerDNSResponseListener
Parameters:
response - The DNSResponse which should be used to run the check
spfSession - The SPFSession which should be used to run the check
Throws:
PermErrorException - Get thrown if an error was detected
TempErrorException - Get thrown if a DNS problem was detected
NoneException - Get thrown if no Record was found
NeutralException - Get thrown if the result should be neutral
See Also:
SPFCheckerDNSResponseListener.onDNSResponse(org.apache.james.jspf.core.DNSResponse, org.apache.james.jspf.core.SPFSession)


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