001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2008-2009 Sun Microsystems, Inc. 025 * Portions Copyright 2011-2014 ForgeRock AS. 026 */ 027package org.opends.server.loggers; 028 029import java.util.List; 030 031import org.forgerock.i18n.LocalizableMessage; 032import org.opends.server.admin.std.server.AccessLogPublisherCfg; 033import org.opends.server.api.ClientConnection; 034import org.opends.server.core.*; 035import org.opends.server.types.DisconnectReason; 036import org.opends.server.types.SearchResultEntry; 037import org.opends.server.types.SearchResultReference; 038 039/** 040 * This class defines the set of methods and structures that must be 041 * implemented for a Directory Server access log publisher. 042 * 043 * @param <T> 044 * The type of access log publisher configuration handled by 045 * this log publisher implementation. 046 */ 047@org.opends.server.types.PublicAPI( 048 stability = org.opends.server.types.StabilityLevel.VOLATILE, 049 mayInstantiate = false, 050 mayExtend = true, 051 mayInvoke = false) 052public abstract class AccessLogPublisher<T extends AccessLogPublisherCfg> 053 implements LogPublisher<T> 054{ 055 056 /** {@inheritDoc} */ 057 @Override 058 public boolean isConfigurationAcceptable(T configuration, 059 List<LocalizableMessage> unacceptableReasons) 060 { 061 // This default implementation does not perform any special 062 // validation. It should be overridden by access log publisher 063 // implementations that wish to perform more detailed validation. 064 return true; 065 } 066 067 068 069 /** 070 * Writes a message to the access logger with information about a 071 * new client connection that has been established, regardless of 072 * whether it will be immediately terminated. 073 * <p> 074 * The default implementation is to not log anything. 075 * 076 * @param clientConnection 077 * The client connection that has been established. 078 */ 079 public void logConnect(ClientConnection clientConnection) 080 { 081 // Do nothing 082 } 083 084 085 086 /** 087 * Writes a message to the access logger with information about the 088 * termination of an existing client connection. 089 * <p> 090 * The default implementation is to not log anything. 091 * 092 * @param clientConnection 093 * The client connection that has been terminated. 094 * @param disconnectReason 095 * A generic disconnect reason for the connection 096 * termination. 097 * @param message 098 * A human-readable message that can provide additional 099 * information about the disconnect. 100 */ 101 public void logDisconnect(ClientConnection clientConnection, 102 DisconnectReason disconnectReason, LocalizableMessage message) 103 { 104 // Do nothing 105 } 106 107 108 109 /** 110 * Writes a message to the access logger with information about the 111 * abandon request associated with the provided abandon operation. 112 * <p> 113 * The default implementation is to not log anything. 114 * 115 * @param abandonOperation 116 * The abandon operation containing the information to use 117 * to log the abandon request. 118 */ 119 public void logAbandonRequest(AbandonOperation abandonOperation) 120 { 121 // Do nothing 122 } 123 124 125 126 /** 127 * Writes a message to the access logger with information about the 128 * result of the provided abandon operation. 129 * <p> 130 * The default implementation is to not log anything. 131 * 132 * @param abandonOperation 133 * The abandon operation containing the information to use 134 * to log the abandon request. 135 */ 136 public void logAbandonResult(AbandonOperation abandonOperation) 137 { 138 // Do nothing 139 } 140 141 142 143 /** 144 * Writes a message to the access logger with information about the 145 * add request associated with the provided add operation. 146 * <p> 147 * The default implementation is to not log anything. 148 * 149 * @param addOperation 150 * The add operation containing the information to use to 151 * log the add request. 152 */ 153 public void logAddRequest(AddOperation addOperation) 154 { 155 // Do nothing 156 } 157 158 159 160 /** 161 * Writes a message to the access logger with information about the 162 * add response associated with the provided add operation. 163 * <p> 164 * The default implementation is to not log anything. 165 * 166 * @param addOperation 167 * The add operation containing the information to use to 168 * log the add response. 169 */ 170 public void logAddResponse(AddOperation addOperation) 171 { 172 // Do nothing 173 } 174 175 176 177 /** 178 * Writes a message to the access logger with information about the 179 * bind request associated with the provided bind operation. 180 * <p> 181 * The default implementation is to not log anything. 182 * 183 * @param bindOperation 184 * The bind operation containing the information to use to 185 * log the bind request. 186 */ 187 public void logBindRequest(BindOperation bindOperation) 188 { 189 // Do nothing 190 } 191 192 193 194 /** 195 * Writes a message to the access logger with information about the 196 * bind response associated with the provided bind operation. 197 * <p> 198 * The default implementation is to not log anything. 199 * 200 * @param bindOperation 201 * The bind operation containing the information to use to 202 * log the bind response. 203 */ 204 public void logBindResponse(BindOperation bindOperation) 205 { 206 // Do nothing 207 } 208 209 210 211 /** 212 * Writes a message to the access logger with information about the 213 * compare request associated with the provided compare operation. 214 * <p> 215 * The default implementation is to not log anything. 216 * 217 * @param compareOperation 218 * The compare operation containing the information to use 219 * to log the compare request. 220 */ 221 public void logCompareRequest(CompareOperation compareOperation) 222 { 223 // Do nothing 224 } 225 226 227 228 /** 229 * Writes a message to the access logger with information about the 230 * compare response associated with the provided compare operation. 231 * <p> 232 * The default implementation is to not log anything. 233 * 234 * @param compareOperation 235 * The compare operation containing the information to use 236 * to log the compare response. 237 */ 238 public void logCompareResponse(CompareOperation compareOperation) 239 { 240 // Do nothing 241 } 242 243 244 245 /** 246 * Writes a message to the access logger with information about the 247 * delete request associated with the provided delete operation. 248 * <p> 249 * The default implementation is to not log anything. 250 * 251 * @param deleteOperation 252 * The delete operation containing the information to use 253 * to log the delete request. 254 */ 255 public void logDeleteRequest(DeleteOperation deleteOperation) 256 { 257 // Do nothing 258 } 259 260 261 262 /** 263 * Writes a message to the access logger with information about the 264 * delete response associated with the provided delete operation. 265 * <p> 266 * The default implementation is to not log anything. 267 * 268 * @param deleteOperation 269 * The delete operation containing the information to use 270 * to log the delete response. 271 */ 272 public void logDeleteResponse(DeleteOperation deleteOperation) 273 { 274 // Do nothing 275 } 276 277 278 279 /** 280 * Writes a message to the access logger with information about the 281 * extended request associated with the provided extended operation. 282 * <p> 283 * The default implementation is to not log anything. 284 * 285 * @param extendedOperation 286 * The extended operation containing the information to use 287 * to log the extended request. 288 */ 289 public void logExtendedRequest(ExtendedOperation extendedOperation) 290 { 291 // Do nothing 292 } 293 294 295 296 /** 297 * Writes a message to the access logger with information about the 298 * extended response associated with the provided extended 299 * operation. 300 * <p> 301 * The default implementation is to not log anything. 302 * 303 * @param extendedOperation 304 * The extended operation containing the information to use 305 * to log the extended response. 306 */ 307 public void logExtendedResponse(ExtendedOperation extendedOperation) 308 { 309 // Do nothing 310 } 311 312 313 314 /** 315 * Writes a message to the access logger with information about the 316 * modify request associated with the provided modify operation. 317 * <p> 318 * The default implementation is to not log anything. 319 * 320 * @param modifyOperation 321 * The modify operation containing the information to use 322 * to log the modify request. 323 */ 324 public void logModifyRequest(ModifyOperation modifyOperation) 325 { 326 // Do nothing 327 } 328 329 330 331 /** 332 * Writes a message to the access logger with information about the 333 * modify response associated with the provided modify operation. 334 * <p> 335 * The default implementation is to not log anything. 336 * 337 * @param modifyOperation 338 * The modify operation containing the information to use 339 * to log the modify response. 340 */ 341 public void logModifyResponse(ModifyOperation modifyOperation) 342 { 343 // Do nothing 344 } 345 346 347 348 /** 349 * Writes a message to the access logger with information about the 350 * modify DN request associated with the provided modify DN 351 * operation. 352 * <p> 353 * The default implementation is to not log anything. 354 * 355 * @param modifyDNOperation 356 * The modify DN operation containing the information to 357 * use to log the modify DN request. 358 */ 359 public void logModifyDNRequest(ModifyDNOperation modifyDNOperation) 360 { 361 // Do nothing 362 } 363 364 365 366 /** 367 * Writes a message to the access logger with information about the 368 * modify DN response associated with the provided modify DN 369 * operation. 370 * <p> 371 * The default implementation is to not log anything. 372 * 373 * @param modifyDNOperation 374 * The modify DN operation containing the information to 375 * use to log the modify DN response. 376 */ 377 public void logModifyDNResponse(ModifyDNOperation modifyDNOperation) 378 { 379 // Do nothing 380 } 381 382 383 384 /** 385 * Writes a message to the access logger with information about the 386 * search request associated with the provided search operation. 387 * <p> 388 * The default implementation is to not log anything. 389 * 390 * @param searchOperation 391 * The search operation containing the information to use 392 * to log the search request. 393 */ 394 public void logSearchRequest(SearchOperation searchOperation) 395 { 396 // Do nothing 397 } 398 399 400 401 /** 402 * Writes a message to the access logger with information about the 403 * search result entry that matches the criteria associated with the 404 * provided search operation. 405 * <p> 406 * The default implementation is to not log anything. 407 * 408 * @param searchOperation 409 * The search operation with which the search result entry 410 * is associated. 411 * @param searchEntry 412 * The search result entry to be logged. 413 */ 414 void logSearchResultEntry(SearchOperation searchOperation, 415 SearchResultEntry searchEntry) 416 { 417 // Do nothing 418 } 419 420 421 422 /** 423 * Writes a message to the access logger with information about the 424 * search result reference returned while processing the associated 425 * search operation. 426 * <p> 427 * The default implementation is to not log anything. 428 * 429 * @param searchOperation 430 * The search operation with which the search result 431 * reference is associated. 432 * @param searchReference 433 * The search result reference to be logged. 434 */ 435 void logSearchResultReference( 436 SearchOperation searchOperation, 437 SearchResultReference searchReference) 438 { 439 // Do nothing 440 } 441 442 443 444 /** 445 * Writes a message to the access logger with information about the 446 * completion of the provided search operation. 447 * <p> 448 * The default implementation is to not log anything. 449 * 450 * @param searchOperation 451 * The search operation containing the information to use 452 * to log the search result done message. 453 */ 454 public void logSearchResultDone(SearchOperation searchOperation) 455 { 456 // Do nothing 457 } 458 459 460 461 /** 462 * Writes a message to the access logger with information about the 463 * unbind request associated with the provided unbind operation. 464 * <p> 465 * The default implementation is to not log anything. 466 * 467 * @param unbindOperation 468 * The unbind operation containing the information to use 469 * to log the unbind request. 470 */ 471 public void logUnbind(UnbindOperation unbindOperation) 472 { 473 // Do nothing 474 } 475 476}