001/*
002 * Copyright 2008-2018 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2018 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 request that
041 * the server refresh the encryption settings database from disk.  It does not
042 * have any custom configuration properties.
043 * <BR>
044 * <BLOCKQUOTE>
045 *   <B>NOTE:</B>  This class, and other classes within the
046 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
047 *   supported for use against Ping Identity, UnboundID, and
048 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
049 *   for proprietary functionality or for external specifications that are not
050 *   considered stable or mature enough to be guaranteed to work in an
051 *   interoperable way with other types of LDAP servers.
052 * </BLOCKQUOTE>
053 */
054@NotMutable()
055@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
056public final class RefreshEncryptionSettingsTask
057       extends Task
058{
059  /**
060   * The fully-qualified name of the Java class that is used for the refresh
061   * encryption settings task in the Directory Server.
062   */
063  static final String REFRESH_ENCRYPTION_SETTINGS_TASK_CLASS =
064       "com.unboundid.directory.server.tasks.RefreshEncryptionSettingsTask";
065
066
067
068  /**
069   * The name of the object class used in refresh encryption settings task
070   * entries.
071   */
072  private static final String OC_REFRESH_ENCRYPTION_SETTINGS_TASK =
073       "ds-task-refresh-encryption-settings";
074
075
076  /**
077   * The serial version UID for this serializable class.
078   */
079  private static final long serialVersionUID = -2469450547006114721L;
080
081
082
083  /**
084   * Creates a new uninitialized refresh encryption settings task instance which
085   * should only be used for obtaining general information about this task,
086   * including the task name, description, and supported properties.
087   */
088  public RefreshEncryptionSettingsTask()
089  {
090    this(null, null, null, null, null, null);
091  }
092
093
094
095  /**
096   * Creates a new refresh encryption settings task with the provided
097   * information.
098   *
099   * @param  taskID         The task ID to use for this task.  If it is
100   *                        {@code null} then a UUID will be generated for use
101   *                        as the task ID.
102   */
103  public RefreshEncryptionSettingsTask(final String taskID)
104  {
105    this(taskID, null, null, null, null, null);
106  }
107
108
109
110  /**
111   * Creates a new refresh encryption settings task with the provided
112   * information.
113   *
114   * @param  taskID                  The task ID to use for this task.  If it is
115   *                                 {@code null} then a UUID will be generated
116   *                                 for use as the task ID.
117   * @param  scheduledStartTime      The time that this task should start
118   *                                 running.
119   * @param  dependencyIDs           The list of task IDs that will be required
120   *                                 to complete before this task will be
121   *                                 eligible to start.
122   * @param  failedDependencyAction  Indicates what action should be taken if
123   *                                 any of the dependencies for this task do
124   *                                 not complete successfully.
125   * @param  notifyOnCompletion      The list of e-mail addresses of individuals
126   *                                 that should be notified when this task
127   *                                 completes.
128   * @param  notifyOnError           The list of e-mail addresses of individuals
129   *                                 that should be notified if this task does
130   *                                 not complete successfully.
131   */
132  public RefreshEncryptionSettingsTask(final String taskID,
133              final Date scheduledStartTime, final List<String> dependencyIDs,
134              final FailedDependencyAction failedDependencyAction,
135              final List<String> notifyOnCompletion,
136              final List<String> notifyOnError)
137  {
138    this(taskID, scheduledStartTime, dependencyIDs, failedDependencyAction,
139         null, notifyOnCompletion, null, notifyOnError, null, null, null);
140  }
141
142
143
144  /**
145   * Creates a new refresh encryption settings task with the provided
146   * information.
147   *
148   * @param  taskID                  The task ID to use for this task.  If it is
149   *                                 {@code null} then a UUID will be generated
150   *                                 for use as the task ID.
151   * @param  scheduledStartTime      The time that this task should start
152   *                                 running.
153   * @param  dependencyIDs           The list of task IDs that will be required
154   *                                 to complete before this task will be
155   *                                 eligible to start.
156   * @param  failedDependencyAction  Indicates what action should be taken if
157   *                                 any of the dependencies for this task do
158   *                                 not complete successfully.
159   * @param  notifyOnStart           The list of e-mail addresses of individuals
160   *                                 that should be notified when this task
161   *                                 starts running.
162   * @param  notifyOnCompletion      The list of e-mail addresses of individuals
163   *                                 that should be notified when this task
164   *                                 completes.
165   * @param  notifyOnSuccess         The list of e-mail addresses of individuals
166   *                                 that should be notified if this task
167   *                                 completes successfully.
168   * @param  notifyOnError           The list of e-mail addresses of individuals
169   *                                 that should be notified if this task does
170   *                                 not complete successfully.
171   * @param  alertOnStart            Indicates whether the server should send an
172   *                                 alert notification when this task starts.
173   * @param  alertOnSuccess          Indicates whether the server should send an
174   *                                 alert notification if this task completes
175   *                                 successfully.
176   * @param  alertOnError            Indicates whether the server should send an
177   *                                 alert notification if this task fails to
178   *                                 complete successfully.
179   */
180  public RefreshEncryptionSettingsTask(final String taskID,
181              final Date scheduledStartTime, final List<String> dependencyIDs,
182              final FailedDependencyAction failedDependencyAction,
183              final List<String> notifyOnStart,
184              final List<String> notifyOnCompletion,
185              final List<String> notifyOnSuccess,
186              final List<String> notifyOnError, final Boolean alertOnStart,
187              final Boolean alertOnSuccess, final Boolean alertOnError)
188  {
189    super(taskID, REFRESH_ENCRYPTION_SETTINGS_TASK_CLASS, scheduledStartTime,
190         dependencyIDs, failedDependencyAction, notifyOnStart,
191         notifyOnCompletion, notifyOnSuccess, notifyOnError, alertOnStart,
192         alertOnSuccess, alertOnError);
193  }
194
195
196
197  /**
198   * Creates a new refresh encryption settings task from the provided entry.
199   *
200   * @param  entry  The entry to use to create this refresh encryption settings
201   *                task.
202   *
203   * @throws  TaskException  If the provided entry cannot be parsed as a refresh
204   *                         encryption settings task entry.
205   */
206  public RefreshEncryptionSettingsTask(final Entry entry)
207         throws TaskException
208  {
209    super(entry);
210  }
211
212
213
214  /**
215   * Creates a new refresh encryption settings task from the provided set of
216   * task properties.
217   *
218   * @param  properties  The set of task properties and their corresponding
219   *                     values to use for the task.  It must not be
220   *                     {@code null}.
221   *
222   * @throws  TaskException  If the provided set of properties cannot be used to
223   *                         create a valid refresh encryption settings task.
224   */
225  public RefreshEncryptionSettingsTask(
226              final Map<TaskProperty,List<Object>> properties)
227         throws TaskException
228  {
229    super(REFRESH_ENCRYPTION_SETTINGS_TASK_CLASS, properties);
230  }
231
232
233
234  /**
235   * {@inheritDoc}
236   */
237  @Override()
238  public String getTaskName()
239  {
240    return INFO_TASK_NAME_REFRESH_ENCRYPTION_SETTINGS.get();
241  }
242
243
244
245  /**
246   * {@inheritDoc}
247   */
248  @Override()
249  public String getTaskDescription()
250  {
251    return INFO_TASK_DESCRIPTION_REFRESH_ENCRYPTION_SETTINGS.get();
252  }
253
254
255
256  /**
257   * {@inheritDoc}
258   */
259  @Override()
260  protected List<String> getAdditionalObjectClasses()
261  {
262    return Collections.singletonList(OC_REFRESH_ENCRYPTION_SETTINGS_TASK);
263  }
264}