Package org.nuxeo.ecm.directory.ldap.dns
Class DNSServiceResolverImpl
java.lang.Object
org.nuxeo.ecm.directory.ldap.dns.DNSServiceResolverImpl
- All Implemented Interfaces:
DNSServiceResolver
Utility class to perform DNS lookups for services.
-
Field Summary
Modifier and TypeFieldDescriptionprotected Map<String,
List<DNSServiceEntry>> Create a cache to hold the at most 100 recent DNS lookups for a period of 10 minutes.protected final DirContext
protected static DNSServiceResolver
protected long
protected final long
protected static final String
Fields inherited from interface org.nuxeo.ecm.directory.ldap.dns.DNSServiceResolver
DNS_CACHE_EXPIRY, LDAP_SERVICE_PREFIX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic DNSServiceResolver
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.resolveLDAPDomainServers
(String domain) Returns a list of LDAP servers for the specified domain by performing an SRV DNS lookup on _ldap.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.
-
Field Details
-
instance
-
SRV_RECORD
- See Also:
-
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
-
-
Constructor Details
-
DNSServiceResolverImpl
protected DNSServiceResolverImpl()
-
-
Method Details
-
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
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 interfaceDNSServiceResolver
- 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 interfaceDNSServiceResolver
prefix
- custom SRV prefix such as "_gc._tcp"- Returns:
- the list of SRV dns entries
- Throws:
NamingException
-