@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class DNSSRVRecordServerSet extends ServerSet
Constructor and Description |
---|
DNSSRVRecordServerSet(java.lang.String recordName)
Creates a new instance of this server set that will use the specified DNS
record name, a default DNS provider URL that will attempt to determine DNS
servers from the underlying system configuration, a default TTL of one
hour, round-robin ordering for servers with the same priority, and default
socket factory and connection options.
|
DNSSRVRecordServerSet(java.lang.String recordName,
java.lang.String providerURL,
long ttlMillis,
javax.net.SocketFactory socketFactory,
LDAPConnectionOptions connectionOptions)
Creates a new instance of this server set that will use the provided
settings.
|
DNSSRVRecordServerSet(java.lang.String recordName,
java.lang.String providerURL,
java.util.Properties jndiProperties,
long ttlMillis,
javax.net.SocketFactory socketFactory,
LDAPConnectionOptions connectionOptions)
Creates a new instance of this server set that will use the provided
settings.
|
DNSSRVRecordServerSet(java.lang.String recordName,
java.lang.String providerURL,
java.util.Properties jndiProperties,
long ttlMillis,
javax.net.SocketFactory socketFactory,
LDAPConnectionOptions connectionOptions,
BindRequest bindRequest,
PostConnectProcessor postConnectProcessor)
Creates a new instance of this server set that will use the provided
settings.
|
Modifier and Type | Method and Description |
---|---|
LDAPConnection |
getConnection()
Attempts to establish a connection to one of the directory servers in this
server set.
|
LDAPConnection |
getConnection(LDAPConnectionPoolHealthCheck healthCheck)
Attempts to establish a connection to one of the directory servers in this
server set, using the provided health check to further validate the
connection.
|
LDAPConnectionOptions |
getConnectionOptions()
Retrieves the set of connection options to use for connections that are
created, if any.
|
java.util.Map<java.lang.String,java.lang.String> |
getJNDIProperties()
Retrieves an unmodifiable map of properties that will be used to initialize
the JNDI context used to interact with DNS.
|
java.lang.String |
getProviderURL()
Retrieves the JNDI provider URL that specifies the DNS server(s) to use.
|
java.lang.String |
getRecordName()
Retrieves the name of the DNS SRV record to retrieve.
|
javax.net.SocketFactory |
getSocketFactory()
Retrieves the socket factory that will be used when creating connections,
if any.
|
long |
getTTLMillis()
Retrieves the maximum length of time in milliseconds that
previously-retrieved DNS information should be cached before it needs to be
refreshed.
|
boolean |
includesAuthentication()
Indicates whether connections created by this server set will be
authenticated.
|
boolean |
includesPostConnectProcessing()
Indicates whether connections created by this server set will have
post-connect processing performed.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this server set to the provided buffer.
|
associateConnectionWithThisServerSet, doBindPostConnectAndHealthCheckProcessing, handleConnectionClosed, shutDown, toString
public DNSSRVRecordServerSet(@Nullable java.lang.String recordName)
recordName
- The name of the DNS SRV record to retrieve. If this is
null
, then a default record name of
"_ldap._tcp" will be used.public DNSSRVRecordServerSet(@Nullable java.lang.String recordName, @Nullable java.lang.String providerURL, long ttlMillis, @Nullable javax.net.SocketFactory socketFactory, @Nullable LDAPConnectionOptions connectionOptions)
recordName
- The name of the DNS SRV record to retrieve. If
this is null
, then a default record name
of "_ldap._tcp" will be used.providerURL
- The JNDI provider URL that may be used to
specify the DNS server(s) to use. If this is
not specified, then a default URL of "dns:" will
be used, which will attempt to determine the
appropriate servers from the underlying system
configuration.ttlMillis
- Specifies the maximum length of time in
milliseconds that DNS information should be
cached before it needs to be retrieved again. A
value less than or equal to zero will use the
default TTL of one hour.socketFactory
- The socket factory that will be used when
creating connections. It may be null
if
the JVM-default socket factory should be used.connectionOptions
- The set of connection options that should be
used for the connections that are created. It
may be null
if the default connection
options should be used.public DNSSRVRecordServerSet(@Nullable java.lang.String recordName, @Nullable java.lang.String providerURL, @Nullable java.util.Properties jndiProperties, long ttlMillis, @Nullable javax.net.SocketFactory socketFactory, @Nullable LDAPConnectionOptions connectionOptions)
recordName
- The name of the DNS SRV record to retrieve. If
this is null
, then a default record name
of "_ldap._tcp" will be used.providerURL
- The JNDI provider URL that may be used to
specify the DNS server(s) to use. If this is
not specified, then a default URL of "dns:" will
be used, which will attempt to determine the
appropriate servers from the underlying system
configuration.jndiProperties
- A set of JNDI-related properties that should be
be used when initializing the context for
interacting with the DNS server via JNDI. If
this is null
, then a default set of
properties will be used.ttlMillis
- Specifies the maximum length of time in
milliseconds that DNS information should be
cached before it needs to be retrieved again. A
value less than or equal to zero will use the
default TTL of one hour.socketFactory
- The socket factory that will be used when
creating connections. It may be null
if
the JVM-default socket factory should be used.connectionOptions
- The set of connection options that should be
used for the connections that are created. It
may be null
if the default connection
options should be used.public DNSSRVRecordServerSet(@Nullable java.lang.String recordName, @Nullable java.lang.String providerURL, @Nullable java.util.Properties jndiProperties, long ttlMillis, @Nullable javax.net.SocketFactory socketFactory, @Nullable LDAPConnectionOptions connectionOptions, @Nullable BindRequest bindRequest, @Nullable PostConnectProcessor postConnectProcessor)
recordName
- The name of the DNS SRV record to retrieve.
If this is null
, then a default
record name of "_ldap._tcp" will be used.providerURL
- The JNDI provider URL that may be used to
specify the DNS server(s) to use. If this is
not specified, then a default URL of
"dns:" will be used, which will attempt to
determine the appropriate servers from the
underlying system configuration.jndiProperties
- A set of JNDI-related properties that should
be be used when initializing the context for
interacting with the DNS server via JNDI.
If this is null
, then a default set
of properties will be used.ttlMillis
- Specifies the maximum length of time in
milliseconds that DNS information should be
cached before it needs to be retrieved
again. A value less than or equal to zero
will use the default TTL of one hour.socketFactory
- The socket factory that will be used when
creating connections. It may be
null
if the JVM-default socket
factory should be used.connectionOptions
- The set of connection options that should be
used for the connections that are created.
It may be null
if the default
connection options should be used.bindRequest
- The bind request that should be used to
authenticate newly-established connections.
It may be null
if this server set
should not perform any authentication.postConnectProcessor
- The post-connect processor that should be
invoked on newly-established connections. It
may be null
if this server set should
not perform any post-connect processing.@NotNull public java.lang.String getRecordName()
@NotNull public java.lang.String getProviderURL()
@NotNull public java.util.Map<java.lang.String,java.lang.String> getJNDIProperties()
public long getTTLMillis()
@Nullable public javax.net.SocketFactory getSocketFactory()
null
if the JVM-default socket factory will be used.@Nullable public LDAPConnectionOptions getConnectionOptions()
null
if a default set of options should be
used.public boolean includesAuthentication()
includesAuthentication
in class ServerSet
true
if connections created by this server set will be
authenticated, or false
if not.public boolean includesPostConnectProcessing()
includesPostConnectProcessing
in class ServerSet
true
if connections created by this server set will have
post-connect processing performed, or false
if not.@NotNull public LDAPConnection getConnection() throws LDAPException
ServerSet.includesAuthentication()
must return true if and only if the
connection will also be authenticated, and the
ServerSet.includesPostConnectProcessing()
method must return true if and
only if pre-authentication and post-authentication post-connect processing
will have been performed. The caller may determine the server to which the
connection is established using the
LDAPConnection.getConnectedAddress()
and
LDAPConnection.getConnectedPort()
methods.getConnection
in class ServerSet
LDAPConnection
object that is established to one of the
servers in this server set.LDAPException
- If it is not possible to establish a connection to
any of the servers in this server set.@NotNull public LDAPConnection getConnection(@Nullable LDAPConnectionPoolHealthCheck healthCheck) throws LDAPException
ServerSet.includesAuthentication()
must return true if and only if the
connection will also be authenticated, and the
ServerSet.includesPostConnectProcessing()
method must return true if and
only if pre-authentication and post-authentication post-connect processing
will have been performed. The caller may determine the server to which the
connection is established using the
LDAPConnection.getConnectedAddress()
and
LDAPConnection.getConnectedPort()
methods.getConnection
in class ServerSet
healthCheck
- The health check to use to verify the health of the
newly-created connection. It may be null
if
no additional health check should be performed. If it
is non-null
and this server set performs
authentication, then the health check's
ensureConnectionValidAfterAuthentication
method will be invoked immediately after the bind
operation is processed (regardless of whether the bind
was successful or not). And regardless of whether
this server set performs authentication, the
health check's ensureNewConnectionValid
method must be invoked on the connection to ensure
that it is valid immediately before it is returned.LDAPConnection
object that is established to one of the
servers in this server set.LDAPException
- If it is not possible to establish a connection to
any of the servers in this server set.