@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class SingleServerSet extends ServerSet
ServerSet
is required but only a single server is needed.Constructor and Description |
---|
SingleServerSet(java.lang.String address,
int port)
Creates a new single server set with the specified address and port.
|
SingleServerSet(java.lang.String address,
int port,
LDAPConnectionOptions connectionOptions)
Creates a new single server set with the specified address and port.
|
SingleServerSet(java.lang.String address,
int port,
javax.net.SocketFactory socketFactory)
Creates a new single server set with the specified address and port, and
using the provided socket factory.
|
SingleServerSet(java.lang.String address,
int port,
javax.net.SocketFactory socketFactory,
LDAPConnectionOptions connectionOptions)
Creates a new single server set with the specified address and port, and
using the provided socket factory.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAddress()
Retrieves the address of the directory server to which the connections
should be established.
|
LDAPConnection |
getConnection()
Attempts to establish a connection to one of the directory servers in this
server set.
|
LDAPConnectionOptions |
getConnectionOptions()
Retrieves the set of connection options that will be used by the underlying
connections.
|
int |
getPort()
Retrieves the port of the directory server to which the connections should
be established.
|
javax.net.SocketFactory |
getSocketFactory()
Retrieves the socket factory that will be used to establish connections.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this server set to the provided buffer.
|
getConnection, toString
public SingleServerSet(java.lang.String address, int port)
address
- The address of the directory server to which the
connections should be established. It must not be
null
.port
- The port of the directory server to which the connections
should be established. It must be between 1 and 65535,
inclusive.public SingleServerSet(java.lang.String address, int port, LDAPConnectionOptions connectionOptions)
address
- The address of the directory server to which the
connections should be established. It must not
be null
.port
- The port of the directory server to which the
connections should be established. It must be
between 1 and 65535, inclusive.connectionOptions
- The set of connection options to use for the
underlying connections.public SingleServerSet(java.lang.String address, int port, javax.net.SocketFactory socketFactory)
address
- The address of the directory server to which the
connections should be established. It must not be
null
.port
- The port of the directory server to which the
connections should be established. It must be
between 1 and 65535, inclusive.socketFactory
- The socket factory to use to create the underlying
connections.public SingleServerSet(java.lang.String address, int port, javax.net.SocketFactory socketFactory, LDAPConnectionOptions connectionOptions)
address
- The address of the directory server to which the
connections should be established. It must not
be null
.port
- The port of the directory server to which the
connections should be established. It must be
between 1 and 65535, inclusive.socketFactory
- The socket factory to use to create the
underlying connections.connectionOptions
- The set of connection options to use for the
underlying connections.public java.lang.String getAddress()
public int getPort()
public javax.net.SocketFactory getSocketFactory()
public LDAPConnectionOptions getConnectionOptions()
public LDAPConnection getConnection() throws LDAPException
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.