org.opends.server.types
Class LDIFExportConfig

java.lang.Object
  extended by org.opends.server.types.OperationConfig
      extended by org.opends.server.types.LDIFExportConfig

@PublicAPI(stability=VOLATILE,
           mayInstantiate=true,
           mayExtend=false,
           mayInvoke=true)
public final class LDIFExportConfig
extends OperationConfig

This class defines a data structure for holding configuration information to use when performing an LDIF export.


Constructor Summary
LDIFExportConfig(java.io.OutputStream ldifOutputStream)
          Creates a new LDIF export configuration that will write to the provided output stream.
LDIFExportConfig(java.lang.String ldifFile, ExistingFileBehavior existingFileBehavior)
          Creates a new LDIF export configuration that will write to the specified LDIF file.
 
Method Summary
 void close()
          Closes any resources that this export config might have open.
 boolean compressData()
          Indicates whether the LDIF data should be compressed as it is written.
 boolean encryptData()
          Indicates whether the LDIF data should be encrypted as it is written.
 java.util.Set<AttributeType> getExcludeAttributes()
          Retrieves the set of attributes that should be excluded from the entries written to LDIF.
 java.util.List<DN> getExcludeBranches()
          Retrieves the set of base DNs that specify the set of entries to exclude from the export.
 java.util.List<SearchFilter> getExcludeFilters()
          Retrieves the set of search filters that should be used to determine which entries to exclude from the LDIF.
 java.util.Set<AttributeType> getIncludeAttributes()
          Retrieves the set of attributes that should be included in the entries written to LDIF.
 java.util.List<DN> getIncludeBranches()
          Retrieves the set of base DNs that specify the set of entries to include in the export.
 java.util.List<SearchFilter> getIncludeFilters()
          Retrieves the set of search filters that should be used to determine which entries to include in the LDIF.
 int getWrapColumn()
          Retrieves the column at which long lines should be wrapped.
 java.io.BufferedWriter getWriter()
          Retrieves the writer that should be used to write the LDIF data.
 boolean hashData()
          Indicates whether to generate a cryptographic hash of the data that is written.
 boolean includeAttribute(AttributeType attributeType)
          Indicates whether the specified attribute should be included in the entries written to LDIF.
 boolean includeEntry(Entry entry)
          Indicates whether the specified entry should be included in the export based on the configured set of include and exclude filters.
 boolean includeObjectClasses()
          Indicates whether the set of objectclasses should be included in the entries written to LDIF.
 boolean includeOperationalAttributes()
          Indicates whether the set of operational attributes should be included in the export.
 boolean includeVirtualAttributes()
          Indicates whether virtual attributes should be included in the export.
 boolean invokeExportPlugins()
          Indicates whether the LDIF export plugins should be invoked for entries as they are exported.
 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(java.util.Set<AttributeType> excludeAttributes)
          Specifies the set of attributes that should be excluded from the entries written to LDIF.
 void setExcludeBranches(java.util.List<DN> excludeBranches)
          Specifies the set of base DNs that specify the set of entries to exclude from the export.
 void setExcludeFilters(java.util.List<SearchFilter> excludeFilters)
          Specifies the set of search filters that should be used to determine which entries to exclude from the LDIF.
 void setHashData(boolean hashData)
          Specifies whether to generate a cryptographic hash of the data that is written.
 void setIncludeAttributes(java.util.Set<AttributeType> includeAttributes)
          Specifies the set of attributes that should be included in the entries written to LDIF.
 void setIncludeBranches(java.util.List<DN> includeBranches)
          Specifies the set of base DNs that specify the set of entries to include in the export.
 void setIncludeFilters(java.util.List<SearchFilter> includeFilters)
          Specifies the set of search filters that should be used to determine which entries to include in the LDIF.
 void setIncludeObjectClasses(boolean includeObjectClasses)
          Specifies whether the objectclasss attribute should be included in the export.
 void setIncludeOperationalAttributes(boolean includeOperationalAttributes)
          Specifies whether the set of operational attributes should be included in the export.
 void setIncludeVirtualAttributes(boolean includeVirtualAttributes)
          Specifies whether virtual attributes should be included in the export.
 void setInvokeExportPlugins(boolean invokeExportPlugins)
          Specifies whether the LDIF export plugins should be invoked for entries as they are exported.
 void setSignHash(boolean signHash)
          Specifies whether to sign the cryptographic hash of the data that is written when the export is complete.
 void setTypesOnly(boolean typesOnly)
          Specifies whether the LDIF generated should include attribute types (i.e., attribute names) only or both attribute types and values.
 void setWrapColumn(int wrapColumn)
          Specifies the column at which long lines should be wrapped.
 boolean signHash()
          Indicates whether to sign the cryptographic hash of the data that is written when the export is complete.
 boolean typesOnly()
          Indicates whether the LDIF generated should include attribute types (i.e., attribute names) only or both attribute types and values.
 
Methods inherited from class org.opends.server.types.OperationConfig
cancel, isCancelled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDIFExportConfig

