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-2017 UnboundID Corp.
* All Rights Reserved.
*/
/*
* Copyright (C) 2015-2017 UnboundID Corp.
*
* 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.NotMutable;
import com.unboundid.util.StaticUtils;
import com.unboundid.util.ThreadSafety;
import com.unboundid.util.ThreadSafetyLevel;
import static com.unboundid.ldap.sdk.unboundidds.tasks.TaskMessages.*;
import static com.unboundid.util.Validator.*;
/**
* This class defines a Directory Server task that can be used to import LDIF
* content into a backend.
*
*
* NOTE: This class is part of the Commercial Edition of the UnboundID
* LDAP SDK for Java. It is not available for use in applications that
* include only the Standard Edition of the LDAP SDK, and is not supported for
* use in conjunction with non-UnboundID products.
*
*
* The properties that are available for use with this type of task include:
*
*
The paths (on the server system) to the LDIF files containing the data
* to be imported. At least one LDIF file path must be provided.
*
The backend ID for the backend into which the data should be
* imported. It may be omitted only if at least one include branch is
* provided.
*
A flag that indicates whether to append to the existing data in the
* backend rather than destroying any existing data before beginning the
* import.
*
A flag that indicates whether to replace entries that already exist
* when operating in append mode.
*
An optional path (on the server system) to a file to which the server
* should write copies of any entries that are rejected, along with a
* message explaining why they were rejected.
*
A flag that indicates whether to overwrite the reject file rather than
* append to it if it already exists.
*
A flag that indicates whether to clear the entire contents of the
* backend even if it has multiple base DNs but only a subset of them
* were provided in the set of include branches.
*
An optional list of base DNs for branches to include in the
* import.
*
An optional list of base DNs for branches to exclude from the
* import.
*
An optional list of search filters that may be used to determine
* whether an entry should be included in the import.
*
An optional list of search filters that may be used to determine
* whether an entry should be excluded from the import.
*
An optional list of attributes that should be included in the entries
* that are imported.
*
An optional list of attributes that should be excluded from the entries
* that are imported.
*
A flag that indicates whether the LDIF data to import is
* compressed.
*
A flag that indicates whether the LDIF data to import is
* encrypted.
*
A flag that indicates whether to skip schema validation for the data
* that is imported.
*
*/
@NotMutable()
@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
public final class ImportTask
extends Task
{
/**
* The fully-qualified name of the Java class that is used for the import
* task.
*/
static final String IMPORT_TASK_CLASS =
"com.unboundid.directory.server.tasks.ImportTask";
/**
* The name of the attribute used to indicate whether to append to an existing
* database rather than overwriting its content.
*/
private static final String ATTR_APPEND =
"ds-task-import-append";
/**
* The name of the attribute used to specify the backend ID for the backend
* into which to import the data.
*/
private static final String ATTR_BACKEND_ID = "ds-task-import-backend-id";
/**
* The name of the attribute used to indicate whether to clear the entire
* backend when importing based on base DN.
*/
private static final String ATTR_CLEAR_BACKEND =
"ds-task-import-clear-backend";
/**
* The name of the attribute used to specify the attributes to exclude from
* entries being imported.
*/
private static final String ATTR_EXCLUDE_ATTRIBUTE =
"ds-task-import-exclude-attribute";
/**
* The name of the attribute used to specify the base DNs of branches to
* exclude from the import.
*/
private static final String ATTR_EXCLUDE_BRANCH =
"ds-task-import-exclude-branch";
/**
* The name of the attribute used to specify the filters used to determine
* whether to exclude an entry from the import.
*/
private static final String ATTR_EXCLUDE_FILTER =
"ds-task-import-exclude-filter";
/**
* The name of the attribute used to specify the attributes to include in
* entries being imported.
*/
private static final String ATTR_INCLUDE_ATTRIBUTE =
"ds-task-import-include-attribute";
/**
* The name of the attribute used to specify the base DNs of branches to
* include in the import.
*/
private static final String ATTR_INCLUDE_BRANCH =
"ds-task-import-include-branch";
/**
* The name of the attribute used to specify the filters used to determine
* whether to include an entry in the import.
*/
private static final String ATTR_INCLUDE_FILTER =
"ds-task-import-include-filter";
/**
* The name of the attribute used to indicate whether the LDIF data is
* compressed.
*/
private static final String ATTR_IS_COMPRESSED =
"ds-task-import-is-compressed";
/**
* The name of the attribute used to indicate whether the LDIF data is
* encrypted.
*/
private static final String ATTR_IS_ENCRYPTED =
"ds-task-import-is-encrypted";
/**
* The name of the attribute used to specify the paths to the LDIF files to be
* imported.
*/
private static final String ATTR_LDIF_FILE = "ds-task-import-ldif-file";
/**
* The name of the attribute used to indicate whether to overwrite an existing
* reject file.
*/
private static final String ATTR_OVERWRITE_REJECTS =
"ds-task-import-overwrite-rejects";
/**
* The name of the attribute used to specify the path to the reject file.
*/
private static final String ATTR_REJECT_FILE = "ds-task-import-reject-file";
/**
* The name of the attribute used to indicate whether to replace existing
* entries when appending to a database rather than overwriting it.
*/
private static final String ATTR_REPLACE_EXISTING =
"ds-task-import-replace-existing";
/**
* The name of the attribute used to indicate whether to skip schema
* validation for the import.
*/
private static final String ATTR_SKIP_SCHEMA_VALIDATION =
"ds-task-import-skip-schema-validation";
/**
* The name of the attribute used to indicate whether to strip illegal
* trailing spaces from LDIF records rather than rejecting those records.
*/
private static final String ATTR_STRIP_TRAILING_SPACES =
"ds-task-import-strip-trailing-spaces";
/**
* 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_IMPORT.get(), String.class,
false, false, false);
/**
* The task property for the LDIF files.
*/
private static final TaskProperty PROPERTY_LDIF_FILE =
new TaskProperty(ATTR_LDIF_FILE, INFO_DISPLAY_NAME_LDIF_FILE.get(),
INFO_DESCRIPTION_LDIF_FILE_IMPORT.get(), String.class,
true, true, false);
/**
* The task property for the append flag.
*/
private static final TaskProperty PROPERTY_APPEND =
new TaskProperty(ATTR_APPEND, INFO_DISPLAY_NAME_APPEND_TO_DB.get(),
INFO_DESCRIPTION_APPEND_TO_DB.get(), Boolean.class,
false, false, true);
/**
* The task property for the replace existing flag.
*/
private static final TaskProperty PROPERTY_REPLACE_EXISTING =
new TaskProperty(ATTR_REPLACE_EXISTING,
INFO_DISPLAY_NAME_REPLACE_EXISTING.get(),
INFO_DESCRIPTION_REPLACE_EXISTING.get(), Boolean.class,
false, false, true);
/**
* The task property for the reject file.
*/
private static final TaskProperty PROPERTY_REJECT_FILE =
new TaskProperty(ATTR_REJECT_FILE,
INFO_DISPLAY_NAME_REJECT_FILE.get(),
INFO_DESCRIPTION_REJECT_FILE.get(), String.class,
false, false, false);
/**
* The task property for the overwrite rejects flag.
*/
private static final TaskProperty PROPERTY_OVERWRITE_REJECTS =
new TaskProperty(ATTR_OVERWRITE_REJECTS,
INFO_DISPLAY_NAME_OVERWRITE_REJECTS.get(),
INFO_DESCRIPTION_OVERWRITE_REJECTS.get(), Boolean.class,
false, false, true);
/**
* The task property for the clear backend flag.
*/
private static final TaskProperty PROPERTY_CLEAR_BACKEND =
new TaskProperty(ATTR_CLEAR_BACKEND,
INFO_DISPLAY_NAME_CLEAR_BACKEND.get(),
INFO_DESCRIPTION_CLEAR_BACKEND.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_IMPORT.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_IMPORT.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_IMPORT.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_IMPORT.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_IMPORT.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_IMPORT.get(),
String.class, false, true, true);
/**
* The task property for the is compressed flag.
*/
private static final TaskProperty PROPERTY_IS_COMPRESSED =
new TaskProperty(ATTR_IS_COMPRESSED,
INFO_DISPLAY_NAME_IS_COMPRESSED_IMPORT.get(),
INFO_DESCRIPTION_IS_COMPRESSED_IMPORT.get(),
Boolean.class, false, false, false);
/**
* The task property for the is encrypted flag.
*/
private static final TaskProperty PROPERTY_IS_ENCRYPTED =
new TaskProperty(ATTR_IS_ENCRYPTED,
INFO_DISPLAY_NAME_IS_ENCRYPTED_IMPORT.get(),
INFO_DESCRIPTION_IS_ENCRYPTED_IMPORT.get(),
Boolean.class, false, false, false);
/**
* The task property for the skip schema validation flag.
*/
private static final TaskProperty PROPERTY_SKIP_SCHEMA_VALIDATION =
new TaskProperty(ATTR_SKIP_SCHEMA_VALIDATION,
INFO_DISPLAY_NAME_SKIP_SCHEMA_VALIDATION.get(),
INFO_DESCRIPTION_SKIP_SCHEMA_VALIDATION.get(),
Boolean.class, false, false, false);
/**
* The task property for the strip trailing spaces flag.
*/
private static final TaskProperty PROPERTY_STRIP_TRAILING_SPACES =
new TaskProperty(ATTR_STRIP_TRAILING_SPACES,
INFO_DISPLAY_NAME_STRIP_TRAILING_SPACES.get(),
INFO_DESCRIPTION_STRIP_TRAILING_SPACES.get(),
Boolean.class, false, false, false);
/**
* The name of the object class used in import task entries.
*/
private static final String OC_IMPORT_TASK = "ds-task-import";
/**
* The serial version UID for this serializable class.
*/
private static final long serialVersionUID = -8451067488894354839L;
// Indicates whether to append to the database rather than overwriting it.
private final boolean append;
// Indicates whether to clear the entire backend when importing by base DN.
private final boolean clearBackend;
// Indicates whether the LDIF data is compressed.
private final boolean isCompressed;
// Indicates whether the LDIF data is encrypted.
private final boolean isEncrypted;
// Indicates whether to overwrite an existing reject file.
private final boolean overwriteRejects;
// Indicates whether to replace existing entries when appending to the DB.
private final boolean replaceExisting;
// Indicates whether to skip schema validation for the import.
private final boolean skipSchemaValidation;
// Indicates whether to strip illegal trailing spaces from LDIF records rather
// than rejecting them.
private final boolean stripTrailingSpaces;
// The set of exclude attributes for the import.
private final List excludeAttributes;
// The set of exclude branches for the import.
private final List excludeBranches;
// The set of exclude filters for the import.
private final List excludeFilters;
// The set of include attributes for the import.
private final List includeAttributes;
// The set of include branches for the import.
private final List includeBranches;
// The set of include filters for the import.
private final List includeFilters;
// The paths to the LDIF files to be imported.
private final List ldifFiles;
// The backend ID of the backend to import.
private final String backendID;
// The path to the reject file to write.
private final String rejectFile;
/**
* Creates a new uninitialized import 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 ImportTask()
{
append = false;
clearBackend = false;
isCompressed = false;
isEncrypted = false;
overwriteRejects = false;
replaceExisting = false;
skipSchemaValidation = false;
stripTrailingSpaces = false;
excludeAttributes = null;
excludeBranches = null;
excludeFilters = null;
includeAttributes = null;
includeBranches = null;
includeFilters = null;
ldifFiles = null;
backendID = null;
rejectFile = null;
}
/**
* Creates a new import task with the provided backend. It will overwrite
* the contents of the backend with the data in the provided LDIF file.
*
* @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 into which the data should
* be imported. It must not be {@code null}.
* @param ldifFile The path to the LDIF file containing the data to be
* imported. It may be an absolute path or a path relative
* to the server install root. It must not be
* {@code null}.
*/
public ImportTask(final String taskID, final String backendID,
final String ldifFile)
{
this(taskID, Arrays.asList(ldifFile), backendID, false, false, null, false,
true, null, null, null, null, null, null, false, false, false, null,
null, null, null, null);
ensureNotNull(ldifFile);
}
/**
* Creates a new import 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 ldifFiles The paths to the LDIF file containing the
* data to be imported. The paths may be
* either absolute or relative to the server
* install root. It must not be {@code null}
* or empty..
* @param backendID The backend ID of the backend into which
* the data should be imported. It may be
* {@code null} only if one or more include
* branches was specified.
* @param append Indicates whether to append to the existing
* data rather than overwriting it.
* @param replaceExisting Indicates whether to replace existing
* entries when appending to the database.
* @param rejectFile The path to a file into which information
* will be written about rejected entries. It
* may be {@code null} if no reject file is to
* be maintained.
* @param overwriteRejects Indicates whether to overwrite an existing
* rejects file rather than appending to it.
* @param clearBackend Indicates whether to clear data below all
* base DNs in the backend. It must be
* {@code true} if the backend was specified
* using a backend ID and no include branches
* are specified and {@code append} is
* {@code false}. If include branches were
* specified, or if data is being appended to
* the backend, then it may be either
* {@code true} or {@code false}.
* @param includeBranches The set of base DNs below which to import
* the data. It may be {@code null} or empty
* if a backend ID was specified and data
* should be imported below all base DNs
* defined in the backend. Otherwise, at
* least one include branch must be provided,
* and any data not under one of the include
* branches will be excluded from the import.
* All include branches must be within the
* scope of the same backend.
* @param excludeBranches The set of base DNs to exclude from the
* import. It may be {@code null} or empty if
* no data is to be excluded based on its
* location.
* @param includeFilters The set of filters to use to determine
* which entries should be included in the
* import. It may be {@code null} or empty if
* no data is to be excluded based on its
* content.
* @param excludeFilters The set of filters to use to determine
* which entries should be excluded from the
* import. It may be {@code null} or empty if
* no data is to be excluded based on its
* content.
* @param includeAttributes The set of attributes to include in the
* entries being imported. It may be
* {@code null} or empty if no attributes
* should be excluded from the import.
* @param excludeAttributes The set of attributes to exclude from the
* entries being imported. It may be
* {@code null} or empty if no attributes
* should be excluded from the import.
* @param isCompressed Indicates whether the data in the LDIF
* file(s) is compressed.
* @param isEncrypted Indicates whether the data in the LDIF
* file(s) is encrypted.
* @param skipSchemaValidation Indicates whether to skip schema validation
* during the import.
* @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 ImportTask(final String taskID, final List ldifFiles,
final String backendID, final boolean append,
final boolean replaceExisting, final String rejectFile,
final boolean overwriteRejects, final boolean clearBackend,
final List includeBranches,
final List excludeBranches,
final List includeFilters,
final List excludeFilters,
final List includeAttributes,
final List excludeAttributes,
final boolean isCompressed, final boolean isEncrypted,
final boolean skipSchemaValidation,
final Date scheduledStartTime,
final List dependencyIDs,
final FailedDependencyAction failedDependencyAction,
final List notifyOnCompletion,
final List notifyOnError)
{
this(taskID, ldifFiles, backendID, append, replaceExisting, rejectFile,
overwriteRejects, clearBackend, includeBranches, excludeBranches,
includeFilters, excludeFilters, includeAttributes, excludeAttributes,
isCompressed, isEncrypted, skipSchemaValidation, false,
scheduledStartTime, dependencyIDs, failedDependencyAction,
notifyOnCompletion, notifyOnError);
}
/**
* Creates a new import 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 ldifFiles The paths to the LDIF file containing the
* data to be imported. The paths may be
* either absolute or relative to the server
* install root. It must not be {@code null}
* or empty..
* @param backendID The backend ID of the backend into which
* the data should be imported. It may be
* {@code null} only if one or more include
* branches was specified.
* @param append Indicates whether to append to the existing
* data rather than overwriting it.
* @param replaceExisting Indicates whether to replace existing
* entries when appending to the database.
* @param rejectFile The path to a file into which information
* will be written about rejected entries. It
* may be {@code null} if no reject file is to
* be maintained.
* @param overwriteRejects Indicates whether to overwrite an existing
* rejects file rather than appending to it.
* @param clearBackend Indicates whether to clear data below all
* base DNs in the backend. It must be
* {@code true} if the backend was specified
* using a backend ID and no include branches
* are specified and {@code append} is
* {@code false}. If include branches were
* specified, or if data is being appended to
* the backend, then it may be either
* {@code true} or {@code false}.
* @param includeBranches The set of base DNs below which to import
* the data. It may be {@code null} or empty
* if a backend ID was specified and data
* should be imported below all base DNs
* defined in the backend. Otherwise, at
* least one include branch must be provided,
* and any data not under one of the include
* branches will be excluded from the import.
* All include branches must be within the
* scope of the same backend.
* @param excludeBranches The set of base DNs to exclude from the
* import. It may be {@code null} or empty if
* no data is to be excluded based on its
* location.
* @param includeFilters The set of filters to use to determine
* which entries should be included in the
* import. It may be {@code null} or empty if
* no data is to be excluded based on its
* content.
* @param excludeFilters The set of filters to use to determine
* which entries should be excluded from the
* import. It may be {@code null} or empty if
* no data is to be excluded based on its
* content.
* @param includeAttributes The set of attributes to include in the
* entries being imported. It may be
* {@code null} or empty if no attributes
* should be excluded from the import.
* @param excludeAttributes The set of attributes to exclude from the
* entries being imported. It may be
* {@code null} or empty if no attributes
* should be excluded from the import.
* @param isCompressed Indicates whether the data in the LDIF
* file(s) is compressed.
* @param isEncrypted Indicates whether the data in the LDIF
* file(s) is encrypted.
* @param skipSchemaValidation Indicates whether to skip schema validation
* during the import.
* @param stripTrailingSpaces Indicates whether to strip illegal trailing
* spaces found in LDIF records rather than
* rejecting those records.
* @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 ImportTask(final String taskID, final List ldifFiles,
final String backendID, final boolean append,
final boolean replaceExisting, final String rejectFile,
final boolean overwriteRejects, final boolean clearBackend,
final List includeBranches,
final List excludeBranches,
final List includeFilters,
final List excludeFilters,
final List includeAttributes,
final List excludeAttributes,
final boolean isCompressed, final boolean isEncrypted,
final boolean skipSchemaValidation,
final boolean stripTrailingSpaces,
final Date scheduledStartTime,
final List dependencyIDs,
final FailedDependencyAction failedDependencyAction,
final List notifyOnCompletion,
final List notifyOnError)
{
super(taskID, IMPORT_TASK_CLASS, scheduledStartTime,
dependencyIDs, failedDependencyAction, notifyOnCompletion,
notifyOnError);
ensureNotNull(ldifFiles);
ensureFalse(ldifFiles.isEmpty(),
"ImportTask.ldifFiles must not be empty.");
ensureFalse((backendID == null) &&
((includeBranches == null) || includeBranches.isEmpty()));
ensureTrue(clearBackend || append ||
((includeBranches != null) && (! includeBranches.isEmpty())));
this.ldifFiles = Collections.unmodifiableList(ldifFiles);
this.backendID = backendID;
this.append = append;
this.replaceExisting = replaceExisting;
this.rejectFile = rejectFile;
this.overwriteRejects = overwriteRejects;
this.clearBackend = clearBackend;
this.isCompressed = isCompressed;
this.isEncrypted = isEncrypted;
this.skipSchemaValidation = skipSchemaValidation;
this.stripTrailingSpaces = stripTrailingSpaces;
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 import task from the provided entry.
*
* @param entry The entry to use to create this import task.
*
* @throws TaskException If the provided entry cannot be parsed as an import
* task entry.
*/
public ImportTask(final Entry entry)
throws TaskException
{
super(entry);
// Get the set of LDIF files. It must be present.
final String[] files = entry.getAttributeValues(ATTR_LDIF_FILE);
if ((files == null) || (files.length == 0))
{
throw new TaskException(ERR_IMPORT_TASK_NO_LDIF.get(getTaskEntryDN()));
}
else
{
ldifFiles = Collections.unmodifiableList(Arrays.asList(files));
}
// Get the backend ID. It may be absent.
backendID = entry.getAttributeValue(ATTR_BACKEND_ID);
// Get the append flag. It may be absent.
append = parseBooleanValue(entry, ATTR_APPEND, false);
// Get the replaceExisting flag. It may be absent.
replaceExisting = parseBooleanValue(entry, ATTR_REPLACE_EXISTING, false);
// Get the reject file. It may be absent.
rejectFile = entry.getAttributeValue(ATTR_REJECT_FILE);
// Get the overwriteRejects flag. It may be absent.
overwriteRejects = parseBooleanValue(entry, ATTR_OVERWRITE_REJECTS, false);
// Get the clearBackend flag. It may be absent.
clearBackend = parseBooleanValue(entry, ATTR_CLEAR_BACKEND, 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 isCompressed flag. It may be absent.
isCompressed = parseBooleanValue(entry, ATTR_IS_COMPRESSED, false);
// Get the isEncrypted flag. It may be absent.
isEncrypted = parseBooleanValue(entry, ATTR_IS_ENCRYPTED, false);
// Get the skipSchemaValidation flag. It may be absent.
skipSchemaValidation = parseBooleanValue(entry, ATTR_SKIP_SCHEMA_VALIDATION,
false);
// Get the stripTrailingSpaces flag. It may be absent.
stripTrailingSpaces = parseBooleanValue(entry, ATTR_STRIP_TRAILING_SPACES,
false);
}
/**
* Creates a new import 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 import task.
*/
public ImportTask(final Map> properties)
throws TaskException
{
super(IMPORT_TASK_CLASS, properties);
boolean a = false;
boolean c = false;
boolean cB = true;
boolean e = false;
boolean o = false;
boolean r = false;
boolean ss = false;
boolean st = false;
String b = null;
String rF = 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;
String[] l = StaticUtils.NO_STRINGS;
for (final Map.Entry> entry :
properties.entrySet())
{
final TaskProperty p = entry.getKey();
final String attrName = p.getAttributeName();
final List