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.extensions;
037
038
039
040import com.unboundid.asn1.ASN1Element;
041import com.unboundid.asn1.ASN1Null;
042import com.unboundid.ldap.sdk.LDAPException;
043import com.unboundid.ldap.sdk.ResultCode;
044import com.unboundid.util.Debug;
045import com.unboundid.util.NotMutable;
046import com.unboundid.util.NotNull;
047import com.unboundid.util.StaticUtils;
048import com.unboundid.util.ThreadSafety;
049import com.unboundid.util.ThreadSafetyLevel;
050
051import static com.unboundid.ldap.sdk.unboundidds.extensions.ExtOpMessages.*;
052
053
054
055/**
056 * This class provides a collect support data log capture window implementation
057 * that indicates that the tool should use its default logic when determining
058 * which log content to include in the support data archive when processing a
059 * {@link CollectSupportDataExtendedRequest}.
060 * <BR>
061 * <BLOCKQUOTE>
062 *   <B>NOTE:</B>  This class, and other classes within the
063 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
064 *   supported for use against Ping Identity, UnboundID, and
065 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
066 *   for proprietary functionality or for external specifications that are not
067 *   considered stable or mature enough to be guaranteed to work in an
068 *   interoperable way with other types of LDAP servers.
069 * </BLOCKQUOTE>
070 *
071 * @see  CollectSupportDataExtendedRequest
072 */
073@NotMutable()
074@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
075public final class ToolDefaultCollectSupportDataLogCaptureWindow
076       extends CollectSupportDataLogCaptureWindow
077{
078  /**
079   * The singleton instance of this tool-default collect support data log
080   * capture window object.
081   */
082  @NotNull private static final ToolDefaultCollectSupportDataLogCaptureWindow
083       INSTANCE = new ToolDefaultCollectSupportDataLogCaptureWindow();
084
085
086
087  /**
088   * The serial version UID for this serializable class.
089   */
090  private static final long serialVersionUID = 7186806291464509659L;
091
092
093
094  // An ASN.1 element that provides an encoded representation of this
095  // tool-default collect support data log capture window.
096  @NotNull private final ASN1Element encodedWindow;
097
098
099
100  /**
101   * Creates a new instance of this tool-default collect support data log
102   * capture window object.
103   */
104  private ToolDefaultCollectSupportDataLogCaptureWindow()
105  {
106    encodedWindow = new ASN1Null(TYPE_TOOL_DEFAULT);
107  }
108
109
110
111  /**
112   * Retrieves the singleton instance of this tool-default collect support data
113   * log capture window object.
114   *
115   * @return  The singleton instance of this tool-default collect support data
116   *          log capture window object.
117   */
118  @NotNull()
119  public static ToolDefaultCollectSupportDataLogCaptureWindow getInstance()
120  {
121    return INSTANCE;
122  }
123
124
125
126  /**
127   * Decodes the provided ASN.1 element as a tool-default collect support data
128   * log capture window object.
129   *
130   * @param  e  The ASN.1 element to be decoded.  It must not be {@code null}.
131   *
132   * @return  The tool-default collect support data log capture window object
133   *          that was decoded.
134   *
135   * @throws  LDAPException  If the provided ASN.1 element cannot be decoded as
136   *                         a valid tool-default collect support data log
137   *                         capture window object.
138   */
139  @NotNull()
140  static ToolDefaultCollectSupportDataLogCaptureWindow decodeInternal(
141              @NotNull final ASN1Element e)
142         throws LDAPException
143  {
144    try
145    {
146      ASN1Null.decodeAsNull(e);
147    }
148    catch (final Exception ex)
149    {
150      Debug.debugException(ex);
151      throw new LDAPException(ResultCode.DECODING_ERROR,
152           ERR_TOOL_DEFAULT_CSD_LOG_WINDOW_CANNOT_DECODE.get(
153                StaticUtils.getExceptionMessage(ex)),
154           ex);
155    }
156
157    return INSTANCE;
158  }
159
160
161
162  /**
163   * {@inheritDoc}
164   */
165  @Override()
166  @NotNull()
167  public ASN1Element encode()
168  {
169    return encodedWindow;
170  }
171
172
173
174  /**
175   * {@inheritDoc}
176   */
177  @Override()
178  public void toString(@NotNull final StringBuilder buffer)
179  {
180    buffer.append("ToolDefaultCollectSupportDataLogCaptureWindow()");
181  }
182}