org.opends.server.tools
Class LDAPConnection

java.lang.Object
  extended by org.opends.server.tools.LDAPConnection

public class LDAPConnection
extends java.lang.Object

This class provides a tool that can be used to issue search requests to the Directory Server.


Constructor Summary
LDAPConnection(java.lang.String host, int port, LDAPConnectionOptions options)
          Constructor for the LDAPConnection object.
LDAPConnection(java.lang.String host, int port, LDAPConnectionOptions options, java.io.PrintStream out, java.io.PrintStream err)
          Constructor for the LDAPConnection object.
 
Method Summary
 void close(java.util.concurrent.atomic.AtomicInteger nextMessageID)
          Close the underlying ASN1 reader and writer, optionally sending an unbind request before disconnecting.
 void connectToHost(java.lang.String bindDN, java.lang.String bindPassword)
          Connects to the directory server instance running on specified hostname and port number.
 void connectToHost(java.lang.String bindDN, java.lang.String bindPassword, java.util.concurrent.atomic.AtomicInteger nextMessageID)
          Connects to the directory server instance running on specified hostname and port number.
 LDAPReader getLDAPReader()
          Get the underlying LDAP reader.
 LDAPWriter getLDAPWriter()
          Get the underlying LDAP writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPConnection

public LDAPConnection(java.lang.String host,
                      int port,
                      LDAPConnectionOptions options)
Constructor for the LDAPConnection object.

Parameters:
host - The hostname to send the request to.
port - The port number on which the directory server is accepting requests.
options - The set of options for this connection.

LDAPConnection

public LDAPConnection(java.lang.String host,
                      int port,
                      LDAPConnectionOptions options,
                      java.io.PrintStream out,
                      java.io.PrintStream err)
Constructor for the LDAPConnection object.

Parameters:
host - The hostname to send the request to.
port - The port number on which the directory server is accepting requests.
options - The set of options for this connection.
out - The print stream to use for standard output.
err - The print stream to use for standard error.
Method Detail

connectToHost

public void connectToHost(java.lang.String bindDN,
                          java.lang.String bindPassword)
                   throws LDAPConnectionException
Connects to the directory server instance running on specified hostname and port number.

Parameters:
bindDN - The DN to bind with.
bindPassword - The password to bind with.
Throws:
LDAPConnectionException - If a problem occurs while attempting to establish the connection to the server.

connectToHost

public void connectToHost(java.lang.String bindDN,
                          java.lang.String bindPassword,
                          java.util.concurrent.atomic.AtomicInteger nextMessageID)
                   throws LDAPConnectionException
Connects to the directory server instance running on specified hostname and port number.

Parameters:
bindDN - The DN to bind with.
bindPassword - The password to bind with.
nextMessageID - The message ID counter that should be used for operations performed while establishing the connection.
Throws:
LDAPConnectionException - If a problem occurs while attempting to establish the connection to the server.

close

public void close(java.util.concurrent.atomic.AtomicInteger nextMessageID)
Close the underlying ASN1 reader and writer, optionally sending an unbind request before disconnecting.

Parameters:
nextMessageID - The message ID counter that should be used for the unbind request, or null if the connection should be closed without an unbind request.

getLDAPWriter

public LDAPWriter getLDAPWriter()
Get the underlying LDAP writer.

Returns:
The underlying LDAP writer.

getLDAPReader

public LDAPReader getLDAPReader()
Get the underlying LDAP reader.

Returns:
The underlying LDAP reader.