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-2018 Ping Identity Corporation
026 */
027package com.unboundid.directory.sdk.ds.scripting;
028
029
030
031import java.util.List;
032import java.util.Set;
033
034import com.unboundid.directory.sdk.common.internal.Reconfigurable;
035import com.unboundid.directory.sdk.common.operation.AddRequest;
036import com.unboundid.directory.sdk.common.operation.AddResult;
037import com.unboundid.directory.sdk.common.operation.BindResult;
038import com.unboundid.directory.sdk.common.operation.CompareRequest;
039import com.unboundid.directory.sdk.common.operation.CompareResult;
040import com.unboundid.directory.sdk.common.operation.DeleteRequest;
041import com.unboundid.directory.sdk.common.operation.DeleteResult;
042import com.unboundid.directory.sdk.common.operation.ExtendedRequest;
043import com.unboundid.directory.sdk.common.operation.ExtendedResult;
044import com.unboundid.directory.sdk.common.operation.ModifyRequest;
045import com.unboundid.directory.sdk.common.operation.ModifyResult;
046import com.unboundid.directory.sdk.common.operation.ModifyDNRequest;
047import com.unboundid.directory.sdk.common.operation.ModifyDNResult;
048import com.unboundid.directory.sdk.common.operation.SASLBindRequest;
049import com.unboundid.directory.sdk.common.operation.SearchRequest;
050import com.unboundid.directory.sdk.common.operation.SearchResult;
051import com.unboundid.directory.sdk.common.operation.SimpleBindRequest;
052import com.unboundid.directory.sdk.common.operation.UpdatableAbandonRequest;
053import com.unboundid.directory.sdk.common.operation.UpdatableAddRequest;
054import com.unboundid.directory.sdk.common.operation.UpdatableAddResult;
055import com.unboundid.directory.sdk.common.operation.UpdatableBindResult;
056import com.unboundid.directory.sdk.common.operation.UpdatableCompareRequest;
057import com.unboundid.directory.sdk.common.operation.UpdatableCompareResult;
058import com.unboundid.directory.sdk.common.operation.UpdatableDeleteRequest;
059import com.unboundid.directory.sdk.common.operation.UpdatableDeleteResult;
060import com.unboundid.directory.sdk.common.operation.UpdatableExtendedRequest;
061import com.unboundid.directory.sdk.common.operation.UpdatableExtendedResult;
062import com.unboundid.directory.sdk.common.operation.UpdatableGenericResult;
063import com.unboundid.directory.sdk.common.operation.UpdatableModifyRequest;
064import com.unboundid.directory.sdk.common.operation.UpdatableModifyResult;
065import com.unboundid.directory.sdk.common.operation.UpdatableModifyDNRequest;
066import com.unboundid.directory.sdk.common.operation.UpdatableModifyDNResult;
067import com.unboundid.directory.sdk.common.operation.UpdatableSASLBindRequest;
068import com.unboundid.directory.sdk.common.operation.UpdatableSearchRequest;
069import com.unboundid.directory.sdk.common.operation.UpdatableSearchResult;
070import com.unboundid.directory.sdk.common.operation.UpdatableSimpleBindRequest;
071import com.unboundid.directory.sdk.common.operation.UpdatableUnbindRequest;
072import com.unboundid.directory.sdk.common.types.ActiveOperationContext;
073import com.unboundid.directory.sdk.common.types.ActiveSearchOperationContext;
074import com.unboundid.directory.sdk.common.types.ClientContext;
075import com.unboundid.directory.sdk.common.types.CompletedOperationContext;
076import com.unboundid.directory.sdk.common.types.CompletedSearchOperationContext;
077import com.unboundid.directory.sdk.common.types.DisconnectReason;
078import com.unboundid.directory.sdk.common.types.Entry;
079import com.unboundid.directory.sdk.common.types.UpdatableEntry;
080import com.unboundid.directory.sdk.ds.config.PluginConfig;
081import com.unboundid.directory.sdk.ds.types.DirectoryServerContext;
082import com.unboundid.directory.sdk.ds.types.IntermediateResponsePluginResult;
083import com.unboundid.directory.sdk.ds.types.LDIFPluginResult;
084import com.unboundid.directory.sdk.ds.types.PostConnectPluginResult;
085import com.unboundid.directory.sdk.ds.types.PostDisconnectPluginResult;
086import com.unboundid.directory.sdk.ds.types.PostOperationPluginResult;
087import com.unboundid.directory.sdk.ds.types.PostResponsePluginResult;
088import com.unboundid.directory.sdk.ds.types.PreOperationPluginResult;
089import com.unboundid.directory.sdk.ds.types.PreParsePluginResult;
090import com.unboundid.directory.sdk.ds.types.SearchEntryPluginResult;
091import com.unboundid.directory.sdk.ds.types.SearchReferencePluginResult;
092import com.unboundid.directory.sdk.ds.types.StartupDependency;
093import com.unboundid.directory.sdk.ds.types.StartupPluginResult;
094import com.unboundid.directory.sdk.ds.types.SubordinateModifyDNPluginResult;
095import com.unboundid.directory.sdk.proxy.internal.DirectoryProxyServerExtension;
096import com.unboundid.directory.sdk.ds.internal.DirectoryServerExtension;
097import com.unboundid.directory.sdk.sync.internal.SynchronizationServerExtension;
098import com.unboundid.ldap.sdk.Control;
099import com.unboundid.ldap.sdk.IntermediateResponse;
100import com.unboundid.ldap.sdk.LDAPException;
101import com.unboundid.ldap.sdk.Modification;
102import com.unboundid.ldap.sdk.ResultCode;
103import com.unboundid.util.Extensible;
104import com.unboundid.util.ThreadSafety;
105import com.unboundid.util.ThreadSafetyLevel;
106import com.unboundid.util.args.ArgumentException;
107import com.unboundid.util.args.ArgumentParser;
108
109
110
111/**
112 * This class defines an API that must be implemented by scripted extensions
113 * which act as server plugins.  There are several different kinds of plugins
114 * which may be invoked for different purposes, including:
115 * <UL>
116 *   <LI>startup -- Startup plugins may be used to perform custom processing
117 *       when the server is in the process of staring up.  By default, the
118 *       processing will be performed near the end of the startup phase just
119 *       before the server begins to accept connections from external clients,
120 *       but if one or more startup dependencies are defined, then the plugin
121 *       may be invoked earlier in the startup process as soon as all declared
122 *       dependencies have been satisfied.</LI>
123 *   <LI>shutdown -- Shutdown plugins may be used to perform custom processing
124 *       when the server is in the process of shutting down.  This will occur
125 *       near the beginning of the shutdown process, just after the server stops
126 *       accepting new client connections and terminates existing connections
127 *       but before shutting down any other components.  Note that shutdown
128 *       plugins may not always be invoked in some unusual shutdown scenarios
129 *       (e.g., if the server process is forcefully killed, or in the event of a
130 *       hardware, OS, or JVM failure).</LI>
131 *   <LI>LDIF import -- LDIF import plugins are invoked for each entry read from
132 *       an LDIF file to be imported into a backend.  It is possible to alter
133 *       the contents of the entry or to cause the entry to be excluded from the
134 *       import.</LI>
135 *   <LI>LDIF export -- LDIF export plugins are invoked for each entry exported
136 *       from a backend to be written to an LDIF file.  It is possible to alter
137 *       the contents of the entry or to cause the entry to be excluded from the
138 *       export.</LI>
139 *   <LI>post-connect -- Post-connect plugins are invoked during the course of
140 *       accepting a new client connection.  They may access information about
141 *       the client and may optionally terminate the client connection if it is
142 *       deemed appropriate.</LI>
143 *   <LI>post-disconnect -- Post-disconnect plugins are invoked after a client
144 *       connection has been closed, regardless of whether the closure was
145 *       initiated by the client (e.g., because of an unbind request or simply
146 *       closing the socket) or by the server (e.g., because the connection had
147 *       been idle for too long or because the client violated some server-side
148 *       constraint.</LI>
149 *   <LI>pre-parse -- Pre-parse plugins are invoked just after the server has
150 *       received an abandon, add, bind, compare, delete, extended, modify,
151 *       modify DN, search, or unbind request.  They may be used to obtain
152 *       information about the requests, alter the contents of the request or
153 *       prevent the server from processing the request.
154 *   <LI>pre-operation -- Pre-operation plugins are invoked for add, bind,
155 *       compare, delete, extended, modify, modify DN, and search operations
156 *       after some level of validation has been performed but just before the
157 *       core processing for the operation.  They may not be used to alter the
158 *       request, but they may still be used to obtain information about the
159 *       request or to prevent the operation from being processed.</LI>
160 *   <LI>post-operation -- Post-operation plugins are invoked for add, bind,
161 *       compare, delete, extended, modify, modify DN, and search operations
162 *       after most processing has completed for the operation but before the
163 *       result has been returned to the client.  They may be used to obtain
164 *       information about the result or to alter the contents of the result to
165 *       be returned.</LI>
166 *   <LI>post-response -- Post-response plugins are invoked for add, bind,
167 *       compare, delete, extended, modify, modify DN, and search operations
168 *       after the response has already been sent to the client.  They may be
169 *       used to perform processing for operations without delaying the response
170 *       to the client.</LI>
171 *   <LI>post-replication -- Post-replication plugins are invoked for add,
172 *       delete, modify, and modify DN operations that have been received and
173 *       processed via replication.  They may be used to obtain information or
174 *       perform processing for replicated changes, but may not alter those
175 *       changes.</LI>
176 *   <LI>search result entry -- Search result entry plugins are invoked for each
177 *       entry to be returned to the client during the course of processing a
178 *       search operation.  They may obtain information about the entry to be
179 *       returned, alter the entry contents, or prevent the entry from being
180 *       returned.</LI>
181 *   <LI>search result reference -- Search result reference plugins are invoked
182 *       for each reference to be returned to the client during the course of
183 *       processing a search operation.  They may obtain information about the
184 *       reference to be returned, alter the referral URLs to be returned, or
185 *       prevent the reference from being returned.</LI>
186 *   <LI>subordinate modify DN -- Subordinate modify DN plugins are invoked for
187 *       each entry below the target entry being renamed in the course of a
188 *       modify DN operation.  They may be used to obtain information about the
189 *       subordinate entry to be renamed and optionally to alter the contents
190 *       of that entry.</LI>
191 *   <LI>intermediate response -- Intermediate response plugins are invoked for
192 *       each intermediate response to be returned to the client.  They may be
193 *       used to obtain information about the response or to prevent it from
194 *       being returned to the client.</LI>
195 * </UL>
196 * <BR><BR>
197 * A single plugin instance may be configured to act in any combination of these
198 * contexts.  For example, a plugin may be configured to operate during both
199 * LDIF import and pre-parse add contexts so that it can transform the contents
200 * of entries whether regardless of the way they are inserted into the backend.
201 * <BR>
202 * <H2>Configuring Groovy-Scripted Plugins</H2>
203 * In order to configure a scripted plugin based on this API and written in the
204 * Groovy scripting language, use a command like:
205 * <PRE>
206 *      dsconfig create-plugin \
207 *           --plugin-name "<I>{plugin-name}</I>" \
208 *           --type groovy-scripted \
209 *           --set enabled:true \
210 *           --set plugin-type:{plugin-type} \
211 *           --set "script-class:<I>{class-name}</I>" \
212 *           --set "script-argument:<I>{name=value}</I>"
213 * </PRE>
214 * where "<I>{plugin-name}</I>" is the name to use for the plugin instance,
215 * "<I>{plugin-type}</I>" is the name of a plugin type for which the plugin
216 * should be invoked,  "<I>{class-name}</I>" is the fully-qualified name of the
217 * Groovy class written using this API, and "<I>{name=value}</I>" represents
218 * name-value pairs for any arguments to provide to the plugin.  If the plugin
219 * should be invoked for multiple plugin types, then the
220 * "<CODE>--set plugin-type:<I>{plugin-type}</I></CODE>" option should be
221 * provided multiple times.  Similarly, if multiple arguments should be provided
222 * to the plugin, then the
223 * "<CODE>--set script-argument:<I>{name=value}</I></CODE>" option should be
224 * provided multiple times.
225 *
226 * @see  com.unboundid.directory.sdk.ds.api.Plugin
227 */
228@Extensible()
229@DirectoryServerExtension()
230@DirectoryProxyServerExtension(appliesToLocalContent=true,
231     appliesToRemoteContent=true,
232     notes="Some plugin types will not be invoked for proxied operations, " +
233          "including pre-operation, post-operation, search result entry, " +
234          "search result reference, intermediate response, and subordinate " +
235          "modify DN.  A proxy transformation may be used to achieve the " +
236          "same result in many cases.")
237@SynchronizationServerExtension(appliesToLocalContent=true,
238     appliesToSynchronizedContent=false)
239@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
240public abstract class ScriptedPlugin
241       implements Reconfigurable<PluginConfig>
242{
243  /**
244   * Creates a new instance of this plugin.  All plugin implementations must
245   * include a default constructor, but any initialization should generally be
246   * done in the {@code initializePlugin} method.
247   */
248  public ScriptedPlugin()
249  {
250    // No implementation is required.
251  }
252
253
254
255  /**
256   * {@inheritDoc}
257   */
258  public void defineConfigArguments(final ArgumentParser parser)
259         throws ArgumentException
260  {
261    // No arguments will be allowed by default.
262  }
263
264
265
266  /**
267   * Initializes this plugin.
268   *
269   * @param  serverContext  A handle to the server context for the server in
270   *                        which this extension is running.
271   * @param  config         The general configuration for this plugin.
272   * @param  parser         The argument parser which has been initialized from
273   *                        the configuration for this plugin.
274   *
275   * @throws  LDAPException  If a problem occurs while initializing this plugin.
276   */
277  public void initializePlugin(final DirectoryServerContext serverContext,
278                               final PluginConfig config,
279                               final ArgumentParser parser)
280         throws LDAPException
281  {
282    // No initialization will be performed by default.
283  }
284
285
286
287  /**
288   * Performs any cleanup which may be necessary when this plugin is to be taken
289   * out of service.
290   */
291  public void finalizePlugin()
292  {
293    // No implementation is required.
294  }
295
296
297
298  /**
299   * {@inheritDoc}
300   */
301  public boolean isConfigurationAcceptable(final PluginConfig config,
302                      final ArgumentParser parser,
303                      final List<String> unacceptableReasons)
304  {
305    // No extended validation will be performed.
306    return true;
307  }
308
309
310
311  /**
312   * {@inheritDoc}
313   */
314  public ResultCode applyConfiguration(final PluginConfig config,
315                                       final ArgumentParser parser,
316                                       final List<String> adminActionsRequired,
317                                       final List<String> messages)
318  {
319    // By default, no configuration changes will be applied.  If there are any
320    // arguments, then add an admin action message indicating that the extension
321    // needs to be restarted for any changes to take effect.
322    if (! parser.getNamedArguments().isEmpty())
323    {
324      adminActionsRequired.add(
325           "No configuration change has actually been applied.  The new " +
326                "configuration will not take effect until this plugin is " +
327                "disabled and re-enabled or until the server is restarted.");
328    }
329
330    return ResultCode.SUCCESS;
331  }
332
333
334
335  /**
336   * Retrieves the set of startup dependencies which must be resolved in order
337   * for this plugin to be invoked at server startup.  This is only applicable
338   * for startup plugins, in which case it may be possible to have the plugin
339   * startup processing invoked as early as possible.  If it returns
340   * {@code null} then startup processing for this plugin will be performed at
341   * the default time during startup.
342   *
343   * @return  The set of startup dependencies for this plugin, or {@code null}
344   *          if it is not a startup plugin, or if startup processing should be
345   *          invoked at the default time during server startup.
346   */
347  public Set<StartupDependency> getStartupDependencies()
348  {
349    return null;
350  }
351
352
353
354  /**
355   * Performs any processing which may be necessary when the server is starting.
356   *
357   * @return  Information about the result of the plugin processing.
358   */
359  public StartupPluginResult doStartup()
360  {
361    // No processing is performed by default.
362    return StartupPluginResult.SUCCESS;
363  }
364
365
366
367  /**
368   * Performs any processing which may be necessary when the server is shutting
369   * down.
370   *
371   * @param  shutdownReason  A message which may provide information about the
372   *                         reason the server is shutting down.
373   */
374  public void doShutdown(final String shutdownReason)
375  {
376    // No processing is performed by default.
377  }
378
379
380
381  /**
382   * Performs any processing which may be necessary for the provided entry to
383   * be imported into the server.
384   *
385   * @param  entry  The entry to be imported.  It may be altered if desired.
386   *
387   * @return  Information about the result of the plugin processing.
388   */
389  public LDIFPluginResult doLDIFImport(final UpdatableEntry entry)
390  {
391    // No processing is performed by default.
392    return LDIFPluginResult.SUCCESS;
393  }
394
395
396
397  /**
398   * Performs any processing which may be necessary for the provided entry to
399   * be exported from the server.
400   *
401   * @param  entry  The entry to be exported.  It may be altered if desired.
402   *
403   * @return  Information about the result of the plugin processing.
404   */
405  public LDIFPluginResult doLDIFExport(final UpdatableEntry entry)
406  {
407    // No processing is performed by default.
408    return LDIFPluginResult.SUCCESS;
409  }
410
411
412
413  /**
414   * Performs any processing which may be necessary when the server has accepted
415   * a new client connection.
416   *
417   * @param  clientContext  Information about the client connection that has
418   *                        been established.
419   *
420   * @return  Information about the result of the plugin processing.
421   */
422  public PostConnectPluginResult doPostConnect(
423                                      final ClientContext clientContext)
424  {
425    // No processing is performed by default.
426    return PostConnectPluginResult.SUCCESS;
427  }
428
429
430
431  /**
432   * Performs any processing which may be necessary when the server has
433   * terminated a client connection.
434   *
435   * @param  clientContext     Information about the client connection that has
436   *                           been established.
437   * @param  disconnectReason  A general reason for the disconnect.
438   * @param  message           A message which may provide additional
439   *                           information about the disconnect.  It may be
440   *                           {@code null} if none is available.
441   *
442   * @return  Information about the result of the plugin processing.
443   */
444  public PostDisconnectPluginResult doPostDisconnect(
445              final ClientContext clientContext,
446              final DisconnectReason disconnectReason, final String message)
447  {
448    // No processing is performed by default.
449    return PostDisconnectPluginResult.SUCCESS;
450  }
451
452
453
454  /**
455   * Performs any processing which may be necessary before the server starts
456   * processing for an abandon request.
457   *
458   * @param  operationContext  The context for the abandon operation.
459   * @param  request           The abandon request to be processed.  It may be
460   *                           altered if desired.
461   *
462   * @return  Information about the result of the plugin processing.
463   */
464  public PreParsePluginResult doPreParse(
465              final ActiveOperationContext operationContext,
466              final UpdatableAbandonRequest request)
467  {
468    // No processing is performed by default.
469    return PreParsePluginResult.SUCCESS;
470  }
471
472
473
474  /**
475   * Performs any processing which may be necessary before the server starts
476   * processing for an add request.  This will be invoked only for add
477   * operations requested directly by clients, but not for add operations
478   * received from another server via replication.
479   *
480   * @param  operationContext  The context for the add operation.
481   * @param  request           The add request to be processed.  It may be
482   *                           altered if desired.
483   * @param  result            The result that will be returned to the client if
484   *                           the plugin result indicates that processing on
485   *                           the operation should be interrupted.  It may be
486   *                           altered if desired.
487   *
488   * @return  Information about the result of the plugin processing.
489   */
490  public PreParsePluginResult doPreParse(
491              final ActiveOperationContext operationContext,
492              final UpdatableAddRequest request,
493              final UpdatableAddResult result)
494  {
495    // No processing is performed by default.
496    return PreParsePluginResult.SUCCESS;
497  }
498
499
500
501  /**
502   * Performs any processing which may be necessary before the server actually
503   * attempts to add an entry to the appropriate backend.  This will be invoked
504   * only for add operations requested directly by clients, but not for add
505   * operations received from another server via replication.
506   *
507   * @param  operationContext  The context for the add operation.
508   * @param  request           The add request to be processed.
509   * @param  result            The result that will be returned to the client if
510   *                           the plugin result indicates that processing on
511   *                           the operation should be interrupted.  It may be
512   *                           altered if desired.
513   *
514   * @return  Information about the result of the plugin processing.
515   */
516  public PreOperationPluginResult doPreOperation(
517              final ActiveOperationContext operationContext,
518              final AddRequest request, final UpdatableAddResult result)
519  {
520    // No processing is performed by default.
521    return PreOperationPluginResult.SUCCESS;
522  }
523
524
525
526  /**
527   * Performs any processing which may be necessary before the server sends a
528   * response for an add operation.  This will be invoked only for add
529   * operations requested directly by clients, but not for add operations
530   * received from another server via replication.
531   *
532   * @param  operationContext  The context for the add operation.
533   * @param  request           The add request that was processed.
534   * @param  result            The result to be returned to the client.  It may
535   *                           be altered if desired.
536   *
537   * @return  Information about the result of the plugin processing.
538   */
539  public PostOperationPluginResult doPostOperation(
540              final ActiveOperationContext operationContext,
541              final AddRequest request, final UpdatableAddResult result)
542  {
543    // No processing is performed by default.
544    return PostOperationPluginResult.SUCCESS;
545  }
546
547
548
549  /**
550   * Performs any processing which may be necessary after all other processing
551   * has been completed for an add operation and the response has been sent to
552   * the client.  This will be invoked only for add operations requested
553   * directly by clients, but not for add operations received from another
554   * server via replication.
555   *
556   * @param  operationContext  The context for the add operation.
557   * @param  request           The add request that was processed.
558   * @param  result            The result that was returned to the client.
559   *
560   * @return  Information about the result of the plugin processing.
561   */
562  public PostResponsePluginResult doPostResponse(
563              final CompletedOperationContext operationContext,
564              final AddRequest request, final AddResult result)
565  {
566    // No processing is performed by default.
567    return PostResponsePluginResult.SUCCESS;
568  }
569
570
571
572  /**
573   * Performs any processing which may be necessary after all other processing
574   * has been completed for an add operation which has been received from
575   * another server via replication.
576   *
577   * @param  operationContext  The context for the add operation.
578   * @param  request           The add request that was processed.
579   * @param  result            The result that was returned to the client.
580   */
581  public void doPostReplication(
582                   final CompletedOperationContext operationContext,
583                   final AddRequest request, final AddResult result)
584  {
585    // No processing is performed by default.
586  }
587
588
589
590  /**
591   * Performs any processing which may be necessary before the server starts
592   * processing for a simple bind request.
593   *
594   * @param  operationContext  The context for the bind operation.
595   * @param  request           The bind request to be processed.  It may be
596   *                           altered if desired.
597   * @param  result            The result that will be returned to the client if
598   *                           the plugin result indicates that processing on
599   *                           the operation should be interrupted.  It may be
600   *                           altered if desired.
601   *
602   * @return  Information about the result of the plugin processing.
603   */
604  public PreParsePluginResult doPreParse(
605              final ActiveOperationContext operationContext,
606              final UpdatableSimpleBindRequest request,
607              final UpdatableBindResult result)
608  {
609    // No processing is performed by default.
610    return PreParsePluginResult.SUCCESS;
611  }
612
613
614
615  /**
616   * Performs any processing which may be necessary before the server actually
617   * attempts to perform the authentication for a simple bind request.
618   *
619   * @param  operationContext  The context for the bind operation.
620   * @param  request           The bind request to be processed.
621   * @param  result            The result that will be returned to the client if
622   *                           the plugin result indicates that processing on
623   *                           the operation should be interrupted.  It may be
624   *                           altered if desired.
625   *
626   * @return  Information about the result of the plugin processing.
627   */
628  public PreOperationPluginResult doPreOperation(
629              final ActiveOperationContext operationContext,
630              final SimpleBindRequest request,
631              final UpdatableBindResult result)
632  {
633    // No processing is performed by default.
634    return PreOperationPluginResult.SUCCESS;
635  }
636
637
638
639  /**
640   * Performs any processing which may be necessary before the server sends a
641   * response for a simple bind operation.
642   *
643   * @param  operationContext  The context for the bind operation.
644   * @param  request           The bind request that was processed.
645   * @param  result            The result to be returned to the client.  It may
646   *                           be altered if desired.
647   *
648   * @return  Information about the result of the plugin processing.
649   */
650  public PostOperationPluginResult doPostOperation(
651              final ActiveOperationContext operationContext,
652              final SimpleBindRequest request, final UpdatableBindResult result)
653  {
654    // No processing is performed by default.
655    return PostOperationPluginResult.SUCCESS;
656  }
657
658
659
660  /**
661   * Performs any processing which may be necessary after all other processing
662   * has been completed for a simple bind operation and the response has been
663   * sent to the client.
664   *
665   * @param  operationContext  The context for the bind operation.
666   * @param  request           The bind request that was processed.
667   * @param  result            The result that was returned to the client.
668   *
669   * @return  Information about the result of the plugin processing.
670   */
671  public PostResponsePluginResult doPostResponse(
672              final CompletedOperationContext operationContext,
673              final SimpleBindRequest request, final BindResult result)
674  {
675    // No processing is performed by default.
676    return PostResponsePluginResult.SUCCESS;
677  }
678
679
680
681  /**
682   * Performs any processing which may be necessary before the server starts
683   * processing for a SASL bind request.
684   *
685   * @param  operationContext  The context for the bind operation.
686   * @param  request           The bind request to be processed.  It may be
687   *                           altered if desired.
688   * @param  result            The result that will be returned to the client if
689   *                           the plugin result indicates that processing on
690   *                           the operation should be interrupted.  It may be
691   *                           altered if desired.
692   *
693   * @return  Information about the result of the plugin processing.
694   */
695  public PreParsePluginResult doPreParse(
696              final ActiveOperationContext operationContext,
697              final UpdatableSASLBindRequest request,
698              final UpdatableBindResult result)
699  {
700    // No processing is performed by default.
701    return PreParsePluginResult.SUCCESS;
702  }
703
704
705
706  /**
707   * Performs any processing which may be necessary before the server actually
708   * attempts to perform the authentication for a SASL bind request.
709   *
710   * @param  operationContext  The context for the bind operation.
711   * @param  request           The bind request to be processed.
712   * @param  result            The result that will be returned to the client if
713   *                           the plugin result indicates that processing on
714   *                           the operation should be interrupted.  It may be
715   *                           altered if desired.
716   *
717   * @return  Information about the result of the plugin processing.
718   */
719  public PreOperationPluginResult doPreOperation(
720              final ActiveOperationContext operationContext,
721              final SASLBindRequest request, final UpdatableBindResult result)
722  {
723    // No processing is performed by default.
724    return PreOperationPluginResult.SUCCESS;
725  }
726
727
728
729  /**
730   * Performs any processing which may be necessary before the server sends a
731   * response for a SASL bind operation.
732   *
733   * @param  operationContext  The context for the bind operation.
734   * @param  request           The bind request that was processed.
735   * @param  result            The result to be returned to the client.  It may
736   *                           be altered if desired.
737   *
738   * @return  Information about the result of the plugin processing.
739   */
740  public PostOperationPluginResult doPostOperation(
741              final ActiveOperationContext operationContext,
742              final SASLBindRequest request, final UpdatableBindResult result)
743  {
744    // No processing is performed by default.
745    return PostOperationPluginResult.SUCCESS;
746  }
747
748
749
750  /**
751   * Performs any processing which may be necessary after all other processing
752   * has been completed for a SASL bind operation and the response has been
753   * sent to the client.
754   *
755   * @param  operationContext  The context for the bind operation.
756   * @param  request           The bind request that was processed.
757   * @param  result            The result that was returned to the client.
758   *
759   * @return  Information about the result of the plugin processing.
760   */
761  public PostResponsePluginResult doPostResponse(
762              final CompletedOperationContext operationContext,
763              final SASLBindRequest request, final BindResult result)
764  {
765    // No processing is performed by default.
766    return PostResponsePluginResult.SUCCESS;
767  }
768
769
770
771  /**
772   * Performs any processing which may be necessary before the server starts
773   * processing for a compare request.
774   *
775   * @param  operationContext  The context for the compare operation.
776   * @param  request           The compare request to be processed.  It may be
777   *                           altered if desired.
778   * @param  result            The result that will be returned to the client if
779   *                           the plugin result indicates that processing on
780   *                           the operation should be interrupted.  It may be
781   *                           altered if desired.
782   *
783   * @return  Information about the result of the plugin processing.
784   */
785  public PreParsePluginResult doPreParse(
786              final ActiveOperationContext operationContext,
787              final UpdatableCompareRequest request,
788              final UpdatableCompareResult result)
789  {
790    // No processing is performed by default.
791    return PreParsePluginResult.SUCCESS;
792  }
793
794
795
796  /**
797   * Performs any processing which may be necessary before the server actually
798   * attempts to perform the core processing for the compare.
799   *
800   * @param  operationContext  The context for the compare operation.
801   * @param  request           The compare request to be processed.
802   * @param  result            The result that will be returned to the client if
803   *                           the plugin result indicates that processing on
804   *                           the operation should be interrupted.  It may be
805   *                           altered if desired.
806   * @param  entry             The entry targeted by the compare operation.
807   *
808   * @return  Information about the result of the plugin processing.
809   */
810  public PreOperationPluginResult doPreOperation(
811              final ActiveOperationContext operationContext,
812              final CompareRequest request, final UpdatableCompareResult result,
813              final Entry entry)
814  {
815    // No processing is performed by default.
816    return PreOperationPluginResult.SUCCESS;
817  }
818
819
820
821  /**
822   * Performs any processing which may be necessary before the server sends a
823   * response for a compare operation.
824   *
825   * @param  operationContext  The context for the compare operation.
826   * @param  request           The compare request that was processed.
827   * @param  result            The result to be returned to the client.  It may
828   *                           be altered if desired.
829   * @param  entry             The entry targeted by the compare operation, if
830   *                           it exists.
831   *
832   * @return  Information about the result of the plugin processing.
833   */
834  public PostOperationPluginResult doPostOperation(
835              final ActiveOperationContext operationContext,
836              final CompareRequest request, final UpdatableCompareResult result,
837              final Entry entry)
838  {
839    // No processing is performed by default.
840    return PostOperationPluginResult.SUCCESS;
841  }
842
843
844
845  /**
846   * Performs any processing which may be necessary after all other processing
847   * has been completed for a compare operation and the response has been sent
848   * to the client.
849   *
850   * @param  operationContext  The context for the compare operation.
851   * @param  request           The compare request that was processed.
852   * @param  result            The result that was returned to the client.
853   *
854   * @return  Information about the result of the plugin processing.
855   */
856  public PostResponsePluginResult doPostResponse(
857              final CompletedOperationContext operationContext,
858              final CompareRequest request, final CompareResult result)
859  {
860    // No processing is performed by default.
861    return PostResponsePluginResult.SUCCESS;
862  }
863
864
865
866  /**
867   * Performs any processing which may be necessary before the server starts
868   * processing for a delete request.  This will be invoked only for delete
869   * operations requested directly by clients, but not for delete operations
870   * received from another server via replication.
871   *
872   * @param  operationContext  The context for the delete operation.
873   * @param  request           The delete request to be processed.  It may be
874   *                           altered if desired.
875   * @param  result            The result that will be returned to the client if
876   *                           the plugin result indicates that processing on
877   *                           the operation should be interrupted.  It may be
878   *                           altered if desired.
879   *
880   * @return  Information about the result of the plugin processing.
881   */
882  public PreParsePluginResult doPreParse(
883              final ActiveOperationContext operationContext,
884              final UpdatableDeleteRequest request,
885              final UpdatableDeleteResult result)
886  {
887    // No processing is performed by default.
888    return PreParsePluginResult.SUCCESS;
889  }
890
891
892
893  /**
894   * Performs any processing which may be necessary before the server actually
895   * attempts to remove the entry from the server.  This will be invoked only
896   * for delete operations requested directly by clients, but not for delete
897   * operations received from another server via replication.
898
899   *
900   * @param  operationContext  The context for the delete operation.
901   * @param  request           The delete request to be processed.
902   * @param  result            The result that will be returned to the client if
903   *                           the plugin result indicates that processing on
904   *                           the operation should be interrupted.  It may be
905   *                           altered if desired.
906   * @param  entry             The entry targeted by the delete operation.
907   *
908   * @return  Information about the result of the plugin processing.
909   */
910  public PreOperationPluginResult doPreOperation(
911              final ActiveOperationContext operationContext,
912              final DeleteRequest request, final UpdatableDeleteResult result,
913              final Entry entry)
914  {
915    // No processing is performed by default.
916    return PreOperationPluginResult.SUCCESS;
917  }
918
919
920
921  /**
922   * Performs any processing which may be necessary before the server sends a
923   * response for a delete operation.  This will be invoked only for delete
924   * operations requested directly by clients, but not for delete operations
925   * received from another server via replication.
926
927   *
928   * @param  operationContext  The context for the delete operation.
929   * @param  request           The delete request that was processed.
930   * @param  result            The result to be returned to the client.  It may
931   *                           be altered if desired.
932   * @param  entry             The entry targeted by the delete operation, if
933   *                           it exists.
934   *
935   * @return  Information about the result of the plugin processing.
936   */
937  public PostOperationPluginResult doPostOperation(
938              final ActiveOperationContext operationContext,
939              final DeleteRequest request, final UpdatableDeleteResult result,
940              final Entry entry)
941  {
942    // No processing is performed by default.
943    return PostOperationPluginResult.SUCCESS;
944  }
945
946
947
948  /**
949   * Performs any processing which may be necessary after all other processing
950   * has been completed for a delete operation and the response has been sent
951   * to the client.  This will be invoked only for delete operations requested
952   * directly by clients, but not for delete operations received from another
953   * server via replication.
954
955   *
956   * @param  operationContext  The context for the delete operation.
957   * @param  request           The delete request that was processed.
958   * @param  result            The result that was returned to the client.
959   *
960   * @return  Information about the result of the plugin processing.
961   */
962  public PostResponsePluginResult doPostResponse(
963              final CompletedOperationContext operationContext,
964              final DeleteRequest request, final DeleteResult result)
965  {
966    // No processing is performed by default.
967    return PostResponsePluginResult.SUCCESS;
968  }
969
970
971
972  /**
973   * Performs any processing which may be necessary after all other processing
974   * has been completed for a delete operation which has been received from
975   * another server via replication.
976   *
977   * @param  operationContext  The context for the delete operation.
978   * @param  request           The delete request that was processed.
979   * @param  result            The result that was returned to the client.
980   */
981  public void doPostReplication(
982                   final CompletedOperationContext operationContext,
983                   final DeleteRequest request, final DeleteResult result)
984  {
985    // No processing is performed by default.
986  }
987
988
989
990  /**
991   * Performs any processing which may be necessary before the server starts
992   * processing for an extended request.
993   *
994   * @param  operationContext  The context for the extended operation.
995   * @param  request           The extended request to be processed.  It may be
996   *                           altered if desired.
997   * @param  result            The result that will be returned to the client if
998   *                           the plugin result indicates that processing on
999   *                           the operation should be interrupted.  It may be
1000   *                           altered if desired.
1001   *
1002   * @return  Information about the result of the plugin processing.
1003   */
1004  public PreParsePluginResult doPreParse(
1005              final ActiveOperationContext operationContext,
1006              final UpdatableExtendedRequest request,
1007              final UpdatableExtendedResult result)
1008  {
1009    // No processing is performed by default.
1010    return PreParsePluginResult.SUCCESS;
1011  }
1012
1013
1014
1015  /**
1016   * Performs any processing which may be necessary before the server actually
1017   * attempts to perform the core processing for the extended operation.
1018   *
1019   * @param  operationContext  The context for the extended operation.
1020   * @param  request           The extended request to be processed.
1021   * @param  result            The result that will be returned to the client if
1022   *                           the plugin result indicates that processing on
1023   *                           the operation should be interrupted.  It may be
1024   *                           altered if desired.
1025   *
1026   * @return  Information about the result of the plugin processing.
1027   */
1028  public PreOperationPluginResult doPreOperation(
1029              final ActiveOperationContext operationContext,
1030              final ExtendedRequest request,
1031              final UpdatableExtendedResult result)
1032  {
1033    // No processing is performed by default.
1034    return PreOperationPluginResult.SUCCESS;
1035  }
1036
1037
1038
1039  /**
1040   * Performs any processing which may be necessary before the server sends a
1041   * response for an extended operation.
1042   *
1043   * @param  operationContext  The context for the extended operation.
1044   * @param  request           The extended request that was processed.
1045   * @param  result            The result to be returned to the client.  It may
1046   *                           be altered if desired.
1047   *
1048   * @return  Information about the result of the plugin processing.
1049   */
1050  public PostOperationPluginResult doPostOperation(
1051              final ActiveOperationContext operationContext,
1052              final ExtendedRequest request,
1053              final UpdatableExtendedResult result)
1054  {
1055    // No processing is performed by default.
1056    return PostOperationPluginResult.SUCCESS;
1057  }
1058
1059
1060
1061  /**
1062   * Performs any processing which may be necessary after all other processing
1063   * has been completed for an extended operation and the response has been sent
1064   * to the client.
1065   *
1066   * @param  operationContext  The context for the extended operation.
1067   * @param  request           The extended request that was processed.
1068   * @param  result            The result that was returned to the client.
1069   *
1070   * @return  Information about the result of the plugin processing.
1071   */
1072  public PostResponsePluginResult doPostResponse(
1073              final CompletedOperationContext operationContext,
1074              final ExtendedRequest request, final ExtendedResult result)
1075  {
1076    // No processing is performed by default.
1077    return PostResponsePluginResult.SUCCESS;
1078  }
1079
1080
1081
1082  /**
1083   * Performs any processing which may be necessary before the server starts
1084   * processing for a modify request.  This will be invoked only for modify
1085   * operations requested directly by clients, but not for modify operations
1086   * received from another server via replication.
1087   *
1088   * @param  operationContext  The context for the modify operation.
1089   * @param  request           The modify request to be processed.  It may be
1090   *                           altered if desired.
1091   * @param  result            The result that will be returned to the client if
1092   *                           the plugin result indicates that processing on
1093   *                           the operation should be interrupted.  It may be
1094   *                           altered if desired.
1095   *
1096   * @return  Information about the result of the plugin processing.
1097   */
1098  public PreParsePluginResult doPreParse(
1099              final ActiveOperationContext operationContext,
1100              final UpdatableModifyRequest request,
1101              final UpdatableModifyResult result)
1102  {
1103    // No processing is performed by default.
1104    return PreParsePluginResult.SUCCESS;
1105  }
1106
1107
1108
1109  /**
1110   * Performs any processing which may be necessary before the server actually
1111   * attempts to update the entry in the backend.  This will be invoked only for
1112   * modify operations requested directly by clients, but not for modify
1113   * operations received from another server via replication.
1114   *
1115   * @param  operationContext  The context for the modify operation.
1116   * @param  request           The modify request to be processed.
1117   * @param  result            The result that will be returned to the client if
1118   *                           the plugin result indicates that processing on
1119   *                           the operation should be interrupted.  It may be
1120   *                           altered if desired.
1121   * @param  oldEntry          The entry as it appeared before the modifications
1122   *                           were applied.
1123   * @param  newEntry          The updated entry as it will appear after the
1124   *                           modifications have been applied.
1125   *
1126   * @return  Information about the result of the plugin processing.
1127   */
1128  public PreOperationPluginResult doPreOperation(
1129              final ActiveOperationContext operationContext,
1130              final ModifyRequest request, final UpdatableModifyResult result,
1131              final Entry oldEntry, final Entry newEntry)
1132  {
1133    // No processing is performed by default.
1134    return PreOperationPluginResult.SUCCESS;
1135  }
1136
1137
1138
1139  /**
1140   * Performs any processing which may be necessary before the server sends a
1141   * response for a modify operation.  This will be invoked only for modify
1142   * operations requested directly by clients, but not for modify operations
1143   * received from another server via replication.
1144   *
1145   * @param  operationContext  The context for the modify operation.
1146   * @param  request           The modify request that was processed.
1147   * @param  result            The result to be returned to the client.  It may
1148   *                           be altered if desired.
1149   * @param  oldEntry          The entry as it appeared before the modifications
1150   *                           were applied, if it exists. .
1151   * @param  newEntry          The entry as it appears after the modifications
1152   *                           have been applied, if it exists. .
1153   *
1154   * @return  Information about the result of the plugin processing.
1155   */
1156  public PostOperationPluginResult doPostOperation(
1157              final ActiveOperationContext operationContext,
1158              final ModifyRequest request, final UpdatableModifyResult result,
1159              final Entry oldEntry, final Entry newEntry)
1160  {
1161    // No processing is performed by default.
1162    return PostOperationPluginResult.SUCCESS;
1163  }
1164
1165
1166
1167  /**
1168   * Performs any processing which may be necessary after all other processing
1169   * has been completed for a modify operation and the response has been sent
1170   * to the client.  This will be invoked only for modify operations requested
1171   * directly by clients, but not for modify operations received from another
1172   * server via replication.
1173   *
1174   * @param  operationContext  The context for the modify operation.
1175   * @param  request           The modify request that was processed.
1176   * @param  result            The result that was returned to the client.
1177   *
1178   * @return  Information about the result of the plugin processing.
1179   */
1180  public PostResponsePluginResult doPostResponse(
1181              final CompletedOperationContext operationContext,
1182              final ModifyRequest request, final ModifyResult result)
1183  {
1184    // No processing is performed by default.
1185    return PostResponsePluginResult.SUCCESS;
1186  }
1187
1188
1189
1190  /**
1191   * Performs any processing which may be necessary after all other processing
1192   * has been completed for a modify operation which has been received from
1193   * another server via replication.
1194   *
1195   * @param  operationContext  The context for the modify operation.
1196   * @param  request           The modify request that was processed.
1197   * @param  result            The result that was returned to the client.
1198   */
1199  public void doPostReplication(
1200                   final CompletedOperationContext operationContext,
1201                   final ModifyRequest request, final ModifyResult result)
1202  {
1203    // No processing is performed by default.
1204  }
1205
1206
1207
1208  /**
1209   * Performs any processing which may be necessary before the server starts
1210   * processing for a modify DN request.  This will be invoked only for modify
1211   * DN operations requested directly by clients, but not for modify DN
1212   * operations received from another server via replication.
1213   *
1214   * @param  operationContext  The context for the modify DN operation.
1215   * @param  request           The modify DN request to be processed.  It may be
1216   *                           altered if desired.
1217   * @param  result            The result that will be returned to the client if
1218   *                           the plugin result indicates that processing on
1219   *                           the operation should be interrupted.  It may be
1220   *                           altered if desired.
1221   *
1222   * @return  Information about the result of the plugin processing.
1223   */
1224  public PreParsePluginResult doPreParse(
1225              final ActiveOperationContext operationContext,
1226              final UpdatableModifyDNRequest request,
1227              final UpdatableModifyDNResult result)
1228  {
1229    // No processing is performed by default.
1230    return PreParsePluginResult.SUCCESS;
1231  }
1232
1233
1234
1235  /**
1236   * Performs any processing which may be necessary before the server actually
1237   * attempts to update the entry in the backend.  This will be invoked only for
1238   * modify DN operations requested directly by clients, but not for modify DN
1239   * operations received from another server via replication.
1240   *
1241   * @param  operationContext  The context for the modify DN operation.
1242   * @param  request           The modify DN request to be processed.
1243   * @param  result            The result that will be returned to the client if
1244   *                           the plugin result indicates that processing on
1245   *                           the operation should be interrupted.  It may be
1246   *                           altered if desired.
1247   * @param  oldEntry          The entry as it appeared before being renamed.
1248   * @param  newEntry          The updated entry as it will appear after it has
1249   *                           been renamed.
1250   *
1251   * @return  Information about the result of the plugin processing.
1252   */
1253  public PreOperationPluginResult doPreOperation(
1254              final ActiveOperationContext operationContext,
1255              final ModifyDNRequest request,
1256              final UpdatableModifyDNResult result, final Entry oldEntry,
1257              final Entry newEntry)
1258  {
1259    // No processing is performed by default.
1260    return PreOperationPluginResult.SUCCESS;
1261  }
1262
1263
1264
1265  /**
1266   * Performs any processing which may be necessary during the course of
1267   * renaming an entry which is subordinate to an entry targeted by a modify DN
1268   * operation.  This will be invoked only for both modify DN operations
1269   * requested by clients and for modify DN operations received from another
1270   * server via replication.
1271   *
1272   * @param  operationContext         The context for the modify DN operation.
1273   * @param  request                  The modify DN request being processed.
1274   * @param  result                   The result that will be returned to the
1275   *                                  client if the plugin result indicates that
1276   *                                  processing on the operation should be
1277   *                                  interrupted.  It may be altered if
1278   *                                  desired.
1279   * @param  oldSubordinateEntry      The subordinate entry as it appeared
1280   *                                  before being renamed.
1281   * @param  newSubordinateEntry      The subordinate entry as it will appear
1282   *                                  after being renamed.
1283   * @param  additionalModifications  A list of additional modifications that
1284   *                                  should be applied to the entry as it is
1285   *                                  renamed.  This list may be altered if
1286   *                                  desired.
1287   *
1288   * @return  Information about the result of the plugin processing.
1289   */
1290  public SubordinateModifyDNPluginResult doSubordinateModifyDN(
1291              final ActiveOperationContext operationContext,
1292              final ModifyDNRequest request,
1293              final UpdatableModifyDNResult result,
1294              final Entry oldSubordinateEntry,
1295              final Entry newSubordinateEntry,
1296              final List<Modification> additionalModifications)
1297  {
1298    // No processing is performed by default.
1299    return SubordinateModifyDNPluginResult.SUCCESS;
1300  }
1301
1302
1303
1304  /**
1305   * Performs any processing which may be necessary before the server sends a
1306   * response for a modify DN operation.  This will be invoked only for modify
1307   * DN operations requested directly by clients, but not for modify DN
1308   * operations received from another server via replication.
1309   *
1310   * @param  operationContext  The context for the modify DN operation.
1311   * @param  request           The modify DN request that was processed.
1312   * @param  result            The result to be returned to the client.  It may
1313   *                           be altered if desired.
1314   * @param  oldEntry          The entry as it appeared before it was renamed,
1315   *                           if it exists.
1316   * @param  newEntry          The entry as it appears after it was renamed, if
1317   *                           it exists. .
1318   *
1319   * @return  Information about the result of the plugin processing.
1320   */
1321  public PostOperationPluginResult doPostOperation(
1322              final ActiveOperationContext operationContext,
1323              final ModifyDNRequest request,
1324              final UpdatableModifyDNResult result, final Entry oldEntry,
1325              final Entry newEntry)
1326  {
1327    // No processing is performed by default.
1328    return PostOperationPluginResult.SUCCESS;
1329  }
1330
1331
1332
1333  /**
1334   * Performs any processing which may be necessary after all other processing
1335   * has been completed for a modify DN operation and the response has been
1336   * sent to the client.  This will be invoked only for modify DN operations
1337   * requested directly by clients, but not for modify DN operations received
1338   * from another server via replication.
1339   *
1340   * @param  operationContext  The context for the modify DN operation.
1341   * @param  request           The modify DN request that was processed.
1342   * @param  result            The result that was returned to the client.
1343   *
1344   * @return  Information about the result of the plugin processing.
1345   */
1346  public PostResponsePluginResult doPostResponse(
1347              final CompletedOperationContext operationContext,
1348              final ModifyDNRequest request, final ModifyDNResult result)
1349  {
1350    // No processing is performed by default.
1351    return PostResponsePluginResult.SUCCESS;
1352  }
1353
1354
1355
1356  /**
1357   * Performs any processing which may be necessary after all other processing
1358   * has been completed for a modify DN operation which has been received from
1359   * another server via replication.
1360   *
1361   * @param  operationContext  The context for the modify DN operation.
1362   * @param  request           The modify DN request that was processed.
1363   * @param  result            The result that was returned to the client.
1364   */
1365  public void doPostReplication(
1366                   final CompletedOperationContext operationContext,
1367                   final ModifyDNRequest request, final ModifyDNResult result)
1368  {
1369    // No processing is performed by default.
1370  }
1371
1372
1373
1374  /**
1375   * Performs any processing which may be necessary before the server starts
1376   * processing for a search request.
1377   *
1378   * @param  operationContext  The context for the search operation.
1379   * @param  request           The search request to be processed.  It may be
1380   *                           altered if desired.
1381   * @param  result            The result that will be returned to the client if
1382   *                           the plugin result indicates that processing on
1383   *                           the operation should be interrupted.  It may be
1384   *                           altered if desired.
1385   *
1386   * @return  Information about the result of the plugin processing.
1387   */
1388  public PreParsePluginResult doPreParse(
1389              final ActiveSearchOperationContext operationContext,
1390              final UpdatableSearchRequest request,
1391              final UpdatableSearchResult result)
1392  {
1393    // No processing is performed by default.
1394    return PreParsePluginResult.SUCCESS;
1395  }
1396
1397
1398
1399  /**
1400   * Performs any processing which may be necessary before the server actually
1401   * attempts to process the search in the backend.
1402   *
1403   * @param  operationContext  The context for the search operation.
1404   * @param  request           The search request to be processed.
1405   * @param  result            The result that will be returned to the client if
1406   *                           the plugin result indicates that processing on
1407   *                           the operation should be interrupted.  It may be
1408   *                           altered if desired.
1409   *
1410   * @return  Information about the result of the plugin processing.
1411   */
1412  public PreOperationPluginResult doPreOperation(
1413              final ActiveSearchOperationContext operationContext,
1414              final SearchRequest request, final UpdatableSearchResult result)
1415  {
1416    // No processing is performed by default.
1417    return PreOperationPluginResult.SUCCESS;
1418  }
1419
1420
1421
1422  /**
1423   * Performs any processing which may be necessary before the server sends a
1424   * search result entry to the client.
1425   *
1426   * @param  operationContext  The context for the search operation.
1427   * @param  request           The search request being processed.
1428   * @param  result            The result that will be returned to the client if
1429   *                           the plugin result indicates that processing on
1430   *                           the operation should be interrupted.  It may be
1431   *                           altered if desired.
1432   * @param  entry             The entry to be returned to the client.  It may
1433   *                           be altered if desired.
1434   * @param  controls          The set of controls to be included with the
1435   *                           entry.  It may be altered if desired.
1436   *
1437   * @return  Information about the result of the plugin processing.
1438   */
1439  public SearchEntryPluginResult doSearchEntry(
1440              final ActiveSearchOperationContext operationContext,
1441              final SearchRequest request, final UpdatableSearchResult result,
1442              final UpdatableEntry entry, final List<Control> controls)
1443  {
1444    // No processing is performed by default.
1445    return SearchEntryPluginResult.SUCCESS;
1446  }
1447
1448
1449
1450  /**
1451   * Performs any processing which may be necessary before the server sends a
1452   * search result reference to the client.
1453   *
1454   * @param  operationContext  The context for the search operation.
1455   * @param  request           The search request being processed.
1456   * @param  result            The result that will be returned to the client if
1457   *                           the plugin result indicates that processing on
1458   *                           the operation should be interrupted.  It may be
1459   *                           altered if desired.
1460   * @param  referralURLs      The set of referral URLs to be returned to the
1461   *                           client.  It may be altered if desired.
1462   * @param  controls          The set of controls to be included with the
1463   *                           reference.  It may be altered if desired.
1464   *
1465   * @return  Information about the result of the plugin processing.
1466   */
1467  public SearchReferencePluginResult doSearchReference(
1468              final ActiveSearchOperationContext operationContext,
1469              final SearchRequest request, final UpdatableSearchResult result,
1470              final List<String> referralURLs, final List<Control> controls)
1471  {
1472    // No processing is performed by default.
1473    return SearchReferencePluginResult.SUCCESS;
1474  }
1475
1476
1477
1478  /**
1479   * Performs any processing which may be necessary before the server sends a
1480   * response for a search operation.
1481   *
1482   * @param  operationContext  The context for the search operation.
1483   * @param  request           The search request that was processed.
1484   * @param  result            The result to be returned to the client.  It may
1485   *                           be altered if desired.
1486   *
1487   * @return  Information about the result of the plugin processing.
1488   */
1489  public PostOperationPluginResult doPostOperation(
1490              final ActiveSearchOperationContext operationContext,
1491              final SearchRequest request, final UpdatableSearchResult result)
1492  {
1493    // No processing is performed by default.
1494    return PostOperationPluginResult.SUCCESS;
1495  }
1496
1497
1498
1499  /**
1500   * Performs any processing which may be necessary after all other processing
1501   * has been completed for a search operation and the response has been sent to
1502   * the client.
1503   *
1504   * @param  operationContext  The context for the search operation.
1505   * @param  request           The search request that was processed.
1506   * @param  result            The result that was returned to the client.
1507   *
1508   * @return  Information about the result of the plugin processing.
1509   */
1510  public PostResponsePluginResult doPostResponse(
1511              final CompletedSearchOperationContext operationContext,
1512              final SearchRequest request, final SearchResult result)
1513  {
1514    // No processing is performed by default.
1515    return PostResponsePluginResult.SUCCESS;
1516  }
1517
1518
1519
1520  /**
1521   * Performs any processing which may be necessary before the server starts
1522   * processing for an unbind request.
1523   *
1524   * @param  operationContext  The context for the unbind operation.
1525   * @param  request           The unbind request to be processed.  It may be
1526   *                           altered if desired.
1527   *
1528   * @return  Information about the result of the plugin processing.
1529   */
1530  public PreParsePluginResult doPreParse(
1531              final ActiveOperationContext operationContext,
1532              final UpdatableUnbindRequest request)
1533  {
1534    // No processing is performed by default.
1535    return PreParsePluginResult.SUCCESS;
1536  }
1537
1538
1539
1540  /**
1541   * Performs any processing which may be necessary before the server sends an
1542   * intermediate response to the client.
1543   *
1544   * @param  operationContext      The context for the associated operation.
1545   * @param  result                The result that will be returned to the
1546   *                               client if the plugin result indicates that
1547   *                               processing on the operation should be
1548   *                               interrupted.  It may be altered if desired.
1549   * @param  intermediateResponse  The intermediate response to be returned to
1550   *                               the client.  It may be altered if desired.
1551   *
1552   * @return  Information about the result of the plugin processing.
1553   */
1554  public IntermediateResponsePluginResult doIntermediateResponse(
1555              final ActiveOperationContext operationContext,
1556              final UpdatableGenericResult result,
1557              final IntermediateResponse intermediateResponse)
1558  {
1559    // No processing is performed by default.
1560    return IntermediateResponsePluginResult.SUCCESS;
1561  }
1562}