public LDIFExportConfig(java.lang.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(java.io.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

getWriter

public java.io.BufferedWriter getWriter()
                                 throws java.io.IOException
Retrieves the writer 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 writer that should be used to write the LDIF data.
Throws:
java.io.IOException - If a problem occurs while preparing the writer.

invokeExportPlugins

public boolean invokeExportPlugins()
Indicates whether the LDIF export plugins should be invoked for entries as they are exported.

Returns:
true if LDIF export plugins should be invoked for entries as they are exported, or false if not.

setInvokeExportPlugins

public void setInvokeExportPlugins(boolean invokeExportPlugins)
Specifies whether the LDIF export plugins should be invoked for entries as they are exported.

Parameters:
invokeExportPlugins - Specifies whether the LDIF export plugins should be invoked for entries as they are exported.

compressData

public boolean compressData()
Indicates whether the LDIF data should be compressed as it is written.

Returns:
true if the LDIF data should be compressed as it is written, or false if not.

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.

encryptData

public boolean encryptData()
Indicates whether the LDIF data should be encrypted as it is written.

Returns:
true if the LDIF data should be encrypted as it is written, or false if not.

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.

hashData

public boolean hashData()
Indicates whether to generate a cryptographic hash of the data that is written.

Returns:
true if a hash should be generated as the data is written, or false if not.

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.

signHash

public boolean signHash()
Indicates whether to sign the cryptographic hash of the data that is written when the export is complete.

Returns:
true if the hash should be signed when the export is complete, or false if not.

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.

typesOnly

public boolean typesOnly()
Indicates whether the LDIF generated should include attribute types (i.e., attribute names) only or both attribute types and values.

Returns:
true if only attribute types should be included in the resulting LDIF, or false if both types and values should be included.

setTypesOnly

public void setTypesOnly(boolean typesOnly)
Specifies whether the LDIF generated should include attribute types (i.e., attribute names) only or both attribute types and values.

Parameters:
typesOnly - Specifies whether the LDIF generated should include attribute types only or both attribute types and values.

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.

getExcludeBranches

public java.util.List<DN> getExcludeBranches()
Retrieves the set of base DNs that specify the set of entries to exclude from 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 exclude from the export.

setExcludeBranches

public void setExcludeBranches(java.util.List<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 java.util.List<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(java.util.List<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.

includeObjectClasses

public boolean includeObjectClasses()
Indicates whether the set of objectclasses should be included in the entries written to LDIF.

Returns:
true if the set of objectclasses should be included in the entries written to LDIF, or false if not.

includeOperationalAttributes

public boolean includeOperationalAttributes()
Indicates whether the set of operational attributes should be included in the export.

Returns:
true if the set of operational attributes should be included in the export.

setIncludeObjectClasses

public void setIncludeObjectClasses(boolean includeObjectClasses)
Specifies whether the objectclasss attribute should be included in the export.

Parameters:
includeObjectClasses - Specifies whether the objectclass attribute should be included 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.

includeVirtualAttributes

public boolean includeVirtualAttributes()
Indicates whether virtual attributes should be included in the export.

Returns:
true if virtual attributes should be included in the export, or false if not.

setIncludeVirtualAttributes

public void setIncludeVirtualAttributes(boolean includeVirtualAttributes)
Specifies whether virtual attributes should be included in the export.

Parameters:
includeVirtualAttributes - Specifies whether virtual attributes should be included in the export.

getExcludeAttributes

public java.util.Set<AttributeType> getExcludeAttributes()
Retrieves the set of attributes that should be excluded from the entries written to LDIF. The set that is returned may be altered by the caller.

Returns:
The set of attributes that should be excluded from the entries written to LDIF.

setExcludeAttributes

public void setExcludeAttributes(java.util.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.

getIncludeAttributes

public java.util.Set<AttributeType> getIncludeAttributes()
Retrieves the set of attributes that should be included in the entries written to LDIF. The set that is returned may be altered by the caller.

Returns:
The set of attributes that should be included in the entries written to LDIF.

setIncludeAttributes

public void setIncludeAttributes(java.util.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.

includeAttribute

public boolean includeAttribute(AttributeType attributeType)
Indicates whether the specified attribute should be included in the entries written to LDIF.

Parameters:
attributeType - The attribute type for which to make the determination.
Returns:
true if the specified attribute should be included in the entries written to LDIF, or false if not.

getExcludeFilters

public java.util.List<SearchFilter> getExcludeFilters()
Retrieves the set of search filters that should be used to determine which entries to exclude from the LDIF. The list that is returned may be altered by the caller.

Returns:
The set of search filters that should be used to determine which entries to exclude from the LDIF.

setExcludeFilters

public void setExcludeFilters(java.util.List<SearchFilter> excludeFilters)
Specifies the set of search filters that should be used to determine which entries to exclude from the LDIF.

Parameters:
excludeFilters - The set of search filters that should be used to determine which entries to exclude from the LDIF.

getIncludeFilters

public java.util.List<SearchFilter> getIncludeFilters()
Retrieves the set of search filters that should be used to determine which entries to include in the LDIF. The list that is returned may be altered by the caller.

Returns:
The set of search filters that should be used to determine which entries to include in the LDIF.

setIncludeFilters

public void setIncludeFilters(java.util.List<SearchFilter> includeFilters)
Specifies the set of search filters that should be used to determine which entries to include in the LDIF.

Parameters:
includeFilters - The set of search filters that should be used to determine which entries to include in the LDIF.

includeEntry

public boolean includeEntry(Entry entry)
                     throws DirectoryException
Indicates whether the specified entry should be included in the export based on the configured set of include and exclude filters.

Parameters:
entry - The entry for which to make the determination.
Returns:
true if the specified entry should be included in the export, or false if not.
Throws:
DirectoryException - If there is a problem with any of the search filters used to make the determination.

close

public void close()
Closes any resources that this export config might have open.