APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.jndi.ldap

pack-priv Class ServiceLocator

extends Object
Class Inheritance
Imports
java.util.*, javax.naming.*, javax.naming.directory.*, javax.naming.spi.NamingManager, javax.naming.ldap.LdapName, .Rdn

This class discovers the location of LDAP services by querying DNS. See http://www.ietf.org/internet-drafts/draft-ietf-ldapext-locate-07.txt

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
ServiceLocator.SrvRecord

This class holds a DNS service (SRV) record.

Field Summary

Modifier and TypeField and Description
private static final Random
private static final String
private static final String[]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static String[]
extractHostports(ServiceLocator.SrvRecord[] srvRecords)

Extract hosts and port numbers from a list of SRV records.

pack-priv static String[]

Returns:

An ordered list of hostports for the LDAP service or null if the service has not been located.
getLdapService
(String
A string domain name.
domainName
,
Map<?, ?>
The possibly null environment of the context.
environment
)

Locates the LDAP service for a given domain.

pack-priv static String[]

Returns:

An ordered list of hostports for the LDAP service or null if the service has not been located.
getLdapService
(String
A string domain name.
domainName
,
Hashtable<?, ?>
The possibly null environment of the context.
environment
)

Locates the LDAP service for a given domain.

pack-priv static String

Returns:

A domain name or null if none can be derived.
mapDnToDomainName
(String
A string distinguished name (RFC 2253).
dn
)

Maps a distinguished name (RFC 2253) to a fully qualified domain name.

private static String
selectHostport(ServiceLocator.SrvRecord[] srvRecords, int head, int tail)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

randomback to summary
private static final Random random
SRV_RRback to summary
private static final String SRV_RR
SRV_RR_ATTRback to summary
private static final String[] SRV_RR_ATTR

Constructor Detail

ServiceLocatorback to summary
private ServiceLocator()

Method Detail

extractHostportsback to summary
private static String[] extractHostports(ServiceLocator.SrvRecord[] srvRecords)

Extract hosts and port numbers from a list of SRV records. An array of hostports is returned or null if none were found.

getLdapServiceback to summary
pack-priv static String[] getLdapService(String domainName, Map<?, ?> environment)

Locates the LDAP service for a given domain. Queries DNS for a list of LDAP Service Location Records (SRV) for a given domain name.

Parameters
domainName:String

A string domain name.

environment:Map<?, ?>

The possibly null environment of the context.

Returns:String[]

An ordered list of hostports for the LDAP service or null if the service has not been located.

getLdapServiceback to summary
pack-priv static String[] getLdapService(String domainName, Hashtable<?, ?> environment)

Locates the LDAP service for a given domain. Queries DNS for a list of LDAP Service Location Records (SRV) for a given domain name.

Parameters
domainName:String

A string domain name.

environment:Hashtable<?, ?>

The possibly null environment of the context.

Returns:String[]

An ordered list of hostports for the LDAP service or null if the service has not been located.

mapDnToDomainNameback to summary
pack-priv static String mapDnToDomainName(String dn) throws InvalidNameException

Maps a distinguished name (RFC 2253) to a fully qualified domain name. Processes a sequence of RDNs having a DC attribute. The special RDN "DC=." denotes the root of the domain tree. Multi-valued RDNs, non-DC attributes, binary-valued attributes and the RDN "DC=." all reset the domain name and processing continues.

Parameters
dn:String

A string distinguished name (RFC 2253).

Returns:String

A domain name or null if none can be derived.

Exceptions
InvalidNameException:
If the distinguished name is invalid.
selectHostportback to summary
private static String selectHostport(ServiceLocator.SrvRecord[] srvRecords, int head, int tail)
com.sun.jndi.ldap back to summary

pack-priv Class ServiceLocator.SrvRecord

extends Object
implements Comparable<ServiceLocator.SrvRecord>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable

This class holds a DNS service (SRV) record. See http://www.ietf.org/rfc/rfc2782.txt

Field Summary

Modifier and TypeField and Description
pack-priv String
pack-priv int
pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv
SrvRecord(String srvRecord)

Creates a service record object from a string record.

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(ServiceLocator.SrvRecord that)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hostportback to summary
pack-priv String hostport
priorityback to summary
pack-priv int priority
sumback to summary
pack-priv int sum
weightback to summary
pack-priv int weight

Constructor Detail

SrvRecordback to summary
pack-priv SrvRecord(String srvRecord) throws Exception

Creates a service record object from a string record. DNS supplies the string record in the following format:

     " "  " "  " " 

Method Detail

compareToback to summary
public int compareTo(ServiceLocator.SrvRecord that)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.