Nuxeo Enterprise Platform 5.3

org.nuxeo.ecm.directory.ldap.dns
Class DNSServiceResolverImpl

java.lang.Object
  extended by org.nuxeo.ecm.directory.ldap.dns.DNSServiceResolverImpl
All Implemented Interfaces:
DNSServiceResolver

public class DNSServiceResolverImpl
extends Object
implements DNSServiceResolver

Utility class to perform DNS lookups for services.


Field Summary
protected  Map<String,List<DNSServiceEntry>> cache
          Create a cache to hold the at most 100 recent DNS lookups for a period of 10 minutes.
protected static DirContext context
           
protected static DNSServiceResolver instance
           
protected  long lastCacheUpdate
           
static Log log
           
protected  long maxDelay
           
protected static String SRV_RECORD
           
 
Fields inherited from interface org.nuxeo.ecm.directory.ldap.dns.DNSServiceResolver
DNS_CACHE_EXPIRY, LDAP_SERVICE_PREFIX
 
Constructor Summary
protected DNSServiceResolverImpl()
           
 
Method Summary
static DNSServiceResolver getInstance()
           
protected  List<DNSServiceEntry> resolveDnsServiceRecord(String service, String domain)
          Returns the host name and port that a server providing the specified service can be reached at.
 List<DNSServiceEntry> resolveLDAPDomainServers(String domain)
          Returns a list of LDAP servers for the specified domain by performing an SRV DNS lookup on _ldap.
 List<DNSServiceEntry> resolveLDAPDomainServers(String domain, String prefix)
          Returns a list of LDAP servers for the specified domain by performing an SRV DNS lookup using a custom DNS service prefix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final Log log

instance

protected static DNSServiceResolver instance

SRV_RECORD

protected static final String SRV_RECORD
See Also:
Constant Field Values

cache

protected Map<String,List<DNSServiceEntry>> cache
Create a cache to hold the at most 100 recent DNS lookups for a period of 10 minutes.


lastCacheUpdate

protected long lastCacheUpdate

maxDelay

protected final long maxDelay

context

protected static DirContext context
Constructor Detail

DNSServiceResolverImpl

protected DNSServiceResolverImpl()
Method Detail

getInstance

public static final DNSServiceResolver getInstance()

resolveDnsServiceRecord

protected List<DNSServiceEntry> resolveDnsServiceRecord(String service,
                                                        String domain)
                                                 throws NamingException
Returns the host name and port that a server providing the specified service can be reached at. A DNS lookup for a SRV record in the form "_service.example.com" is attempted.

As an example, a lookup for "example.com" for the service _gc._tcp may return "dc01.example.com:3268".

Parameters:
service - the service.
domain - the domain.
Returns:
a List of DNSServiceEntrys, which encompasses the hostname and port that the server can be reached at for the specified domain.
Throws:
NamingException - if the DNS server is unreachable

resolveLDAPDomainServers

public List<DNSServiceEntry> resolveLDAPDomainServers(String domain)
                                               throws NamingException
Description copied from interface: DNSServiceResolver
Returns a list of LDAP servers for the specified domain by performing an SRV DNS lookup on _ldap._tcp.${domain}

Specified by:
resolveLDAPDomainServers in interface DNSServiceResolver
Returns:
the list of SRV dns entries
Throws:
NamingException

resolveLDAPDomainServers

public List<DNSServiceEntry> resolveLDAPDomainServers(String domain,
                                                      String prefix)
                                               throws NamingException
Description copied from interface: DNSServiceResolver
Returns a list of LDAP servers for the specified domain by performing an SRV DNS lookup using a custom DNS service prefix.

Specified by:
resolveLDAPDomainServers in interface DNSServiceResolver
prefix - custom SRV prefix such as "_gc._tcp"
Returns:
the list of SRV dns entries
Throws:
NamingException

Nuxeo Enterprise Platform 5.3

Copyright © 2010 Nuxeo SAS. All Rights Reserved.