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