Class LDIFLoad

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

public class LDIFLoad extends Object
LDIF Load. Loads LDIF data from given filename, optionally substituting part of the DN (relocating the entries), and on error either aborting, prompting or continuing.

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(). If the operation stops before the finish because it requires the user to make a choice, it may be restarted by executing the run() method again.

No aliases are followed when writing entries.

Author:
jp
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final boolean
    Correct DN-valued attributes that are loaded?
    final DN
    DN to add to source DN, if removal succeeded.
    final DN
    DN to remove from source DN.
  • Constructor Summary

    Constructors
    Constructor
    Description
    LDIFLoad(DirectorySession ds, String in_fnam, boolean continue_on_error, DN dn_remove, DN dn_add, boolean correct_dn, boolean strip_op_coll)
    Initialize the LDIFLoad.
    LDIFLoad(DirectorySession ds, String in_fnam, boolean continue_on_error, DN dn_remove, DN dn_add, boolean correct_dn, boolean strip_op_coll, Substitutor subs)
    Initialize the LDIFLoad.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Abort the operation.
    int
    Return the number of entries written to date.
    int
    Return the number of errors noted to date.
    Returns the next outstanding Exception, or null if there are no more exceptions outstanding.
    boolean
    Test to see if the dump has finished.
    void
    run()
    Run the LDIF load.
    Get the current status of the operation as a string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • dn_remove

      public final DN dn_remove
      DN to remove from source DN.
    • dn_add

      public final DN dn_add
      DN to add to source DN, if removal succeeded.
    • correct_dn

      public final boolean correct_dn
      Correct DN-valued attributes that are loaded?
  • Constructor Details

    • LDIFLoad

      public LDIFLoad(DirectorySession ds, String in_fnam, boolean continue_on_error, DN dn_remove, DN dn_add, boolean correct_dn, boolean strip_op_coll)
      Initialize the LDIFLoad. This may be called from the GUI thread.
      Parameters:
      ds - DirectorySession to use
      in_fnam - LDIF file to write
      continue_on_error - Continue operations after errors?
      dn_remove - DN to remove from each source DN
      dn_add - DN to add to each source DN, assuming the removal succeeded
      correct_dn - Correct DNs in loaded data according to dn_remove/dn_add
      strip_op_coll - Strip operational and collective attributes
    • LDIFLoad

      public LDIFLoad(DirectorySession ds, String in_fnam, boolean continue_on_error, DN dn_remove, DN dn_add, boolean correct_dn, boolean strip_op_coll, Substitutor subs)
      Initialize the LDIFLoad. This may be called from the GUI thread.
      Parameters:
      ds - DirectorySession to use
      in_fnam - LDIF file to write
      continue_on_error - Continue operations after errors?
      dn_remove - DN to remove from each source DN
      dn_add - DN to add to each source DN, assuming the removal succeeded
      correct_dn - Correct DNs in loaded data according to dn_remove/dn_add
      strip_op_coll - Strip operational and collective attributes
      subs - Helper class which will perform attribute modification/replacement, which may be null
      Since:
      R16.2
  • Method Details

    • run

      public void run()
      Run the LDIF load. Non-fatal Exceptions are queued rather than rethrown, so it is important to check for errors after running this method by calling getException(). If the load is set not to continue on errors, then this method will return early (with isFinished() returning not true), and execution of the load may then be continued by calling it again.

      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.

    • getEntryCount

      public int getEntryCount()
      Return the number of entries written to date.
    • getErrorCount

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