Package org.opends.server.types
Class LDIFExportConfig
- java.lang.Object
-
- org.opends.server.types.Cancellable
-
- org.opends.server.types.LDIFExportConfig
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
@PublicAPI(stability=VOLATILE, mayInstantiate=true, mayInvoke=true) 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 Summary
Constructors Constructor Description LDIFExportConfig(OutputStream ldifOutputStream)
Creates a new LDIF export configuration that will write to the provided output stream.LDIFExportConfig(String ldifFile, ExistingFileBehavior existingFileBehavior)
Creates a new LDIF export configuration that will write to the specified LDIF file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes any resources that this export config might have open.LdifEntryWriter
createLdifEntryWriter()
Creates an LDIF entry writer from using the configuration held in this object.Set<Dn>
getIncludeBranches()
Retrieves the set of base DNs that specify the set of entries to include in the export.OutputStream
getOutputStream()
Retrieves the output stream that should be used to write the LDIF data.int
getWrapColumn()
Retrieves the column at which long lines should be wrapped.void
setCompressData(boolean compressData)
Specifies whether the LDIF data should be compressed as it is written.void
setEncryptData(boolean encryptData)
Specifies whether the LDIF data should be encrypted as it is written.void
setExcludeAttributes(Set<AttributeType> excludeAttributes)
Specifies the set of attributes that should be excluded from the entries written to LDIF.void
setExcludeBranches(Set<Dn> excludeBranches)
Specifies the set of base DNs that specify the set of entries to exclude from the export.void
setHashData(boolean hashData)
Specifies whether to generate a cryptographic hash of the data that is written.void
setIncludeAttributes(Set<AttributeType> includeAttributes)
Specifies the set of attributes that should be included in the entries written to LDIF.void
setIncludeBranches(Set<Dn> includeBranches)
Specifies the set of base DNs that specify the set of entries to include in the export.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.void
setIncludeOperationalAttributes(boolean includeOperationalAttributes)
Specifies whether the set of operational attributes should be included in the export.void
setSignHash(boolean signHash)
Specifies whether to sign the cryptographic hash of the data that is written when the export is complete.void
setWrapColumn(int wrapColumn)
Specifies the column at which long lines should be wrapped.-
Methods inherited from class org.opends.server.types.Cancellable
cancel, getCancelReason, isCancelled, toString
-
-
-
-
Constructor Detail
-
LDIFExportConfig
public LDIFExportConfig(String 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 Detail
-
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 callinggetWriter
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 callinggetWriter
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 callinggetWriter
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 callinggetWriter
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-