001/*
002 * Copyright 2022-2024 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2022-2024 Ping Identity Corporation
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020/*
021 * Copyright (C) 2022-2024 Ping Identity Corporation
022 *
023 * This program is free software; you can redistribute it and/or modify
024 * it under the terms of the GNU General Public License (GPLv2 only)
025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
026 * as published by the Free Software Foundation.
027 *
028 * This program is distributed in the hope that it will be useful,
029 * but WITHOUT ANY WARRANTY; without even the implied warranty of
030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031 * GNU General Public License for more details.
032 *
033 * You should have received a copy of the GNU General Public License
034 * along with this program; if not, see <http://www.gnu.org/licenses>.
035 */
036package com.unboundid.ldap.sdk.unboundidds.logs.v2.text;
037
038
039
040import java.util.List;
041import java.util.Set;
042
043import com.unboundid.ldap.sdk.ResultCode;
044import com.unboundid.ldap.sdk.unboundidds.logs.AccessLogMessageType;
045import com.unboundid.ldap.sdk.unboundidds.logs.LogException;
046import com.unboundid.ldap.sdk.unboundidds.logs.v2.
047            ExtendedResultAccessLogMessage;
048import com.unboundid.util.NotMutable;
049import com.unboundid.util.NotNull;
050import com.unboundid.util.Nullable;
051import com.unboundid.util.ThreadSafety;
052import com.unboundid.util.ThreadSafetyLevel;
053
054
055
056/**
057 * This class provides a data structure that holds information about a
058 * text-formatted extended result access log message.
059 * <BR>
060 * <BLOCKQUOTE>
061 *   <B>NOTE:</B>  This class, and other classes within the
062 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
063 *   supported for use against Ping Identity, UnboundID, and
064 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
065 *   for proprietary functionality or for external specifications that are not
066 *   considered stable or mature enough to be guaranteed to work in an
067 *   interoperable way with other types of LDAP servers.
068 * </BLOCKQUOTE>
069 */
070@NotMutable()
071@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
072public final class TextFormattedExtendedResultAccessLogMessage
073       extends TextFormattedExtendedRequestAccessLogMessage
074       implements ExtendedResultAccessLogMessage
075{
076  /**
077   * The serial version UID for this serializable class.
078   */
079  private static final long serialVersionUID = 6860620762769239759L;
080
081
082
083  // The client connection policy name for this access log message.
084  @Nullable private final String clientConnectionPolicy;
085
086  // The extended response OID for this access log message.
087  @Nullable private final String responseOID;
088
089  // The extended response type for this access log message.
090  @Nullable private final String responseType;
091
092  // The forward helper for this access log message.
093  @NotNull private final TextFormattedForwardAccessLogMessageHelper
094       forwardHelper;
095
096  // The result helper for this access log message.
097  @NotNull private final TextFormattedResultAccessLogMessageHelper
098       resultHelper;
099
100
101
102  /**
103   * Creates a new text-formatted extended result access log message from the
104   * provided message string.
105   *
106   * @param  logMessageString  The string representation of this log message.
107   *                           It must not be {@code null}.
108   *
109   * @throws  LogException  If the provided string cannot be parsed as a valid
110   *                        log message.
111   */
112  public TextFormattedExtendedResultAccessLogMessage(
113              @NotNull final String logMessageString)
114         throws LogException
115  {
116    this(new TextFormattedLogMessage(logMessageString));
117  }
118
119
120
121  /**
122   * Creates a new text-formatted extended result access log message from the
123   * provided message.
124   *
125   * @param  logMessage  The log message to use to create this extended result
126   *                     access log message.  It must not be {@code null}.
127   *
128   * @throws  LogException  If the provided string cannot be parsed as a valid
129   *                        log message.
130   */
131  TextFormattedExtendedResultAccessLogMessage(
132       @NotNull final TextFormattedLogMessage logMessage)
133  {
134    super(logMessage);
135
136    responseOID = getString(TextFormattedAccessLogFields.EXTENDED_RESPONSE_OID);
137    responseType =
138         getString(TextFormattedAccessLogFields.EXTENDED_RESPONSE_TYPE);
139    clientConnectionPolicy = getString(
140         TextFormattedAccessLogFields.CLIENT_CONNECTION_POLICY);
141
142    resultHelper = new TextFormattedResultAccessLogMessageHelper(this);
143    forwardHelper = new TextFormattedForwardAccessLogMessageHelper(this);
144  }
145
146
147
148  /**
149   * {@inheritDoc}
150   */
151  @Override()
152  @NotNull()
153  public AccessLogMessageType getMessageType()
154  {
155    return AccessLogMessageType.RESULT;
156  }
157
158
159
160  /**
161   * {@inheritDoc}
162   */
163  @Override()
164  @Nullable()
165  public ResultCode getResultCode()
166  {
167    return resultHelper.getResultCode();
168  }
169
170
171
172  /**
173   * {@inheritDoc}
174   */
175  @Override()
176  @Nullable()
177  public String getDiagnosticMessage()
178  {
179    return resultHelper.getDiagnosticMessage();
180  }
181
182
183
184  /**
185   * {@inheritDoc}
186   */
187  @Override()
188  @Nullable()
189  public String getAdditionalInformation()
190  {
191    return resultHelper.getAdditionalInformation();
192  }
193
194
195
196  /**
197   * {@inheritDoc}
198   */
199  @Override()
200  @Nullable()
201  public String getMatchedDN()
202  {
203    return resultHelper.getMatchedDN();
204  }
205
206
207
208  /**
209   * {@inheritDoc}
210   */
211  @Override()
212  @NotNull()
213  public List<String> getReferralURLs()
214  {
215    return resultHelper.getReferralURLs();
216  }
217
218
219
220  /**
221   * {@inheritDoc}
222   */
223  @Override()
224  @Nullable()
225  public Double getProcessingTimeMillis()
226  {
227    return resultHelper.getProcessingTimeMillis();
228  }
229
230
231
232  /**
233   * {@inheritDoc}
234   */
235  @Override()
236  @Nullable()
237  public Double getWorkQueueWaitTimeMillis()
238  {
239    return resultHelper.getWorkQueueWaitTimeMillis();
240  }
241
242
243
244  /**
245   * {@inheritDoc}
246   */
247  @Override()
248  @NotNull()
249  public Set<String> getResponseControlOIDs()
250  {
251    return resultHelper.getResponseControlOIDs();
252  }
253
254
255
256  /**
257   * {@inheritDoc}
258   */
259  @Override()
260  @Nullable()
261  public Long getIntermediateResponsesReturned()
262  {
263    return resultHelper.getIntermediateResponsesReturned();
264  }
265
266
267
268  /**
269   * {@inheritDoc}
270   */
271  @Override()
272  @NotNull()
273  public List<String> getServersAccessed()
274  {
275    return resultHelper.getServersAccessed();
276  }
277
278
279
280  /**
281   * {@inheritDoc}
282   */
283  @Override()
284  @Nullable()
285  public Boolean getUncachedDataAccessed()
286  {
287    return resultHelper.getUncachedDataAccessed();
288  }
289
290
291
292  /**
293   * {@inheritDoc}
294   */
295  @Override()
296  @NotNull()
297  public Set<String> getUsedPrivileges()
298  {
299    return resultHelper.getUsedPrivileges();
300  }
301
302
303
304  /**
305   * {@inheritDoc}
306   */
307  @Override()
308  @NotNull()
309  public Set<String> getPreAuthorizationUsedPrivileges()
310  {
311    return resultHelper.getPreAuthorizationUsedPrivileges();
312  }
313
314
315
316  /**
317   * {@inheritDoc}
318   */
319  @Override()
320  @NotNull()
321  public Set<String> getMissingPrivileges()
322  {
323    return resultHelper.getMissingPrivileges();
324  }
325
326
327
328  /**
329   * Retrieves a string representation of an intermediate client response
330   * control included in the log message.
331   *
332   * @return  A string representation of an intermediate client response control
333   *          included in the log message, or {@code null} if there is none.
334   */
335  @Nullable()
336  public String getIntermediateClientResponseControl()
337  {
338    return resultHelper.getIntermediateClientResponseControl();
339  }
340
341
342
343  /**
344   * {@inheritDoc}
345   */
346  @Override()
347  @Nullable()
348  public String getTargetHost()
349  {
350    return forwardHelper.getTargetHost();
351  }
352
353
354
355  /**
356   * {@inheritDoc}
357   */
358  @Override()
359  @Nullable()
360  public Integer getTargetPort()
361  {
362    return forwardHelper.getTargetPort();
363  }
364
365
366
367  /**
368   * {@inheritDoc}
369   */
370  @Override()
371  @Nullable()
372  public String getTargetProtocol()
373  {
374    return forwardHelper.getTargetProtocol();
375  }
376
377
378
379  /**
380   * {@inheritDoc}
381   */
382  @Override()
383  @Nullable()
384  public String getResponseOID()
385  {
386    return responseOID;
387  }
388
389
390
391  /**
392   * {@inheritDoc}
393   */
394  @Override()
395  @Nullable()
396  public String getResponseType()
397  {
398    return responseType;
399  }
400
401
402
403  /**
404   * {@inheritDoc}
405   */
406  @Override()
407  @Nullable()
408  public String getClientConnectionPolicy()
409  {
410    return clientConnectionPolicy;
411  }
412}