Package org.ldaptive.dns
Class SRVDNSResolver
- java.lang.Object
-
- org.ldaptive.dns.AbstractDNSResolver<SRVRecord>
-
- org.ldaptive.dns.SRVDNSResolver
-
- All Implemented Interfaces:
DNSResolver<SRVRecord>
public class SRVDNSResolver extends AbstractDNSResolver<SRVRecord>
Queries for DNS A records for a given host name.
-
-
Field Summary
Fields Modifier and Type Field Description private static String[]ATTRIBUTESAttributes (DNS record types) to query for.private static StringDEFAULT_RECORD_NAMEDefault DNS record name.private booleanuseSSLConnect to LDAP using LDAPS.-
Fields inherited from class org.ldaptive.dns.AbstractDNSResolver
logger
-
-
Constructor Summary
Constructors Constructor Description SRVDNSResolver()Default constructor.SRVDNSResolver(DNSContextFactory factory)Creates a new DNS address resolver.SRVDNSResolver(DNSContextFactory factory, boolean ssl)Creates a new DNS address resolver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String[]getAttributes()Get the types of records to query for, e.g.protected Set<SRVRecord>processRecords(Set<String> records)Process a set of DNS records.Set<SRVRecord>resolve(String name)Resolve a set of DNS records of some type for the given name.protected Set<SRVRecord>sortSrvRecords(Set<SRVRecord> records)Sorts the supplied SRV records according to RFC 2782.StringtoString()
-
-
-
Field Detail
-
ATTRIBUTES
private static final String[] ATTRIBUTES
Attributes (DNS record types) to query for.
-
DEFAULT_RECORD_NAME
private static final String DEFAULT_RECORD_NAME
Default DNS record name.- See Also:
- Constant Field Values
-
useSSL
private final boolean useSSL
Connect to LDAP using LDAPS.
-
-
Constructor Detail
-
SRVDNSResolver
public SRVDNSResolver()
Default constructor.
-
SRVDNSResolver
public SRVDNSResolver(DNSContextFactory factory)
Creates a new DNS address resolver.- Parameters:
factory- JNDI dir context factory
-
SRVDNSResolver
public SRVDNSResolver(DNSContextFactory factory, boolean ssl)
Creates a new DNS address resolver.- Parameters:
factory- JNDI dir context factoryssl- whether SRV records should produce LDAPS URLs
-
-
Method Detail
-
resolve
public Set<SRVRecord> resolve(String name)
Description copied from interface:DNSResolverResolve a set of DNS records of some type for the given name.- Specified by:
resolvein interfaceDNSResolver<SRVRecord>- Overrides:
resolvein classAbstractDNSResolver<SRVRecord>- Parameters:
name- Name for which to resolve DNS records.- Returns:
- Set of records of type T bound to the given name.
-
getAttributes
protected String[] getAttributes()
Description copied from class:AbstractDNSResolverGet the types of records to query for, e.g.{"A", "AAAA"}.- Specified by:
getAttributesin classAbstractDNSResolver<SRVRecord>- Returns:
- Array of JNDI attribute names.
-
processRecords
protected Set<SRVRecord> processRecords(Set<String> records)
Description copied from class:AbstractDNSResolverProcess a set of DNS records.- Specified by:
processRecordsin classAbstractDNSResolver<SRVRecord>- Parameters:
records- Set of raw DNS records returned from a name query.- Returns:
- Set of converted/processed records.
-
sortSrvRecords
protected Set<SRVRecord> sortSrvRecords(Set<SRVRecord> records)
Sorts the supplied SRV records according to RFC 2782. Records with the lowest priority are first. Records with the same priority are arranged by weight with higher weights having a greater chance to be ordered first.- Parameters:
records- to sort- Returns:
- sorted records
-
toString
public String toString()
- Overrides:
toStringin classAbstractDNSResolver<SRVRecord>
-
-