001/*
002 * Copyright 2015-2020 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2015-2020 Ping Identity Corporation
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020/*
021 * Copyright (C) 2015-2020 Ping Identity Corporation
022 *
023 * This program is free software; you can redistribute it and/or modify
024 * it under the terms of the GNU General Public License (GPLv2 only)
025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
026 * as published by the Free Software Foundation.
027 *
028 * This program is distributed in the hope that it will be useful,
029 * but WITHOUT ANY WARRANTY; without even the implied warranty of
030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031 * GNU General Public License for more details.
032 *
033 * You should have received a copy of the GNU General Public License
034 * along with this program; if not, see <http://www.gnu.org/licenses>.
035 */
036package com.unboundid.ldap.sdk.unboundidds.tasks;
037
038
039
040import java.util.Collections;
041import java.util.Date;
042import java.util.List;
043import java.util.Map;
044
045import com.unboundid.ldap.sdk.Entry;
046import com.unboundid.util.NotMutable;
047import com.unboundid.util.ThreadSafety;
048import com.unboundid.util.ThreadSafetyLevel;
049
050import static com.unboundid.ldap.sdk.unboundidds.tasks.TaskMessages.*;
051
052
053
054/**
055 * This class defines a Directory Server task that can be used to synchronize
056 * the encryption settings definitions in one instance with one or more other
057 * servers in the topology.  This task does not have any task-specific
058 * properties.
059 * <BR>
060 * <BLOCKQUOTE>
061 *   <B>NOTE:</B>  This class, and other classes within the
062 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
063 *   supported for use against Ping Identity, UnboundID, and
064 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
065 *   for proprietary functionality or for external specifications that are not
066 *   considered stable or mature enough to be guaranteed to work in an
067 *   interoperable way with other types of LDAP servers.
068 * </BLOCKQUOTE>
069 */
070@NotMutable()
071@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
072public final class SynchronizeEncryptionSettingsTask
073       extends Task
074{
075  /**
076   * The fully-qualified name of the Java class that is used for the synchronize
077   * encryption settings task.
078   */
079  static final String SYNCHRONIZE_ENCRYPTION_SETTINGS_TASK_CLASS =
080       "com.unboundid.directory.server.crypto." +
081            "SynchronizeEncryptionSettingsTask";
082
083
084
085  /**
086   * The name of the object class used in synchronize encryption settings task
087   * entries.
088   */
089  private static final String OC_SYNCHRONIZE_ENCRYPTION_SETTINGS_TASK =
090       "ds-task-synchronize-encryption-settings";
091
092
093
094  /**
095   * The serial version UID for this serializable class.
096   */
097  private static final long serialVersionUID = 5176601759135180183L;
098
099
100
101  /**
102   * Creates a new uninitialized synchronize encryption settings task instance
103   * that should only be used for obtaining general information about this task,
104   * including the task name, description, and supported properties.
105   */
106  public SynchronizeEncryptionSettingsTask()
107  {
108    this(null, null, null, null, null, null);
109  }
110
111
112
113  /**
114   * Creates a new synchronize encryption settings task with the provided
115   * information.
116   *
117   * @param  taskID         The task ID to use for this task.  If it is
118   *                        {@code null} then a UUID will be generated for use
119   *                        as the task ID.
120   */
121  public SynchronizeEncryptionSettingsTask(final String taskID)
122  {
123    this(taskID, null, null, null, null, null);
124  }
125
126
127
128  /**
129   * Creates a new synchronize encryption settings task with the provided
130   * information.
131   *
132   * @param  taskID                  The task ID to use for this task.  If it is
133   *                                 {@code null} then a UUID will be generated
134   *                                 for use as the task ID.
135   * @param  scheduledStartTime      The time that this task should start
136   *                                 running.
137   * @param  dependencyIDs           The list of task IDs that will be required
138   *                                 to complete before this task will be
139   *                                 eligible to start.
140   * @param  failedDependencyAction  Indicates what action should be taken if
141   *                                 any of the dependencies for this task do
142   *                                 not complete successfully.
143   * @param  notifyOnCompletion      The list of e-mail addresses of individuals
144   *                                 that should be notified when this task
145   *                                 completes.
146   * @param  notifyOnError           The list of e-mail addresses of individuals
147   *                                 that should be notified if this task does
148   *                                 not complete successfully.
149   */
150  public SynchronizeEncryptionSettingsTask(final String taskID,
151              final Date scheduledStartTime, final List<String> dependencyIDs,
152              final FailedDependencyAction failedDependencyAction,
153              final List<String> notifyOnCompletion,
154              final List<String> notifyOnError)
155  {
156    this(taskID, scheduledStartTime, dependencyIDs, failedDependencyAction,
157         null, notifyOnCompletion, null, notifyOnError, null, null, null);
158  }
159
160
161
162  /**
163   * Creates a new synchronize encryption settings task with the provided
164   * information.
165   *
166   * @param  taskID                  The task ID to use for this task.  If it is
167   *                                 {@code null} then a UUID will be generated
168   *                                 for use as the task ID.
169   * @param  scheduledStartTime      The time that this task should start
170   *                                 running.
171   * @param  dependencyIDs           The list of task IDs that will be required
172   *                                 to complete before this task will be
173   *                                 eligible to start.
174   * @param  failedDependencyAction  Indicates what action should be taken if
175   *                                 any of the dependencies for this task do
176   *                                 not complete successfully.
177   * @param  notifyOnStart           The list of e-mail addresses of individuals
178   *                                 that should be notified when this task
179   *                                 starts running.
180   * @param  notifyOnCompletion      The list of e-mail addresses of individuals
181   *                                 that should be notified when this task
182   *                                 completes.
183   * @param  notifyOnSuccess         The list of e-mail addresses of individuals
184   *                                 that should be notified if this task
185   *                                 completes successfully.
186   * @param  notifyOnError           The list of e-mail addresses of individuals
187   *                                 that should be notified if this task does
188   *                                 not complete successfully.
189   * @param  alertOnStart            Indicates whether the server should send an
190   *                                 alert notification when this task starts.
191   * @param  alertOnSuccess          Indicates whether the server should send an
192   *                                 alert notification if this task completes
193   *                                 successfully.
194   * @param  alertOnError            Indicates whether the server should send an
195   *                                 alert notification if this task fails to
196   *                                 complete successfully.
197   */
198  public SynchronizeEncryptionSettingsTask(final String taskID,
199              final Date scheduledStartTime, final List<String> dependencyIDs,
200              final FailedDependencyAction failedDependencyAction,
201              final List<String> notifyOnStart,
202              final List<String> notifyOnCompletion,
203              final List<String> notifyOnSuccess,
204              final List<String> notifyOnError, final Boolean alertOnStart,
205              final Boolean alertOnSuccess, final Boolean alertOnError)
206  {
207    super(taskID, SYNCHRONIZE_ENCRYPTION_SETTINGS_TASK_CLASS,
208         scheduledStartTime, dependencyIDs, failedDependencyAction,
209         notifyOnStart, notifyOnCompletion, notifyOnSuccess, notifyOnError,
210         alertOnStart, alertOnSuccess, alertOnError);
211  }
212
213
214
215  /**
216   * Creates a new synchronize encryption settings task from the provided entry.
217   *
218   * @param  entry  The entry to use to create this synchronize encryption
219   *                settings task.
220   *
221   * @throws  TaskException  If the provided entry cannot be parsed as a
222   *                         synchronize encryption settings task entry.
223   */
224  public SynchronizeEncryptionSettingsTask(final Entry entry)
225         throws TaskException
226  {
227    super(entry);
228  }
229
230
231
232  /**
233   * Creates a new synchronize encryption settings task from the provided set of
234   * task properties.
235   *
236   * @param  properties  The set of task properties and their corresponding
237   *                     values to use for the task.  It must not be
238   *                     {@code null}.
239   *
240   * @throws  TaskException  If the provided set of properties cannot be used to
241   *                         create a valid synchronize encryption settings
242   *                         task.
243   */
244  public SynchronizeEncryptionSettingsTask(
245              final Map<TaskProperty,List<Object>> properties)
246         throws TaskException
247  {
248    super(SYNCHRONIZE_ENCRYPTION_SETTINGS_TASK_CLASS, properties);
249  }
250
251
252
253  /**
254   * {@inheritDoc}
255   */
256  @Override()
257  public String getTaskName()
258  {
259    return INFO_TASK_NAME_SYNCHRONIZE_ENCRYPTION_SETTINGS.get();
260  }
261
262
263
264  /**
265   * {@inheritDoc}
266   */
267  @Override()
268  public String getTaskDescription()
269  {
270    return INFO_TASK_DESCRIPTION_SYNCHRONIZE_ENCRYPTION_SETTINGS.get();
271  }
272
273
274
275  /**
276   * {@inheritDoc}
277   */
278  @Override()
279  protected List<String> getAdditionalObjectClasses()
280  {
281    return Collections.singletonList(OC_SYNCHRONIZE_ENCRYPTION_SETTINGS_TASK);
282  }
283}