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.- Author:
- Middleware Services
-
-
Field Summary
-
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 java.lang.String[]
getAttributes()
Get the types of records to query for, e.g.protected java.util.Set<SRVRecord>
processRecords(java.util.Set<java.lang.String> records)
Process a set of DNS records.java.util.Set<SRVRecord>
resolve(java.lang.String name)
Resolve a set of DNS records of some type for the given name.protected java.util.Set<SRVRecord>
sortSrvRecords(java.util.Set<SRVRecord> records)
Sorts the supplied SRV records according to RFC 2782.java.lang.String
toString()
-
-
-
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 java.util.Set<SRVRecord> resolve(java.lang.String name)
Description copied from interface:DNSResolver
Resolve a set of DNS records of some type for the given name.- Specified by:
resolve
in interfaceDNSResolver<SRVRecord>
- Overrides:
resolve
in 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 java.lang.String[] getAttributes()
Description copied from class:AbstractDNSResolver
Get the types of records to query for, e.g.{"A", "AAAA"}
.- Specified by:
getAttributes
in classAbstractDNSResolver<SRVRecord>
- Returns:
- Array of JNDI attribute names.
-
processRecords
protected java.util.Set<SRVRecord> processRecords(java.util.Set<java.lang.String> records)
Description copied from class:AbstractDNSResolver
Process a set of DNS records.- Specified by:
processRecords
in classAbstractDNSResolver<SRVRecord>
- Parameters:
records
- Set of raw DNS records returned from a name query.- Returns:
- Set of converted/processed records.
-
sortSrvRecords
protected java.util.Set<SRVRecord> sortSrvRecords(java.util.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 java.lang.String toString()
- Overrides:
toString
in classAbstractDNSResolver<SRVRecord>
-
-