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