Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2008-2018 Ping Identity Corporation
* All Rights Reserved.
*/
/*
* Copyright (C) 2015-2018 Ping Identity Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (GPLv2 only)
* or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see .
*/
package com.unboundid.ldap.sdk.unboundidds.tasks;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.unboundid.ldap.sdk.Attribute;
import com.unboundid.ldap.sdk.Entry;
import com.unboundid.util.Debug;
import com.unboundid.util.NotMutable;
import com.unboundid.util.StaticUtils;
import com.unboundid.util.ThreadSafety;
import com.unboundid.util.ThreadSafetyLevel;
import com.unboundid.util.Validator;
import static com.unboundid.ldap.sdk.unboundidds.tasks.TaskMessages.*;
/**
* This class defines a Directory Server task that can be used to export the
* contents of a backend to LDIF.
*
*
* NOTE: This class, and other classes within the
* {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
* supported for use against Ping Identity, UnboundID, and
* Nokia/Alcatel-Lucent 8661 server products. These classes provide support
* for proprietary functionality or for external specifications that are not
* considered stable or mature enough to be guaranteed to work in an
* interoperable way with other types of LDAP servers.
*
*
* The properties that are available for use with this type of task include:
*
*
The backend ID for the backend from which the data is to be exported.
* It must be provided when scheduling a task of this type.
*
The path (on the server system) and name of the LDIF file to be
* written. It must be provided when scheduling a task of this type.
*
A flag that indicates whether to append to any existing file or to
* overwrite it.
*
An optional list of base DNs for branches that should be included in
* the export.
*
An optional list of base DNs for branches that should be excluded from
* the export.
*
An optional list of filters that may be used to determine whether an
* entry should be included in the export.
*
An optional list of filters that may be used to determine whether an
* entry should be excluded from the export.
*
An optional list of attributes that should be included in entries that
* are exported.
*
An optional list of attributes that should be excluded form entries
* that are exported.
*
An integer value that 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.
*
A flag that indicates whether to compress the LDIF data as it is
* written.
*
A flag that indicates whether to encrypt the LDIF data as it is
* written.
*
A flag that indicates whether to generate a signature for the LDIF data
* as it is written.
*
The path to a file containing a passphrase to use to generate the
* encryption key.
*
The ID of the encryption settings definition to use to generate the
* encryption key.
*
The maximum rate in megabytes per second at which the LDIF file should
* be written.
*
*/
@NotMutable()
@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
public final class ExportTask
extends Task
{
/**
* The fully-qualified name of the Java class that is used for the export
* task.
*/
static final String EXPORT_TASK_CLASS =
"com.unboundid.directory.server.tasks.ExportTask";
/**
* The name of the attribute used to indicate whether to append to an existing
* file.
*/
private static final String ATTR_APPEND_TO_LDIF =
"ds-task-export-append-to-ldif";
/**
* The name of the attribute used to specify the backend ID of the backend to
* export.
*/
private static final String ATTR_BACKEND_ID = "ds-task-export-backend-id";
/**
* The name of the attribute used to indicate whether the exported LDIF should
* be compressed as it is written.
*/
private static final String ATTR_COMPRESS = "ds-task-export-compress-ldif";
/**
* The name of the attribute used to indicate whether the exported LDIF should
* be encrypted as it is written.
*/
private static final String ATTR_ENCRYPT = "ds-task-export-encrypt-ldif";
/**
* The name of the attribute used to specify the path to a file that contains
* the passphrase to use to generate the encryption key.
*/
private static final String ATTR_ENCRYPTION_PASSPHRASE_FILE =
"ds-task-export-encryption-passphrase-file";
/**
* The name of the attribute used to specify the path to a file that contains
* the ID of the encryption settings definition to use to generate the
* encryption key.
*/
private static final String ATTR_ENCRYPTION_SETTINGS_DEFINITION_ID =
"ds-task-export-encryption-settings-definition-id";
/**
* The name of the attribute used to specify the attributes to exclude from
* the export.
*/
private static final String ATTR_EXCLUDE_ATTRIBUTE =
"ds-task-export-exclude-attribute";
/**
* The name of the attribute used to specify the base DNs to exclude from the
* export.
*/
private static final String ATTR_EXCLUDE_BRANCH =
"ds-task-export-exclude-branch";
/**
* The name of the attribute used to specify the filters to use to identify
* entries to exclude from the export.
*/
private static final String ATTR_EXCLUDE_FILTER =
"ds-task-export-exclude-filter";
/**
* The name of the attribute used to specify the attributes to include in the
* export.
*/
private static final String ATTR_INCLUDE_ATTRIBUTE =
"ds-task-export-include-attribute";
/**
* The name of the attribute used to specify the base DNs to include in the
* export.
*/
private static final String ATTR_INCLUDE_BRANCH =
"ds-task-export-include-branch";
/**
* The name of the attribute used to specify the filters to use to identify
* entries to include in the export.
*/
private static final String ATTR_INCLUDE_FILTER =
"ds-task-export-include-filter";
/**
* The name of the attribute used to specify the path to the LDIF file to be
* written.
*/
private static final String ATTR_LDIF_FILE = "ds-task-export-ldif-file";
/**
* The name of the attribute used to specify the maximum LDIF write rate in
* megabytes per second.
*/
private static final String ATTR_MAX_MEGABYTES_PER_SECOND =
"ds-task-export-max-megabytes-per-second";
/**
* The name of the attribute used to indicate whether the exported LDIF should
* include a signed hash of the contents.
*/
private static final String ATTR_SIGN = "ds-task-export-sign-hash";
/**
* The name of the attribute used to specify the column at which to wrap long
* lines in the export.
*/
private static final String ATTR_WRAP_COLUMN = "ds-task-export-wrap-column";
/**
* The name of the object class used in export task entries.
*/
private static final String OC_EXPORT_TASK = "ds-task-export";
/**
* The task property for the backend ID.
*/
private static final TaskProperty PROPERTY_BACKEND_ID =
new TaskProperty(ATTR_BACKEND_ID, INFO_DISPLAY_NAME_BACKEND_ID.get(),
INFO_DESCRIPTION_BACKEND_ID_EXPORT.get(), String.class,
true, false, false);
/**
* The task property for the LDIF file.
*/
private static final TaskProperty PROPERTY_LDIF_FILE =
new TaskProperty(ATTR_LDIF_FILE, INFO_DISPLAY_NAME_LDIF_FILE.get(),
INFO_DESCRIPTION_LDIF_FILE_EXPORT.get(), String.class,
true, false, false);
/**
* The task property for the append to LDIF flag.
*/
private static final TaskProperty PROPERTY_APPEND_TO_LDIF =
new TaskProperty(ATTR_APPEND_TO_LDIF,
INFO_DISPLAY_NAME_APPEND_TO_LDIF.get(),
INFO_DESCRIPTION_APPEND_TO_LDIF.get(), Boolean.class,
false, false, true);
/**
* The task property for the include branches.
*/
private static final TaskProperty PROPERTY_INCLUDE_BRANCH =
new TaskProperty(ATTR_INCLUDE_BRANCH,
INFO_DISPLAY_NAME_INCLUDE_BRANCH.get(),
INFO_DESCRIPTION_INCLUDE_BRANCH_EXPORT.get(),
String.class, false, true, true);
/**
* The task property for the exclude branches.
*/
private static final TaskProperty PROPERTY_EXCLUDE_BRANCH =
new TaskProperty(ATTR_EXCLUDE_BRANCH,
INFO_DISPLAY_NAME_EXCLUDE_BRANCH.get(),
INFO_DESCRIPTION_EXCLUDE_BRANCH_EXPORT.get(),
String.class, false, true, true);
/**
* The task property for the include filters.
*/
private static final TaskProperty PROPERTY_INCLUDE_FILTER =
new TaskProperty(ATTR_INCLUDE_FILTER,
INFO_DISPLAY_NAME_INCLUDE_FILTER.get(),
INFO_DESCRIPTION_INCLUDE_FILTER_EXPORT.get(),
String.class, false, true, true);
/**
* The task property for the exclude filters.
*/
private static final TaskProperty PROPERTY_EXCLUDE_FILTER =
new TaskProperty(ATTR_EXCLUDE_FILTER,
INFO_DISPLAY_NAME_EXCLUDE_FILTER.get(),
INFO_DESCRIPTION_EXCLUDE_FILTER_EXPORT.get(),
String.class, false, true, true);
/**
* The task property for the include attributes.
*/
private static final TaskProperty PROPERTY_INCLUDE_ATTRIBUTE =
new TaskProperty(ATTR_INCLUDE_ATTRIBUTE,
INFO_DISPLAY_NAME_INCLUDE_ATTRIBUTE.get(),
INFO_DESCRIPTION_INCLUDE_ATTRIBUTE_EXPORT.get(),
String.class, false, true, true);
/**
* The task property for the exclude attributes.
*/
private static final TaskProperty PROPERTY_EXCLUDE_ATTRIBUTE =
new TaskProperty(ATTR_EXCLUDE_ATTRIBUTE,
INFO_DISPLAY_NAME_EXCLUDE_ATTRIBUTE.get(),
INFO_DESCRIPTION_EXCLUDE_ATTRIBUTE_EXPORT.get(),
String.class, false, true, true);
/**
* The task property for the wrap column.
*/
private static final TaskProperty PROPERTY_WRAP_COLUMN =
new TaskProperty(ATTR_WRAP_COLUMN, INFO_DISPLAY_NAME_WRAP_COLUMN.get(),
INFO_DESCRIPTION_WRAP_COLUMN.get(), Long.class, false,
false, true);
/**
* The task property for the compress flag.
*/
private static final TaskProperty PROPERTY_COMPRESS =
new TaskProperty(ATTR_COMPRESS, INFO_DISPLAY_NAME_COMPRESS.get(),
INFO_DESCRIPTION_COMPRESS_EXPORT.get(), Boolean.class,
false, false, false);
/**
* The task property for the encrypt flag.
*/
private static final TaskProperty PROPERTY_ENCRYPT =
new TaskProperty(ATTR_ENCRYPT, INFO_DISPLAY_NAME_ENCRYPT.get(),
INFO_DESCRIPTION_ENCRYPT_EXPORT.get(), Boolean.class,
false, false, false);
/**
* The task property that will be used for the encryption passphrase file.
*/
private static final TaskProperty PROPERTY_ENCRYPTION_PASSPHRASE_FILE =
new TaskProperty(ATTR_ENCRYPTION_PASSPHRASE_FILE,
INFO_DISPLAY_NAME_ENCRYPTION_PASSPHRASE_FILE.get(),
INFO_DESCRIPTION_ENCRYPTION_PASSPHRASE_FILE.get(),
String.class, false, false, true);
/**
* The task property that will be used for the encryption settings definition
* ID.
*/
private static final TaskProperty PROPERTY_ENCRYPTION_SETTINGS_DEFINITION_ID =
new TaskProperty(ATTR_ENCRYPTION_SETTINGS_DEFINITION_ID,
INFO_DISPLAY_NAME_ENCRYPTION_SETTINGS_DEFINITION_ID.get(),
INFO_DESCRIPTION_ENCRYPTION_SETTINGS_DEFINITION_ID.get(),
String.class, false, false, true);
/**
* The task property for the sign flag.
*/
private static final TaskProperty PROPERTY_SIGN =
new TaskProperty(ATTR_SIGN, INFO_DISPLAY_NAME_SIGN.get(),
INFO_DESCRIPTION_SIGN_EXPORT.get(), Boolean.class,
false, false, false);
/**
* The task property that will be used for the maximum write rate in megabytes
* per second.
*/
private static final TaskProperty PROPERTY_MAX_MEGABYTES_PER_SECOND =
new TaskProperty(ATTR_MAX_MEGABYTES_PER_SECOND,
INFO_DISPLAY_NAME_EXPORT_MAX_MEGABYTES_PER_SECOND.get(),
INFO_DESCRIPTION_EXPORT_MAX_MEGABYTES_PER_SECOND.get(),
Long.class, false, false, true);
/**
* The serial version UID for this serializable class.
*/
private static final long serialVersionUID = -6807534587873728959L;
// Indicates whether to append the data to an existing file.
private final boolean appendToLDIF;
// Indicates whether to compress the data.
private final boolean compress;
// Indicates whether to encrypt the data.
private final boolean encrypt;
// Indicates whether to sign the data.
private final boolean sign;
// The column at which to wrap long lines.
private final int wrapColumn;
// The maximum write rate in megabytes per second.
private final Integer maxMegabytesPerSecond;
// The set of attributes to exclude from the export.
private final List excludeAttributes;
// The set of base DNs to exclude from the export.
private final List excludeBranches;
// The set of filters to use to identify entries to exclude.
private final List excludeFilters;
// The set of attributes to include in the export.
private final List includeAttributes;
// The set of base DNs to include in the export.
private final List includeBranches;
// The set of filters to use to identify entries to include.
private final List includeFilters;
// The backend ID of the backend to export.
private final String backendID;
// The path to a file containing the passphrase to use to generate the
// encryption key.
private final String encryptionPassphraseFile;
// The identifier for the encryption settings definition to use to generate
// the encryption key.
private final String encryptionSettingsDefinitionID;
// The path to the LDIF file to generate.
private final String ldifFile;
/**
* Creates a new uninitialized export task instance which should only be used
* for obtaining general information about this task, including the task name,
* description, and supported properties. Attempts to use a task created with
* this constructor for any other reason will likely fail.
*/
public ExportTask()
{
appendToLDIF = false;
compress = false;
encrypt = false;
sign = false;
wrapColumn = -1;
maxMegabytesPerSecond = null;
encryptionPassphraseFile = null;
encryptionSettingsDefinitionID = null;
excludeAttributes = null;
excludeBranches = null;
excludeFilters = null;
includeAttributes = null;
includeBranches = null;
includeFilters = null;
backendID = null;
ldifFile = null;
}
/**
* Creates a new export task with the provided information.
*
* @param taskID The task ID to use for this task. If it is {@code null}
* then a UUID will be generated for use as the task ID.
* @param backendID The backend ID of the backend containing the data to
* export. It must not be {@code null}.
* @param ldifFile The path to the LDIF file to create. It may be an
* absolute path or a path relative to the server install
* root. It must not be {@code null}.
*/
public ExportTask(final String taskID, final String backendID,
final String ldifFile)
{
this(taskID, backendID, ldifFile, false, null, null, null, null, null, null,
-1, false, false, false, null, null, null, null, null);
}
/**
* Creates a new export task with the provided information.
*
* @param taskID The task ID to use for this task. If it is
* {@code null} then a UUID will be generated
* for use as the task ID.
* @param backendID The backend ID of the backend to be
* exported. It must not be {@code null}.
* @param ldifFile The path to the LDIF file to be written.
* It may be an absolute path or one that is
* relative to the server root. It must not
* be {@code null}.
* @param appendToLDIF Indicates whether to an append to any
* existing file rather than overwriting it.
* @param includeBranches The set of base DNs of entries to include
* in the export. It may be {@code null} or
* empty if no entries should be excluded
* based on their location.
* @param excludeBranches The set of base DNs of entries to exclude
* from the export. It may be {@code null} or
* empty if no entries should be excluded
* based on their location.
* @param includeFilters The set of filters to use to match entries
* that should be included in the export. It
* may be {@code null} or empty if no entries
* should be excluded based on their content.
* @param excludeFilters The set of filters to use to match entries
* that should be excluded from the export.
* It may be {@code null} or empty if no
* entries should be excluded based on their
* content.
* @param includeAttributes The set of attributes that should be
* included in exported entries. It may be
* {@code null} or empty if all attributes
* should be included.
* @param excludeAttributes The set of attributes that should be
* excluded from exported entries. It may be
* {@code null} or empty if no attributes
* should be excluded.
* @param wrapColumn The column at which long lines should be
* wrapped. It may be less than or equal to
* zero to indicate that long lines should not
* be wrapped.
* @param compress Indicates whether the LDIF data should be
* compressed as it is written.
* @param encrypt Indicates whether the LDIF data should be
* encrypted as it is written.
* @param sign Indicates whether to include a signed hash
* of the content in the exported data.
* @param scheduledStartTime The time that this task should start
* running.
* @param dependencyIDs The list of task IDs that will be required
* to complete before this task will be
* eligible to start.
* @param failedDependencyAction Indicates what action should be taken if
* any of the dependencies for this task do
* not complete successfully.
* @param notifyOnCompletion The list of e-mail addresses of individuals
* that should be notified when this task
* completes.
* @param notifyOnError The list of e-mail addresses of individuals
* that should be notified if this task does
* not complete successfully.
*/
public ExportTask(final String taskID, final String backendID,
final String ldifFile, final boolean appendToLDIF,
final List includeBranches,
final List excludeBranches,
final List includeFilters,
final List excludeFilters,
final List includeAttributes,
final List excludeAttributes, final int wrapColumn,
final boolean compress, final boolean encrypt,
final boolean sign, final Date scheduledStartTime,
final List dependencyIDs,
final FailedDependencyAction failedDependencyAction,
final List notifyOnCompletion,
final List notifyOnError)
{
this(taskID, backendID, ldifFile, appendToLDIF, includeBranches,
excludeBranches, includeFilters, excludeFilters, includeAttributes,
excludeAttributes, wrapColumn, compress, encrypt, null, null, sign,
null, scheduledStartTime, dependencyIDs, failedDependencyAction,
notifyOnCompletion, notifyOnError);
}
/**
* Creates a new export task with the provided information.
*
* @param taskID The task ID to use for this task.
* If it is {@code null} then a UUID
* will be generated for use as the
* task ID.
* @param backendID The backend ID of the backend to be
* exported. It must not be
* {@code null}.
* @param ldifFile The path to the LDIF file to be
* written. It may be an absolute
* path or one that is relative to the
* server root. It must not be
* {@code null}.
* @param appendToLDIF Indicates whether to an append to
* any existing file rather than
* overwriting it.
* @param includeBranches The set of base DNs of entries to
* include in the export. It may be
* {@code null} or empty if no entries
* should be excluded based on their
* location.
* @param excludeBranches The set of base DNs of entries to
* exclude from the export. It may be
* {@code null} or empty if no entries
* should be excluded based on their
* location.
* @param includeFilters The set of filters to use to match
* entries that should be included in
* the export. It may be {@code null}
* or empty if no entries should be
* excluded based on their content.
* @param excludeFilters The set of filters to use to match
* entries that should be excluded
* from the export. It may be
* {@code null} or empty if no entries
* should be excluded based on their
* content.
* @param includeAttributes The set of attributes that should
* be included in exported entries.
* It may be {@code null} or empty if
* all attributes should be included.
* @param excludeAttributes The set of attributes that should
* be excluded from exported entries.
* It may be {@code null} or empty if
* no attributes should be excluded.
* @param wrapColumn The column at which long lines
* should be wrapped. It may be less
* than or equal to zero to indicate
* that long lines should not be
* wrapped.
* @param compress Indicates whether the LDIF data
* should be compressed as it is
* written.
* @param encrypt Indicates whether the LDIF data
* should be encrypted as it is
* written.
* @param encryptionPassphraseFile The path to a file containing the
* passphrase to use to generate the
* encryption key. It amy be
* {@code null} if the LDIF file is
* not to be encrypted, or if the key
* should be obtained in some other
* way.
* @param encryptionSettingsDefinitionID The ID of the encryption settings
* definition use to generate the
* encryption key. It may be
* {@code null} if the LDIF file is
* not to be encrypted, or if the key
* should be obtained in some other
* way.
* @param sign Indicates whether to include a
* signed hash of the content in the
* exported data.
* @param maxMegabytesPerSecond The maximum rate in megabytes per
* second at which the LDIF file
* should be written.
* @param scheduledStartTime The time that this task should
* start running.
* @param dependencyIDs The list of task IDs that will be
* required to complete before this
* task will be eligible to start.
* @param failedDependencyAction Indicates what action should be
* taken if any of the dependencies
* for this task do not complete
* successfully.
* @param notifyOnCompletion The list of e-mail addresses of
* individuals that should be notified
* when this task completes.
* @param notifyOnError The list of e-mail addresses of
* individuals that should be notified
* if this task does not complete
* successfully.
*/
public ExportTask(final String taskID, final String backendID,
final String ldifFile, final boolean appendToLDIF,
final List includeBranches,
final List excludeBranches,
final List includeFilters,
final List excludeFilters,
final List includeAttributes,
final List excludeAttributes, final int wrapColumn,
final boolean compress, final boolean encrypt,
final String encryptionPassphraseFile,
final String encryptionSettingsDefinitionID,
final boolean sign, final Integer maxMegabytesPerSecond,
final Date scheduledStartTime,
final List dependencyIDs,
final FailedDependencyAction failedDependencyAction,
final List notifyOnCompletion,
final List notifyOnError)
{
this(taskID, backendID, ldifFile, appendToLDIF, includeBranches,
excludeBranches, includeFilters, excludeFilters, includeAttributes,
excludeAttributes, wrapColumn, compress, encrypt,
encryptionPassphraseFile, encryptionSettingsDefinitionID, sign,
maxMegabytesPerSecond, scheduledStartTime, dependencyIDs,
failedDependencyAction, null, notifyOnCompletion, null,
notifyOnError, null, null, null);
}
/**
* Creates a new export task with the provided information.
*
* @param taskID The task ID to use for this task.
* If it is {@code null} then a UUID
* will be generated for use as the
* task ID.
* @param backendID The backend ID of the backend to be
* exported. It must not be
* {@code null}.
* @param ldifFile The path to the LDIF file to be
* written. It may be an absolute
* path or one that is relative to the
* server root. It must not be
* {@code null}.
* @param appendToLDIF Indicates whether to an append to
* any existing file rather than
* overwriting it.
* @param includeBranches The set of base DNs of entries to
* include in the export. It may be
* {@code null} or empty if no entries
* should be excluded based on their
* location.
* @param excludeBranches The set of base DNs of entries to
* exclude from the export. It may be
* {@code null} or empty if no entries
* should be excluded based on their
* location.
* @param includeFilters The set of filters to use to match
* entries that should be included in
* the export. It may be {@code null}
* or empty if no entries should be
* excluded based on their content.
* @param excludeFilters The set of filters to use to match
* entries that should be excluded
* from the export. It may be
* {@code null} or empty if no entries
* should be excluded based on their
* content.
* @param includeAttributes The set of attributes that should
* be included in exported entries.
* It may be {@code null} or empty if
* all attributes should be included.
* @param excludeAttributes The set of attributes that should
* be excluded from exported entries.
* It may be {@code null} or empty if
* no attributes should be excluded.
* @param wrapColumn The column at which long lines
* should be wrapped. It may be less
* than or equal to zero to indicate
* that long lines should not be
* wrapped.
* @param compress Indicates whether the LDIF data
* should be compressed as it is
* written.
* @param encrypt Indicates whether the LDIF data
* should be encrypted as it is
* written.
* @param encryptionPassphraseFile The path to a file containing the
* passphrase to use to generate the
* encryption key. It amy be
* {@code null} if the LDIF file is
* not to be encrypted, or if the key
* should be obtained in some other
* way.
* @param encryptionSettingsDefinitionID The ID of the encryption settings
* definition use to generate the
* encryption key. It may be
* {@code null} if the LDIF file is
* not to be encrypted, or if the key
* should be obtained in some other
* way.
* @param sign Indicates whether to include a
* signed hash of the content in the
* exported data.
* @param maxMegabytesPerSecond The maximum rate in megabytes per
* second at which the LDIF file
* should be written.
* @param scheduledStartTime The time that this task should
* start running.
* @param dependencyIDs The list of task IDs that will be
* required to complete before this
* task will be eligible to start.
* @param failedDependencyAction Indicates what action should be
* taken if any of the dependencies
* for this task do not complete
* successfully.
* @param notifyOnStart The list of e-mail addresses of
* individuals that should be notified
* when this task starts running.
* @param notifyOnCompletion The list of e-mail addresses of
* individuals that should be notified
* when this task completes.
* @param notifyOnSuccess The list of e-mail addresses of
* individuals that should be notified
* if this task completes
* successfully.
* @param notifyOnError The list of e-mail addresses of
* individuals that should be notified
* if this task does not complete
* successfully.
* @param alertOnStart Indicates whether the server should
* send an alert notification when
* this task starts.
* @param alertOnSuccess Indicates whether the server should
* send an alert notification if this
* task completes successfully.
* @param alertOnError Indicates whether the server should
* send an alert notification if this
* task fails to complete
* successfully.
*/
public ExportTask(final String taskID, final String backendID,
final String ldifFile, final boolean appendToLDIF,
final List includeBranches,
final List excludeBranches,
final List includeFilters,
final List excludeFilters,
final List includeAttributes,
final List excludeAttributes, final int wrapColumn,
final boolean compress, final boolean encrypt,
final String encryptionPassphraseFile,
final String encryptionSettingsDefinitionID,
final boolean sign, final Integer maxMegabytesPerSecond,
final Date scheduledStartTime,
final List dependencyIDs,
final FailedDependencyAction failedDependencyAction,
final List notifyOnStart,
final List notifyOnCompletion,
final List notifyOnSuccess,
final List notifyOnError,
final Boolean alertOnStart, final Boolean alertOnSuccess,
final Boolean alertOnError)
{
super(taskID, EXPORT_TASK_CLASS, scheduledStartTime,
dependencyIDs, failedDependencyAction, notifyOnStart,
notifyOnCompletion, notifyOnSuccess, notifyOnError, alertOnStart,
alertOnSuccess, alertOnError);
Validator.ensureNotNull(backendID, ldifFile);
this.backendID = backendID;
this.ldifFile = ldifFile;
this.appendToLDIF = appendToLDIF;
this.wrapColumn = wrapColumn;
this.compress = compress;
this.encrypt = encrypt;
this.encryptionPassphraseFile = encryptionPassphraseFile;
this.encryptionSettingsDefinitionID = encryptionSettingsDefinitionID;
this.sign = sign;
this.maxMegabytesPerSecond = maxMegabytesPerSecond;
if (includeBranches == null)
{
this.includeBranches = Collections.emptyList();
}
else
{
this.includeBranches = Collections.unmodifiableList(includeBranches);
}
if (excludeBranches == null)
{
this.excludeBranches = Collections.emptyList();
}
else
{
this.excludeBranches = Collections.unmodifiableList(excludeBranches);
}
if (includeFilters == null)
{
this.includeFilters = Collections.emptyList();
}
else
{
this.includeFilters = Collections.unmodifiableList(includeFilters);
}
if (excludeFilters == null)
{
this.excludeFilters = Collections.emptyList();
}
else
{
this.excludeFilters = Collections.unmodifiableList(excludeFilters);
}
if (includeAttributes == null)
{
this.includeAttributes = Collections.emptyList();
}
else
{
this.includeAttributes = Collections.unmodifiableList(includeAttributes);
}
if (excludeAttributes == null)
{
this.excludeAttributes = Collections.emptyList();
}
else
{
this.excludeAttributes = Collections.unmodifiableList(excludeAttributes);
}
}
/**
* Creates a new export task from the provided entry.
*
* @param entry The entry to use to create this export task.
*
* @throws TaskException If the provided entry cannot be parsed as an export
* task entry.
*/
public ExportTask(final Entry entry)
throws TaskException
{
super(entry);
// Get the backend ID. It must be present.
backendID = entry.getAttributeValue(ATTR_BACKEND_ID);
if (backendID == null)
{
throw new TaskException(ERR_EXPORT_TASK_NO_BACKEND_ID.get(
getTaskEntryDN()));
}
// Get the LDIF file path. It must be present.
ldifFile = entry.getAttributeValue(ATTR_LDIF_FILE);
if (ldifFile == null)
{
throw new TaskException(ERR_EXPORT_TASK_NO_LDIF_FILE.get(
getTaskEntryDN()));
}
// Get the appendLDIF flag. It may be absent.
appendToLDIF = parseBooleanValue(entry, ATTR_APPEND_TO_LDIF, false);
// Get the list of include branches. It may be absent.
includeBranches = parseStringList(entry, ATTR_INCLUDE_BRANCH);
// Get the list of exclude branches. It may be absent.
excludeBranches = parseStringList(entry, ATTR_EXCLUDE_BRANCH);
// Get the list of include filters. It may be absent.
includeFilters = parseStringList(entry, ATTR_INCLUDE_FILTER);
// Get the list of exclude filters. It may be absent.
excludeFilters = parseStringList(entry, ATTR_EXCLUDE_FILTER);
// Get the list of include attributes. It may be absent.
includeAttributes = parseStringList(entry, ATTR_INCLUDE_ATTRIBUTE);
// Get the list of exclude attributes. It may be absent.
excludeAttributes = parseStringList(entry, ATTR_EXCLUDE_ATTRIBUTE);
// Get the wrap column. It may be absent.
final String wrapStr = entry.getAttributeValue(ATTR_WRAP_COLUMN);
if (wrapStr == null)
{
wrapColumn = -1;
}
else
{
try
{
wrapColumn = Integer.parseInt(wrapStr);
}
catch (final Exception e)
{
Debug.debugException(e);
throw new TaskException(ERR_EXPORT_TASK_CANNOT_PARSE_WRAP_COLUMN.get(
getTaskEntryDN(), wrapStr), e);
}
}
// Get the compress flag. It may be absent.
compress = parseBooleanValue(entry, ATTR_COMPRESS, false);
// Get the encrypt flag. It may be absent.
encrypt = parseBooleanValue(entry, ATTR_ENCRYPT, false);
// Get the path to the encryption passphrase file. It may be absent.
encryptionPassphraseFile =
entry.getAttributeValue(ATTR_ENCRYPTION_PASSPHRASE_FILE);
// Get the encryption settings definition ID. It may be absent.
encryptionSettingsDefinitionID =
entry.getAttributeValue(ATTR_ENCRYPTION_SETTINGS_DEFINITION_ID);
// Get the sign flag. It may be absent.
sign = parseBooleanValue(entry, ATTR_SIGN, false);
// Get the maximum write rate in megabytes per second. It may be absent.
maxMegabytesPerSecond =
entry.getAttributeValueAsInteger(ATTR_MAX_MEGABYTES_PER_SECOND);
}
/**
* Creates a new export task from the provided set of task properties.
*
* @param properties The set of task properties and their corresponding
* values to use for the task. It must not be
* {@code null}.
*
* @throws TaskException If the provided set of properties cannot be used to
* create a valid export task.
*/
public ExportTask(final Map> properties)
throws TaskException
{
super(EXPORT_TASK_CLASS, properties);
boolean a = false;
boolean c = false;
boolean e = false;
boolean s = false;
Integer maxMB = null;
long w = 0;
String b = null;
String encID = null;
String encPWFile = null;
String l = null;
String[] eA = StaticUtils.NO_STRINGS;
String[] eB = StaticUtils.NO_STRINGS;
String[] eF = StaticUtils.NO_STRINGS;
String[] iA = StaticUtils.NO_STRINGS;
String[] iB = StaticUtils.NO_STRINGS;
String[] iF = StaticUtils.NO_STRINGS;
for (final Map.Entry> entry :
properties.entrySet())
{
final TaskProperty p = entry.getKey();
final String attrName = p.getAttributeName();
final List