org.apache.james.api.dnsservice
Interface DNSService

All Known Implementing Classes:
AbstractDNSServer, DNSServer

public interface DNSService

Provides abstraction for DNS resolutions. The interface is Mail specific. It may be a good idea to make the interface more generic or expose commonly needed DNS methods.


Field Summary
static java.lang.String ROLE
          The component role used by components implementing this service
 
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.
 

Field Detail

ROLE

static final java.lang.String ROLE
The component role used by components implementing this service

See Also:
Constant Field Values
Method Detail

findMXRecords

java.util.Collection findMXRecords(java.lang.String hostname)
                                   throws TemporaryResolutionException

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

Parameters:
hostname - domain name to look up
Returns:
a unmodifiable list of handling servers corresponding to this mail domain name
Throws:
TemporaryResolutionException - get thrown on temporary problems

findTXTRecords

java.util.Collection findTXTRecords(java.lang.String hostname)
Get a collection of DNS TXT Records

Parameters:
hostname - The hostname to check
Returns:
collection of strings representing TXT record values

getSMTPHostAddresses

java.util.Iterator getSMTPHostAddresses(java.lang.String domainName)
                                        throws TemporaryResolutionException
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.

Parameters:
domainName - - the domain for which to find mail servers
Returns:
an Iterator over HostAddress instances, sorted by priority
Throws:
TemporaryResolutionException - get thrown on temporary problems
Since:
v2.2.0a16-unstable

getAllByName

java.net.InetAddress[] getAllByName(java.lang.String host)
                                    throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException
See Also:
InetAddress.getAllByName(String)

getByName

java.net.InetAddress getByName(java.lang.String host)
                               throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException
See Also:
InetAddress.getByName(String)

getHostName

java.lang.String getHostName(java.net.InetAddress addr)
See Also:
Address.getHostName(InetAddress)

getLocalHost

java.net.InetAddress getLocalHost()
                                  throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException


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