org.opends.server.tools
Class LDAPCompare

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

public class LDAPCompare
extends java.lang.Object

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


Constructor Summary
LDAPCompare(java.util.concurrent.atomic.AtomicInteger nextMessageID, java.io.PrintStream out, java.io.PrintStream err)
          Constructor for the LDAPCompare object.
 
Method Summary
static void main(java.lang.String[] args)
          The main method for LDAPCompare tool.
static int mainCompare(java.lang.String[] args)
          Parses the provided command-line arguments and uses that information to run the ldapcompare tool.
static int mainCompare(java.lang.String[] args, boolean initializeServer, java.io.OutputStream outStream, java.io.OutputStream errStream)
          Parses the provided command-line arguments and uses that information to run the ldapcompare tool.
 void readAndExecute(LDAPConnection connection, java.lang.String attributeType, byte[] attributeVal, java.util.ArrayList<java.lang.String> lines, LDAPCompareOptions compareOptions)
          Execute the compare request in the specified list of DNs.
 void readAndExecute(LDAPConnection connection, java.lang.String attributeType, byte[] attributeVal, java.io.Reader reader, LDAPCompareOptions compareOptions)
          Read the specified DNs from the given reader (file or stdin) and execute the given compare request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPCompare

public LDAPCompare(java.util.concurrent.atomic.AtomicInteger nextMessageID,
                   java.io.PrintStream out,
                   java.io.PrintStream err)
Constructor for the LDAPCompare object.

Parameters:
nextMessageID - The message ID counter to use for requests.
out - The print stream to use for standard output.
err - The print stream to use for standard error.
Method Detail

readAndExecute

public void readAndExecute(LDAPConnection connection,
                           java.lang.String attributeType,
                           byte[] attributeVal,
                           java.util.ArrayList<java.lang.String> lines,
                           LDAPCompareOptions compareOptions)
                    throws java.io.IOException,
                           LDAPException
Execute the compare request in the specified list of DNs.

Parameters:
connection - The connection to execute the request on.
attributeType - The attribute type to compare.
attributeVal - The attribute value to compare.
lines - The list of DNs to compare the attribute in.
compareOptions - The constraints for the compare request.
Throws:
java.io.IOException - If a problem occurs while communicating with the Directory Server.
LDAPException - If the server returns an error response.

readAndExecute

public void readAndExecute(LDAPConnection connection,
                           java.lang.String attributeType,
                           byte[] attributeVal,
                           java.io.Reader reader,
                           LDAPCompareOptions compareOptions)
                    throws java.io.IOException,
                           LDAPException
Read the specified DNs from the given reader (file or stdin) and execute the given compare request.

Parameters:
connection - The connection to execute the request on.
attributeType - The attribute type to compare.
attributeVal - The attribute value to compare.
reader - The reader to read the list of DNs from.
compareOptions - The constraints for the compare request.
Throws:
java.io.IOException - If a problem occurs while communicating with the Directory Server.
LDAPException - If the server returns an error response.

main

public static void main(java.lang.String[] args)
The main method for LDAPCompare tool.

Parameters:
args - The command-line arguments provided to this program.

mainCompare

public static int mainCompare(java.lang.String[] args)
Parses the provided command-line arguments and uses that information to run the ldapcompare tool.

Parameters:
args - The command-line arguments provided to this program.
Returns:
The error code.

mainCompare

public static int mainCompare(java.lang.String[] args,
                              boolean initializeServer,
                              java.io.OutputStream outStream,
                              java.io.OutputStream errStream)
Parses the provided command-line arguments and uses that information to run the ldapcompare tool.

Parameters:
args - The command-line arguments provided to this program.
initializeServer - Indicates whether to initialize the server.
outStream - The output stream to use for standard output, or null if standard output is not needed.
errStream - The output stream to use for standard error, or null if standard error is not needed.
Returns:
The error code.