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.SearchResultAccessLogMessage; 047import com.unboundid.util.NotMutable; 048import com.unboundid.util.NotNull; 049import com.unboundid.util.Nullable; 050import com.unboundid.util.ThreadSafety; 051import com.unboundid.util.ThreadSafetyLevel; 052 053 054 055/** 056 * This class provides a data structure that holds information about a 057 * text-formatted search result access log message. 058 * <BR> 059 * <BLOCKQUOTE> 060 * <B>NOTE:</B> This class, and other classes within the 061 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 062 * supported for use against Ping Identity, UnboundID, and 063 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 064 * for proprietary functionality or for external specifications that are not 065 * considered stable or mature enough to be guaranteed to work in an 066 * interoperable way with other types of LDAP servers. 067 * </BLOCKQUOTE> 068 */ 069@NotMutable() 070@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 071public final class TextFormattedSearchResultAccessLogMessage 072 extends TextFormattedSearchRequestAccessLogMessage 073 implements SearchResultAccessLogMessage 074{ 075 /** 076 * The serial version UID for this serializable class. 077 */ 078 private static final long serialVersionUID = -5895892142452308149L; 079 080 081 082 // Indicates whether the search is unindexed. 083 @Nullable private final Boolean isUnindexed; 084 085 // The number of entries returned for this access log message. 086 @Nullable private final Long entriesReturned; 087 088 // The forward helper for this access log message. 089 @NotNull private final TextFormattedForwardAccessLogMessageHelper 090 forwardHelper; 091 092 // The result helper for this access log message. 093 @NotNull private final TextFormattedResultAccessLogMessageHelper 094 resultHelper; 095 096 097 098 /** 099 * Creates a new text-formatted search result access log message from the 100 * provided message string. 101 * 102 * @param logMessageString The string representation of this log message. 103 * It must not be {@code null}. 104 * 105 * @throws LogException If the provided string cannot be parsed as a valid 106 * log message. 107 */ 108 public TextFormattedSearchResultAccessLogMessage( 109 @NotNull final String logMessageString) 110 throws LogException 111 { 112 this(new TextFormattedLogMessage(logMessageString)); 113 } 114 115 116 117 /** 118 * Creates a new text-formatted search result access log message from the 119 * provided message. 120 * 121 * @param logMessage The log message to use to create this search result 122 * access log message. It must not be {@code null}. 123 */ 124 TextFormattedSearchResultAccessLogMessage( 125 @NotNull final TextFormattedLogMessage logMessage) 126 { 127 super(logMessage); 128 129 entriesReturned = 130 getLongNoThrow(TextFormattedAccessLogFields.SEARCH_ENTRIES_RETURNED); 131 isUnindexed = getBooleanNoThrow( 132 TextFormattedAccessLogFields.SEARCH_UNINDEXED); 133 134 resultHelper = new TextFormattedResultAccessLogMessageHelper(this); 135 forwardHelper = new TextFormattedForwardAccessLogMessageHelper(this); 136 } 137 138 139 140 /** 141 * {@inheritDoc} 142 */ 143 @Override() 144 @NotNull() 145 public AccessLogMessageType getMessageType() 146 { 147 return AccessLogMessageType.RESULT; 148 } 149 150 151 152 /** 153 * {@inheritDoc} 154 */ 155 @Override() 156 @Nullable() 157 public ResultCode getResultCode() 158 { 159 return resultHelper.getResultCode(); 160 } 161 162 163 164 /** 165 * {@inheritDoc} 166 */ 167 @Override() 168 @Nullable() 169 public String getDiagnosticMessage() 170 { 171 return resultHelper.getDiagnosticMessage(); 172 } 173 174 175 176 /** 177 * {@inheritDoc} 178 */ 179 @Override() 180 @Nullable() 181 public String getAdditionalInformation() 182 { 183 return resultHelper.getAdditionalInformation(); 184 } 185 186 187 188 /** 189 * {@inheritDoc} 190 */ 191 @Override() 192 @Nullable() 193 public String getMatchedDN() 194 { 195 return resultHelper.getMatchedDN(); 196 } 197 198 199 200 /** 201 * {@inheritDoc} 202 */ 203 @Override() 204 @NotNull() 205 public List<String> getReferralURLs() 206 { 207 return resultHelper.getReferralURLs(); 208 } 209 210 211 212 /** 213 * {@inheritDoc} 214 */ 215 @Override() 216 @Nullable() 217 public Double getProcessingTimeMillis() 218 { 219 return resultHelper.getProcessingTimeMillis(); 220 } 221 222 223 224 /** 225 * {@inheritDoc} 226 */ 227 @Override() 228 @Nullable() 229 public Double getWorkQueueWaitTimeMillis() 230 { 231 return resultHelper.getWorkQueueWaitTimeMillis(); 232 } 233 234 235 236 /** 237 * {@inheritDoc} 238 */ 239 @Override() 240 @NotNull() 241 public Set<String> getResponseControlOIDs() 242 { 243 return resultHelper.getResponseControlOIDs(); 244 } 245 246 247 248 /** 249 * {@inheritDoc} 250 */ 251 @Override() 252 @Nullable() 253 public Long getIntermediateResponsesReturned() 254 { 255 return resultHelper.getIntermediateResponsesReturned(); 256 } 257 258 259 260 /** 261 * {@inheritDoc} 262 */ 263 @Override() 264 @NotNull() 265 public List<String> getServersAccessed() 266 { 267 return resultHelper.getServersAccessed(); 268 } 269 270 271 272 /** 273 * {@inheritDoc} 274 */ 275 @Override() 276 @Nullable() 277 public Boolean getUncachedDataAccessed() 278 { 279 return resultHelper.getUncachedDataAccessed(); 280 } 281 282 283 284 /** 285 * {@inheritDoc} 286 */ 287 @Override() 288 @NotNull() 289 public Set<String> getUsedPrivileges() 290 { 291 return resultHelper.getUsedPrivileges(); 292 } 293 294 295 296 /** 297 * {@inheritDoc} 298 */ 299 @Override() 300 @NotNull() 301 public Set<String> getPreAuthorizationUsedPrivileges() 302 { 303 return resultHelper.getPreAuthorizationUsedPrivileges(); 304 } 305 306 307 308 /** 309 * {@inheritDoc} 310 */ 311 @Override() 312 @NotNull() 313 public Set<String> getMissingPrivileges() 314 { 315 return resultHelper.getMissingPrivileges(); 316 } 317 318 319 320 /** 321 * {@inheritDoc} 322 */ 323 @Override() 324 @Nullable() 325 public String getAlternateAuthorizationDN() 326 { 327 return resultHelper.getAlternateAuthorizationDN(); 328 } 329 330 331 332 /** 333 * {@inheritDoc} 334 */ 335 @Override() 336 @NotNull() 337 public Set<String> getIndexesWithKeysAccessedNearEntryLimit() 338 { 339 return resultHelper.getIndexesWithKeysAccessedNearEntryLimit(); 340 } 341 342 343 344 /** 345 * {@inheritDoc} 346 */ 347 @Override() 348 @NotNull() 349 public Set<String> getIndexesWithKeysAccessedExceedingEntryLimit() 350 { 351 return resultHelper.getIndexesWithKeysAccessedExceedingEntryLimit(); 352 } 353 354 355 356 /** 357 * Retrieves a string representation of an intermediate client response 358 * control included in the log message. 359 * 360 * @return A string representation of an intermediate client response control 361 * included in the log message, or {@code null} if there is none. 362 */ 363 @Nullable() 364 public String getIntermediateClientResponseControl() 365 { 366 return resultHelper.getIntermediateClientResponseControl(); 367 } 368 369 370 371 /** 372 * {@inheritDoc} 373 */ 374 @Override() 375 @Nullable() 376 public String getTargetHost() 377 { 378 return forwardHelper.getTargetHost(); 379 } 380 381 382 383 /** 384 * {@inheritDoc} 385 */ 386 @Override() 387 @Nullable() 388 public Integer getTargetPort() 389 { 390 return forwardHelper.getTargetPort(); 391 } 392 393 394 395 /** 396 * {@inheritDoc} 397 */ 398 @Override() 399 @Nullable() 400 public String getTargetProtocol() 401 { 402 return forwardHelper.getTargetProtocol(); 403 } 404 405 406 407 /** 408 * {@inheritDoc} 409 */ 410 @Override() 411 @Nullable() 412 public Long getEntriesReturned() 413 { 414 return entriesReturned; 415 } 416 417 418 419 /** 420 * {@inheritDoc} 421 */ 422 @Override() 423 @Nullable() 424 public Boolean getUnindexed() 425 { 426 return isUnindexed; 427 } 428}