org.opends.server.tools
Class LDIFModify

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

public class LDIFModify
extends java.lang.Object

This class provides a program that may be used to apply a set of changes (in LDIF change format) to an LDIF file. It will first read all of the changes into memory, and then will iterate through an LDIF file and apply them to the entries contained in it. Note that because of the manner in which it processes the changes, certain types of operations will not be allowed, including:


Constructor Summary
LDIFModify()
           
 
Method Summary
static int ldifModifyMain(java.lang.String[] args, boolean serverInitialized, java.io.OutputStream outStream, java.io.OutputStream errStream)
          Processes the command-line arguments and makes the appropriate updates to the LDIF file.
static void main(java.lang.String[] args)
          Invokes ldifModifyMain to perform the appropriate processing.
static boolean modifyLDIF(LDIFReader sourceReader, LDIFReader changeReader, LDIFWriter targetWriter, java.util.List<Message> errorList)
          Applies the specified changes to the source LDIF, writing the modified file to the specified target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDIFModify

public LDIFModify()
Method Detail

modifyLDIF

public static boolean modifyLDIF(LDIFReader sourceReader,
                                 LDIFReader changeReader,
                                 LDIFWriter targetWriter,
                                 java.util.List<Message> errorList)
                          throws java.io.IOException,
                                 LDIFException
Applies the specified changes to the source LDIF, writing the modified file to the specified target. Neither the readers nor the writer will be closed.

Parameters:
sourceReader - The LDIF reader that will be used to read the LDIF content to be modified.
changeReader - The LDIF reader that will be used to read the changes to be applied.
targetWriter - The LDIF writer that will be used to write the modified LDIF.
errorList - A list into which any error messages generated while processing changes may be added.
Returns:
true if all updates were successfully applied, or false if any errors were encountered.
Throws:
java.io.IOException - If a problem occurs while attempting to read the source or changes, or write the target.
LDIFException - If a problem occurs while attempting to decode the source or changes, or trying to determine whether to include the entry in the output.

main

public static void main(java.lang.String[] args)
Invokes ldifModifyMain to perform the appropriate processing.

Parameters:
args - The command-line arguments provided to the client.

ldifModifyMain

public static int ldifModifyMain(java.lang.String[] args,
                                 boolean serverInitialized,
                                 java.io.OutputStream outStream,
                                 java.io.OutputStream errStream)
Processes the command-line arguments and makes the appropriate updates to the LDIF file.

Parameters:
args - The command line arguments provided to this program.
serverInitialized - Indicates whether the Directory Server has already been initialized (and therefore should not be initialized a second time).
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:
A value of zero if everything completed properly, or nonzero if any problem(s) occurred.