Package org.opends.server.types
Class LDIFImportConfig
java.lang.Object
org.opends.server.types.Cancellable
org.opends.server.types.LDIFImportConfig
- All Implemented Interfaces:
Closeable,AutoCloseable
This class defines a data structure for holding configuration information to use when performing an LDIF import.
-
Constructor Summary
ConstructorsConstructorDescriptionLDIFImportConfig(InputStream ldifInputStream) Creates a new LDIF import configuration that will read from the provided input stream.LDIFImportConfig(Path ldifFile) Creates a new LDIF import configuration that will read from the specified LDIF file.LDIFImportConfig(List<Path> ldifFiles) Creates a new LDIF import configuration that will read from the specified LDIF files.LDIFImportConfig(EntryReader entryReader) Creates a new LDIF import configuration that will read from the provided entry reader. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether to clear the entire backend if importing to a backend with more than one base DNs.voidclose()Closes any resources that this import config might have open.Retrieves the writer that should be used to write entries that are rejected rather than imported for some reason.Retrieves the writer that should be used to write entries that are skipped because they don't match the criteria.intReturn the specified thread count.Return the temporary directory path.booleanincludeAttribute(AttributeType attributeType) Indicates whether the specified attribute should be included in the entries read from the LDIF.includeEntry(Dn dn) Indicates whether to include the entry with the specified DN in the import.includeEntry(Entry entry) Indicates whether the specified entry should be included in the import based on the configured set of include and exclude filters.booleanIndicates whether any LDIF import plugins registered with the server should be invoked during the import operation.booleanIndicates whether the input LDIF source is expected to be compressed.booleanIndicates whether the input LDIF source is expected to be encrypted.Retrieves the next reader that should be used to read the following LDIF data.voidsetBufferSize(int bufferSize) Specifies the buffer size that should be used when reading LDIF data.voidsetClearBackend(boolean clearBackend) Specifies whether to clear the entire backend if importing to a backend.voidsetCompressed(boolean isCompressed) Specifies whether the input LDIF source is expected to be compressed.voidsetEncrypted(boolean isEncrypted) Specifies whether the input LDIF source is expected to be encrypted.voidsetExcludeAllOperationalAttributes(boolean excludeAllOpAttrs) Specifies whether all the operational attributes should be excluded.voidsetExcludeAllUserAttributes(boolean excludeAllUserAttrs) Specifies whether all the user attributes should be excluded.voidsetExcludeAttributes(Set<AttributeType> excludeAttributes) Specifies the set of attributes that should be excluded from the entries read from the LDIF.voidsetExcludeBranches(Set<Dn> excludeBranches) Specifies the set of base DNs that specify the set of entries to exclude from the import.voidsetIncludeAllOpAttributes(boolean includeAllOpAttrs) Specifies whether all the operational attributes should be included.voidsetIncludeAllUserAttributes(boolean includeAllUserAttrs) Specifies whether all the user attributes should be included.voidsetIncludeAttributes(Set<AttributeType> includeAttributes) Specifies the set of attributes that should be included in the entries read from the LDIF.voidsetIncludeBranches(Set<Dn> includeBranches) Specifies the set of base DNs that specify the set of entries to include in the import.voidsetIncludeExcludeFilters(Set<Filter> includeFilters, Set<Filter> excludeFilters) Specifies search filters that should be used to determine which entries to include/exclude from the LDIF.voidsetInvokeImportPlugins(boolean invokeImportPlugins) Specifies whether any LDIF import plugins registered with the server should be invoked during the import operation.voidsetThreadCount(int c) Set the thread count.voidsetTmpDirectory(String path) Set the temporary directory to the specified path.voidsetValidateSchema(boolean validateSchema) Specifies whether to perform schema validation on entries as they are read.booleanIndicates whether to perform schema validation on entries as they are read.voidwriteRejectedEntries(Path rejectFile, ExistingFileBehavior existingFileBehavior) Indicates that rejected entries should be written to the specified file.voidwriteSkippedEntries(Path skipFile, ExistingFileBehavior existingFileBehavior) Indicates that skipped entries should be written to the specified file.Methods inherited from class org.opends.server.types.Cancellable
cancel, getCancelReason, isCancelled, toString
-
Constructor Details
-
LDIFImportConfig
Creates a new LDIF import configuration that will read from the specified LDIF file.- Parameters:
ldifFile- The path to the LDIF file with the data to import.
-
LDIFImportConfig
Creates a new LDIF import configuration that will read from the specified LDIF files. The files will be imported in the order they are specified in the provided list.- Parameters:
ldifFiles- The paths to the LDIF files with the data to import.
-
LDIFImportConfig
Creates a new LDIF import configuration that will read from the provided entry reader.- Parameters:
entryReader- The entry reader from which to read the LDIF data.
-
LDIFImportConfig
Creates a new LDIF import configuration that will read from the provided input stream.- Parameters:
ldifInputStream- The input stream from which to read the LDIF data.
-
-
Method Details
-
nextReader
Retrieves the next reader that should be used to read the following LDIF data.- Returns:
- The reader that should be used to read the LDIF data, or
nullif there are no more files to read. - Throws:
IOException- If a problem occurs while obtaining the reader.
-
getRejectWriter
Retrieves the writer that should be used to write entries that are rejected rather than imported for some reason.- Returns:
- The reject writer, or
nullif none is to be used.
-
getSkipWriter
Retrieves the writer that should be used to write entries that are skipped because they don't match the criteria.- Returns:
- The skip writer, or
nullif none is to be used.
-
writeRejectedEntries
public void writeRejectedEntries(Path rejectFile, ExistingFileBehavior existingFileBehavior) throws IOException Indicates that rejected entries should be written to the specified file. Note that this applies only to entries that are rejected because they are invalid (e.g., are malformed or don't conform to schema requirements), and not to entries that are rejected because they matched exclude criteria.- Parameters:
rejectFile- The path to the file to which reject information should be written.existingFileBehavior- Indicates how to treat an existing file.- Throws:
IOException- If a problem occurs while opening the reject file for writing.
-
writeSkippedEntries
public void writeSkippedEntries(Path skipFile, ExistingFileBehavior existingFileBehavior) throws IOException Indicates that skipped entries should be written to the specified file. Note that this applies only to entries that are skipped because they matched exclude criteria.- Parameters:
skipFile- The path to the file to which skipped information should be written.existingFileBehavior- Indicates how to treat an existing file.- Throws:
IOException- If a problem occurs while opening the skip file for writing.
-
invokeImportPlugins
public boolean invokeImportPlugins()Indicates whether any LDIF import plugins registered with the server should be invoked during the import operation.- Returns:
trueif registered LDIF import plugins should be invoked during the import operation, orfalseif they should not be invoked.
-
setInvokeImportPlugins
public void setInvokeImportPlugins(boolean invokeImportPlugins) Specifies whether any LDIF import plugins registered with the server should be invoked during the import operation.- Parameters:
invokeImportPlugins- Specifies whether any LDIF import plugins registered with the server should be invoked during the import operation.
-
isCompressed
public boolean isCompressed()Indicates whether the input LDIF source is expected to be compressed.- Returns:
trueif the LDIF source is expected to be compressed, orfalseif not.
-
setCompressed
public void setCompressed(boolean isCompressed) Specifies whether the input LDIF source is expected to be compressed. If compression is used, then this must be set prior to the initial call togetReader.- Parameters:
isCompressed- Indicates whether the input LDIF source is expected to be compressed.
-
isEncrypted
public boolean isEncrypted()Indicates whether the input LDIF source is expected to be encrypted.- Returns:
trueif the LDIF source is expected to be encrypted, orfalseif not.
-
setEncrypted
public void setEncrypted(boolean isEncrypted) Specifies whether the input LDIF source is expected to be encrypted. If encryption is used, then this must be set prior to the initial call togetReader.- Parameters:
isEncrypted- Indicates whether the input LDIF source is expected to be encrypted.
-
clearBackend
public boolean clearBackend()Indicates whether to clear the entire backend if importing to a backend with more than one base DNs.- Returns:
trueif the entire backend should be cleared orfalseif not.
-
setClearBackend
public void setClearBackend(boolean clearBackend) Specifies whether to clear the entire backend if importing to a backend.- Parameters:
clearBackend- Indicates whether to clear the entire backend.
-
validateSchema
public boolean validateSchema()Indicates whether to perform schema validation on entries as they are read.- Returns:
trueif schema validation should be performed on the entries as they are read, orfalseif not.
-
setValidateSchema
public void setValidateSchema(boolean validateSchema) Specifies whether to perform schema validation on entries as they are read.- Parameters:
validateSchema- Indicates whether to perform schema validation on entries as they are read.
-
setExcludeBranches
Specifies the set of base DNs that specify the set of entries to exclude from the import.- Parameters:
excludeBranches- The set of base DNs that specify the set of entries to exclude from the import.
-
setIncludeBranches
Specifies the set of base DNs that specify the set of entries to include in the import.- Parameters:
includeBranches- The set of base DNs that specify the set of entries to include in the import.
-
includeEntry
Indicates whether to include the entry with the specified DN in the import.- Parameters:
dn- The DN of the entry for which to make the determination.- Returns:
- a pair where the first element is a boolean indicating whether the entry with the specified DN should be
included in the import, and the second element is a message with the reason why an entry is not included
in the import (it is
nullwhen the entry is included in the import).
-
setExcludeAttributes
Specifies the set of attributes that should be excluded from the entries read from the LDIF.- Parameters:
excludeAttributes- The set of attributes that should be excluded from the entries read from the LDIF.
-
setIncludeAttributes
Specifies the set of attributes that should be included in the entries read from the LDIF.- Parameters:
includeAttributes- The set of attributes that should be included in the entries read from the LDIF.
-
includeAttribute
Indicates whether the specified attribute should be included in the entries read from the LDIF.- Parameters:
attributeType- The attribute type for which to make the determination.- Returns:
trueif the specified attribute should be included in the entries read from the LDIF, orfalseif not.
-
setIncludeExcludeFilters
Specifies search filters that should be used to determine which entries to include/exclude from the LDIF.- Parameters:
includeFilters- The filters that should be used to determine which entries to include from the LDIF.excludeFilters- The filters that should be used to determine which entries to exclude from the LDIF.
-
includeEntry
Indicates whether the specified entry should be included in the import based on the configured set of include and exclude filters.- Parameters:
entry- The entry for which to make the determination.- Returns:
- a pair where the first element is a boolean indicating whether the entry with the specified DN should be
included in the import, and the second element is a message with the reason why an entry is not included
in the import (it is
nullwhen the entry is included in the import).
-
setBufferSize
public void setBufferSize(int bufferSize) Specifies the buffer size that should be used when reading LDIF data.- Parameters:
bufferSize- The buffer size that should be used when reading LDIF data.
-
setExcludeAllUserAttributes
public void setExcludeAllUserAttributes(boolean excludeAllUserAttrs) Specifies whether all the user attributes should be excluded.- Parameters:
excludeAllUserAttrs- Specifies all user attributes to be excluded.
-
setExcludeAllOperationalAttributes
public void setExcludeAllOperationalAttributes(boolean excludeAllOpAttrs) Specifies whether all the operational attributes should be excluded.- Parameters:
excludeAllOpAttrs- Specifies whether all the operational attributes should be excluded.
-
setIncludeAllOpAttributes
public void setIncludeAllOpAttributes(boolean includeAllOpAttrs) Specifies whether all the operational attributes should be included.- Parameters:
includeAllOpAttrs- Specifies whether all the operation attributes should be included.
-
setIncludeAllUserAttributes
public void setIncludeAllUserAttributes(boolean includeAllUserAttrs) Specifies whether all the user attributes should be included.- Parameters:
includeAllUserAttrs- Specifies whether all the user attributes should be included.
-
close
public void close()Closes any resources that this import config might have open.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
setTmpDirectory
Set the temporary directory to the specified path.- Parameters:
path- The path to set the temporary directory to.
-
getTmpDirectory
Return the temporary directory path.- Returns:
- The temporary directory string.
-
setThreadCount
public void setThreadCount(int c) Set the thread count.- Parameters:
c- The thread count value.
-
getThreadCount
public int getThreadCount()Return the specified thread count.- Returns:
- The thread count.
-