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