org.apache.james.jspf.impl
Class DNSServiceXBillImpl

java.lang.Object
  extended by org.apache.james.jspf.impl.DNSServiceXBillImpl
All Implemented Interfaces:
DNSService

public class DNSServiceXBillImpl
extends java.lang.Object
implements DNSService

This class contains helper to get all neccassary DNS infos that are needed for SPF


Field Summary
protected  Logger log
           
protected  int recordLimit
           
protected  org.xbill.DNS.Resolver resolver
           
 
Constructor Summary
DNSServiceXBillImpl(Logger logger)
          Default Constructor.
DNSServiceXBillImpl(Logger logger, org.xbill.DNS.Resolver resolver)
          Constructor to specify a custom resolver.
 
Method Summary
static java.util.List convertRecordsToList(org.xbill.DNS.Record[] rr)
          Convert the given Record array to a List
 java.util.List getLocalDomainNames()
          Try to get all domain names for the running host
 int getRecordLimit()
           
 java.util.List getRecords(DNSRequest request)
          Retrieve dns records for the given host
 void setRecordLimit(int recordLimit)
          Set a new limit for the number of records for MX and PTR lookups.
 void setTimeOut(int timeOut)
          NOTE if this class is created with the default constructor it will use the static DefaultResolver from DNSJava and this method will change it's timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected Logger log

recordLimit

protected int recordLimit

resolver

protected org.xbill.DNS.Resolver resolver
Constructor Detail

DNSServiceXBillImpl

public DNSServiceXBillImpl(Logger logger)
Default Constructor. Uses the DNSJava static DefaultResolver


DNSServiceXBillImpl

public DNSServiceXBillImpl(Logger logger,
                           org.xbill.DNS.Resolver resolver)
Constructor to specify a custom resolver.

Method Detail

setTimeOut

public void setTimeOut(int timeOut)
NOTE if this class is created with the default constructor it will use the static DefaultResolver from DNSJava and this method will change it's timeout. Other tools using DNSJava in the same JVM could be affected by this timeout change.

Specified by:
setTimeOut in interface DNSService
Parameters:
timeOut - The timeout in seconds
See Also:
DNSService.setTimeOut(int)

getLocalDomainNames

public java.util.List getLocalDomainNames()
Description copied from interface: DNSService
Try to get all domain names for the running host

Specified by:
getLocalDomainNames in interface DNSService
Returns:
names A List contains all domain names which could resolved
See Also:
DNSService.getLocalDomainNames()

getRecordLimit

public int getRecordLimit()
Specified by:
getRecordLimit in interface DNSService
Returns:
the current record limit

setRecordLimit

public void setRecordLimit(int recordLimit)
Set a new limit for the number of records for MX and PTR lookups.

Specified by:
setRecordLimit in interface DNSService
Parameters:
recordLimit -

getRecords

public java.util.List getRecords(DNSRequest request)
                          throws TimeoutException
Description copied from interface: DNSService
Retrieve dns records for the given host

Specified by:
getRecords in interface DNSService
Parameters:
request - the dns request
Returns:
an array of Strings representing the records
Throws:
TimeoutException
See Also:
DNSService.getRecords(org.apache.james.jspf.core.DNSRequest)

convertRecordsToList

public static java.util.List convertRecordsToList(org.xbill.DNS.Record[] rr)
Convert the given Record array to a List

Parameters:
rr - Record array
Returns:
list


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