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