Class LDIFExportConfig

java.lang.Object
org.opends.server.types.Cancellable
org.opends.server.types.LDIFExportConfig
All Implemented Interfaces:
Closeable, AutoCloseable

public final class LDIFExportConfig extends Cancellable implements Closeable
This class defines a data structure for holding configuration information to use when performing an LDIF export.
  • Constructor Details

    • LDIFExportConfig

      public LDIFExportConfig(Path ldifFile, ExistingFileBehavior existingFileBehavior)
      Creates a new LDIF export configuration that will write to the specified LDIF file.
      Parameters:
      ldifFile - The path to the LDIF file to export.
      existingFileBehavior - Indicates how to proceed if the specified file already exists.
    • LDIFExportConfig

      public LDIFExportConfig(OutputStream ldifOutputStream)
      Creates a new LDIF export configuration that will write to the provided output stream.
      Parameters:
      ldifOutputStream - The output stream to which the LDIF data should be written.
  • Method Details

    • getOutputStream

      public OutputStream getOutputStream() throws IOException
      Retrieves the output stream that should be used to write the LDIF data. If compression or encryption are to be used, then they must be enabled before the first call to this method.
      Returns:
      The output stream that should be used to write the LDIF data.
      Throws:
      IOException - If a problem occurs while preparing the writer.
    • setCompressData

      public void setCompressData(boolean compressData)
      Specifies whether the LDIF data should be compressed as it is written. If compression should be used, then this must be set before calling getWriter for the first time.
      Parameters:
      compressData - Indicates whether the LDIF data should be compressed as it is written.
    • setEncryptData

      public void setEncryptData(boolean encryptData)
      Specifies whether the LDIF data should be encrypted as it is written. If encryption should be used, then this must be set before calling getWriter for the first time.
      Parameters:
      encryptData - Indicates whether the LDIF data should be encrypted as it is written.
    • setHashData

      public void setHashData(boolean hashData)
      Specifies whether to generate a cryptographic hash of the data that is written. If hashing is to be used, then this must be set before calling getWriter for the first time.
      Parameters:
      hashData - Indicates whether to generate a hash of the data as it is written.
    • setSignHash

      public void setSignHash(boolean signHash)
      Specifies whether to sign the cryptographic hash of the data that is written when the export is complete. If the export is not configured to generate a hash, then this will be ignored. If hashing is to be used and the hash should be signed, then this must be set before calling getWriter for the first time.
      Parameters:
      signHash - Indicates whether to generate a hash of the data as it is written.
    • getWrapColumn

      public int getWrapColumn()
      Retrieves the column at which long lines should be wrapped.
      Returns:
      The column at which long lines should be wrapped, or a value less than or equal to zero to indicate that no wrapping should be performed.
    • setWrapColumn

      public void setWrapColumn(int wrapColumn)
      Specifies the column at which long lines should be wrapped. A value less than or equal to zero indicates that no wrapping should be performed.
      Parameters:
      wrapColumn - The column at which long lines should be wrapped.
    • setExcludeBranches

      public void setExcludeBranches(Set<Dn> excludeBranches)
      Specifies the set of base DNs that specify the set of entries to exclude from the export.
      Parameters:
      excludeBranches - The set of base DNs that specify the set of entries to exclude from the export.
    • getIncludeBranches

      public Set<Dn> getIncludeBranches()
      Retrieves the set of base DNs that specify the set of entries to include in the export. The list that is returned may be altered by the caller.
      Returns:
      The set of base DNs that specify the set of entries to include in the export.
    • setIncludeBranches

      public void setIncludeBranches(Set<Dn> includeBranches)
      Specifies the set of base DNs that specify the set of entries to include in the export.
      Parameters:
      includeBranches - The set of base DNs that specify the set of entries to include in the export.
    • setIncludeOperationalAttributes

      public void setIncludeOperationalAttributes(boolean includeOperationalAttributes)
      Specifies whether the set of operational attributes should be included in the export.
      Parameters:
      includeOperationalAttributes - Specifies whether the set of operational attributes should be included in the export.
    • setExcludeAttributes

      public void setExcludeAttributes(Set<AttributeType> excludeAttributes)
      Specifies the set of attributes that should be excluded from the entries written to LDIF.
      Parameters:
      excludeAttributes - The set of attributes that should be excluded from the entries written to LDIF.
    • setIncludeAttributes

      public void setIncludeAttributes(Set<AttributeType> includeAttributes)
      Specifies the set of attributes that should be included in the entries written to LDIF.
      Parameters:
      includeAttributes - The set of attributes that should be included in the entries written to LDIF.
    • setIncludeExcludeFilters

      public void setIncludeExcludeFilters(Set<Filter> includeFilters, Set<Filter> excludeFilters)
      Specifies the search filters that should be used to determine which entries to include / exclude in the LDIF.
      Parameters:
      includeFilters - The search filters that should be used to determine which entries to include in the LDIF.
      excludeFilters - The search filters that should be used to determine which entries to exclude from the LDIF.
    • createLdifEntryWriter

      public LdifEntryWriter createLdifEntryWriter() throws IOException
      Creates an LDIF entry writer from using the configuration held in this object.
      Returns:
      a new LDIF entry writer
      Throws:
      IOException - If a problem occurs while opening the writer.
    • close

      public void close()
      Closes any resources that this export config might have open.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable