org.apache.james.api.dnsservice
Class AbstractDNSServer

java.lang.Object
  extended by org.apache.james.api.dnsservice.AbstractDNSServer
All Implemented Interfaces:
DNSService

public class AbstractDNSServer
extends java.lang.Object
implements DNSService

Abstract class to simplify the mocks


Field Summary
 
Fields inherited from interface org.apache.james.api.dnsservice.DNSService
ROLE
 
Constructor Summary
AbstractDNSServer()
           
 
Method Summary
 java.util.Collection findMXRecords(java.lang.String hostname)
          Return a prioritized unmodifiable list of host handling mail for the domain.
 java.util.Collection findTXTRecords(java.lang.String hostname)
          Get a collection of DNS TXT Records
 java.net.InetAddress[] getAllByName(java.lang.String host)
           
 java.net.InetAddress getByName(java.lang.String host)
           
 java.lang.String getHostName(java.net.InetAddress addr)
           
 java.net.InetAddress getLocalHost()
           
 java.util.Iterator getSMTPHostAddresses(java.lang.String domainName)
          Returns an Iterator over org.apache.mailet.HostAddress, a specialized subclass of javax.mail.URLName, which provides location information for servers that are specified as mail handlers for the given hostname.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDNSServer

public AbstractDNSServer()
Method Detail

findMXRecords

public java.util.Collection findMXRecords(java.lang.String hostname)
Description copied from interface: DNSService

Return a prioritized unmodifiable list of host handling mail for the domain.

First lookup MX hosts, then MX hosts of the CNAME adress, and if no server is found return the IP of the hostname

Specified by:
findMXRecords in interface DNSService
Parameters:
hostname - domain name to look up
Returns:
a unmodifiable list of handling servers corresponding to this mail domain name
See Also:
DNSService.findMXRecords(String)

findTXTRecords

public java.util.Collection findTXTRecords(java.lang.String hostname)
Description copied from interface: DNSService
Get a collection of DNS TXT Records

Specified by:
findTXTRecords in interface DNSService
Parameters:
hostname - The hostname to check
Returns:
collection of strings representing TXT record values
See Also:
DNSService.findTXTRecords(String)

getAllByName

public java.net.InetAddress[] getAllByName(java.lang.String host)
                                    throws java.net.UnknownHostException
Specified by:
getAllByName in interface DNSService
Throws:
java.net.UnknownHostException
See Also:
DNSService.getAllByName(String)

getByName

public java.net.InetAddress getByName(java.lang.String host)
                               throws java.net.UnknownHostException
Specified by:
getByName in interface DNSService
Throws:
java.net.UnknownHostException
See Also:
DNSService.getByName(String)

getSMTPHostAddresses

public java.util.Iterator getSMTPHostAddresses(java.lang.String domainName)
Description copied from interface: DNSService
Returns an Iterator over org.apache.mailet.HostAddress, a specialized subclass of javax.mail.URLName, which provides location information for servers that are specified as mail handlers for the given hostname. This is done using MX records, and the HostAddress instances are returned sorted by MX priority. If no host is found for domainName, the Iterator returned will be empty and the first call to hasNext() will return false. The Iterator is a nested iterator: the outer iteration is over the results of the MX record lookup, and the inner iteration is over potentially multiple A records for each MX record. DNS lookups are deferred until actually needed.

Specified by:
getSMTPHostAddresses in interface DNSService
Parameters:
domainName - - the domain for which to find mail servers
Returns:
an Iterator over HostAddress instances, sorted by priority
See Also:
DNSService.getSMTPHostAddresses(String)

getHostName

public java.lang.String getHostName(java.net.InetAddress addr)
Specified by:
getHostName in interface DNSService
See Also:
DNSService.getHostName(java.net.InetAddress)

getLocalHost

public java.net.InetAddress getLocalHost()
                                  throws java.net.UnknownHostException
Specified by:
getLocalHost in interface DNSService
Throws:
java.net.UnknownHostException
See Also:
DNSService.getLocalHost()


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.