Class ExportLdif

  • All Implemented Interfaces:
    Closeable, AutoCloseable, TaskCommand

    public final class ExportLdif
    extends com.forgerock.opendj.cli.Tool
    implements TaskCommand
    This program provides a utility that may be used to export the contents of a Directory Server backend to an LDIF file. Depending on the arguments given, this program will either perform the export directly as a process that runs separate from Directory Server; or by scheduling a task to perform the action within the Directory Server via the tasks interface.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.forgerock.opendj.cli.Tool

        com.forgerock.opendj.cli.Tool.Style
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTaskAttributes​(Entry taskEntry)
      Adds attributes to the task entry before it is sent to the server.
      boolean canInitializeClient()
      Indicates whether to initialize a Directory Server client when running online.
      Class<? extends Task> getTaskClass()
      Returns the task class.
      String getTaskObjectClass()
      Returns the task's object class.
      static void main​(String[] args)
      The main method for ExportLdif tool.
      static com.forgerock.opendj.cli.ReturnCode mainExportLdif​(String[] args, ServerContext serverContext, PrintStream outStream, PrintStream errStream)
      Processes the command-line arguments and invokes the export process.
      com.forgerock.opendj.cli.ReturnCode processLocal()
      Runs the command in offline mode.
      com.forgerock.opendj.cli.ReturnCode run​(String... args)
      Run this Tool tool with the provided arguments.
      • Methods inherited from class com.forgerock.opendj.cli.Tool

        askPort, close, confirmAction, enableConsoleLoggingIfVerbose, errPrintln, errPrintln, errPrintln, errPrintlnSurroundedByBlankLines, errPrintVerboseMessage, flush, flushLogStream, getErrorStream, getErrStream, getInputStream, getOutputStream, isFullyInteractive, isQuiet, isScriptFriendly, isVerbose, logVerboseMessage, mayPrompt, parseArguments, pressReturnToContinue, print, println, println, println, printlnNoWrap, printlnSurroundedByBlankLines, printNoWrap, readInput, readInput, readInputAllowEmpty, readLineOfInput, readPassword, readValidatedInput, readValidatedInputOrThrow, report
    • Method Detail

      • main

        public static void main​(String[] args)
        The main method for ExportLdif tool.
        Parameters:
        args - The command-line arguments provided to this program.
      • mainExportLdif

        public static com.forgerock.opendj.cli.ReturnCode mainExportLdif​(String[] args,
                                                                         ServerContext serverContext,
                                                                         PrintStream outStream,
                                                                         PrintStream errStream)
        Processes the command-line arguments and invokes the export process.
        Parameters:
        args - The command-line arguments provided to this program.
        serverContext - The server context, or null if the tool should initialize the server context itself.
        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 return code.
      • run

        public com.forgerock.opendj.cli.ReturnCode run​(String... args)
                                                throws com.forgerock.opendj.cli.ClientException
        Description copied from class: com.forgerock.opendj.cli.Tool
        Run this Tool tool with the provided arguments. Output and errors will be written on the provided streams.

        This method can be used to run the tool programmatically.

        Overrides:
        run in class com.forgerock.opendj.cli.Tool
        Parameters:
        args - Arguments set to pass to the tool.
        Returns:
        0 if all processing completed successfully, or non-zero if an error occurred.
        Throws:
        com.forgerock.opendj.cli.ClientException - If an error occurs while running the tool.
      • addTaskAttributes

        public void addTaskAttributes​(Entry taskEntry)
        Description copied from interface: TaskCommand
        Adds attributes to the task entry before it is sent to the server.
        Specified by:
        addTaskAttributes in interface TaskCommand
        Parameters:
        taskEntry - the task entry.
      • canInitializeClient

        public boolean canInitializeClient()
        Description copied from interface: TaskCommand
        Indicates whether to initialize a Directory Server client when running online. This method should only return false when running tests while a client has already been initialized.
        Specified by:
        canInitializeClient in interface TaskCommand
        Returns:
        whether to initialize a Directory Server client when running online.
      • processLocal

        public com.forgerock.opendj.cli.ReturnCode processLocal()
                                                         throws com.forgerock.opendj.cli.ClientException
        Description copied from interface: TaskCommand
        Runs the command in offline mode.
        Specified by:
        processLocal in interface TaskCommand
        Returns:
        the return code.
        Throws:
        com.forgerock.opendj.cli.ClientException - If an error occurs.
      • getTaskObjectClass

        public String getTaskObjectClass()
        Description copied from interface: TaskCommand
        Returns the task's object class.
        Specified by:
        getTaskObjectClass in interface TaskCommand
        Returns:
        the task's object class