Class LDIFDump

java.lang.Object
com.isode.dsapi.bulk.LDIFDump

public class LDIFDump extends Object
LDIF dump: for the list of DNs provided by the given DirectoryIterator, read the entries from the directory and dump them to the given LDIF file. Error-counts and write-counts are updated during the scan and may be monitored by the GUI thread using the status() method. The GUI thread may also read the errors as they are generated using getException(), and may also request that the operation be aborted using abort().

The dump always dumps aliases as themselves, never following them.

Author:
jp
  • Constructor Details

    • LDIFDump

      public LDIFDump(DirectorySession ds, DirectoryIterator<DN> di, String out_fnam, boolean include_opattr, boolean include_collective)
      Initialize the LDIFDump. This may be called from the GUI thread.
      Parameters:
      ds - DirectorySession to use
      di - DirectoryIterator that will provide the DNs to save
      out_fnam - LDIF file to write
      include_opattr - Include operational attributes in the dump
      include_collective - Include collective attributes in the dump
    • LDIFDump

      public LDIFDump(DirectorySession ds, DirectoryIterator<DN> di, String out_fnam, boolean include_opattr, boolean include_collective, LDIFSelector selector)
      Initialize the LDIFDump. This may be called from the GUI thread.
      Parameters:
      ds - DirectorySession to use
      di - DirectoryIterator that will provide the DNs to save
      out_fnam - LDIF file to write
      include_opattr - Include operational attributes in the dump
      include_collective - Include collective attributes in the dump
      selector - Selector to determine if an entry should be included in the dump, which may be null
      Since:
      R16.2
  • Method Details

    • run

      public void run()
      Run the LDIF dump. Non-fatal Exceptions are queued rather than rethrown, so it is important to check for errors after running this method by calling getException().

      This method must be run from a background (non-GUI) thread as it does directory operations directly and will block whilst waiting for directory data.

    • abort

      public void abort()
      Abort the operation. This may be called from the GUI thread (assuming that the LDIF dump is running in the background). This will stop the operation at the next available opportunity. Note that if the operation is blocked waiting for a directory result, this cannot be interrupted and the abort will not be processed until the directory operation actually returns.
    • status

      public String status()
      Get the current status of the operation as a string. This may be called from the GUI thread (assuming that the LDIF dump is running in the background).
      Returns:
      Status of the operation as a string
    • isFinished

      public boolean isFinished()
      Test to see if the dump has finished.
      Returns:
      Finished?
    • getException

      public Exception getException()
      Returns the next outstanding Exception, or null if there are no more exceptions outstanding. This may be called from the GUI thread (assuming that the LDIF dump is running in the background).

      The Exceptions are plain Exceptions, with an explanation and the problem DN in the message text. If the exception was caused by a DSAPIException, this is available using the getCause() method.

    • getRecordCount

      public int getRecordCount()
      Return the number of records written to date.
    • getErrorCount

      public int getErrorCount()
      Return the number of errors noted to date.