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