001/*
002 * Copyright 2022-2024 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2022-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) 2022-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 certificate monitor data immediately.  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 RefreshCertificateMonitorTask
074       extends Task
075{
076  /**
077   * The fully-qualified name of the Java class that is used for the refresh
078   * certificate monitor task in the Directory Server.
079   */
080  @NotNull static final String REFRESH_CERTIFICATE_MONITOR_TASK_CLASS =
081       "com.unboundid.directory.server.tasks.RefreshCertificateMonitorTask";
082
083
084
085  /**
086   * The name of the object class used in refresh certificate monitor task
087   * entries.
088   */
089  @NotNull private static final String OC_REFRESH_CERTIFICATE_MONITOR_TASK =
090       "ds-task-refresh-certificate-monitor";
091
092
093  /**
094   * The serial version UID for this serializable class.
095   */
096  private static final long serialVersionUID = -7576460767480962435L;
097
098
099
100  /**
101   * Creates a new refresh certificate monitor task with a randomly generated
102   * task ID and default values for all other settings.
103   */
104  public RefreshCertificateMonitorTask()
105  {
106    this((String) null);
107  }
108
109
110
111  /**
112   * Creates a new refresh certificate monitor task with the provided
113   * task ID and default values for all other settings.
114   *
115   * @param  taskID  The task ID to use for this task.  If it is {@code null}
116   *                 then a UUID will be generated for use as the task ID.
117   */
118  public RefreshCertificateMonitorTask(@Nullable final String taskID)
119  {
120    this(taskID, null, null, null, null, null, null, null, null, null, null);
121  }
122
123
124
125  /**
126   * Creates a new refresh certificate monitor task with the provided
127   * information.
128   *
129   * @param  taskID                  The task ID to use for this task.  If it is
130   *                                 {@code null} then a UUID will be generated
131   *                                 for use as the task ID.
132   * @param  scheduledStartTime      The time that this task should start
133   *                                 running.
134   * @param  dependencyIDs           The list of task IDs that will be required
135   *                                 to complete before this task will be
136   *                                 eligible to start.
137   * @param  failedDependencyAction  Indicates what action should be taken if
138   *                                 any of the dependencies for this task do
139   *                                 not complete successfully.
140   * @param  notifyOnStart           The list of e-mail addresses of individuals
141   *                                 that should be notified when this task
142   *                                 starts running.
143   * @param  notifyOnCompletion      The list of e-mail addresses of individuals
144   *                                 that should be notified when this task
145   *                                 completes.
146   * @param  notifyOnSuccess         The list of e-mail addresses of individuals
147   *                                 that should be notified if this task
148   *                                 completes successfully.
149   * @param  notifyOnError           The list of e-mail addresses of individuals
150   *                                 that should be notified if this task does
151   *                                 not complete successfully.
152   * @param  alertOnStart            Indicates whether the server should send an
153   *                                 alert notification when this task starts.
154   * @param  alertOnSuccess          Indicates whether the server should send an
155   *                                 alert notification if this task completes
156   *                                 successfully.
157   * @param  alertOnError            Indicates whether the server should send an
158   *                                 alert notification if this task fails to
159   *                                 complete successfully.
160   */
161  public RefreshCertificateMonitorTask(
162              @Nullable final String taskID,
163              @Nullable final Date scheduledStartTime,
164              @Nullable final List<String> dependencyIDs,
165              @Nullable final FailedDependencyAction failedDependencyAction,
166              @Nullable final List<String> notifyOnStart,
167              @Nullable final List<String> notifyOnCompletion,
168              @Nullable final List<String> notifyOnSuccess,
169              @Nullable final List<String> notifyOnError,
170              @Nullable final Boolean alertOnStart,
171              @Nullable final Boolean alertOnSuccess,
172              @Nullable final Boolean alertOnError)
173  {
174    super(taskID, REFRESH_CERTIFICATE_MONITOR_TASK_CLASS, scheduledStartTime,
175         dependencyIDs, failedDependencyAction, notifyOnStart,
176         notifyOnCompletion, notifyOnSuccess, notifyOnError, alertOnStart,
177         alertOnSuccess, alertOnError);
178  }
179
180
181
182  /**
183   * Creates a new refresh certificate monitor task from the provided entry.
184   *
185   * @param  entry  The entry to use to create this refresh certificate monitor
186   *                task.
187   *
188   * @throws  TaskException  If the provided entry cannot be parsed as a refresh
189   *                         certificate monitor task entry.
190   */
191  public RefreshCertificateMonitorTask(@NotNull final Entry entry)
192         throws TaskException
193  {
194    super(entry);
195  }
196
197
198
199  /**
200   * Creates a new refresh certificate monitor task from the provided set of
201   * task properties.
202   *
203   * @param  properties  The set of task properties and their corresponding
204   *                     values to use for the task.  It must not be
205   *                     {@code null}.
206   *
207   * @throws  TaskException  If the provided set of properties cannot be used to
208   *                         create a valid refresh certificate monitor task.
209   */
210  public RefreshCertificateMonitorTask(
211              @NotNull final Map<TaskProperty,List<Object>> properties)
212         throws TaskException
213  {
214    super(REFRESH_CERTIFICATE_MONITOR_TASK_CLASS, properties);
215  }
216
217
218
219  /**
220   * {@inheritDoc}
221   */
222  @Override()
223  @NotNull()
224  public String getTaskName()
225  {
226    return INFO_TASK_NAME_REFRESH_CERTIFICATE_MONITOR.get();
227  }
228
229
230
231  /**
232   * {@inheritDoc}
233   */
234  @Override()
235  @NotNull()
236  public String getTaskDescription()
237  {
238    return INFO_TASK_DESCRIPTION_REFRESH_CERTIFICATE_MONITOR.get();
239  }
240
241
242
243  /**
244   * {@inheritDoc}
245   */
246  @Override()
247  @NotNull()
248  protected List<String> getAdditionalObjectClasses()
249  {
250    return Collections.singletonList(OC_REFRESH_CERTIFICATE_MONITOR_TASK);
251  }
252}