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
010     * docs/licenses/cddl.txt
011     * or http://www.opensource.org/licenses/cddl1.php.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * docs/licenses/cddl.txt.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2010-2013 UnboundID Corp.
026     */
027    package com.unboundid.directory.sdk.common.scripting;
028    
029    
030    
031    import java.security.cert.Certificate;
032    import java.util.List;
033    import java.util.Map;
034    
035    import com.unboundid.directory.sdk.common.config.AccessLoggerConfig;
036    import com.unboundid.directory.sdk.common.internal.Reconfigurable;
037    import com.unboundid.directory.sdk.common.operation.AbandonRequest;
038    import com.unboundid.directory.sdk.common.operation.AddRequest;
039    import com.unboundid.directory.sdk.common.operation.AddResult;
040    import com.unboundid.directory.sdk.common.operation.BindResult;
041    import com.unboundid.directory.sdk.common.operation.CompareRequest;
042    import com.unboundid.directory.sdk.common.operation.CompareResult;
043    import com.unboundid.directory.sdk.common.operation.DeleteRequest;
044    import com.unboundid.directory.sdk.common.operation.DeleteResult;
045    import com.unboundid.directory.sdk.common.operation.ExtendedRequest;
046    import com.unboundid.directory.sdk.common.operation.ExtendedResult;
047    import com.unboundid.directory.sdk.common.operation.GenericResult;
048    import com.unboundid.directory.sdk.common.operation.ModifyRequest;
049    import com.unboundid.directory.sdk.common.operation.ModifyResult;
050    import com.unboundid.directory.sdk.common.operation.ModifyDNRequest;
051    import com.unboundid.directory.sdk.common.operation.ModifyDNResult;
052    import com.unboundid.directory.sdk.common.operation.SASLBindRequest;
053    import com.unboundid.directory.sdk.common.operation.SearchRequest;
054    import com.unboundid.directory.sdk.common.operation.SearchResult;
055    import com.unboundid.directory.sdk.common.operation.SimpleBindRequest;
056    import com.unboundid.directory.sdk.common.operation.UnbindRequest;
057    import com.unboundid.directory.sdk.common.types.AssuredReplicationResult;
058    import com.unboundid.directory.sdk.common.types.ClientContext;
059    import com.unboundid.directory.sdk.common.types.CompletedOperationContext;
060    import com.unboundid.directory.sdk.common.types.CompletedSearchOperationContext;
061    import com.unboundid.directory.sdk.common.types.DisconnectReason;
062    import com.unboundid.directory.sdk.common.types.Entry;
063    import com.unboundid.directory.sdk.common.types.ForwardTarget;
064    import com.unboundid.directory.sdk.common.types.OperationContext;
065    import com.unboundid.directory.sdk.common.types.ServerContext;
066    import com.unboundid.directory.sdk.ds.internal.DirectoryServerExtension;
067    import com.unboundid.directory.sdk.metrics.internal.MetricsEngineExtension;
068    import com.unboundid.directory.sdk.proxy.internal.DirectoryProxyServerExtension;
069    import com.unboundid.directory.sdk.sync.internal.SynchronizationServerExtension;
070    import com.unboundid.ldap.sdk.Control;
071    import com.unboundid.ldap.sdk.IntermediateResponse;
072    import com.unboundid.ldap.sdk.LDAPException;
073    import com.unboundid.ldap.sdk.ResultCode;
074    import com.unboundid.ldap.sdk.unboundidds.MoveSubtreeResult;
075    import com.unboundid.util.Extensible;
076    import com.unboundid.util.ThreadSafety;
077    import com.unboundid.util.ThreadSafetyLevel;
078    import com.unboundid.util.args.ArgumentException;
079    import com.unboundid.util.args.ArgumentParser;
080    
081    
082    
083    /**
084     * This class defines an API that must be implemented by scripted extensions
085     * which record information about interaction with clients, including
086     * connections established and received and operations requested and completed.
087     * <BR><BR>
088     * Access loggers will be invoked for the following events:
089     * <UL>
090     *   <LI>Whenever a new connection is established.</LI>
091     *   <LI>Whenever an existing connection is closed or terminated.</LI>
092     *   <LI>Whenever an abandon, add, bind, compare, delete, extended, modify,
093     *       modify DN, search, or unbind request is received.</LI>
094     *   <LI>Whenever an abandon, add, bind, compare, delete, extended, modify,
095     *       modify DN, or search request is forwarded to another server for
096     *       processing.</LI>
097     *   <LI>If a forwarded add, bind, compare, delete, extended, modify, modify DN,
098     *       or search operation fails.</LI>
099     *   <LI>After sending the result for an add, bind, compare, delete, extended,
100     *       modify, modify DN, or search operation.</LI>
101     *   <LI>After completing processing for an abandon operation.</LI>
102     *   <LI>After sending a search result entry, search result reference, or
103     *       intermediate response message to the client.</LI>
104     * </UL>
105     * <BR><BR>
106     * Each access logger may configured to indicate whether to include or exclude
107     * internal and/or replicated operations, and criteria may be used to provide
108     * filtered logging.  This is handled automatically by the server, so individual
109     * access logger implementations do not need to attempt to perform that
110     * filtering on their own.  However, they may perform additional processing if
111     * desired to further narrow the set of messages that should be logged.
112     * <BR>
113     * <H2>Configuring Groovy-Scripted Access Loggers</H2>
114     * In order to configure a scripted access logger based on this API and written
115     * in the Groovy scripting language, use a command
116     * like:
117     * <PRE>
118     *      dsconfig create-log-publisher \
119     *           --publisher-name "<I>{logger-name}</I>" \
120     *           --type groovy-scripted-access \
121     *           --set enabled:true \
122     *           --set "script-class:<I>{class-name}</I>" \
123     *           --set "script-argument:<I>{name=value}</I>"
124     * </PRE>
125     * where "<I>{logger-name}</I>" is the name to use for the access logger
126     * instance, "<I>{class-name}</I>" is the fully-qualified name of the Groovy
127     * class written using this API, and "<I>{name=value}</I>" represents name-value
128     * pairs for any arguments to provide to the logger.  If multiple arguments
129     * should be provided to the logger, then the
130     * "<CODE>--set script-argument:<I>{name=value}</I></CODE>" option should be
131     * provided multiple times.
132     *
133     * @see  com.unboundid.directory.sdk.common.api.AccessLogger
134     * @see  com.unboundid.directory.sdk.common.api.FileBasedAccessLogger
135     * @see  ScriptedFileBasedAccessLogger
136     */
137    @Extensible()
138    @DirectoryServerExtension()
139    @DirectoryProxyServerExtension(appliesToLocalContent=true,
140         appliesToRemoteContent=false)
141    @SynchronizationServerExtension(appliesToLocalContent=true,
142         appliesToSynchronizedContent=false)
143    @MetricsEngineExtension()
144    @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
145    public abstract class ScriptedAccessLogger
146           implements Reconfigurable<AccessLoggerConfig>
147    {
148      /**
149       * Creates a new instance of this access logger.  All access logger
150       * implementations must include a default constructor, but any initialization
151       * should generally be done in the {@code initializeAccessLogger} method.
152       */
153      public ScriptedAccessLogger()
154      {
155        // No implementation is required.
156      }
157    
158    
159    
160      /**
161       * {@inheritDoc}
162       */
163      public void defineConfigArguments(final ArgumentParser parser)
164             throws ArgumentException
165      {
166        // No arguments will be allowed by default.
167      }
168    
169    
170    
171      /**
172       * Initializes this access logger.
173       *
174       * @param  serverContext  A handle to the server context for the server in
175       *                        which this extension is running.
176       * @param  config         The general configuration for this access logger.
177       * @param  parser         The argument parser which has been initialized from
178       *                        the configuration for this access logger.
179       *
180       * @throws  LDAPException  If a problem occurs while initializing this
181       *                         access logger.
182       */
183      public void initializeAccessLogger(final ServerContext serverContext,
184                                         final AccessLoggerConfig config,
185                                         final ArgumentParser parser)
186             throws LDAPException
187      {
188        // No initialization will be performed by default.
189      }
190    
191    
192    
193      /**
194       * Performs any cleanup which may be necessary when this access logger is to
195       * be taken out of service.
196       */
197      public void finalizeAccessLogger()
198      {
199        // No implementation is required.
200      }
201    
202    
203    
204      /**
205       * {@inheritDoc}
206       */
207      public boolean isConfigurationAcceptable(final AccessLoggerConfig config,
208                          final ArgumentParser parser,
209                          final List<String> unacceptableReasons)
210      {
211        // No extended validation will be performed.
212        return true;
213      }
214    
215    
216    
217      /**
218       * {@inheritDoc}
219       */
220      public ResultCode applyConfiguration(final AccessLoggerConfig config,
221                                           final ArgumentParser parser,
222                                           final List<String> adminActionsRequired,
223                                           final List<String> messages)
224      {
225        // By default, no configuration changes will be applied.  If there are any
226        // arguments, then add an admin action message indicating that the extension
227        // needs to be restarted for any changes to take effect.
228        if (! parser.getNamedArguments().isEmpty())
229        {
230          adminActionsRequired.add(
231               "No configuration change has actually been applied.  The new " +
232                    "configuration will not take effect until this access logger " +
233                    "is disabled and re-enabled or until the server is restarted.");
234        }
235    
236        return ResultCode.SUCCESS;
237      }
238    
239    
240    
241      /**
242       * Logs a message indicating that a new connection has been established.
243       *
244       * @param  clientContext  Information about the client connection that has
245       *                        been accepted.
246       */
247      public void logConnect(final ClientContext clientContext)
248      {
249        // No action will be taken by default.
250      }
251    
252    
253    
254      /**
255       * Logs a message indicating that a connection has been closed.
256       *
257       * @param  clientContext     Information about the client connection that has
258       *                           been closed.
259       * @param  disconnectReason  A general reason that the connection has been
260       *                           closed.
261       * @param  message           A message with additional information about the
262       *                           closure.  It may be {@code null} if none is
263       *                           available.
264       */
265      public void logDisconnect(final ClientContext clientContext,
266                                final DisconnectReason disconnectReason,
267                                final String message)
268      {
269        // No action will be taken by default.
270      }
271    
272    
273    
274      /**
275       * Logs a message about security negotiation performed by a client.
276       *
277       * @param  clientContext  Information about the client connection on which
278       *                        the negotiation was completed.
279       * @param  protocol       The security protocol selected by the negotiation.
280       *                        It may be {@code null} if no protocol is available.
281       * @param  cipher         The cipher suite selected by the negotiation.  It
282       *                        may be {@code null} if no cipher is available.
283       * @param  properties     A set of additional properties that may be included
284       *                        in the log message.  It may be {@code null} or empty
285       *                        if no additional properties are needed.
286       */
287      public void logSecurityNegotiation(final ClientContext clientContext,
288                                         final String protocol, final String cipher,
289                                         final Map<String,String> properties)
290      {
291        // No action will be taken by default.
292      }
293    
294    
295    
296      /**
297       * Logs a message about a certificate chain presented by a client.
298       *
299       * @param  clientContext  Information about the client that presented the
300       *                        certificate chain.
301       * @param  certChain      The certificate chain presented by the client.
302       * @param  authDN         The DN of the user as whom the client was
303       *                        automatically authenticated, or {@code null} if the
304       *                        client was not automatically authenticated.
305       */
306      public void logClientCertificateChain(final ClientContext clientContext,
307                                            final Certificate[] certChain,
308                                            final String authDN)
309      {
310        // No action will be taken by default.
311      }
312    
313    
314    
315      /**
316       * Logs a message about an abandon request received from a client.
317       *
318       * @param  opContext  The operation context for the abandon operation.
319       * @param  request    The abandon request that was received.
320       */
321      public void logAbandonRequest(final OperationContext opContext,
322                                    final AbandonRequest request)
323      {
324        // No action will be taken by default.
325      }
326    
327    
328    
329      /**
330       * Logs a message about an abandon request that will be forwarded to another
331       * server.
332       *
333       * @param  opContext  The operation context for the abandon operation.
334       * @param  request    The abandon request that was received.
335       * @param  target     Information about the server to which the request will
336       *                    be forwarded.
337       */
338      public void logAbandonForward(final OperationContext opContext,
339                                    final AbandonRequest request,
340                                    final ForwardTarget target)
341      {
342        // No action will be taken by default.
343      }
344    
345    
346    
347      /**
348       * Logs a message about the result of processing an abandon request.
349       *
350       * @param  opContext  The operation context for the abandon operation.
351       * @param  request    The abandon request that was received.
352       * @param  result     The result of processing the abandon request.
353       */
354      public void logAbandonResult(final CompletedOperationContext opContext,
355                                   final AbandonRequest request,
356                                   final GenericResult result)
357      {
358        // No action will be taken by default.
359      }
360    
361    
362    
363      /**
364       * Logs a message about an add request received from a client.
365       *
366       * @param  opContext  The operation context for the add operation.
367       * @param  request    The add request that was received.
368       */
369      public void logAddRequest(final OperationContext opContext,
370                                final AddRequest request)
371      {
372        // No action will be taken by default.
373      }
374    
375    
376    
377      /**
378       * Logs a message about an add request that will be forwarded to another
379       * server.
380       *
381       * @param  opContext  The operation context for the add operation.
382       * @param  request    The add request that was received.
383       * @param  target     Information about the server to which the request will
384       *                    be forwarded.
385       */
386      public void logAddForward(final OperationContext opContext,
387                                final AddRequest request,
388                                final ForwardTarget target)
389      {
390        // No action will be taken by default.
391      }
392    
393    
394    
395      /**
396       * Logs a message about a failure encountered while attempting to forward an
397       * add request to another server.
398       *
399       * @param  opContext  The operation context for the add operation.
400       * @param  request    The add request that was received.
401       * @param  target     Information about the server to which the request was
402       *                    forwarded.
403       * @param  failure    The exception that was received when attempting to
404       *                    forward the request.
405       */
406      public void logAddForwardFailure(final OperationContext opContext,
407                                       final AddRequest request,
408                                       final ForwardTarget target,
409                                       final LDAPException failure)
410      {
411        // No action will be taken by default.
412      }
413    
414    
415    
416      /**
417       * Logs a message about the result of processing an add request.
418       *
419       * @param  opContext  The operation context for the add operation.
420       * @param  request    The add request that was received.
421       * @param  result     The result of processing the add request.
422       */
423      public void logAddResponse(final CompletedOperationContext opContext,
424                                 final AddRequest request,
425                                 final AddResult result)
426      {
427        // No action will be taken by default.
428      }
429    
430    
431    
432      /**
433       * Logs a message about the result of replication assurance processing for an
434       * add operation.
435       *
436       * @param  opContext        The operation context for the add operation.
437       * @param  request          The add request that was received.
438       * @param  result           The result of processing the add request.
439       * @param  assuranceResult  The replication assurance processing result.
440       */
441      public void logAddAssuranceCompleted(
442                       final CompletedOperationContext opContext,
443                       final AddRequest request, final AddResult result,
444                       final AssuredReplicationResult assuranceResult)
445      {
446        // No action will be taken by default.
447      }
448    
449    
450    
451      /**
452       * Logs a message about a simple bind request received from a client.
453       *
454       * @param  opContext  The operation context for the bind operation.
455       * @param  request    The bind request that was received.
456       */
457      public void logBindRequest(final OperationContext opContext,
458                                 final SimpleBindRequest request)
459      {
460        // No action will be taken by default.
461      }
462    
463    
464    
465      /**
466       * Logs a message about a simple bind request that will be forwarded to
467       * another server.
468       *
469       * @param  opContext  The operation context for the bind operation.
470       * @param  request    The bind request that was received.
471       * @param  target     Information about the server to which the request will
472       *                    be forwarded.
473       */
474      public void logBindForward(final OperationContext opContext,
475                                    final SimpleBindRequest request,
476                                    final ForwardTarget target)
477      {
478        // No action will be taken by default.
479      }
480    
481    
482    
483      /**
484       * Logs a message about a failure encountered while attempting to forward a
485       * simple bind request to another server.
486       *
487       * @param  opContext  The operation context for the bind operation.
488       * @param  request    The bind request that was received.
489       * @param  target     Information about the server to which the request was
490       *                    forwarded.
491       * @param  failure    The exception that was received when attempting to
492       *                    forward the request.
493       */
494      public void logBindForwardFailure(final OperationContext opContext,
495                                        final SimpleBindRequest request,
496                                        final ForwardTarget target,
497                                        final LDAPException failure)
498      {
499        // No action will be taken by default.
500      }
501    
502    
503    
504      /**
505       * Logs a message about the result of processing a simple bind request.
506       *
507       * @param  opContext  The operation context for the bind operation.
508       * @param  request    The bind request that was received.
509       * @param  result     The result of processing the bind request.
510       */
511      public void logBindResponse(final CompletedOperationContext opContext,
512                                  final SimpleBindRequest request,
513                                  final BindResult result)
514      {
515        // No action will be taken by default.
516      }
517    
518    
519    
520      /**
521       * Logs a message about a SASL bind request received from a client.
522       *
523       * @param  opContext  The operation context for the bind operation.
524       * @param  request    The bind request that was received.
525       */
526      public void logBindRequest(final OperationContext opContext,
527                                 final SASLBindRequest request)
528      {
529        // No action will be taken by default.
530      }
531    
532    
533    
534      /**
535       * Logs a message about a SASL bind request that will be forwarded to
536       * another server.
537       *
538       * @param  opContext  The operation context for the bind operation.
539       * @param  request    The bind request that was received.
540       * @param  target     Information about the server to which the request will
541       *                    be forwarded.
542       */
543      public void logBindForward(final OperationContext opContext,
544                                    final SASLBindRequest request,
545                                    final ForwardTarget target)
546      {
547        // No action will be taken by default.
548      }
549    
550    
551    
552      /**
553       * Logs a message about a failure encountered while attempting to forward a
554       * SASL bind request to another server.
555       *
556       * @param  opContext  The operation context for the bind operation.
557       * @param  request    The bind request that was received.
558       * @param  target     Information about the server to which the request was
559       *                    forwarded.
560       * @param  failure    The exception that was received when attempting to
561       *                    forward the request.
562       */
563      public void logBindForwardFailure(final OperationContext opContext,
564                                        final SASLBindRequest request,
565                                        final ForwardTarget target,
566                                        final LDAPException failure)
567      {
568        // No action will be taken by default.
569      }
570    
571    
572    
573      /**
574       * Logs a message about the result of processing a SASL bind request.
575       *
576       * @param  opContext  The operation context for the bind operation.
577       * @param  request    The bind request that was received.
578       * @param  result     The result of processing the bind request.
579       */
580      public void logBindResponse(final CompletedOperationContext opContext,
581                                  final SASLBindRequest request,
582                                  final BindResult result)
583      {
584        // No action will be taken by default.
585      }
586    
587    
588    
589      /**
590       * Logs a message about a compare request received from a client.
591       *
592       * @param  opContext  The operation context for the compare operation.
593       * @param  request    The compare request that was received.
594       */
595      public void logCompareRequest(final OperationContext opContext,
596                                    final CompareRequest request)
597      {
598        // No action will be taken by default.
599      }
600    
601    
602    
603      /**
604       * Logs a message about a compare request that will be forwarded to another
605       * server.
606       *
607       * @param  opContext  The operation context for the compare operation.
608       * @param  request    The compare request that was received.
609       * @param  target     Information about the server to which the request will
610       *                    be forwarded.
611       */
612      public void logCompareForward(final OperationContext opContext,
613                                    final CompareRequest request,
614                                    final ForwardTarget target)
615      {
616        // No action will be taken by default.
617      }
618    
619    
620    
621      /**
622       * Logs a message about a failure encountered while attempting to forward a
623       * compare request to another server.
624       *
625       * @param  opContext  The operation context for the compare operation.
626       * @param  request    The compare request that was received.
627       * @param  target     Information about the server to which the request was
628       *                    forwarded.
629       * @param  failure    The exception that was received when attempting to
630       *                    forward the request.
631       */
632      public void logCompareForwardFailure(final OperationContext opContext,
633                                           final CompareRequest request,
634                                           final ForwardTarget target,
635                                           final LDAPException failure)
636      {
637        // No action will be taken by default.
638      }
639    
640    
641    
642      /**
643       * Logs a message about the result of processing a compare request.
644       *
645       * @param  opContext  The operation context for the compare operation.
646       * @param  request    The compare request that was received.
647       * @param  result     The result of processing the compare request.
648       */
649      public void logCompareResponse(final CompletedOperationContext opContext,
650                                     final CompareRequest request,
651                                     final CompareResult result)
652      {
653        // No action will be taken by default.
654      }
655    
656    
657    
658      /**
659       * Logs a message about a delete request received from a client.
660       *
661       * @param  opContext  The operation context for the delete operation.
662       * @param  request    The delete request that was received.
663       */
664      public void logDeleteRequest(final OperationContext opContext,
665                                   final DeleteRequest request)
666      {
667        // No action will be taken by default.
668      }
669    
670    
671    
672      /**
673       * Logs a message about a delete request that will be forwarded to another
674       * server.
675       *
676       * @param  opContext  The operation context for the delete operation.
677       * @param  request    The delete request that was received.
678       * @param  target     Information about the server to which the request will
679       *                    be forwarded.
680       */
681      public void logDeleteForward(final OperationContext opContext,
682                                   final DeleteRequest request,
683                                   final ForwardTarget target)
684      {
685        // No action will be taken by default.
686      }
687    
688    
689    
690      /**
691       * Logs a message about a failure encountered while attempting to forward a
692       * delete request to another server.
693       *
694       * @param  opContext  The operation context for the delete operation.
695       * @param  request    The delete request that was received.
696       * @param  target     Information about the server to which the request was
697       *                    forwarded.
698       * @param  failure    The exception that was received when attempting to
699       *                    forward the request.
700       */
701      public void logDeleteForwardFailure(final OperationContext opContext,
702                                          final DeleteRequest request,
703                                          final ForwardTarget target,
704                                          final LDAPException failure)
705      {
706        // No action will be taken by default.
707      }
708    
709    
710    
711      /**
712       * Logs a message about the result of processing a delete request.
713       *
714       * @param  opContext  The operation context for the delete operation.
715       * @param  request    The delete request that was received.
716       * @param  result     The result of processing the delete request.
717       */
718      public void logDeleteResponse(final CompletedOperationContext opContext,
719                                    final DeleteRequest request,
720                                    final DeleteResult result)
721      {
722        // No action will be taken by default.
723      }
724    
725    
726    
727      /**
728       * Logs a message about the result of replication assurance processing for a
729       * delete operation.
730       *
731       * @param  opContext        The operation context for the delete operation.
732       * @param  request          The delete request that was received.
733       * @param  result           The result of processing the delete request.
734       * @param  assuranceResult  The replication assurance processing result.
735       */
736      public void logDeleteAssuranceCompleted(
737                       final CompletedOperationContext opContext,
738                       final DeleteRequest request, final DeleteResult result,
739                       final AssuredReplicationResult assuranceResult)
740      {
741        // No action will be taken by default.
742      }
743    
744    
745    
746      /**
747       * Logs a message about an extended request received from a client.
748       *
749       * @param  opContext  The operation context for the extended operation.
750       * @param  request    The extended request that was received.
751       */
752      public void logExtendedRequest(final OperationContext opContext,
753                                     final ExtendedRequest request)
754      {
755        // No action will be taken by default.
756      }
757    
758    
759    
760      /**
761       * Logs a message about an extended request that will be forwarded to another
762       * server.
763       *
764       * @param  opContext  The operation context for the extended operation.
765       * @param  request    The extended request that was received.
766       * @param  target     Information about the server to which the request will
767       *                    be forwarded.
768       */
769      public void logExtendedForward(final OperationContext opContext,
770                                     final ExtendedRequest request,
771                                     final ForwardTarget target)
772      {
773        // No action will be taken by default.
774      }
775    
776    
777    
778      /**
779       * Logs a message about a failure encountered while attempting to forward an
780       * extended request to another server.
781       *
782       * @param  opContext  The operation context for the extended operation.
783       * @param  request    The extended request that was received.
784       * @param  target     Information about the server to which the request was
785       *                    forwarded.
786       * @param  failure    The exception that was received when attempting to
787       *                    forward the request.
788       */
789      public void logExtendedForwardFailure(final OperationContext opContext,
790                                            final ExtendedRequest request,
791                                            final ForwardTarget target,
792                                            final LDAPException failure)
793      {
794        // No action will be taken by default.
795      }
796    
797    
798    
799      /**
800       * Logs a message about the result of processing an extended request.
801       *
802       * @param  opContext  The operation context for the extended operation.
803       * @param  request    The extended request that was received.
804       * @param  result     The result of processing the extended request.
805       */
806      public void logExtendedResponse(final CompletedOperationContext opContext,
807                                      final ExtendedRequest request,
808                                      final ExtendedResult result)
809      {
810        // No action will be taken by default.
811      }
812    
813    
814    
815      /**
816       * Logs a message about a modify request received from a client.
817       *
818       * @param  opContext  The operation context for the modify operation.
819       * @param  request    The modify request that was received.
820       */
821      public void logModifyRequest(final OperationContext opContext,
822                                   final ModifyRequest request)
823      {
824        // No action will be taken by default.
825      }
826    
827    
828    
829      /**
830       * Logs a message about a modify request that will be forwarded to another
831       * server.
832       *
833       * @param  opContext  The operation context for the modify operation.
834       * @param  request    The modify request that was received.
835       * @param  target     Information about the server to which the request will
836       *                    be forwarded.
837       */
838      public void logModifyForward(final OperationContext opContext,
839                                   final ModifyRequest request,
840                                   final ForwardTarget target)
841      {
842        // No action will be taken by default.
843      }
844    
845    
846    
847      /**
848       * Logs a message about a failure encountered while attempting to forward a
849       * modify request to another server.
850       *
851       * @param  opContext  The operation context for the modify operation.
852       * @param  request    The modify request that was received.
853       * @param  target     Information about the server to which the request was
854       *                    forwarded.
855       * @param  failure    The exception that was received when attempting to
856       *                    forward the request.
857       */
858      public void logModifyForwardFailure(final OperationContext opContext,
859                                          final ModifyRequest request,
860                                          final ForwardTarget target,
861                                          final LDAPException failure)
862      {
863        // No action will be taken by default.
864      }
865    
866    
867    
868      /**
869       * Logs a message about the result of processing a modify request.
870       *
871       * @param  opContext  The operation context for the modify operation.
872       * @param  request    The modify request that was received.
873       * @param  result     The result of processing the modify request.
874       */
875      public void logModifyResponse(final CompletedOperationContext opContext,
876                                    final ModifyRequest request,
877                                    final ModifyResult result)
878      {
879        // No action will be taken by default.
880      }
881    
882    
883    
884      /**
885       * Logs a message about the result of replication assurance processing for a
886       * modify operation.
887       *
888       * @param  opContext        The operation context for the modify operation.
889       * @param  request          The modify request that was received.
890       * @param  result           The result of processing the modify request.
891       * @param  assuranceResult  The replication assurance processing result.
892       */
893      public void logModifyAssuranceCompleted(
894                       final CompletedOperationContext opContext,
895                       final ModifyRequest request, final ModifyResult result,
896                       final AssuredReplicationResult assuranceResult)
897      {
898        // No action will be taken by default.
899      }
900    
901    
902    
903      /**
904       * Logs a message about a modify DN request received from a client.
905       *
906       * @param  opContext  The operation context for the modify DN operation.
907       * @param  request    The modify DN request that was received.
908       */
909      public void logModifyDNRequest(final OperationContext opContext,
910                                     final ModifyDNRequest request)
911      {
912        // No action will be taken by default.
913      }
914    
915    
916    
917      /**
918       * Logs a message about a modify DN request that will be forwarded to another
919       * server.
920       *
921       * @param  opContext  The operation context for the modify DN operation.
922       * @param  request    The modify DN request that was received.
923       * @param  target     Information about the server to which the request will
924       *                    be forwarded.
925       */
926      public void logModifyDNForward(final OperationContext opContext,
927                                     final ModifyDNRequest request,
928                                     final ForwardTarget target)
929      {
930        // No action will be taken by default.
931      }
932    
933    
934    
935      /**
936       * Logs a message about a failure encountered while attempting to forward a
937       * modify DN request to another server.
938       *
939       * @param  opContext  The operation context for the modify DN operation.
940       * @param  request    The modify DN request that was received.
941       * @param  target     Information about the server to which the request was
942       *                    forwarded.
943       * @param  failure    The exception that was received when attempting to
944       *                    forward the request.
945       */
946      public void logModifyDNForwardFailure(final OperationContext opContext,
947                                            final ModifyDNRequest request,
948                                            final ForwardTarget target,
949                                            final LDAPException failure)
950      {
951        // No action will be taken by default.
952      }
953    
954    
955    
956      /**
957       * Logs a message about the result of processing a modify DN request.
958       *
959       * @param  opContext  The operation context for the modify DN operation.
960       * @param  request    The modify DN request that was received.
961       * @param  result     The result of processing the modify DN request.
962       */
963      public void logModifyDNResponse(final CompletedOperationContext opContext,
964                                      final ModifyDNRequest request,
965                                      final ModifyDNResult result)
966      {
967        // No action will be taken by default.
968      }
969    
970    
971    
972      /**
973       * Logs a message about the result of replication assurance processing for a
974       * modify DN operation.
975       *
976       * @param  opContext        The operation context for the modify DN operation.
977       * @param  request          The modify DN request that was received.
978       * @param  result           The result of processing the modify DN request.
979       * @param  assuranceResult  The replication assurance processing result.
980       */
981      public void logModifyDNAssuranceCompleted(
982                       final CompletedOperationContext opContext,
983                       final ModifyDNRequest request, final ModifyDNResult result,
984                       final AssuredReplicationResult assuranceResult)
985      {
986        // No action will be taken by default.
987      }
988    
989    
990    
991      /**
992       * Logs a message about a search request received from a client.
993       *
994       * @param  opContext  The operation context for the search operation.
995       * @param  request    The search request that was received.
996       */
997      public void logSearchRequest(final OperationContext opContext,
998                                   final SearchRequest request)
999      {
1000        // No action will be taken by default.
1001      }
1002    
1003    
1004    
1005      /**
1006       * Logs a message about a search request that will be forwarded to another
1007       * server.
1008       *
1009       * @param  opContext  The operation context for the search operation.
1010       * @param  request    The search request that was received.
1011       * @param  target     Information about the server to which the request will
1012       *                    be forwarded.
1013       */
1014      public void logSearchForward(final OperationContext opContext,
1015                                   final SearchRequest request,
1016                                   final ForwardTarget target)
1017      {
1018        // No action will be taken by default.
1019      }
1020    
1021    
1022    
1023      /**
1024       * Logs a message about a failure encountered while attempting to forward a
1025       * search request to another server.
1026       *
1027       * @param  opContext  The operation context for the search operation.
1028       * @param  request    The search request that was received.
1029       * @param  target     Information about the server to which the request was
1030       *                    forwarded.
1031       * @param  failure    The exception that was received when attempting to
1032       *                    forward the request.
1033       */
1034      public void logSearchForwardFailure(final OperationContext opContext,
1035                                          final SearchRequest request,
1036                                          final ForwardTarget target,
1037                                          final LDAPException failure)
1038      {
1039        // No action will be taken by default.
1040      }
1041    
1042    
1043    
1044      /**
1045       * Logs a message about a search result entry that was returned to the client.
1046       *
1047       * @param  opContext  The operation context for the search operation.
1048       * @param  request    The search request that was received.
1049       * @param  entry      The entry that was returned.
1050       * @param  controls   The set of controls included with the entry, or an empty
1051       *                    list if there were none.
1052       */
1053      public void logSearchResultEntry(final OperationContext opContext,
1054                                       final SearchRequest request,
1055                                       final Entry entry,
1056                                       final List<Control> controls)
1057      {
1058        // No action will be taken by default.
1059      }
1060    
1061    
1062    
1063      /**
1064       * Logs a message about a search result reference that was returned to the
1065       * client.
1066       *
1067       * @param  opContext     The operation context for the search operation.
1068       * @param  request       The search request that was received.
1069       * @param  referralURLs  The referral URLs for the reference that was
1070       *                       returned.
1071       * @param  controls      The set of controls included with the reference, or
1072       *                       an empty list if there were none.
1073       */
1074      public void logSearchResultReference(final OperationContext opContext,
1075                                           final SearchRequest request,
1076                                           final List<String> referralURLs,
1077                                           final List<Control> controls)
1078      {
1079        // No action will be taken by default.
1080      }
1081    
1082    
1083    
1084      /**
1085       * Logs a message about the result of processing a search request.
1086       *
1087       * @param  opContext  The operation context for the search operation.
1088       * @param  request    The search request that was received.
1089       * @param  result     The result of processing the search request.
1090       */
1091      public void logSearchResultDone(
1092                       final CompletedSearchOperationContext opContext,
1093                       final SearchRequest request, final SearchResult result)
1094      {
1095        // No action will be taken by default.
1096      }
1097    
1098    
1099    
1100      /**
1101       * Logs a message about an unbind request received from a client.
1102       *
1103       * @param  opContext  The operation context for the unbind operation.
1104       * @param  request    The unbind request that was received.
1105       */
1106      public void logUnbindRequest(final OperationContext opContext,
1107                                   final UnbindRequest request)
1108      {
1109        // No action will be taken by default.
1110      }
1111    
1112    
1113    
1114      /**
1115       * Logs a message about an intermediate response that was returned to the
1116       * client.
1117       *
1118       * @param  opContext             The operation context for the associated
1119       *                               operation.
1120       * @param  intermediateResponse  The intermediate response that was returned.
1121       */
1122      public void logIntermediateResponse(final OperationContext opContext,
1123                       final IntermediateResponse intermediateResponse)
1124      {
1125        // No action will be taken by default.
1126      }
1127    
1128    
1129    
1130      /**
1131       * Writes a message to the access logger to indicate that the Directory Proxy
1132       * Server will attempt to perform entry rebalancing by migrating a subtree
1133       * from one backend set to another.
1134       *
1135       * @param  rebalancingOperationID  The unique ID assigned to the entry
1136       *                                 balancing operation.
1137       * @param  triggerOperation        The operation that triggered the entry
1138       *                                 rebalancing.  It may be {@code null} if the
1139       *                                 rebalancing operation wasn't triggered by a
1140       *                                 client request.
1141       * @param  baseDN                  The base DN of the subtree to migrate.
1142       * @param  sizeLimit               The maximum number of entries to migrate.
1143       * @param  sourceBackendSetName    The name of the backend set containing the
1144       *                                 subtree to migrate.
1145       * @param  sourceAddress           The address of the server from which the
1146       *                                 source entries will be read.
1147       * @param  sourcePort              The port of the server from which the
1148       *                                 source entries will be read.
1149       * @param  targetBackendSetName    The name of the backend set to which the
1150       *                                 subtree will be migrated.
1151       * @param  targetAddress           The address of the server to which the
1152       *                                 subtree will be migrated.
1153       * @param  targetPort              The port of the server to which the subtree
1154       *                                 will be migrated.
1155       */
1156      public void logEntryRebalancingRequest(final long rebalancingOperationID,
1157                       final OperationContext triggerOperation, final String baseDN,
1158                       final int sizeLimit, final String sourceBackendSetName,
1159                       final String sourceAddress, final int sourcePort,
1160                       final String targetBackendSetName,
1161                       final String targetAddress, final int targetPort)
1162      {
1163        // No action performed by default.
1164      }
1165    
1166    
1167    
1168      /**
1169       * Writes a message to the access logger to indicate that the Directory Proxy
1170       * Server will attempt to perform entry rebalancing by migrating a subtree
1171       * from one backend set to another.
1172       *
1173       * @param  rebalancingOperationID  The unique ID assigned to the entry
1174       *                                 balancing operation.
1175       * @param  triggerOperation        The operation that triggered the entry
1176       *                                 rebalancing.  It may be {@code null} if the
1177       *                                 rebalancing operation wasn't triggered by a
1178       *                                 client request.
1179       * @param  baseDN                  The base DN of the subtree to migrate.
1180       * @param  sizeLimit               The maximum number of entries to migrate.
1181       * @param  sourceBackendSetName    The name of the backend set containing the
1182       *                                 subtree to migrate.
1183       * @param  sourceAddress           The address of the server from which the
1184       *                                 source entries will be read.
1185       * @param  sourcePort              The port of the server from which the
1186       *                                 source entries will be read.
1187       * @param  targetBackendSetName    The name of the backend set to which the
1188       *                                 subtree will be migrated.
1189       * @param  targetAddress           The address of the server to which the
1190       *                                 subtree will be migrated.
1191       * @param  targetPort              The port of the server to which the subtree
1192       *                                 will be migrated.
1193       * @param  moveSubtreeResult       An object with information about the result
1194       *                                 of the subtree move processing.
1195       */
1196      public void logEntryRebalancingResult(final long rebalancingOperationID,
1197                       final OperationContext triggerOperation, final String baseDN,
1198                       final int sizeLimit, final String sourceBackendSetName,
1199                       final String sourceAddress, final int sourcePort,
1200                       final String targetBackendSetName,
1201                       final String targetAddress, final int targetPort,
1202                       final MoveSubtreeResult moveSubtreeResult)
1203      {
1204        // No action performed by default.
1205      }
1206    }