001/*
002 * Copyright 2020-2024 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2020-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) 2020-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.io.Serializable;
041import java.util.ArrayList;
042import java.util.Date;
043import java.util.Iterator;
044import java.util.List;
045import java.util.concurrent.TimeUnit;
046
047import com.unboundid.util.Debug;
048import com.unboundid.util.Mutable;
049import com.unboundid.util.NotNull;
050import com.unboundid.util.Nullable;
051import com.unboundid.util.ThreadSafety;
052import com.unboundid.util.ThreadSafetyLevel;
053import com.unboundid.util.args.ArgumentException;
054import com.unboundid.util.args.DurationArgument;
055
056
057
058/**
059 * This class defines a set of properties that may be used when creating a
060 * {@link CollectSupportDataTask}.
061 * <BR>
062 * <BLOCKQUOTE>
063 *   <B>NOTE:</B>  This class, and other classes within the
064 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
065 *   supported for use against Ping Identity, UnboundID, and
066 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
067 *   for proprietary functionality or for external specifications that are not
068 *   considered stable or mature enough to be guaranteed to work in an
069 *   interoperable way with other types of LDAP servers.
070 * </BLOCKQUOTE>
071 */
072@Mutable()
073@ThreadSafety(level=ThreadSafetyLevel.NOT_THREADSAFE)
074public final class CollectSupportDataTaskProperties
075       implements Serializable
076{
077  /**
078   * The serial version UID for this serializable class.
079   */
080  private static final long serialVersionUID = 1424492798476859173L;
081
082
083
084  // Indicates whether to generate an administrative alert if the task completes
085  // with an error.
086  @Nullable private Boolean alertOnError;
087
088  // Indicates whether to generate an administrative alert when the task starts
089  // running.
090  @Nullable private Boolean alertOnStart;
091
092  // Indicates whether to generate an administrative alert if the task completes
093  // successfully.
094  @Nullable private Boolean alertOnSuccess;
095
096  // Indicates whether to include binary files in the support data archive.
097  @Nullable private Boolean includeBinaryFiles;
098
099  // Indicates whether to include expensive data in the support data archive.
100  @Nullable private Boolean includeExpensiveData;
101
102  // Indicates whether to include third-party extension source code in the
103  // support data archive.
104  @Nullable private Boolean includeExtensionSource;
105
106  // Indicates whether to include a replication state dump in the support data
107  // archive.
108  @Nullable private Boolean includeReplicationStateDump;
109
110  // Indicates whether to capture information sequentially rather than in
111  // parallel.
112  @Nullable private Boolean useSequentialMode;
113
114  // The security level to use for data included in the support data archive.
115  @Nullable private CollectSupportDataSecurityLevel securityLevel;
116
117  // The time at which to end collecting log data.
118  @Nullable private Date logEndTime;
119
120  // The time at which to start collecting log data.
121  @Nullable private Date logStartTime;
122
123  // The time at which the task should start running.
124  @Nullable private Date scheduledStartTime;
125
126  // The action to take if any of the dependencies for this task complete
127  // unsuccessfully.
128  @Nullable private FailedDependencyAction failedDependencyAction;
129
130  // The number of jstacks to include in the support data archive.
131  @Nullable private Integer jstackCount;
132
133  // The amount of data in kilobytes to capture from the beginning of each log
134  // file.
135  @Nullable private Integer logFileHeadCollectionSizeKB;
136
137  // The amount of data in kilobytes to capture from the end of each log file.
138  @Nullable private Integer logFileTailCollectionSizeKB;
139
140  // The report count to use for sampled metrics.
141  @Nullable private Integer reportCount;
142
143  // The report interval in seconds to use for sampled metrics.
144  @Nullable private Integer reportIntervalSeconds;
145
146  // The minimum number of existing support data archives that should be
147  // retained.
148  @Nullable private Integer retainPreviousSupportDataArchiveCount;
149
150  // The dependency IDs of any tasks on which the collect support data task
151  // should depend.
152  @NotNull private final List<String> dependencyIDs;
153
154  // The addresses to email whenever the task completes, regardless of success
155  // or failure.
156  @NotNull private final List<String> notifyOnCompletion;
157
158  // The addresses to email if the task completes with an error.
159  @NotNull private final List<String> notifyOnError;
160
161  // The addresses to email when the task starts.
162  @NotNull private final List<String> notifyOnStart;
163
164  // The addresses to email if the task completes successfully.
165  @NotNull private final List<String> notifyOnSuccess;
166
167  // A comment to include in the support data archive.
168  @Nullable private String comment;
169
170  // The path to the encryption passphrase file.
171  @Nullable private String encryptionPassphraseFile;
172
173  // A string representation of the log duration to capture.
174  @Nullable private String logDuration;
175
176  // The path to which the support data archive should be written.
177  @Nullable private String outputPath;
178
179  // The minimum age for existing support data archives that should be retained.
180  @Nullable private String retainPreviousSupportDataArchiveAge;
181
182  // The task ID to use for the collect support data task.
183  @Nullable private String taskID;
184
185
186
187  /**
188   * Creates a new set of collect support data task properties without any of
189   * the properties set (so that the server will use default values for all of
190   * them).
191   */
192  public CollectSupportDataTaskProperties()
193  {
194    alertOnError = null;
195    alertOnStart = null;
196    alertOnSuccess = null;
197    includeBinaryFiles = null;
198    includeExpensiveData = null;
199    includeExtensionSource = null;
200    includeReplicationStateDump = null;
201    useSequentialMode = null;
202    securityLevel = null;
203    logEndTime = null;
204    logStartTime = null;
205    scheduledStartTime = null;
206    failedDependencyAction = null;
207    jstackCount = null;
208    logFileHeadCollectionSizeKB = null;
209    logFileTailCollectionSizeKB = null;
210    reportCount = null;
211    reportIntervalSeconds = null;
212    retainPreviousSupportDataArchiveCount = null;
213    dependencyIDs = new ArrayList<>(5);
214    notifyOnCompletion = new ArrayList<>(5);
215    notifyOnError = new ArrayList<>(5);
216    notifyOnStart = new ArrayList<>(5);
217    notifyOnSuccess = new ArrayList<>(5);
218    comment = null;
219    encryptionPassphraseFile = null;
220    logDuration = null;
221    outputPath = null;
222    retainPreviousSupportDataArchiveAge = null;
223    taskID = null;
224  }
225
226
227
228  /**
229   * Creates a new set of collect support data task properties as a copy of the
230   * provided properties.
231   *
232   * @param  properties  The collect support data task properties to duplicate.
233   */
234  public CollectSupportDataTaskProperties(
235              @NotNull final CollectSupportDataTaskProperties properties)
236  {
237    alertOnError = properties.getAlertOnError();
238    alertOnStart = properties.getAlertOnStart();
239    alertOnSuccess = properties.getAlertOnSuccess();
240    includeBinaryFiles = properties.getIncludeBinaryFiles();
241    includeExpensiveData = properties.getIncludeExpensiveData();
242    includeExtensionSource = properties.getIncludeExtensionSource();
243    includeReplicationStateDump = properties.getIncludeReplicationStateDump();
244    useSequentialMode = properties.getUseSequentialMode();
245    securityLevel = properties.getSecurityLevel();
246    logEndTime = properties.getLogEndTime();
247    logStartTime = properties.getLogStartTime();
248    scheduledStartTime = properties.getScheduledStartTime();
249    failedDependencyAction = properties.getFailedDependencyAction();
250    jstackCount = properties.getJStackCount();
251    logFileHeadCollectionSizeKB = properties.getLogFileHeadCollectionSizeKB();
252    logFileTailCollectionSizeKB = properties.getLogFileTailCollectionSizeKB();
253    reportCount = properties.getReportCount();
254    reportIntervalSeconds = properties.getReportIntervalSeconds();
255    retainPreviousSupportDataArchiveCount =
256         properties.getRetainPreviousSupportDataArchiveCount();
257    dependencyIDs = new ArrayList<>(properties.getDependencyIDs());
258    notifyOnCompletion = new ArrayList<>(properties.getNotifyOnCompletion());
259    notifyOnError = new ArrayList<>(properties.getNotifyOnError());
260    notifyOnStart = new ArrayList<>(properties.getNotifyOnStart());
261    notifyOnSuccess = new ArrayList<>(properties.getNotifyOnSuccess());
262    comment = properties.getComment();
263    encryptionPassphraseFile = properties.getEncryptionPassphraseFile();
264    logDuration = properties.getLogDuration();
265    outputPath = properties.getOutputPath();
266    retainPreviousSupportDataArchiveAge =
267         properties.getRetainPreviousSupportDataArchiveAge();
268    taskID = properties.getTaskID();
269  }
270
271
272
273  /**
274   * Creates a new set of collect support data task properties set from the
275   * provided task instance.
276   *
277   * @param  task  The collect support data task instance from which the
278   *               properties should be set.
279   */
280  public CollectSupportDataTaskProperties(
281              @NotNull final CollectSupportDataTask task)
282  {
283    alertOnError = task.getAlertOnError();
284    alertOnStart = task.getAlertOnStart();
285    alertOnSuccess = task.getAlertOnSuccess();
286    includeBinaryFiles = task.getIncludeBinaryFiles();
287    includeExpensiveData = task.getIncludeExpensiveData();
288    includeExtensionSource = task.getIncludeExtensionSource();
289    includeReplicationStateDump = task.getIncludeReplicationStateDump();
290    useSequentialMode = task.getUseSequentialMode();
291    securityLevel = task.getSecurityLevel();
292    logEndTime = task.getLogEndTime();
293    logStartTime = task.getLogStartTime();
294    scheduledStartTime = task.getScheduledStartTime();
295    failedDependencyAction = task.getFailedDependencyAction();
296    jstackCount = task.getJStackCount();
297    logFileHeadCollectionSizeKB = task.getLogFileHeadCollectionSizeKB();
298    logFileTailCollectionSizeKB = task.getLogFileTailCollectionSizeKB();
299    reportCount = task.getReportCount();
300    reportIntervalSeconds = task.getReportIntervalSeconds();
301    retainPreviousSupportDataArchiveCount =
302         task.getRetainPreviousSupportDataArchiveCount();
303    dependencyIDs = new ArrayList<>(task.getDependencyIDs());
304    notifyOnCompletion = new ArrayList<>(task.getNotifyOnCompletionAddresses());
305    notifyOnError = new ArrayList<>(task.getNotifyOnErrorAddresses());
306    notifyOnStart = new ArrayList<>(task.getNotifyOnStartAddresses());
307    notifyOnSuccess = new ArrayList<>(task.getNotifyOnSuccessAddresses());
308    comment = task.getComment();
309    encryptionPassphraseFile = task.getEncryptionPassphraseFile();
310    logDuration = task.getLogDuration();
311    outputPath = task.getOutputPath();
312    retainPreviousSupportDataArchiveAge =
313         task.getRetainPreviousSupportDataArchiveAge();
314    taskID = task.getTaskID();
315  }
316
317
318
319  /**
320   * Retrieves the path on the server filesystem to which the support data
321   * archive should be written.
322   *
323   * @return  The path on the server filesystem to which the support data
324   *          archive should be written, or {@code null} if no value has been
325   *          specified for the property.
326   */
327  @Nullable()
328  public String getOutputPath()
329  {
330    return outputPath;
331  }
332
333
334
335  /**
336   * Specifies the path on the server filesystem to which the support data '
337   * archive should be written.  If this is provided, then the value may be
338   * one of the following:
339   * <UL>
340   *   <LI>If the path refers to a file that exists, then the file will be
341   *       overwritten with the new support data archive.</LI>
342   *   <LI>If the path refers to a directory that exists, then the support data
343   *       archive will be written into that directory with a name generated
344   *       by the server.</LI>
345   *   <LI>If the path refers to a file that does not exist, then its parent
346   *       directory must exist, and the support data archive will be written
347   *       with the specified path and name.</LI>
348   * </UL>
349   *
350   * @param  outputPath  The path on the server filesystem to which the support
351   *                     data archive should be written.  It may be {@code null}
352   *                     if the server should choose the path and name for the
353   *                     output file.
354   */
355  public void setOutputPath(@Nullable final String outputPath)
356  {
357    this.outputPath = outputPath;
358  }
359
360
361
362  /**
363   * Retrieves the path on the server filesystem to a file that contains the
364   * passphrase to use to encrypt the support data archive.
365   *
366   * @return  The path on the server filesystem to a file that contains the
367   *          passphrase to use to encrypt the support data archive, or
368   *          {@code null} if no value has been specified for the property, and
369   *          the support data archive should not be encrypted.
370   */
371  @Nullable()
372  public String getEncryptionPassphraseFile()
373  {
374    return encryptionPassphraseFile;
375  }
376
377
378
379  /**
380   * Specifies the path on the server filesystem to a file that contains the
381   * passphrase to use to encrypt the support data archive.  If this is
382   * provided, then this must refer to a file that exists and that contains
383   * exactly one line whose entire content is the desired encryption passphrase.
384   *
385   * @param  encryptionPassphraseFile  The path on the server filesystem to a
386   *                                   file that contains the passphrase to use
387   *                                   to encrypt the support data archive.  It
388   *                                   may be {@code null} if the support data
389   *                                   archive should not be encrypted.
390   */
391  public void setEncryptionPassphraseFile(
392                   @Nullable final String encryptionPassphraseFile)
393  {
394    this.encryptionPassphraseFile = encryptionPassphraseFile;
395  }
396
397
398
399  /**
400   * Retrieves the value of a flag that indicates whether the support data
401   * archive may include data that is potentially expensive to collect and
402   * could affect the performance or responsiveness of the server.
403   *
404   * @return  The value of a flag that indicates whether the support data
405   *          archive may include data that is potentially expensive to collect,
406   *          or {@code null} if the property should not be specified when the
407   *          task is created (in which case the server will use a default
408   *          behavior of excluding expensive data).
409   */
410  @Nullable()
411  public Boolean getIncludeExpensiveData()
412  {
413    return includeExpensiveData;
414  }
415
416
417
418  /**
419   * Specifies the value of a flag that indicates whether the support data
420   * archive may include data that is potentially expensive to collect and could
421   * affect the performance or responsiveness of the server.
422   *
423   * @param  includeExpensiveData  The value of a flag that indicates whether
424   *                               the support data archive may include data
425   *                               that is potentially expensive to collect.  It
426   *                               may be {@code null} if the flag should not be
427   *                               specified when the task is created (in which
428   *                               case the server will use a default behavior
429   *                               of excluding expensive data).
430   */
431  public void setIncludeExpensiveData(
432                   @Nullable final Boolean includeExpensiveData)
433  {
434    this.includeExpensiveData = includeExpensiveData;
435  }
436
437
438
439  /**
440   * Retrieves the value of a flag that indicates whether the support data
441   * archive may include a replication state dump, which may be several
442   * megabytes in size.
443   *
444   * @return  The value of a flag that indicates whether the support data
445   *          archive may include a replication state dump, or {@code null} if
446   *          the property should not be specified when the task is created (in
447   *          which case the server will use a default behavior of excluding the
448   *          state dump).
449   */
450  @Nullable()
451  public Boolean getIncludeReplicationStateDump()
452  {
453    return includeReplicationStateDump;
454  }
455
456
457
458  /**
459   * Specifies the value of a flag that indicates whether the support data
460   * archive may include a replication state dump, which may be several
461   * megabytes in size.
462   *
463   * @param  includeReplicationStateDump  The value of a flag that indicates
464   *                                      whether the support data archive may
465   *                                      include a replication state dump.  It
466   *                                      may be {@code null} if the flag should
467   *                                      not be specified when the task is
468   *                                      created (in which case the server will
469   *                                      use a default behavior of excluding
470   *                                      the state dump).
471   */
472  public void setIncludeReplicationStateDump(
473                   @Nullable final Boolean includeReplicationStateDump)
474  {
475    this.includeReplicationStateDump = includeReplicationStateDump;
476  }
477
478
479
480  /**
481   * Retrieves the value of a flag that indicates whether the support data
482   * archive may include binary files.
483   *
484   * @return  The value of a flag that indicates whether the support data
485   *          archive may include binary files, or {@code null} if the property
486   *          should not be specified when the task is created (in which case
487   *          the server will use a default behavior of excluding binary files).
488   */
489  @Nullable()
490  public Boolean getIncludeBinaryFiles()
491  {
492    return includeBinaryFiles;
493  }
494
495
496
497  /**
498   * Specifies the value of a flag that that indicates whether the support data
499   * archive may include binary files.
500   *
501   * @param  includeBinaryFiles  The value of a flag that indicates whether the
502   *                             support data archive may include binary files.
503   *                             It may be {@code null} if the property should
504   *                             not be specified when the task is created (in
505   *                             which case the server will use a default
506   *                             behavior of excluding binary files).
507   */
508  public void setIncludeBinaryFiles(@Nullable final Boolean includeBinaryFiles)
509  {
510    this.includeBinaryFiles = includeBinaryFiles;
511  }
512
513
514
515  /**
516   * Retrieves the value of a flag that indicates whether the support data
517   * archive should include source code (if available) for any third-party
518   * extensions installed in the server.
519   *
520   * @return  The value of a flag that indicates whether the support data
521   *          archive should include source code (if available) for any
522   *          third-party extensions installed in the server, or {@code null} if
523   *          the property should not be specified when the task is created (in
524   *          which case the server will use a default behavior of excluding
525   *          extension source code).
526   */
527  @Nullable()
528  public Boolean getIncludeExtensionSource()
529  {
530    return includeExtensionSource;
531  }
532
533
534
535  /**
536   * Specifies the value of a flag that indicates whether the support data
537   * archive should include source code (if available) for any third-party
538   * extensions installed in the server.
539   *
540   * @param  includeExtensionSource  The value of a flag that indicates whether
541   *                                 the support data archive should include
542   *                                 source code (if available) for any
543   *                                 third-party extensions in the server.  It
544   *                                 may be {@code null} if the property should
545   *                                 not be specified when the task is
546   *                                 created (in which case the server will use
547   *                                 a default behavior of excluding extension
548   *                                 source code).
549   */
550  public void setIncludeExtensionSource(
551                   @Nullable final Boolean includeExtensionSource)
552  {
553    this.includeExtensionSource = includeExtensionSource;
554  }
555
556
557
558  /**
559   * Retrieves the value of a flag that indicates whether the server should
560   * collect items for the support data archive in sequential mode rather than
561   * in parallel.  Collecting data in sequential mode may reduce the amount of
562   * memory consumed during the collection process, but it will take longer to
563   * complete.
564   *
565   * @return  The value of a flag that indicates whether the server should
566   *          collect items for the support data archive in sequential mode
567   *          rather than in parallel, or {@code null} if the property should
568   *          not be specified when the task is created (in which case the
569   *          server will default to capturing data in parallel).
570   */
571  @Nullable()
572  public Boolean getUseSequentialMode()
573  {
574    return useSequentialMode;
575  }
576
577
578
579  /**
580   * Specifies the value of a flag that indicates whether the server should
581   * collect items for the support data archive in sequential mode rather than
582   * in parallel.  Collecting data in sequential mode may reduce the amount of
583   * memory consumed during the collection process, but it will take longer to
584   * complete.
585   *
586   * @param  useSequentialMode  The value of a flag that indicates whether the
587   *                            server should collect items for the support data
588   *                            archive in sequential mode rather than in
589   *                            parallel.  It may be {@code null} if the
590   *                            property should not be specified when the task
591   *                            is created (in which case the server will
592   *                            default to capturing data in parallel).
593   */
594  public void setUseSequentialMode(@Nullable final Boolean useSequentialMode)
595  {
596    this.useSequentialMode = useSequentialMode;
597  }
598
599
600
601  /**
602   * Retrieves the security level that should be used to indicate which data
603   * should be obscured, redacted, or omitted from the support data archive.
604   *
605   * @return  The security level that should be used when creating the support
606   *          data archive, or {@code null} if the property should not be
607   *          specified when the task is created (in which case the server will
608   *          use a default security level).
609   */
610  @Nullable()
611  public CollectSupportDataSecurityLevel getSecurityLevel()
612  {
613    return securityLevel;
614  }
615
616
617
618  /**
619   * Specifies the security level that should be used to indicate which data
620   * should be obscured, redacted, or omitted from the support data archive.
621   *
622   * @param  securityLevel  The security level that should be used when creating
623   *                        the support data archive.  It may be {@code null} if
624   *                        the property should not be specified when the task
625   *                        is created (in which case the server will use a
626   *                        default security level).
627   */
628  public void setSecurityLevel(
629       @Nullable final CollectSupportDataSecurityLevel securityLevel)
630
631  {
632    this.securityLevel = securityLevel;
633  }
634
635
636
637  /**
638   * Retrieves the number of intervals that should be captured from tools that
639   * use interval-based sampling (e.g., vmstat, iostat, mpstat, etc.).
640   *
641   * @return  The number of intervals that should be captured from tools that
642   *          use interval-based sampling, or {@code null} if the property
643   *          should not be specified when the task is created (in which case
644   *          the server will use a default report count).
645   */
646  @Nullable()
647  public Integer getReportCount()
648  {
649    return reportCount;
650  }
651
652
653
654  /**
655   * Specifies the number of intervals that should be captured form tools that
656   * use interval-based sampling (e.g., vmstat, iostat, mpstat, etc.).
657   *
658   * @param  reportCount  The number of intervals that should be captured from
659   *                      tools that use interval-based sampling.  The value
660   *                      must not be negative, but it may be zero to indicate
661   *                      that no intervals should be captured.  It may be
662   *                      {@code null} if the property should not be specified
663   *                      when the task is created (in which case the server
664   *                      will use a default report count).
665   */
666  public void setReportCount(@Nullable final Integer reportCount)
667  {
668    this.reportCount = reportCount;
669  }
670
671
672
673  /**
674   * Retrieves the interval duration in seconds that should be used for tools
675   * that use interval-based sampling (e.g., vmstat, iostat, mpstat, etc.).
676   *
677   * @return  The interval duration in seconds that should be used for tools
678   *          that use interval-based sampling, or {@code null} if the property
679   *          should not be specified when the task is created (in which case
680   *          the server will use a default report interval).
681   */
682  @Nullable()
683  public Integer getReportIntervalSeconds()
684  {
685    return reportIntervalSeconds;
686  }
687
688
689
690  /**
691   * Specifies the interval duration in seconds that should be used for tools
692   * that use interval-based sampling (e.g., vmstat, iostat, mpstat, etc.).
693   *
694   * @param  reportIntervalSeconds  The interval duration in seconds that should
695   *                                be used for tools that use interval-based
696   *                                sampling.  The value must be greater than or
697   *                                equal to one.  It may be {@code null} if the
698   *                                property should not be specified when the
699   *                                task is created (in which case the server
700   *                                will use a default report count).
701   */
702  public void setReportIntervalSeconds(
703                   @Nullable final Integer reportIntervalSeconds)
704  {
705    this.reportIntervalSeconds = reportIntervalSeconds;
706  }
707
708
709
710  /**
711   * Retrieves the number of times that the jstack utility should be invoked to
712   * obtain stack traces from all threads in the server.
713   *
714   * @return  The number of times that the jstack utility should be invoked to
715   *          obtain stack traces from all threads in the server, or
716   *          {@code null} if the property should not be specified when the task
717   *          is created (in which case the server will use a default count).
718   */
719  @Nullable()
720  public Integer getJStackCount()
721  {
722    return jstackCount;
723  }
724
725
726
727  /**
728   * Specifies the number of times that the jstack utility should be invoked to
729   * obtain stack traces from all threads in the server.
730   *
731   * @param  jstackCount  The number of times that the jstack utility should be
732   *                      invoked to obtain stack traces from all threads in the
733   *                      server.  The value must not be negative, but it may be
734   *                      zero to indicate that the jstack utility should not be
735   *                      invoked.  It may be {@code null} if the property
736   *                      should not be specified when the task is created (in
737   *                      which case the server will use a default count).
738   */
739  public void setJStackCount(@Nullable final Integer jstackCount)
740  {
741    this.jstackCount = jstackCount;
742  }
743
744
745
746  /**
747   * Retrieves the start time for the range of log messages to include in the
748   * support data archive.
749   *
750   * @return  The start time for the range of log messages to include in the
751   *          support data archive, or {@code null} if no log start time has
752   *          been specified.
753   */
754  @Nullable()
755  public Date getLogStartTime()
756  {
757    return logStartTime;
758  }
759
760
761
762  /**
763   * Retrieves the end time for the range of log messages to include in the
764   * support data archive.
765   *
766   * @return  The end time for the range of log messages to include in the
767   *          support data archive, or {@code null} if no log end time has
768   *          been specified.
769   */
770  @Nullable()
771  public Date getLogEndTime()
772  {
773    return logEndTime;
774  }
775
776
777
778  /**
779   * Specifies the time range for log messages to include in the support data
780   * archive.  If a log time range is to be used, then the start time must be
781   * specified, and the end time may optionally be specified.  A log time range
782   * should not be used in conjunction with a log duration or with a log head
783   * or tail size.
784   *
785   * @param  logStartTime  The start time for the range of log messages to
786   *                       include in the support data archive.  It may be
787   *                       {@code null} if no log time range should be used.
788   * @param  logEndTime    The end time for the range of log messages to include
789   *                       in the support data archive.  It may be {@code null}
790   *                       if no log time range should be used, or if the time
791   *                       range should only be specified using a start time
792   *                       without an end time.
793   */
794  public void setLogTimeRange(@Nullable final Date logStartTime,
795                              @Nullable final Date logEndTime)
796  {
797    this.logStartTime = logStartTime;
798    this.logEndTime = logEndTime;
799  }
800
801
802
803  /**
804   * Retrieves a string representation of the duration (up until the time that
805   * the collect support data task is invoked) of log content that should be
806   * included in the support data archive.
807   *
808   * @return  A string representation of the duration of log content that should
809   *          be included in the support data archive, or {@code null} if the
810   *          property should not be specified when the task is created (in
811   *          which case the server will use a default behavior for selecting
812   *          the amount of log content to include).
813   */
814  @Nullable()
815  public String getLogDuration()
816  {
817    return logDuration;
818  }
819
820
821
822  /**
823   * Retrieves a parsed value of the log duration in milliseconds.
824   *
825   * @return  A parsed value of the log duration in milliseconds or {@code null}
826   *          if no log duration is set.
827   *
828   * @throws  TaskException  If the log duration value cannot be parsed as a
829   *                         valid duration.
830   */
831  @Nullable()
832  public Long getLogDurationMillis()
833         throws TaskException
834  {
835    if (logDuration == null)
836    {
837      return null;
838    }
839
840    try
841    {
842      return DurationArgument.parseDuration(logDuration, TimeUnit.MILLISECONDS);
843    }
844    catch (final ArgumentException e)
845    {
846      Debug.debugException(e);
847      throw new TaskException(e.getMessage(), e);
848    }
849  }
850
851
852
853  /**
854   * Specifies the string representation of the duration (up until the time that
855   * the collect support data task is invoked) of log content that should be
856   * included in the support data archive.
857   * <BR><BR>
858   * The string representation of the duration should be specified as
859   * an integer followed by a time unit, where the unit may be one of
860   * millisecond, second, minute, hour, day, or week (or one of their plurals).
861   * For example, "5 minutes" or "1 hour".
862   *
863   * @param  logDuration  The string representation of the duration of log
864   *                      content that should be included in the support data
865   *                      archive.  It may be {@code null} if the property
866   *                      should not be specified when the task is created (in
867   *                      which case the server will determine an appropriate
868   *                      amount of log content to include).
869   *
870   * @throws  TaskException  If the provided string representation cannot be
871   *                         parsed as a valid duration.
872   */
873  public void setLogDuration(@Nullable final String logDuration)
874         throws TaskException
875  {
876    if (logDuration == null)
877    {
878      this.logDuration = null;
879    }
880    else
881    {
882      try
883      {
884        DurationArgument.parseDuration(logDuration, TimeUnit.MILLISECONDS);
885        this.logDuration = logDuration;
886      }
887      catch (final ArgumentException e)
888      {
889        Debug.debugException(e);
890        throw new TaskException(e.getMessage(), e);
891      }
892    }
893  }
894
895
896
897  /**
898   * Specifies the duration in milliseconds (up until the time that the collect
899   * support data task is invoked) of log content that should be included in the
900   * support data archive.
901   *
902   * @param  logDurationMillis  The duration in milliseconds of log content that
903   *                            should be included in the support data archive.
904   *                            The value must be greater than zero.  It may be
905   *                            {@code null} if the property should not be
906   *                            specified when the task is created (in which
907   *                            case the server will determine an appropriate
908   *                            amount of log content to include).
909   */
910  public void setLogDurationMillis(@Nullable final Long logDurationMillis)
911  {
912    if (logDurationMillis == null)
913    {
914      logDuration = null;
915    }
916    else
917    {
918      logDuration = DurationArgument.nanosToDuration(
919           TimeUnit.MILLISECONDS.toNanos(logDurationMillis));
920    }
921  }
922
923
924
925  /**
926   * Retrieves the amount of data in kilobytes to capture from the beginning of
927   * each log file that should be included in the support data archive.
928   *
929   * @return  The amount of data in kilobytes to capture from the beginning of
930   *          each log file that should be included in the support data archive,
931   *          or {@code null} if the property should not be specified when the
932   *          task is created (in which case the server will determine an
933   *          appropriate amount of log content to include).
934   */
935  @Nullable()
936  public Integer getLogFileHeadCollectionSizeKB()
937  {
938    return logFileHeadCollectionSizeKB;
939  }
940
941
942
943  /**
944   * Specifies the amount of data in kilobytes to capture from the beginning of
945   * each log file that should be included in the support data archive.
946   *
947   * @param  logFileHeadCollectionSizeKB  The amount of data in kilobytes to
948   *                                      capture from the beginning of each log
949   *                                      file that should be included in the
950   *                                      support data archive.  This may be
951   *                                      {@code null} if the property should
952   *                                      not be specified when the task is
953   *                                      created (in which case the server will
954   *                                      determine an appropriate amount of log
955   *                                      content to include).
956   */
957  public void setLogFileHeadCollectionSizeKB(
958                   @Nullable final Integer logFileHeadCollectionSizeKB)
959  {
960    this.logFileHeadCollectionSizeKB = logFileHeadCollectionSizeKB;
961  }
962
963
964
965  /**
966   * Retrieves the amount of data in kilobytes to capture from the end of each
967   * log file that should be included in the support data archive.
968   *
969   * @return  The amount of data in kilobytes to capture from the end of each
970   *          log file that should be included in the support data archive, or
971   *          {@code null} if the property should not be specified when the task
972   *          is created (in which case the server will determine an
973   *          appropriate amount of log content to include).
974   */
975  @Nullable()
976  public Integer getLogFileTailCollectionSizeKB()
977  {
978    return logFileTailCollectionSizeKB;
979  }
980
981
982
983  /**
984   * Specifies the amount of data in kilobytes to capture from the end of each
985   * log file that should be included in the support data archive.
986   *
987   * @param  logFileTailCollectionSizeKB  The amount of data in kilobytes to
988   *                                      capture from the end of each log file
989   *                                      that should be included in the
990   *                                      support data archive.  This may be
991   *                                      {@code null} if the property should
992   *                                      not be specified when the task is
993   *                                      created (in which case the server will
994   *                                      determine an appropriate amount of log
995   *                                      content to include).
996   */
997  public void setLogFileTailCollectionSizeKB(
998                   @Nullable final Integer logFileTailCollectionSizeKB)
999  {
1000    this.logFileTailCollectionSizeKB = logFileTailCollectionSizeKB;
1001  }
1002
1003
1004
1005  /**
1006   * Retrieves an additional comment that should be included in the support data
1007   * archive.
1008   *
1009   * @return  An additional comment that should be included in the support data
1010   *          archive, or {@code null} if no comment should be included.
1011   */
1012  @Nullable()
1013  public String getComment()
1014  {
1015    return comment;
1016  }
1017
1018
1019
1020  /**
1021   * Specifies an additional comment that should be included in the support data
1022   * archive.
1023   *
1024   * @param  comment  An additional comment that should be included in the
1025   *                  support data archive.  It may be {@code null} if no
1026   *                  additional comment should be included.
1027   */
1028  public void setComment(@Nullable final String comment)
1029  {
1030    this.comment = comment;
1031  }
1032
1033
1034
1035  /**
1036   * Retrieves the minimum number of existing support data archives that should
1037   * be retained.
1038   *
1039   * @return  The minimum number of existing support data archives that should
1040   *          be retained, or {@code null} if there is no minimum retain count.
1041   */
1042  @Nullable()
1043  public Integer getRetainPreviousSupportDataArchiveCount()
1044  {
1045    return retainPreviousSupportDataArchiveCount;
1046  }
1047
1048
1049
1050  /**
1051   * Specifies the minimum number of existing support data archives that should
1052   * be retained.
1053   * <BR><BR>
1054   * Note that if an output path is specified, then a retain count or retain age
1055   * may only be used if that output path specifies a directory rather than a
1056   * file, so that the file name will be generated by the server, and only
1057   * archive files in that directory with names that conform to the
1058   * server-generated pattern may be removed.
1059   * <BR><BR>
1060   * If neither a retain count nor a retain age is specified, then no existing
1061   * support data archives will be removed.  If both are specified, then any
1062   * existing archive that is outside the criteria for either will be removed.
1063   *
1064   * @param  retainPreviousSupportDataArchiveCount
1065   *              The minimum number of existing support data archives that
1066   *              should be retained.  A value of zero indicates that only the
1067   *              new support data archive should be retained, and any other
1068   *              preexisting archives may be removed.  It may be {@code null}
1069   *              if only the age of existing archives should be considered (if
1070   *              a retain age is specified), or if no existing support data
1071   *              archives should be removed (if no retain age is specified).
1072   */
1073  public void setRetainPreviousSupportDataArchiveCount(
1074       @Nullable final Integer retainPreviousSupportDataArchiveCount)
1075  {
1076    this.retainPreviousSupportDataArchiveCount =
1077         retainPreviousSupportDataArchiveCount;
1078  }
1079
1080
1081
1082  /**
1083   * Retrieves the minimum age of existing support data archives that should be
1084   * retained.
1085   *
1086   * @return  The minimum age of existing support data archives that should
1087   *          be retained, or {@code null} if there is no minimum retain age.
1088   */
1089  @Nullable()
1090  public String getRetainPreviousSupportDataArchiveAge()
1091  {
1092    return retainPreviousSupportDataArchiveAge;
1093  }
1094
1095
1096
1097  /**
1098   * Retrieves a parsed value of the retain previous support data archive age in
1099   * milliseconds.
1100   *
1101   * @return  A parsed value of the retain previous support data archive age in
1102   *          milliseconds or {@code null} if no retain age is set.
1103   *
1104   * @throws  TaskException  If the retain age value cannot be parsed as a valid
1105   *                         duration.
1106   */
1107  @Nullable()
1108  public Long getRetainPreviousSupportDataArchiveAgeMillis()
1109         throws TaskException
1110  {
1111    if (retainPreviousSupportDataArchiveAge == null)
1112    {
1113      return null;
1114    }
1115
1116    try
1117    {
1118      return DurationArgument.parseDuration(
1119           retainPreviousSupportDataArchiveAge, TimeUnit.MILLISECONDS);
1120    }
1121    catch (final ArgumentException e)
1122    {
1123      Debug.debugException(e);
1124      throw new TaskException(e.getMessage(), e);
1125    }
1126  }
1127
1128
1129
1130  /**
1131   * Specifies the minimum age of existing support data archives that should be
1132   * retained.
1133   * <BR><BR>
1134   * The string representation of the duration should be specified as an integer
1135   * followed by a time unit, where the unit may be one of millisecond, second,
1136   * minute, hour, day, or week (or one of their plurals).  For example, "5
1137   * minutes" or "1 hour".
1138   * <BR><BR>
1139   * Note that if an output path is specified, then a retain count or retain age
1140   * may only be used if that output path specifies a directory rather than a
1141   * file, so that the file name will be generated by the server, and only
1142   * archive files in that directory with names that conform to the
1143   * server-generated pattern may be removed.
1144   * <BR><BR>
1145   * If neither a retain count nor a retain age is specified, then no existing
1146   * support data archives will be removed.  If both are specified, then any
1147   * existing archive that is outside the criteria for either will be removed.
1148   *
1149   * @param  retainPreviousSupportDataArchiveAge
1150   *              The minimum age of existing support data archives that
1151   *              should be retained.  Any existing support data archives that
1152   *              are older than this may be removed.  It may be {@code null}
1153   *              if only the number of existing archives should be considered
1154   *              (if a retain count is specified), or if no existing support
1155   *              data archives should be removed (if no retain count is
1156   *              specified).
1157   *
1158   * @throws  TaskException  If the provided string representation cannot be
1159   *                         parsed as a valid duration.
1160   */
1161  public void setRetainPreviousSupportDataArchiveAge(
1162                   @Nullable final String retainPreviousSupportDataArchiveAge)
1163         throws TaskException
1164  {
1165    if (retainPreviousSupportDataArchiveAge == null)
1166    {
1167      this.retainPreviousSupportDataArchiveAge = null;
1168    }
1169    else
1170    {
1171      try
1172      {
1173        DurationArgument.parseDuration(retainPreviousSupportDataArchiveAge,
1174             TimeUnit.MILLISECONDS);
1175        this.retainPreviousSupportDataArchiveAge =
1176             retainPreviousSupportDataArchiveAge;
1177      }
1178      catch (final ArgumentException e)
1179      {
1180        Debug.debugException(e);
1181        throw new TaskException(e.getMessage(), e);
1182      }
1183    }
1184  }
1185
1186
1187
1188  /**
1189   * Specifies the minimum age in milliseconds of existing support data
1190   * archives that should be retained.
1191   * <BR><BR>
1192   * Note that if an output path is specified, then a retain count or retain age
1193   * may only be used if that output path specifies a directory rather than a
1194   * file, so that the file name will be generated by the server, and only
1195   * archive files in that directory with names that conform to the
1196   * server-generated pattern may be removed.
1197   * <BR><BR>
1198   * If neither a retain count nor a retain age is specified, then no existing
1199   * support data archives will be removed.  If both are specified, then any
1200   * existing archive that is outside the criteria for either will be removed.
1201   *
1202   * @param  retainPreviousSupportDataArchiveAgeMillis
1203   *              The minimum age in milliseconds of existing support data
1204   *              archives that should be retained.  Any existing support data
1205   *              archives that are older than this may be removed.  It may be
1206   *              {@code null} if only the number of existing archives should be
1207   *              considered (if a retain count is specified), or if no existing
1208   *              support data archives should be removed (if no retain count is
1209   *              specified).
1210   */
1211  public void setRetainPreviousSupportDataArchiveAgeMillis(
1212       @Nullable final Long retainPreviousSupportDataArchiveAgeMillis)
1213  {
1214    if (retainPreviousSupportDataArchiveAgeMillis == null)
1215    {
1216      retainPreviousSupportDataArchiveAge = null;
1217    }
1218    else
1219    {
1220      retainPreviousSupportDataArchiveAge = DurationArgument.nanosToDuration(
1221           TimeUnit.MILLISECONDS.toNanos(
1222                retainPreviousSupportDataArchiveAgeMillis));
1223    }
1224  }
1225
1226
1227
1228  /**
1229   * Retrieves the task ID that should be used for the task.
1230   *
1231   * @return  The task ID that should be used for the task, or {@code null} if a
1232   *          random UUID should be generated for use as the task ID.
1233   */
1234  @Nullable()
1235  public String getTaskID()
1236  {
1237    return taskID;
1238  }
1239
1240
1241
1242  /**
1243   *Specifies the task ID that should be used for the task.
1244   *
1245   * @param  taskID  The task ID that should be used for the task.  It may be
1246   *                 {@code null} if a random UUID should be generated for use
1247   *                 as the task ID.
1248   */
1249  public void setTaskID(@Nullable final String taskID)
1250  {
1251    this.taskID = taskID;
1252  }
1253
1254
1255
1256  /**
1257   * Retrieves the earliest time that the task should be eligible to start
1258   * running.
1259   *
1260   * @return  The earliest time that the task should be eligible to start
1261   *          running, or {@code null} if the task should be eligible to start
1262   *          immediately (or as soon as all of its dependencies have been
1263   *          satisfied).
1264   */
1265  @Nullable()
1266  public Date getScheduledStartTime()
1267  {
1268    return scheduledStartTime;
1269  }
1270
1271
1272
1273  /**
1274   * Specifies the earliest time that the task should be eligible to start
1275   * running.
1276   *
1277   * @param  scheduledStartTime  The earliest time that the task should be
1278   *                             eligible to start running.  It may be
1279   *                             {@code null} if the task should be eligible to
1280   *                             start immediately (or as soon as all of its
1281   *                             dependencies have been satisfied).
1282   */
1283  public void setScheduledStartTime(@Nullable final Date scheduledStartTime)
1284  {
1285    this.scheduledStartTime = scheduledStartTime;
1286  }
1287
1288
1289
1290  /**
1291   * Retrieves the task IDs for any tasks that must complete before the new
1292   * collect support data task will be eligible to start running.
1293   *
1294   * @return  The task IDs for any tasks that must complete before the new
1295   *          collect support data task will be eligible to start running, or
1296   *          an empty list if the new task should not depend on any other
1297   *          tasks.
1298   */
1299  @NotNull()
1300  public List<String> getDependencyIDs()
1301  {
1302    return new ArrayList<>(dependencyIDs);
1303  }
1304
1305
1306
1307  /**
1308   * Specifies the task IDs for any tasks that must complete before the new
1309   * collect support data task will be eligible to start running.
1310   *
1311   * @param  dependencyIDs  The task IDs for any tasks that must complete before
1312   *                        the new collect support data task will be eligible
1313   *                        to start running.  It may be {@code null} or empty
1314   *                        if the new task should not depend on any other
1315   *                        tasks.
1316   */
1317  public void setDependencyIDs(@Nullable final List<String> dependencyIDs)
1318  {
1319    this.dependencyIDs.clear();
1320    if (dependencyIDs != null)
1321    {
1322      this.dependencyIDs.addAll(dependencyIDs);
1323    }
1324  }
1325
1326
1327
1328  /**
1329   * Retrieves the action that the server should take if any of the tasks on
1330   * which the new task depends did not complete successfully.
1331   *
1332   * @return  The action that the server should take if any of the tasks on
1333   *          which the new task depends did not complete successfully, or
1334   *          {@code null} if the property should not be specified when creating
1335   *          the task (and the server should choose an appropriate failed
1336   *          dependency action).
1337   */
1338  @Nullable()
1339  public FailedDependencyAction getFailedDependencyAction()
1340  {
1341    return failedDependencyAction;
1342  }
1343
1344
1345
1346  /**
1347   * Specifies the action that the server should take if any of the tasks on
1348   * which the new task depends did not complete successfully.
1349   *
1350   * @param  failedDependencyAction  The action that the server should take if
1351   *                                 any of the tasks on which the new task
1352   *                                 depends did not complete successfully.  It
1353   *                                 may be {@code null} if the property should
1354   *                                 not be specified when creating the task
1355   *                                 (and the server should choose an
1356   *                                 appropriate failed dependency action).
1357   */
1358  public void setFailedDependencyAction(
1359       @Nullable final FailedDependencyAction failedDependencyAction)
1360  {
1361    this.failedDependencyAction = failedDependencyAction;
1362  }
1363
1364
1365
1366  /**
1367   * Retrieves the addresses to email whenever the task starts running.
1368   *
1369   * @return  The addresses to email whenever the task starts running, or an
1370   *          empty list if no email notification should be sent when starting
1371   *          the task.
1372   */
1373  @NotNull()
1374  public List<String> getNotifyOnStart()
1375  {
1376    return new ArrayList<>(notifyOnStart);
1377  }
1378
1379
1380
1381  /**
1382   * Specifies the addresses to email whenever the task starts running.
1383   *
1384   * @param  notifyOnStart  The addresses to email whenever the task starts
1385   *                        running.  It amy be {@code null} or empty if no
1386   *                        email notification should be sent when starting the
1387   *                        task.
1388   */
1389  public void setNotifyOnStart(@Nullable final List<String> notifyOnStart)
1390  {
1391    this.notifyOnStart.clear();
1392    if (notifyOnStart != null)
1393    {
1394      this.notifyOnStart.addAll(notifyOnStart);
1395    }
1396  }
1397
1398
1399
1400  /**
1401   * Retrieves the addresses to email whenever the task completes, regardless of
1402   * its success or failure.
1403   *
1404   * @return  The addresses to email whenever the task completes, or an
1405   *          empty list if no email notification should be sent when the task
1406   *          completes.
1407   */
1408  @NotNull()
1409  public List<String> getNotifyOnCompletion()
1410  {
1411    return new ArrayList<>(notifyOnCompletion);
1412  }
1413
1414
1415
1416  /**
1417   * Specifies the addresses to email whenever the task completes, regardless of
1418   * its success or failure.
1419   *
1420   * @param  notifyOnCompletion  The addresses to email whenever the task
1421   *                             completes.  It amy be {@code null} or empty if
1422   *                             no email notification should be sent when the
1423   *                             task completes.
1424   */
1425  public void setNotifyOnCompletion(
1426                   @Nullable final List<String> notifyOnCompletion)
1427  {
1428    this.notifyOnCompletion.clear();
1429    if (notifyOnCompletion != null)
1430    {
1431      this.notifyOnCompletion.addAll(notifyOnCompletion);
1432    }
1433  }
1434
1435
1436
1437  /**
1438   * Retrieves the addresses to email if the task completes successfully.
1439   *
1440   * @return  The addresses to email if the task completes successfully, or an
1441   *          empty list if no email notification should be sent on successful
1442   *          completion.
1443   */
1444  @NotNull()
1445  public List<String> getNotifyOnSuccess()
1446  {
1447    return new ArrayList<>(notifyOnSuccess);
1448  }
1449
1450
1451
1452  /**
1453   * Specifies the addresses to email if the task completes successfully.
1454   *
1455   * @param  notifyOnSuccess  The addresses to email if the task completes
1456   *                          successfully.  It amy be {@code null} or empty if
1457   *                          no email notification should be sent on
1458   *                          successful completion.
1459   */
1460  public void setNotifyOnSuccess(@Nullable final List<String> notifyOnSuccess)
1461  {
1462    this.notifyOnSuccess.clear();
1463    if (notifyOnSuccess != null)
1464    {
1465      this.notifyOnSuccess.addAll(notifyOnSuccess);
1466    }
1467  }
1468
1469
1470
1471  /**
1472   * Retrieves the addresses to email if the task does not complete
1473   * successfully.
1474   *
1475   * @return  The addresses to email if the task does not complete successfully,
1476   *          or an empty list if no email notification should be sent on an
1477   *          unsuccessful completion.
1478   */
1479  @NotNull()
1480  public List<String> getNotifyOnError()
1481  {
1482    return new ArrayList<>(notifyOnError);
1483  }
1484
1485
1486
1487  /**
1488   * Specifies the addresses to email if the task does not complete
1489   * successfully.
1490   *
1491   * @param  notifyOnError  The addresses to email if the task does not complete
1492   *                        successfully.  It amy be {@code null} or empty if
1493   *                        no email notification should be sent on an
1494   *                        unsuccessful completion.
1495   */
1496  public void setNotifyOnError(@Nullable final List<String> notifyOnError)
1497  {
1498    this.notifyOnError.clear();
1499    if (notifyOnError != null)
1500    {
1501      this.notifyOnError.addAll(notifyOnError);
1502    }
1503  }
1504
1505
1506
1507  /**
1508   * Retrieves the flag that indicates whether the server should send an
1509   * administrative alert notification when the task starts running.
1510   *
1511   * @return  The flag that indicates whether the server should send an
1512   *          administrative alert notification when the task starts running,
1513   *          or {@code null} if the property should not be specified when the
1514   *          task is created (and the server will default to not sending any
1515   *          alert).
1516   */
1517  @Nullable()
1518  public Boolean getAlertOnStart()
1519  {
1520    return alertOnStart;
1521  }
1522
1523
1524
1525  /**
1526   * Specifies the flag that indicates whether the server should send an
1527   * administrative alert notification when the task starts running.
1528   *
1529   * @param  alertOnStart  The flag that indicates whether the server should
1530   *                       send an administrative alert notification when the
1531   *                       task starts running,  It may be {@code null} if the
1532   *                       property should not be specified when the task is
1533   *                       created (and the server will default to not sending
1534   *                       any alert).
1535   */
1536  public void setAlertOnStart(@Nullable final Boolean alertOnStart)
1537  {
1538    this.alertOnStart = alertOnStart;
1539  }
1540
1541
1542
1543  /**
1544   * Retrieves the flag that indicates whether the server should send an
1545   * administrative alert notification if the task completes successfully.
1546   *
1547   * @return  The flag that indicates whether the server should send an
1548   *          administrative alert notification if the task completes
1549   *          successfully, or {@code null} if the property should not be
1550   *          specified when the task is created (and the server will default to
1551   *          not sending any alert).
1552   */
1553  @Nullable()
1554  public Boolean getAlertOnSuccess()
1555  {
1556    return alertOnSuccess;
1557  }
1558
1559
1560
1561  /**
1562   * Specifies the flag that indicates whether the server should send an
1563   * administrative alert notification if the task completes successfully.
1564   *
1565   * @param  alertOnSuccess  The flag that indicates whether the server should
1566   *                         send an administrative alert notification if the
1567   *                         task completes successfully,  It may be
1568   *                         {@code null} if the property should not be
1569   *                         specified when the task is created (and the server
1570   *                         will default to not sending any alert).
1571   */
1572  public void setAlertOnSuccess(@Nullable final Boolean alertOnSuccess)
1573  {
1574    this.alertOnSuccess = alertOnSuccess;
1575  }
1576
1577
1578
1579  /**
1580   * Retrieves the flag that indicates whether the server should send an
1581   * administrative alert notification if the task does not complete
1582   * successfully.
1583   *
1584   * @return  The flag that indicates whether the server should send an
1585   *          administrative alert notification if the task does not complete
1586   *          successfully, or {@code null} if the property should not be
1587   *          specified when the task is created (and the server will default to
1588   *          not sending any alert).
1589   */
1590  @Nullable()
1591  public Boolean getAlertOnError()
1592  {
1593    return alertOnError;
1594  }
1595
1596
1597
1598  /**
1599   * Specifies the flag that indicates whether the server should send an
1600   * administrative alert notification if the task does not complete
1601   * successfully.
1602   *
1603   * @param  alertOnError  The flag that indicates whether the server should
1604   *                       send an administrative alert notification if the task
1605   *                       does not complete successfully,  It may be
1606   *                       {@code null} if the property should not be specified
1607   *                       when the task is created (and the server will default
1608   *                       to not sending any alert).
1609   */
1610  public void setAlertOnError(@Nullable final Boolean alertOnError)
1611  {
1612    this.alertOnError = alertOnError;
1613  }
1614
1615
1616
1617  /**
1618   * Retrieves a string representation of this collect support data task
1619   * properties object.
1620   *
1621   * @return  A string representation of this collect support data task
1622   *          properties object.
1623   */
1624  @Override()
1625  @NotNull()
1626  public String toString()
1627  {
1628    final StringBuilder buffer = new StringBuilder();
1629    toString(buffer);
1630    return buffer.toString();
1631  }
1632
1633
1634
1635  /**
1636   * Appends a string representation of this collect support data task
1637   * properties object to the provided buffer.
1638   *
1639   * @param  buffer  The buffer to which the string representation will be
1640   *                 appended.  It must not be {@code null}.
1641   */
1642  public void toString(@NotNull final StringBuilder buffer)
1643  {
1644    buffer.append("CollectSupportDataArchiveProperties(");
1645
1646    appendNameValuePair(buffer, "taskID", taskID);
1647    appendNameValuePair(buffer, "outputPath", outputPath);
1648    appendNameValuePair(buffer, "encryptionPassphraseFile",
1649         encryptionPassphraseFile);
1650    appendNameValuePair(buffer, "includeExpensiveData", includeExpensiveData);
1651    appendNameValuePair(buffer, "includeReplicationStateDump",
1652         includeReplicationStateDump);
1653    appendNameValuePair(buffer, "includeBinaryFiles", includeBinaryFiles);
1654    appendNameValuePair(buffer, "includeExtensionSource",
1655         includeExtensionSource);
1656    appendNameValuePair(buffer, "securityLevel", securityLevel);
1657    appendNameValuePair(buffer, "useSequentialMode", useSequentialMode);
1658    appendNameValuePair(buffer, "reportCount", reportCount);
1659    appendNameValuePair(buffer, "reportIntervalSeconds", reportIntervalSeconds);
1660    appendNameValuePair(buffer, "jstackCount", jstackCount);
1661    appendNameValuePair(buffer, "logStartTime", logStartTime);
1662    appendNameValuePair(buffer, "logEndTime", logEndTime);
1663    appendNameValuePair(buffer, "logDuration", logDuration);
1664    appendNameValuePair(buffer, "logFileHeadCollectionSizeKB",
1665         logFileHeadCollectionSizeKB);
1666    appendNameValuePair(buffer, "logFileTailCollectionSizeKB",
1667         logFileTailCollectionSizeKB);
1668    appendNameValuePair(buffer, "comment", comment);
1669    appendNameValuePair(buffer, "retainPreviousSupportDataArchiveCount",
1670         retainPreviousSupportDataArchiveCount);
1671    appendNameValuePair(buffer, "retainPreviousSupportDataArchiveAge",
1672         retainPreviousSupportDataArchiveAge);
1673    appendNameValuePair(buffer, "scheduledStartTime", scheduledStartTime);
1674    appendNameValuePair(buffer, "dependencyIDs", dependencyIDs);
1675    appendNameValuePair(buffer, "failedDependencyAction",
1676         failedDependencyAction);
1677    appendNameValuePair(buffer, "notifyOnStart", notifyOnStart);
1678    appendNameValuePair(buffer, "notifyOnCompletion", notifyOnCompletion);
1679    appendNameValuePair(buffer, "notifyOnSuccess", notifyOnSuccess);
1680    appendNameValuePair(buffer, "notifyOnError", notifyOnError);
1681    appendNameValuePair(buffer, "alertOnStart", alertOnStart);
1682    appendNameValuePair(buffer, "alertOnSuccess", alertOnSuccess);
1683    appendNameValuePair(buffer, "alertOnError", alertOnError);
1684
1685    buffer.append(')');
1686  }
1687
1688
1689
1690  /**
1691   * Appends a name-value pair to the provided buffer, if the value is
1692   * non-{@code null}.
1693   *
1694   * @param  buffer  The buffer to which the name-value pair should be appended.
1695   * @param  name    The name to be used.  It must not be {@code null}.
1696   * @param  value   The value to be used.  It may be {@code null} if there is
1697   *                 no value for the property.
1698   */
1699  private static void appendNameValuePair(@NotNull final StringBuilder buffer,
1700                                          @NotNull final String name,
1701                                          @Nullable final Object value)
1702  {
1703    if (value == null)
1704    {
1705      return;
1706    }
1707
1708    if ((buffer.length() > 0) &&
1709         (buffer.charAt(buffer.length() - 1) != '('))
1710    {
1711      buffer.append(", ");
1712    }
1713
1714    buffer.append(name);
1715    buffer.append("='");
1716    buffer.append(value);
1717    buffer.append('\'');
1718  }
1719
1720
1721
1722  /**
1723   * Appends a name-value pair to the provided buffer, if the value is
1724   * non-{@code null}.
1725   *
1726   * @param  buffer   The buffer to which the name-value pair should be
1727   *                  appended.
1728   * @param  name     The name to be used.  It must not be {@code null}.
1729   * @param  values   The list of values to be used.  It may be {@code null} or
1730   *                  empty if there are no values for the property.
1731   */
1732  private static void appendNameValuePair(@NotNull final StringBuilder buffer,
1733                                          @NotNull final String name,
1734                                          @Nullable final List<String> values)
1735  {
1736    if ((values == null) || values.isEmpty())
1737    {
1738      return;
1739    }
1740
1741    if ((buffer.length() > 0) &&
1742         (buffer.charAt(buffer.length() - 1) != '('))
1743    {
1744      buffer.append(", ");
1745    }
1746
1747    buffer.append(name);
1748    buffer.append("={ ");
1749
1750    final Iterator<String> iterator = values.iterator();
1751    while (iterator.hasNext())
1752    {
1753      buffer.append('\'');
1754      buffer.append(iterator.next());
1755      buffer.append('\'');
1756
1757      if (iterator.hasNext())
1758      {
1759        buffer.append(", ");
1760      }
1761    }
1762
1763    buffer.append('}');
1764  }
1765}