001/*
002 * Copyright 2020-2026 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2020-2026 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-2026 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.extensions;
037
038
039
040import java.io.Serializable;
041
042import com.unboundid.asn1.ASN1OctetString;
043import com.unboundid.ldap.sdk.unboundidds.tasks.CollectSupportDataSecurityLevel;
044import com.unboundid.util.Mutable;
045import com.unboundid.util.NotNull;
046import com.unboundid.util.Nullable;
047import com.unboundid.util.ThreadSafety;
048import com.unboundid.util.ThreadSafetyLevel;
049import com.unboundid.util.Validator;
050
051
052
053/**
054 * This class defines a set of properties that may be used when creating a
055 * {@link CollectSupportDataExtendedRequest}.
056 * <BR>
057 * <BLOCKQUOTE>
058 *   <B>NOTE:</B>  This class, and other classes within the
059 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
060 *   supported for use against Ping Identity, UnboundID, and
061 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
062 *   for proprietary functionality or for external specifications that are not
063 *   considered stable or mature enough to be guaranteed to work in an
064 *   interoperable way with other types of LDAP servers.
065 * </BLOCKQUOTE>
066 */
067@Mutable()
068@ThreadSafety(level=ThreadSafetyLevel.NOT_THREADSAFE)
069public final class CollectSupportDataExtendedRequestProperties
070       implements Serializable
071{
072  /**
073   * The serial version UID for this serializable class.
074   */
075  private static final long serialVersionUID = 5585016444537427389L;
076
077
078
079  // The passphrase to use to encrypt the contents of the support data archive.
080  @Nullable private ASN1OctetString encryptionPassphrase;
081
082  // Indicates whether to include binary files in the support data archive.
083  @Nullable private Boolean includeBinaryFiles;
084
085  // Indicates whether to include expensive data in the support data archive.
086  @Nullable private Boolean includeExpensiveData;
087
088  // Indicates whether to include third-party extension source code in the
089  // support data archive.
090  @Nullable private Boolean includeExtensionSource;
091
092  // Indicates whether to include a replication state dump in the support data
093  // archive.
094  @Nullable private Boolean includeReplicationStateDump;
095
096  // Indicates whether to skip the collection of Java Flight Recorder data.
097  @Nullable private Boolean noJFR;
098
099  // Indicates whether to capture information sequentially rather than in
100  // parallel.
101  @Nullable private Boolean useSequentialMode;
102
103  // The log capture window that indicates how much log content to include in
104  // the support data archive.
105  @Nullable private CollectSupportDataLogCaptureWindow logCaptureWindow;
106
107  // The security level to use for data included in the support data archive.
108  @Nullable private CollectSupportDataSecurityLevel securityLevel;
109
110  // The number of jstacks to include in the support data archive.
111  @Nullable private Integer jstackCount;
112
113  // The maximum size, in bytes, of any support data archive fragment to include
114  // in a collect support data archive fragment intermediate response.
115  @Nullable private Integer maximumFragmentSizeBytes;
116
117  // The port of a backend Directory Server instance to which the collect
118  // support data extended request should be forwarded.
119  @Nullable private Integer proxyToServerPort;
120
121  // The report count to use for sampled metrics.
122  @Nullable private Integer reportCount;
123
124  // The report interval in seconds to use for sampled metrics.
125  @Nullable private Integer reportIntervalSeconds;
126
127  // The name (without any path information) the client intends to use for the
128  // support data archive file.
129  @Nullable private String archiveFileName;
130
131  // A comment to include in the support data archive.
132  @Nullable private String comment;
133
134  // The address of a backend Directory Server to which the collect support data
135  // extended request should be forwarded.
136  @Nullable private String proxyToServerAddress;
137
138
139
140  /**
141   * Creates a new set of collect support data extended request properties
142   * with none of the properties set, indicating that the server should use the
143   * default values for all of them.
144   */
145  public CollectSupportDataExtendedRequestProperties()
146  {
147    encryptionPassphrase = null;
148    includeBinaryFiles = null;
149    includeExpensiveData = null;
150    includeExtensionSource = null;
151    includeReplicationStateDump = null;
152    noJFR = null;
153    useSequentialMode = null;
154    logCaptureWindow = null;
155    securityLevel = null;
156    jstackCount = null;
157    maximumFragmentSizeBytes = null;
158    proxyToServerPort = null;
159    reportCount = null;
160    reportIntervalSeconds = null;
161    archiveFileName = null;
162    comment = null;
163    proxyToServerAddress = null;
164  }
165
166
167
168  /**
169   * Creates a new set of collect support data extended request properties
170   * that is a copy of the provided properties.
171   *
172   * @param  properties  The set of properties to duplicate.
173   */
174  public CollectSupportDataExtendedRequestProperties(
175       @NotNull final CollectSupportDataExtendedRequestProperties properties)
176  {
177    encryptionPassphrase = properties.getEncryptionPassphrase();
178    includeBinaryFiles = properties.getIncludeBinaryFiles();
179    includeExpensiveData = properties.getIncludeExpensiveData();
180    includeExtensionSource = properties.getIncludeExtensionSource();
181    includeReplicationStateDump = properties.getIncludeReplicationStateDump();
182    noJFR = properties.getNoJFR();
183    useSequentialMode = properties.getUseSequentialMode();
184    logCaptureWindow = properties.getLogCaptureWindow();
185    securityLevel = properties.getSecurityLevel();
186    jstackCount = properties.getJStackCount();
187    maximumFragmentSizeBytes = properties.getMaximumFragmentSizeBytes();
188    proxyToServerPort = properties.getProxyToServerPort();
189    reportCount = properties.getReportCount();
190    reportIntervalSeconds = properties.getReportIntervalSeconds();
191    archiveFileName = properties.getArchiveFileName();
192    comment = properties.getComment();
193    proxyToServerAddress = properties.getProxyToServerAddress();
194  }
195
196
197
198  /**
199   * Creates a new set of collect support data extended request properties
200   * using the settings from the provided extended request.
201   *
202   * @param  request  The collect support data extended request from which to
203   *                  set the property values.
204   */
205  public CollectSupportDataExtendedRequestProperties(
206       @NotNull final CollectSupportDataExtendedRequest request)
207  {
208    encryptionPassphrase = request.getEncryptionPassphrase();
209    includeBinaryFiles = request.getIncludeBinaryFiles();
210    includeExpensiveData = request.getIncludeExpensiveData();
211    includeExtensionSource = request.getIncludeExtensionSource();
212    includeReplicationStateDump = request.getIncludeReplicationStateDump();
213    noJFR = request.getNoJFR();
214    useSequentialMode = request.getUseSequentialMode();
215    logCaptureWindow = request.getLogCaptureWindow();
216    securityLevel = request.getSecurityLevel();
217    jstackCount = request.getJStackCount();
218    maximumFragmentSizeBytes = request.getMaximumFragmentSizeBytes();
219    proxyToServerPort = request.getProxyToServerPort();
220    reportCount = request.getReportCount();
221    reportIntervalSeconds = request.getReportIntervalSeconds();
222    archiveFileName = request.getArchiveFileName();
223    comment = request.getComment();
224    proxyToServerAddress = request.getProxyToServerAddress();
225  }
226
227
228
229  /**
230   * Retrieves the name (without any path information) that the client intends
231   * to use for the support data archive file.
232   *
233   * @return  The name (without any path information) that the client intends to
234   *          use for the support data archive file, or {@code null} if the
235   *          server should generate an archive file name.
236   */
237  @Nullable()
238  public String getArchiveFileName()
239  {
240    return archiveFileName;
241  }
242
243
244
245  /**
246   * Specifies the name (without any path information) that the client intends
247   * to use for the support data archive file.
248   *
249   * @param  archiveFileName  The name (without any path information) that the
250   *                          client intends to use for the support data archive
251   *                          file.  It may be {@code null} if the server
252   *                          should generate an archive file name.
253   */
254  public void setArchiveFileName(@Nullable final String archiveFileName)
255  {
256    this.archiveFileName = archiveFileName;
257  }
258
259
260
261  /**
262   * Retrieves the passphrase that should be used to encrypt the contents of the
263   * support data archive.
264   *
265   * @return  The passphrase that should be used to encrypt the contents of the
266   *          support data archive, or {@code null} if the archive should not
267   *          be encrypted.
268   */
269  @Nullable()
270  public ASN1OctetString getEncryptionPassphrase()
271  {
272    return encryptionPassphrase;
273  }
274
275
276
277  /**
278   * Specifies the passphrase that should be used to encrypt the contents of the
279   * support data archive.
280   *
281   * @param  encryptionPassphrase  The passphrase that should be used to
282   *                               encrypt the contents of the support data
283   *                               archive.  It may be {@code null} if the
284   *                               support data archive should not be encrypted.
285   */
286  public void setEncryptionPassphrase(
287                   @Nullable final String encryptionPassphrase)
288  {
289    if (encryptionPassphrase == null)
290    {
291      this.encryptionPassphrase = null;
292    }
293    else
294    {
295      this.encryptionPassphrase = new ASN1OctetString(
296           CollectSupportDataExtendedRequest.TYPE_ENCRYPTION_PASSPHRASE,
297           encryptionPassphrase);
298    }
299  }
300
301
302
303  /**
304   * Specifies the passphrase that should be used to encrypt the contents of the
305   * support data archive.
306   *
307   * @param  encryptionPassphrase  The passphrase that should be used to
308   *                               encrypt the contents of the support data
309   *                               archive.  It may be {@code null} if the
310   *                               support data archive should not be encrypted.
311   */
312  public void setEncryptionPassphrase(
313                   @Nullable final byte[] encryptionPassphrase)
314  {
315    if (encryptionPassphrase == null)
316    {
317      this.encryptionPassphrase = null;
318    }
319    else
320    {
321      this.encryptionPassphrase = new ASN1OctetString(
322           CollectSupportDataExtendedRequest.TYPE_ENCRYPTION_PASSPHRASE,
323           encryptionPassphrase);
324    }
325  }
326
327
328
329  /**
330   * Specifies the passphrase that should be used to encrypt the contents of the
331   * support data archive.
332   *
333   * @param  encryptionPassphrase  The passphrase that should be used to
334   *                               encrypt the contents of the support data
335   *                               archive.  It may be {@code null} if the
336   *                               support data archive should not be encrypted.
337   */
338  public void setEncryptionPassphrase(
339                   @Nullable final ASN1OctetString encryptionPassphrase)
340  {
341    if (encryptionPassphrase == null)
342    {
343      this.encryptionPassphrase = null;
344    }
345    else
346    {
347      this.encryptionPassphrase = new ASN1OctetString(
348           CollectSupportDataExtendedRequest.TYPE_ENCRYPTION_PASSPHRASE,
349           encryptionPassphrase.getValue());
350    }
351  }
352
353
354
355  /**
356   * Retrieves the value of a flag that indicates whether the support data
357   * archive may include data that is potentially expensive to collect and
358   * could affect the performance or responsiveness of the server.
359   *
360   * @return  The value of a flag that indicates whether the support data
361   *          archive may include data that is potentially expensive to collect,
362   *          or {@code null} if the property should not be specified when the
363   *          request is created (in which case the server will use a default
364   *          behavior of excluding expensive data).
365   */
366  @Nullable()
367  public Boolean getIncludeExpensiveData()
368  {
369    return includeExpensiveData;
370  }
371
372
373
374  /**
375   * Specifies the value of a flag that indicates whether the support data
376   * archive may include data that is potentially expensive to collect and could
377   * affect the performance or responsiveness of the server.
378   *
379   * @param  includeExpensiveData  The value of a flag that indicates whether
380   *                               the support data archive may include data
381   *                               that is potentially expensive to collect.  It
382   *                               may be {@code null} if the flag should not be
383   *                               specified when the request is created (in
384   *                               which case the server will use a default
385   *                               behavior of excluding expensive data).
386   */
387  public void setIncludeExpensiveData(
388                   @Nullable final Boolean includeExpensiveData)
389  {
390    this.includeExpensiveData = includeExpensiveData;
391  }
392
393
394
395  /**
396   * Retrieves the value of a flag that indicates whether the support data
397   * archive may include a replication state dump, which may be several
398   * megabytes in size.
399   *
400   * @return  The value of a flag that indicates whether the support data
401   *          archive may include a replication state dump, or {@code null} if
402   *          the property should not be specified when the request is created
403   *          (in which case the server will use a default behavior of
404   *          excluding the state dump).
405   */
406  @Nullable()
407  public Boolean getIncludeReplicationStateDump()
408  {
409    return includeReplicationStateDump;
410  }
411
412
413
414  /**
415   * Specifies the value of a flag that indicates whether the support data
416   * archive may include a replication state dump, which may be several
417   * megabytes in size.
418   *
419   * @param  includeReplicationStateDump  The value of a flag that indicates
420   *                                      whether the support data archive may
421   *                                      include a replication state dump.  It
422   *                                      may be {@code null} if the flag should
423   *                                      not be specified when the request is
424   *                                      created (in which case the server will
425   *                                      use a default behavior of excluding
426   *                                      the state dump).
427   */
428  public void setIncludeReplicationStateDump(
429                   @Nullable final Boolean includeReplicationStateDump)
430  {
431    this.includeReplicationStateDump = includeReplicationStateDump;
432  }
433
434
435
436  /**
437   * Retrieves the value of a flag that indicates whether the support data
438   * archive may include binary files.
439   *
440   * @return  The value of a flag that indicates whether the support data
441   *          archive may include binary files, or {@code null} if the property
442   *          should not be specified when the request is created (in which case
443   *          the server will use a default behavior of excluding binary files).
444   */
445  @Nullable()
446  public Boolean getIncludeBinaryFiles()
447  {
448    return includeBinaryFiles;
449  }
450
451
452
453  /**
454   * Specifies the value of a flag that that indicates whether the support data
455   * archive may include binary files.
456   *
457   * @param  includeBinaryFiles  The value of a flag that indicates whether the
458   *                             support data archive may include binary files.
459   *                             It may be {@code null} if the property should
460   *                             not be specified when the request is created
461   *                             (in which case the server will use a default
462   *                             behavior of excluding binary files).
463   */
464  public void setIncludeBinaryFiles(@Nullable final Boolean includeBinaryFiles)
465  {
466    this.includeBinaryFiles = includeBinaryFiles;
467  }
468
469
470
471  /**
472   * Retrieves the value of a flag that indicates whether the support data
473   * archive should include source code (if available) for any third-party
474   * extensions installed in the server.
475   *
476   * @return  The value of a flag that indicates whether the support data
477   *          archive should include source code (if available) for any
478   *          third-party extensions installed in the server, or {@code null} if
479   *          the property should not be specified when the request is created
480   *          (in which case the server will use a default behavior of excluding
481   *          extension source code).
482   */
483  @Nullable()
484  public Boolean getIncludeExtensionSource()
485  {
486    return includeExtensionSource;
487  }
488
489
490
491  /**
492   * Specifies the value of a flag that indicates whether the support data
493   * archive should include source code (if available) for any third-party
494   * extensions installed in the server.
495   *
496   * @param  includeExtensionSource  The value of a flag that indicates whether
497   *                                 the support data archive should include
498   *                                 source code (if available) for any
499   *                                 third-party extensions in the server.  It
500   *                                 may be {@code null} if the property should
501   *                                 not be specified when the requets is
502   *                                 created (in which case the server will use
503   *                                 a default behavior of excluding extension
504   *                                 source code).
505   */
506  public void setIncludeExtensionSource(
507                   @Nullable final Boolean includeExtensionSource)
508  {
509    this.includeExtensionSource = includeExtensionSource;
510  }
511
512
513
514  /**
515   * Retrieves the value of a flag that indicates whether the server should
516   * collect items for the support data archive in sequential mode rather than
517   * in parallel.  Collecting data in sequential mode may reduce the amount of
518   * memory consumed during the collection process, but it will take longer to
519   * complete.
520   *
521   * @return  The value of a flag that indicates whether the server should
522   *          collect items for the support data archive in sequential mode
523   *          rather than in parallel, or {@code null} if the property should
524   *          not be specified when the request is created (in which case the
525   *          server will default to capturing data in parallel).
526   */
527  @Nullable()
528  public Boolean getUseSequentialMode()
529  {
530    return useSequentialMode;
531  }
532
533
534
535  /**
536   * Specifies the value of a flag that indicates whether the server should
537   * collect items for the support data archive in sequential mode rather than
538   * in parallel.  Collecting data in sequential mode may reduce the amount of
539   * memory consumed during the collection process, but it will take longer to
540   * complete.
541   *
542   * @param  useSequentialMode  The value of a flag that indicates whether the
543   *                            server should collect items for the support data
544   *                            archive in sequential mode rather than in
545   *                            parallel.  It may be {@code null} if the
546   *                            property should not be specified when the
547   *                            request is created (in which case the server
548   *                            will default to capturing data in parallel).
549   */
550  public void setUseSequentialMode(@Nullable final Boolean useSequentialMode)
551  {
552    this.useSequentialMode = useSequentialMode;
553  }
554
555
556
557  /**
558   * Retrieves the value of a flag that indicates whether the server should skip
559   * the collection of Java Flight Recorder (JFR) data.
560   *
561   * @return  The value of a flag that indicates whether the server should skip
562   *          the collection of Java Flight Recorder data, or {@code null} if
563   *          the property should not be specified when the request is created
564   *          (in which case the server will use a default behavior of
565   *          collecting JFR data if a recording is available).
566   */
567  @Nullable()
568  public Boolean getNoJFR()
569  {
570    return noJFR;
571  }
572
573
574
575  /**
576   * Specifies the value of a flag that indicates whether the server should skip
577   * the collection of Java Flight Recorder (JFR) data.  This may be useful to
578   * avoid the additional time and space needed to include a JFR recording
579   * sample in the support data archive, especially because the archive is
580   * streamed back to the client.
581   *
582   * @param  noJFR  The value of a flag that indicates whether the server should
583   *                skip the collection of Java Flight Recorder data.  It may be
584   *                {@code null} if the property should not be specified when
585   *                the request is created (in which case the server will use a
586   *                default behavior of collecting JFR data if a recording is
587   *                available).
588   */
589  public void setNoJFR(@Nullable final Boolean noJFR)
590  {
591    this.noJFR = noJFR;
592  }
593
594
595
596  /**
597   * Retrieves the security level that should be used to indicate which data
598   * should be obscured, redacted, or omitted from the support data archive.
599   *
600   * @return  The security level that should be used when creating the support
601   *          data archive, or {@code null} if the property should not be
602   *          specified when the request is created (in which case the server
603   *          will use a default security level).
604   */
605  @Nullable()
606  public CollectSupportDataSecurityLevel getSecurityLevel()
607  {
608    return securityLevel;
609  }
610
611
612
613  /**
614   * Specifies the security level that should be used to indicate which data
615   * should be obscured, redacted, or omitted from the support data archive.
616   *
617   * @param  securityLevel  The security level that should be used when creating
618   *                        the support data archive.  It may be {@code null} if
619   *                        the property should not be specified when the
620   *                        request is created (in which case the server will
621   *                        use a default security level).
622   */
623  public void setSecurityLevel(
624       @Nullable final CollectSupportDataSecurityLevel securityLevel)
625  {
626    this.securityLevel = securityLevel;
627  }
628
629
630
631  /**
632   * Retrieves the number of times that the jstack utility should be invoked to
633   * obtain stack traces from all threads in the server.
634   *
635   * @return  The number of times that the jstack utility should be invoked to
636   *          obtain stack traces from all threads in the server, or
637   *          {@code null} if the property should not be specified when the
638   *          request is created (in which case the server will use a default
639   *          count).
640   */
641  @Nullable()
642  public Integer getJStackCount()
643  {
644    return jstackCount;
645  }
646
647
648
649  /**
650   * Specifies the number of times that the jstack utility should be invoked to
651   * obtain stack traces from all threads in the server.
652   *
653   * @param  jstackCount  The number of times that the jstack utility should be
654   *                      invoked to obtain stack traces from all threads in the
655   *                      server.  The value must not be negative, but it may be
656   *                      zero to indicate that the jstack utility should not be
657   *                      invoked.  It may be {@code null} if the property
658   *                      should not be specified when the request is created
659   *                      (in which case the server will use a default count).
660   */
661  public void setJStackCount(@Nullable final Integer jstackCount)
662  {
663    if (jstackCount != null)
664    {
665      Validator.ensureTrue((jstackCount >= 0),
666           "If CollectSupportDataExtendedRequestProperties.jstackCount is " +
667                "non-null, then the value must be greater than or equal to " +
668                "zero.");
669    }
670
671    this.jstackCount = jstackCount;
672  }
673
674
675
676  /**
677   * Retrieves the number of intervals that should be captured from tools that
678   * use interval-based sampling (e.g., vmstat, iostat, mpstat, etc.).
679   *
680   * @return  The number of intervals that should be captured from tools that
681   *          use interval-based sampling, or {@code null} if the property
682   *          should not be specified when the request is created (in which case
683   *          the server will use a default report count).
684   */
685  @Nullable()
686  public Integer getReportCount()
687  {
688    return reportCount;
689  }
690
691
692
693  /**
694   * Specifies the number of intervals that should be captured form tools that
695   * use interval-based sampling (e.g., vmstat, iostat, mpstat, etc.).
696   *
697   * @param  reportCount  The number of intervals that should be captured from
698   *                      tools that use interval-based sampling.  The value
699   *                      must not be negative, but it may be zero to indicate
700   *                      that no intervals should be captured.  It may be
701   *                      {@code null} if the property should not be specified
702   *                      when the request is created (in which case the server
703   *                      will use a default report count).
704   */
705  public void setReportCount(@Nullable final Integer reportCount)
706  {
707    if (reportCount != null)
708    {
709      Validator.ensureTrue((reportCount >= 0),
710           "If CollectSupportDataExtendedRequestProperties.reportCount is " +
711                "non-null, then the value must be greater than or equal to " +
712                "zero.");
713    }
714
715    this.reportCount = reportCount;
716  }
717
718
719
720  /**
721   * Retrieves the interval duration in seconds that should be used for tools
722   * that use interval-based sampling (e.g., vmstat, iostat, mpstat, etc.).
723   *
724   * @return  The interval duration in seconds that should be used for tools
725   *          that use interval-based sampling, or {@code null} if the property
726   *          should not be specified when the request is created (in which case
727   *          the server will use a default report interval).
728   */
729  @Nullable()
730  public Integer getReportIntervalSeconds()
731  {
732    return reportIntervalSeconds;
733  }
734
735
736
737  /**
738   * Specifies the interval duration in seconds that should be used for tools
739   * that use interval-based sampling (e.g., vmstat, iostat, mpstat, etc.).
740   *
741   * @param  reportIntervalSeconds  The interval duration in seconds that should
742   *                                be used for tools that use interval-based
743   *                                sampling.  The value must be greater than or
744   *                                equal to one.  It may be {@code null} if the
745   *                                property should not be specified when the
746   *                                request is created (in which case the server
747   *                                will use a default report count).
748   */
749  public void setReportIntervalSeconds(
750                   @Nullable final Integer reportIntervalSeconds)
751  {
752    if (reportIntervalSeconds != null)
753    {
754      Validator.ensureTrue((reportIntervalSeconds > 0),
755           "If CollectSupportDataExtendedRequestProperties." +
756                "reportIntervalSeconds is non-null, then the value must be " +
757                "greater than zero.");
758    }
759
760    this.reportIntervalSeconds = reportIntervalSeconds;
761  }
762
763
764
765  /**
766   * Retrieves the log capture window object that indicates how much log content
767   * should be included in the support data archive.
768   *
769   * @return  The log capture window object that indicates how much log content
770   *          should be included in the support data archive, or {@code null}
771   *          if this should not be specified in the request and the server
772   *          should choose an appropriate amount of log content.
773   */
774  @Nullable()
775  public CollectSupportDataLogCaptureWindow getLogCaptureWindow()
776  {
777    return logCaptureWindow;
778  }
779
780
781
782  /**
783   * Specifies the log capture window object that indicates how much log content
784   * should be included in the support data archive.
785   *
786   * @param  logCaptureWindow  The log capture window object that indicates how
787   *                           much log content should be included in the
788   *                           support data archive.  It may be {@code null} to
789   *                           indicate that the server should choose an
790   *                           appropriate amount of log content.
791   */
792  public void setLogCaptureWindow(
793       @Nullable final CollectSupportDataLogCaptureWindow logCaptureWindow)
794  {
795    this.logCaptureWindow = logCaptureWindow;
796  }
797
798
799
800  /**
801   * Retrieves an additional comment that should be included in the support data
802   * archive.
803   *
804   * @return  An additional comment that should be included in the support data
805   *          archive, or {@code null} if no comment should be included.
806   */
807  @Nullable()
808  public String getComment()
809  {
810    return comment;
811  }
812
813
814
815  /**
816   * Specifies an additional comment that should be included in the support data
817   * archive.
818   *
819   * @param  comment  An additional comment that should be included in the
820   *                  support data archive.  It may be {@code null} if no
821   *                  additional comment should be included.
822   */
823  public void setComment(@Nullable final String comment)
824  {
825    this.comment = comment;
826  }
827
828
829
830  /**
831   * Retrieves the address of the backend Directory Server to which the collect
832   * support data extended request should be forwarded.
833   *
834   * @return  The address of the backend Directory Server to which the collect
835   *          support data extended request should be forwarded, or {@code null}
836   *          if the request should be processed directly by the server that
837   *          receives it.
838   */
839  @Nullable()
840  public String getProxyToServerAddress()
841  {
842    return proxyToServerAddress;
843  }
844
845
846
847  /**
848   * Retrieves the port of the backend Directory Server to which the collect
849   * support data extended request should be forwarded.
850   *
851   * @return  The port of the backend Directory Server to which the collect
852   *          support data extended request should be forwarded, or {@code null}
853   *          if the request should be processed directly by the server that
854   *          receives it.
855   */
856  @Nullable()
857  public Integer getProxyToServerPort()
858  {
859    return proxyToServerPort;
860  }
861
862
863
864  /**
865   * Specifies the address and port of the backend Directory Server to which the
866   * collect support data extended request should be forwarded.  Either both
867   * arguments must be {@code null} or both must be non-{@code null}.
868   *
869   * @param  address  The address of the backend Directory Server to which the
870   *                  request should be forwarded.  It may be {@code null} if
871   *                  the request should be processed directly by the server
872   *                  that receives it, in which case the {@code port} value
873   *                  must also be {@code null}.  If it is non-{@code null},
874   *                  then it must also be non-empty.
875   * @param  port     The port of the backend Directory Server to which the
876   *                  request should be forwarded.  It may be {@code nuoll} if
877   *                  the request should be processed directly by the server
878   *                  that receives it, in which case the {@code address} value
879   *                  must also be non-{@code null}.  If it is non-{@code null},
880   *                  then the value must be between 1 and 65535, inclusive.
881   */
882  public void setProxyToServer(@Nullable final String address,
883                               @Nullable final Integer port)
884  {
885    if (address == null)
886    {
887      Validator.ensureTrue((port == null),
888           "If CollectSupportDataExtendedRequestProperties.proxyToServer." +
889                "address is null, then " +
890                "CollectSupportDataExtendedRequestProperties.proxyToServer." +
891                "port must also be null.");
892    }
893    else
894    {
895      Validator.ensureFalse(address.isEmpty(),
896           "If CollectSupportDataExtendedRequestProperties.proxyToServer." +
897                "address is non-null, then it must also be non-empty.");
898      Validator.ensureNotNullWithMessage(port,
899           "If CollectSupportDataExtendedRequestProperties.proxyToServer." +
900                "address is non-null, then " +
901                "CollectSupportDataExtendedRequestProperties.proxyToServer." +
902                "port must also be non-null.");
903      Validator.ensureTrue(((port >= 1) && (port <= 65535)),
904           "If CollectSupportDataExtendedRequestProperties.proxyToServer." +
905                "port is non-null, then its value must be between 1 and " +
906                "65535, inclusive.");
907    }
908
909    proxyToServerAddress = address;
910    proxyToServerPort = port;
911  }
912
913
914
915  /**
916   * Retrieves the maximum size, in bytes, that may be used for a support data
917   * archive fragment returned in any single
918   * {@link CollectSupportDataArchiveFragmentIntermediateResponse} message.
919   *
920   * @return  The maximum size, in bytes, that may be used for a support data
921   *          archive fragment in any single archive fragment intermediate
922   *          response message, or {@code null} if the server should use a
923   *          default maximum fragment size.
924   */
925  @Nullable()
926  public Integer getMaximumFragmentSizeBytes()
927  {
928    return maximumFragmentSizeBytes;
929  }
930
931
932
933  /**
934   * Specifies the maximum size, in bytes, that may be used for a support data
935   * archive fragment returned in any single
936   * {@link CollectSupportDataArchiveFragmentIntermediateResponse} message.
937   *
938   * @param  maximumFragmentSizeBytes  The maximum size, in bytes, that may be
939   *                                   used for a support data archive fragment
940   *                                   returned in any single archive fragment
941   *                                   intermediate response message.  It may be
942   *                                   {@code null} if the server should use a
943   *                                   default maximum fragment size.  If it is
944   *                                   non-{@code null}, then the value must
945   *                                   also be greater than zero.
946   */
947  public void setMaximumFragmentSizeBytes(
948                   @Nullable final Integer maximumFragmentSizeBytes)
949  {
950    if (maximumFragmentSizeBytes != null)
951    {
952      Validator.ensureTrue((maximumFragmentSizeBytes > 0),
953           "If CollectSupportDataExtendedRequestProperties." +
954                "maximumFragmentSizeBytes is non-null, then its value must " +
955                "be greater than zero.");
956    }
957
958    this.maximumFragmentSizeBytes = maximumFragmentSizeBytes;
959  }
960
961
962
963  /**
964   * Retrieves a string representation of this collect support data request
965   * properties object.
966   *
967   * @return  A string representation of this collect support data request
968   *          properties object.
969   */
970  @Override()
971  @NotNull()
972  public String toString()
973  {
974    final StringBuilder buffer = new StringBuilder();
975    toString(buffer);
976    return buffer.toString();
977  }
978
979
980
981  /**
982   * Appends a string representation of this collect support data request
983   * properties object to the provided buffer.
984   *
985   * @param  buffer  The buffer to which the string representation will be
986   *                 appended.  It must not be {@code null}.
987   */
988  public void toString(@NotNull final StringBuilder buffer)
989  {
990    buffer.append("CollectSupportDataArchiveProperties(");
991    appendNameValuePair(buffer, "archiveFileName", archiveFileName);
992
993    if (encryptionPassphrase != null)
994    {
995      appendNameValuePair(buffer, "encryptionPassphrase", "*****REDACTED*****");
996    }
997
998    appendNameValuePair(buffer, "includeExpensiveData", includeExpensiveData);
999    appendNameValuePair(buffer, "includeReplicationStateDump",
1000         includeReplicationStateDump);
1001    appendNameValuePair(buffer, "includeBinaryFiles", includeBinaryFiles);
1002    appendNameValuePair(buffer, "includeExtensionSource",
1003         includeExtensionSource);
1004    appendNameValuePair(buffer, "securityLevel", securityLevel);
1005    appendNameValuePair(buffer, "useSequentialMode", useSequentialMode);
1006    appendNameValuePair(buffer, "noJFR", noJFR);
1007    appendNameValuePair(buffer, "jstackCount", jstackCount);
1008    appendNameValuePair(buffer, "reportCount", reportCount);
1009    appendNameValuePair(buffer, "reportIntervalSeconds", reportIntervalSeconds);
1010    appendNameValuePair(buffer, "logCaptureWindow", logCaptureWindow);
1011    appendNameValuePair(buffer, "comment", comment);
1012    appendNameValuePair(buffer, "proxyToServerAddress", proxyToServerAddress);
1013    appendNameValuePair(buffer, "proxyToServerPort", proxyToServerPort);
1014    appendNameValuePair(buffer, "maximumFragmentSizeBytes",
1015         maximumFragmentSizeBytes);
1016
1017    buffer.append(')');
1018  }
1019
1020
1021
1022  /**
1023   * Appends a name-value pair to the provided buffer, if the value is
1024   * non-{@code null}.
1025   *
1026   * @param  buffer  The buffer to which the name-value pair should be appended.
1027   * @param  name    The name to be used.  It must not be {@code null}.
1028   * @param  value   The value to be used.  It may be {@code null} if there is
1029   *                 no value for the property.
1030   */
1031  private static void appendNameValuePair(@NotNull final StringBuilder buffer,
1032               @NotNull final String name,
1033               @Nullable final Object value)
1034  {
1035    if (value == null)
1036    {
1037      return;
1038    }
1039
1040    if ((buffer.length() > 0) &&
1041         (buffer.charAt(buffer.length() - 1) != '('))
1042    {
1043      buffer.append(", ");
1044    }
1045
1046    buffer.append(name);
1047    buffer.append('=');
1048
1049    if ((value instanceof Boolean) || (value instanceof Integer) ||
1050         (value instanceof CollectSupportDataLogCaptureWindow))
1051    {
1052      buffer.append(value);
1053    }
1054    else
1055    {
1056      buffer.append('\'');
1057      buffer.append(value);
1058      buffer.append('\'');
1059    }
1060  }
1061}