com.unboundid.ldap.sdk
Class SingleServerSet

java.lang.Object
  extended by com.unboundid.ldap.sdk.ServerSet
      extended by com.unboundid.ldap.sdk.SingleServerSet

@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class SingleServerSet
extends ServerSet

This class provides a server set implementation that only provides the ability to connect to a single server. It may be used in cases where a ServerSet is required but only a single server is needed.


Constructor Summary
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.
 
Method Summary
 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.
 
Methods inherited from class com.unboundid.ldap.sdk.ServerSet
getConnection, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SingleServerSet

public SingleServerSet(java.lang.String address,
                       int port)
Creates a new single server set with the specified address and port. It will use the default socket factory provided by the JVM to create the underlying socket.

Parameters:
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.

SingleServerSet

public SingleServerSet(java.lang.String address,
                       int port,
                       LDAPConnectionOptions connectionOptions)
Creates a new single server set with the specified address and port. It will use the default socket factory provided by the JVM to create the underlying socket.

Parameters:
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.

SingleServerSet

public 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.

Parameters:
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.

SingleServerSet

public 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.

Parameters:
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.
Method Detail

getAddress

public java.lang.String getAddress()
Retrieves the address of the directory server to which the connections should be established.

Returns:
The address of the directory server to which the connections should be established.

getPort

public int getPort()
Retrieves the port of the directory server to which the connections should be established.

Returns:
The port of the directory server to which the connections should be established.

getSocketFactory

public javax.net.SocketFactory getSocketFactory()
Retrieves the socket factory that will be used to establish connections.

Returns:
The socket factory that will be used to establish connections.

getConnectionOptions

public LDAPConnectionOptions getConnectionOptions()
Retrieves the set of connection options that will be used by the underlying connections.

Returns:
The set of connection options that will be used by the underlying connections.

getConnection

public LDAPConnection getConnection()
                             throws LDAPException
Attempts to establish a connection to one of the directory servers in this server set. The connection should be established but unauthenticated. The caller may determine the server to which the connection is established using the LDAPConnection.getConnectedAddress() and LDAPConnection.getConnectedPort() methods.

Specified by:
getConnection in class ServerSet
Returns:
An LDAPConnection object that is established to one of the servers in this server set.
Throws:
LDAPException - If it is not possible to establish a connection to any of the servers in this server set.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this server set to the provided buffer.

Overrides:
toString in class ServerSet
Parameters:
buffer - The buffer to which the string representation should be appended.