001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2010 Sun Microsystems, Inc.
015 * Portions Copyright 2014-2016 ForgeRock AS.
016 */
017package org.opends.server.api.plugin;
018
019import org.forgerock.i18n.LocalizableMessage;
020
021import java.util.List;
022import java.util.Set;
023
024import org.opends.server.admin.std.server.PluginCfg;
025import org.opends.server.api.ClientConnection;
026import org.forgerock.opendj.config.server.ConfigException;
027import org.forgerock.opendj.ldap.DN;
028import org.opends.server.core.DeleteOperation;
029import org.opends.server.types.*;
030import org.opends.server.types.operation.*;
031
032import static org.opends.messages.PluginMessages.*;
033
034
035/**
036 * This class defines the set of methods and structures that are
037 * available for use in Directory Server plugins.  This is a single
038 * class that may be used for all types of plugins, and an individual
039 * plugin only needs to implement the specific methods that are
040 * applicable to that particular plugin type.
041 *
042 * @param  <T>  The type of configuration handled by this plugin.
043 */
044@org.opends.server.types.PublicAPI(
045     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
046     mayInstantiate=false,
047     mayExtend=true,
048     mayInvoke=false)
049public abstract class DirectoryServerPlugin
050       <T extends PluginCfg>
051{
052  /** Indicates whether this plugin should be invoked for internal operations. */
053  private boolean invokeForInternalOps;
054
055  /** The DN of the configuration entry for this plugin. */
056  private DN pluginDN;
057
058  /** The plugin types for which this plugin is registered. */
059  private Set<PluginType> pluginTypes;
060
061
062
063  /**
064   * Creates a new instance of this Directory Server plugin.  Every
065   * plugin must implement a default constructor (it is the only one
066   * that will be used to create plugins defined in the
067   * configuration), and every plugin constructor must call
068   * {@code super()} as its first action.
069   */
070  protected DirectoryServerPlugin()
071  {
072  }
073
074
075
076  /**
077   * Indicates whether the provided configuration is acceptable for
078   * this plugin.  It should be possible to call this method on an
079   * uninitialized plugin instance in order to determine whether the
080   * plugin would be able to use the provided configuration.
081   *
082   * @param  configuration        The plugin configuration for which
083   *                              to make the determination.
084   * @param  unacceptableReasons  A list that may be used to hold the
085   *                              reasons that the provided
086   *                              configuration is not acceptable.
087   *
088   * @return  {@code true} if the provided configuration is acceptable
089   *          for this plugin, or {@code false} if not.
090   */
091  public boolean isConfigurationAcceptable(PluginCfg configuration,
092                      List<LocalizableMessage> unacceptableReasons)
093  {
094    // This default implementation does not perform any special
095    // validation.  It should be overridden by plugin implementations
096    // that wish to perform more detailed validation.
097    return true;
098  }
099
100
101
102  /**
103   * Performs any initialization that should be done for all types of
104   * plugins regardless of type. This should only be called by the
105   * core Directory Server code during the course of loading a plugin.
106   *
107   * @param pluginDN
108   *          The configuration entry name of this plugin.
109   * @param pluginTypes
110   *          The set of plugin types for which this plugin is
111   *          registered.
112   * @param invokeForInternalOps
113   *          Indicates whether this plugin should be invoked for
114   *          internal operations.
115   */
116  @org.opends.server.types.PublicAPI(
117       stability=org.opends.server.types.StabilityLevel.PRIVATE,
118       mayInstantiate=false,
119       mayExtend=false,
120       mayInvoke=false)
121  public final void initializeInternal(DN pluginDN,
122      Set<PluginType> pluginTypes, boolean invokeForInternalOps)
123  {
124    this.pluginDN = pluginDN;
125    this.pluginTypes = pluginTypes;
126    this.invokeForInternalOps = invokeForInternalOps;
127  }
128
129
130
131  /**
132   * Performs any initialization necessary for this plugin.  This will
133   * be called as soon as the plugin has been loaded and before it is
134   * registered with the server.
135   *
136   * @param  pluginTypes    The set of plugin types that indicate the
137   *                        ways in which this plugin will be invoked.
138   * @param  configuration  The configuration for this plugin.
139   *
140   * @throws  ConfigException  If the provided entry does not contain
141   *                           a valid configuration for this plugin.
142   *
143   * @throws  InitializationException  If a problem occurs while
144   *                                   initializing the plugin that is
145   *                                   not related to the server
146   *                                   configuration.
147   */
148  public abstract void initializePlugin(Set<PluginType> pluginTypes,
149                                        T configuration)
150         throws ConfigException, InitializationException;
151
152
153
154  /**
155   * Performs any necessary finalization for this plugin.  This will
156   * be called just after the plugin has been deregistered with the
157   * server but before it has been unloaded.
158   */
159  public void finalizePlugin()
160  {
161    // No implementation is required by default.
162  }
163
164
165
166  /**
167   * Retrieves the DN of the configuration entry for this plugin.
168   *
169   * @return  The DN of the configuration entry for this plugin.
170   */
171  public final DN getPluginEntryDN()
172  {
173    return pluginDN;
174  }
175
176
177
178  /**
179   * Retrieves the plugin types for which this plugin is registered.
180   * This set must not be modified.
181   *
182   * @return  The plugin types for which this plugin is registered.
183   */
184  public final Set<PluginType> getPluginTypes()
185  {
186    return pluginTypes;
187  }
188
189
190
191  /**
192   * Indicates whether this plugin should be invoked for internal
193   * operations.
194   *
195   * @return  {@code true} if this plugin should be invoked for
196   *          internal operations, or {@code false} if not.
197   */
198  public final boolean invokeForInternalOperations()
199  {
200    return invokeForInternalOps;
201  }
202
203
204
205  /**
206   * Specifies whether this plugin should be invoked for internal
207   * operations.
208   *
209   * @param  invokeForInternalOps  Indicates whether this plugin
210   *                               should be invoked for internal
211   *                               operations.
212   */
213  @org.opends.server.types.PublicAPI(
214       stability=org.opends.server.types.StabilityLevel.PRIVATE,
215       mayInstantiate=false,
216       mayExtend=false,
217       mayInvoke=false)
218  public final void setInvokeForInternalOperations(
219                         boolean invokeForInternalOps)
220  {
221    this.invokeForInternalOps = invokeForInternalOps;
222  }
223
224
225
226  /**
227   * Performs any processing that should be done when the Directory
228   * Server is in the process of starting.  This method will be called
229   * after virtually all other initialization has been performed but
230   * before the connection handlers are started.
231   *
232   * @return  The result of the startup plugin processing.
233   */
234  public PluginResult.Startup doStartup()
235  {
236    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
237        pluginDN, PluginType.STARTUP.getName()).toString());
238  }
239
240
241
242  /**
243   * Performs any processing that should be done when the Directory
244   * Server is in the process of performing a graceful shutdown.  This
245   * method will be called early in the shutdown process after the
246   * connection handlers are stopped but before other finalization is
247   * performed.
248   *
249   * @param  reason  The human-readable reason for the shutdown.
250   */
251  public void doShutdown(LocalizableMessage reason)
252  {
253    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
254        pluginDN, PluginType.SHUTDOWN.getName()).toString());
255  }
256
257
258
259  /**
260   * Performs any processing that should be done when the Directory
261   * Server accepts a new connection from a client.  This method will
262   * be called after additional verification is performed to ensure
263   * that the connection should be accepted.
264   *
265   * @param  clientConnection  The client connection that has been
266   *                           accepted.
267   *
268   * @return  The result of the plugin processing.
269   */
270  public PluginResult.PostConnect doPostConnect(ClientConnection
271                                                    clientConnection)
272  {
273    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
274        pluginDN, PluginType.POST_CONNECT.getName()).toString());
275  }
276
277
278
279  /**
280   * Performs any processing that should be done whenever a client
281   * connection is closed (regardless of whether the closure is
282   * initiated by the client or the server).
283   *
284   * @param  clientConnection  The client connection that has been
285   *                           closed.
286   * @param  disconnectReason  The disconnect reason for the closure.
287   * @param  message           A message providing additional
288   *                           information about the closure, or
289   *                           {@code null} if there is none.
290   *
291   * @return  The result of the plugin processing.
292   */
293  public PluginResult.PostDisconnect
294              doPostDisconnect(ClientConnection clientConnection,
295                               DisconnectReason disconnectReason,
296                               LocalizableMessage message)
297  {
298    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
299        pluginDN, PluginType.POST_DISCONNECT.getName()).toString());
300  }
301
302
303  /**
304   * Performs any necessary processing that should be done during an
305   * LDIF import operation immediately after reading an entry and
306   * confirming that it should be imported based on the provided
307   * configuration.
308   *
309   * @param  importConfig  The configuration used for the LDIF import.
310   * @param  entry         The entry that has been read to the LDIF
311   *                       file.
312   *
313   * @return  The result of the plugin processing.
314   */
315  public PluginResult.ImportLDIF
316    doLDIFImport(LDIFImportConfig importConfig, Entry entry)
317  {
318    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
319        pluginDN, PluginType.LDIF_IMPORT.getName()).toString());
320  }
321
322  /**
323   * Terminates an import session.
324   * Performs any necessary processing that should be done at the end
325   * of an LDIF import session based on the provided configuration.
326   *
327   * @param  importConfig  The configuration used for the LDIF import.
328   */
329  public void doLDIFImportEnd(LDIFImportConfig importConfig)
330  {
331    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
332        pluginDN, PluginType.LDIF_IMPORT_END.getName()).toString());
333  }
334
335  /**
336   * Starts an import session.
337   * Performs any necessary processing that should be done at the
338   * beginning of an LDIF import session based on the provided
339   * configuration.
340   *
341   * @param  importConfig  The configuration used for the LDIF import.
342   */
343  public void doLDIFImportBegin(LDIFImportConfig importConfig)
344  {
345    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
346        pluginDN, PluginType.LDIF_IMPORT_BEGIN.getName()).toString());
347  }
348
349  /**
350   * Performs any necessary processing that should be done during an
351   * LDIF export operation immediately after determining that the
352   * provided entry should be included in the export.
353   *
354   * @param  exportConfig  The configuration used for the LDIF export.
355   * @param  entry         The entry to be written to the LDIF file.
356   *
357   * @return  The result of the plugin processing.
358   */
359  public PluginResult.ImportLDIF
360    doLDIFExport(LDIFExportConfig exportConfig, Entry entry)
361  {
362    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
363        pluginDN, PluginType.LDIF_EXPORT.getName()).toString());
364  }
365
366
367
368  /**
369   * Performs any necessary processing that should be done before the
370   * Directory Server parses the elements of an abandon request.
371   *
372   * @param  abandonOperation  The abandon operation that has been
373   *                           requested.
374   *
375   * @return  Information about the result of the plugin processing.
376   */
377  public PluginResult.PreParse
378       doPreParse(PreParseAbandonOperation abandonOperation)
379  {
380    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
381        pluginDN, PluginType.PRE_PARSE_ABANDON.getName()).toString());
382  }
383
384
385
386  /**
387   * Performs any necessary processing that should be done after the
388   * Directory Server has completed processing for an abandon
389   * operation.
390   *
391   * @param  abandonOperation  The abandon operation for which
392   *                           processing has completed.
393   *
394   * @return  Information about the result of the plugin processing.
395   */
396  public PluginResult.PostOperation
397       doPostOperation(PostOperationAbandonOperation abandonOperation)
398  {
399    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
400        pluginDN, PluginType.POST_OPERATION_ABANDON.getName()).toString());
401  }
402
403
404
405  /**
406   * Performs any necessary processing that should be done before the
407   * Directory Server parses the elements of an add request.
408   *
409   * @param  addOperation  The add operation that has been requested.
410   *
411   * @return  Information about the result of the plugin processing.
412   *
413   * @throws CanceledOperationException if this operation should
414   * be cancelled.
415   */
416  public PluginResult.PreParse
417       doPreParse(PreParseAddOperation addOperation)
418       throws CanceledOperationException {
419    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
420        pluginDN, PluginType.PRE_PARSE_ADD.getName()).toString());
421  }
422
423
424
425  /**
426   * Performs any necessary processing that should be done just before
427   * the Directory Server performs the core processing for an add
428   * operation.
429   * This method is not called when processing synchronization
430   * operations.
431   *
432   * @param  addOperation  The add operation to be processed.
433   *
434   * @return  Information about the result of the plugin processing.
435   *
436   * @throws CanceledOperationException if this operation should
437   * be cancelled.
438   */
439  public PluginResult.PreOperation
440       doPreOperation(PreOperationAddOperation addOperation)
441      throws CanceledOperationException {
442    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
443        pluginDN, PluginType.PRE_OPERATION_ADD.getName()).toString());
444  }
445
446
447
448  /**
449   * Performs any necessary processing that should be done after the
450   * Directory Server has completed the core processing for an add
451   * operation but before the response has been sent to the client.
452   *
453   * @param  addOperation  The add operation for which processing has
454   *                       completed but no response has yet been
455   *                       sent.
456   *
457   * @return  Information about the result of the plugin processing.
458   */
459  public PluginResult.PostOperation
460       doPostOperation(PostOperationAddOperation addOperation)
461  {
462    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
463        pluginDN, PluginType.POST_OPERATION_ADD.getName()).toString());
464  }
465
466
467
468  /**
469   * Performs any necessary processing that should be done after the
470   * Directory Server has completed all processing for an add
471   * operation and has sent the response to the client.
472   *
473   * @param  addOperation  The add operation for which processing has
474   *                       completed and the response has been sent to
475   *                       the client.
476   *
477   * @return  Information about the result of the plugin processing.
478   */
479  public PluginResult.PostResponse
480       doPostResponse(PostResponseAddOperation addOperation)
481  {
482    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
483        pluginDN, PluginType.POST_RESPONSE_ADD.getName()).toString());
484  }
485
486
487
488  /**
489   * Performs any necessary processing that should be done after the
490   * Directory Server has completed processing for an add operation
491   * performed via synchronization.
492   *
493   * @param  addOperation  The synchronized add operation for which
494   *                       processing has been completed.
495   */
496  public void doPostSynchronization(
497                   PostSynchronizationAddOperation addOperation)
498  {
499    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
500        pluginDN, PluginType.POST_SYNCHRONIZATION_ADD.getName()).toString());
501  }
502
503
504
505  /**
506   * Performs any necessary processing that should be done before the
507   * Directory Server parses the elements of a bind request.
508   *
509   * @param  bindOperation  The bind operation that has been
510   *                        requested.
511   *
512   * @return  Information about the result of the plugin processing.
513   */
514  public PluginResult.PreParse
515       doPreParse(PreParseBindOperation bindOperation)
516  {
517    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
518        pluginDN, PluginType.PRE_PARSE_BIND.getName()).toString());
519  }
520
521
522
523  /**
524   * Performs any necessary processing that should be done just before
525   * the Directory Server performs the core processing for a bind
526   * operation.
527   *
528   * @param  bindOperation  The bind operation to be processed.
529   *
530   * @return  Information about the result of the plugin processing.
531   */
532  public PluginResult.PreOperation
533       doPreOperation(PreOperationBindOperation bindOperation)
534  {
535    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
536        pluginDN, PluginType.PRE_OPERATION_BIND.getName()).toString());
537  }
538
539
540
541  /**
542   * Performs any necessary processing that should be done after the
543   * Directory Server has completed the core processing for a bind
544   * operation but before the response has been sent to the client.
545   *
546   * @param  bindOperation  The bind operation for which processing
547   *                        has completed but no response has yet been
548   *                        sent.
549   *
550   * @return  Information about the result of the plugin processing.
551   */
552  public PluginResult.PostOperation
553       doPostOperation(PostOperationBindOperation bindOperation)
554  {
555    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
556        pluginDN, PluginType.POST_OPERATION_BIND.getName()).toString());
557  }
558
559
560
561  /**
562   * Performs any necessary processing that should be done after the
563   * Directory Server has completed all processing for a bind
564   * operation and has sent the response to the client.
565   *
566   * @param  bindOperation  The bind operation for which processing
567   *                        has completed and the response has been
568   *                        sent to the client.
569   *
570   * @return  Information about the result of the plugin processing.
571   */
572  public PluginResult.PostResponse
573       doPostResponse(PostResponseBindOperation bindOperation)
574  {
575    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
576        pluginDN, PluginType.POST_RESPONSE_BIND.getName()).toString());
577  }
578
579
580
581  /**
582   * Performs any necessary processing that should be done before the
583   * Directory Server parses the elements of a compare request.
584   *
585   * @param  compareOperation  The compare operation that has been
586   *                           requested.
587   *
588   * @return  Information about the result of the plugin processing.
589   *
590   * @throws CanceledOperationException if this operation should
591   * be cancelled.
592   */
593  public PluginResult.PreParse
594       doPreParse(PreParseCompareOperation compareOperation)
595       throws CanceledOperationException {
596    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
597        pluginDN, PluginType.PRE_PARSE_COMPARE.getName()).toString());
598  }
599
600
601
602  /**
603   * Performs any necessary processing that should be done just before
604   * the Directory Server performs the core processing for a compare
605   * operation.
606   *
607   * @param  compareOperation  The compare operation to be processed.
608   *
609   * @return  Information about the result of the plugin processing.
610   *
611   * @throws CanceledOperationException if this operation should
612   * be cancelled.
613   */
614  public PluginResult.PreOperation
615       doPreOperation(PreOperationCompareOperation compareOperation)
616      throws CanceledOperationException {
617    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
618        pluginDN, PluginType.PRE_OPERATION_COMPARE.getName()).toString());
619  }
620
621
622
623  /**
624   * Performs any necessary processing that should be done after the
625   * Directory Server has completed the core processing for a compare
626   * operation but before the response has been sent to the client.
627   *
628   * @param  compareOperation  The compare operation for which
629   *                           processing has completed but no
630   *                           response has yet been sent.
631   *
632   * @return  Information about the result of the plugin processing.
633   */
634  public PluginResult.PostOperation
635       doPostOperation(PostOperationCompareOperation compareOperation)
636  {
637    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
638        pluginDN, PluginType.POST_OPERATION_COMPARE.getName()).toString());
639  }
640
641
642
643  /**
644   * Performs any necessary processing that should be done after the
645   * Directory Server has completed all processing for a compare
646   * operation and has sent the response to the client.
647   *
648   * @param  compareOperation  The compare operation for which
649   *                           processing has completed and the
650   *                           response has been sent to the client.
651   *
652   * @return  Information about the result of the plugin processing.
653   */
654  public PluginResult.PostResponse
655       doPostResponse(PostResponseCompareOperation compareOperation)
656  {
657    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
658        pluginDN, PluginType.POST_RESPONSE_COMPARE.getName()).toString());
659  }
660
661
662
663  /**
664   * Performs any necessary processing that should be done before the
665   * Directory Server parses the elements of a delete request.
666   *
667   * @param  deleteOperation  The delete operation that has been
668   *                          requested.
669   *
670   * @return  Information about the result of the plugin processing.
671   *
672   * @throws CanceledOperationException if this operation should
673   * be cancelled.
674   */
675  public PluginResult.PreParse
676       doPreParse(PreParseDeleteOperation deleteOperation)
677       throws CanceledOperationException {
678    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
679        pluginDN, PluginType.PRE_PARSE_DELETE.getName()).toString());
680  }
681
682
683
684  /**
685   * Performs any necessary processing that should be done just before
686   * the Directory Server performs the core processing for a delete
687   * operation.
688   * This method is not called when processing synchronization
689   * operations.
690   *
691   * @param  deleteOperation  The delete operation to be processed.
692   *
693   * @return  Information about the result of the plugin processing.
694   *
695   * @throws CanceledOperationException if this operation should
696   * be cancelled.
697   */
698  public PluginResult.PreOperation
699       doPreOperation(PreOperationDeleteOperation deleteOperation)
700      throws CanceledOperationException {
701    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
702        pluginDN, PluginType.PRE_OPERATION_DELETE.getName()).toString());
703  }
704
705
706
707  /**
708   * Performs any necessary processing that should be done after the
709   * Directory Server has completed the core processing for a delete
710   * operation but before the response has been sent to the client.
711   *
712   * @param  deleteOperation  The delete operation for which
713   *                          processing has completed but no
714   *                          response has yet been sent.
715   *
716   * @return  Information about the result of the plugin processing.
717   */
718  public PluginResult.PostOperation
719       doPostOperation(PostOperationDeleteOperation deleteOperation)
720  {
721    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
722        pluginDN, PluginType.POST_OPERATION_DELETE.getName()).toString());
723  }
724
725
726
727  /**
728   * Performs any necessary processing that should be done after the
729   * Directory Server has completed all processing for a delete
730   * operation and has sent the response to the client.
731   *
732   * @param  deleteOperation  The delete operation for which
733   *                          processing has completed and the
734   *                          response has been sent to the client.
735   *
736   * @return  Information about the result of the plugin processing.
737   */
738  public PluginResult.PostResponse
739       doPostResponse(PostResponseDeleteOperation deleteOperation)
740  {
741    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
742        pluginDN, PluginType.POST_RESPONSE_DELETE.getName()).toString());
743  }
744
745
746
747  /**
748   * Performs any necessary processing that should be done after the
749   * Directory Server has completed processing for a delete operation
750   * performed via synchronization.
751   *
752   * @param  deleteOperation  The synchronized delete operation for
753   *                          which processing has been completed.
754   */
755  public void doPostSynchronization(
756                   PostSynchronizationDeleteOperation deleteOperation)
757  {
758    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
759        pluginDN, PluginType.POST_SYNCHRONIZATION_DELETE.getName()).toString());
760  }
761
762
763
764  /**
765   * Performs any necessary processing that should be done before the
766   * Directory Server parses the elements of an extended request.
767   *
768   * @param  extendedOperation  The extended operation that has been
769   *                            requested.
770   *
771   * @return  Information about the result of the plugin processing.
772   *
773   * @throws CanceledOperationException if this operation should
774   * be cancelled.
775   */
776  public PluginResult.PreParse
777       doPreParse(PreParseExtendedOperation extendedOperation)
778       throws CanceledOperationException {
779    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
780        pluginDN, PluginType.PRE_PARSE_EXTENDED.getName()).toString());
781  }
782
783
784
785  /**
786   * Performs any necessary processing that should be done just before
787   * the Directory Server performs the core processing for an extended
788   * operation.
789   *
790   * @param  extendedOperation  The extended operation to be
791   *                            processed.
792   *
793   * @return  Information about the result of the plugin processing.
794   *
795   * @throws CanceledOperationException if this operation should
796   * be cancelled.
797   */
798  public PluginResult.PreOperation
799       doPreOperation(PreOperationExtendedOperation extendedOperation)
800      throws CanceledOperationException {
801    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
802        pluginDN, PluginType.PRE_OPERATION_EXTENDED.getName()).toString());
803  }
804
805
806
807  /**
808   * Performs any necessary processing that should be done after the
809   * Directory Server has completed the core processing for an
810   * extended operation but before the response has been sent to the
811   * client.
812   *
813   * @param  extendedOperation  The extended operation for which
814   *                            processing has completed but no
815   *                            response has yet been sent.
816   *
817   * @return  Information about the result of the plugin processing.
818   */
819  public PluginResult.PostOperation
820       doPostOperation(PostOperationExtendedOperation
821                            extendedOperation)
822  {
823    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
824        pluginDN, PluginType.POST_OPERATION_EXTENDED.getName()).toString());
825  }
826
827
828
829  /**
830   * Performs any necessary processing that should be done after the
831   * Directory Server has completed all processing for an extended
832   * operation and has sent the response to the client.
833   *
834   * @param  extendedOperation  The extended operation for which
835   *                            processing has completed and the
836   *                            response has been sent to the client.
837   *
838   * @return  Information about the result of the plugin processing.
839   */
840  public PluginResult.PostResponse
841       doPostResponse(PostResponseExtendedOperation extendedOperation)
842  {
843    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
844        pluginDN, PluginType.POST_RESPONSE_EXTENDED.getName()).toString());
845  }
846
847
848
849  /**
850   * Performs any necessary processing that should be done before the
851   * Directory Server parses the elements of a modify request.
852   *
853   * @param  modifyOperation  The modify operation that has been
854   *                          requested.
855   *
856   * @return  Information about the result of the plugin processing.
857   *
858   * @throws CanceledOperationException if this operation should
859   * be cancelled.
860   */
861  public PluginResult.PreParse
862       doPreParse(PreParseModifyOperation modifyOperation)
863       throws CanceledOperationException {
864    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
865        pluginDN, PluginType.PRE_PARSE_MODIFY.getName()).toString());
866  }
867
868
869
870  /**
871   * Performs any necessary processing that should be done just before
872   * the Directory Server performs the core processing for a modify
873   * operation.
874   *
875   * This method is not called when processing synchronization
876   * operations.
877   * @param  modifyOperation  The modify operation to be processed.
878   *
879   * @return  Information about the result of the plugin processing.
880   *
881   * @throws CanceledOperationException if this operation should
882   * be cancelled.
883   */
884  public PluginResult.PreOperation
885       doPreOperation(PreOperationModifyOperation modifyOperation)
886      throws CanceledOperationException {
887    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
888        pluginDN, PluginType.PRE_OPERATION_MODIFY.getName()).toString());
889  }
890
891
892
893  /**
894   * Performs any necessary processing that should be done after the
895   * Directory Server has completed the core processing for a modify
896   * operation but before the response has been sent to the client.
897   *
898   * @param  modifyOperation  The modify operation for which
899   *                          processing has completed but no response
900   *                          has yet been sent.
901   *
902   * @return  Information about the result of the plugin processing.
903   */
904  public PluginResult.PostOperation
905       doPostOperation(PostOperationModifyOperation modifyOperation)
906  {
907    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
908        pluginDN, PluginType.POST_OPERATION_MODIFY.getName()).toString());
909  }
910
911
912
913  /**
914   * Performs any necessary processing that should be done after the
915   * Directory Server has completed all processing for a modify
916   * operation and has sent the response to the client.
917   *
918   * @param  modifyOperation  The modify operation for which
919   *                          processing has completed and the
920   *                          response has been sent to the client.
921   *
922   * @return  Information about the result of the plugin processing.
923   */
924  public PluginResult.PostResponse
925       doPostResponse(PostResponseModifyOperation modifyOperation)
926  {
927    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
928        pluginDN, PluginType.POST_RESPONSE_MODIFY.getName()).toString());
929  }
930
931
932
933  /**
934   * Performs any necessary processing that should be done after the
935   * Directory Server has completed processing for a modify operation
936   * performed via synchronization.
937   *
938   * @param  modifyOperation  The synchronized modify operation for
939   *                          which processing has been completed.
940   */
941  public void doPostSynchronization(
942                   PostSynchronizationModifyOperation modifyOperation)
943  {
944    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
945        pluginDN, PluginType.POST_SYNCHRONIZATION_MODIFY.getName()).toString());
946  }
947
948
949
950  /**
951   * Performs any necessary processing that should be done before the
952   * Directory Server parses the elements of a modify DN request.
953   *
954   * @param  modifyDNOperation  The modify DN operation that has been
955   *                            requested.
956   *
957   * @return  Information about the result of the plugin processing.
958   *
959   * @throws CanceledOperationException if this operation should
960   * be cancelled.
961   */
962  public PluginResult.PreParse
963       doPreParse(PreParseModifyDNOperation modifyDNOperation)
964       throws CanceledOperationException {
965    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
966        pluginDN, PluginType.PRE_PARSE_MODIFY_DN.getName()).toString());
967  }
968
969
970
971  /**
972   * Performs any necessary processing that should be done just before
973   * the Directory Server performs the core processing for a modify DN
974   * operation.
975   * This method is not called when processing synchronization
976   * operations.
977   *
978   * @param  modifyDNOperation  The modify DN operation to be
979   *                            processed.
980   *
981   * @return  Information about the result of the plugin processing.
982   *
983   * @throws CanceledOperationException if this operation should
984   * be cancelled.
985   */
986  public PluginResult.PreOperation
987       doPreOperation(PreOperationModifyDNOperation modifyDNOperation)
988      throws CanceledOperationException {
989    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
990        pluginDN, PluginType.PRE_OPERATION_MODIFY_DN.getName()).toString());
991  }
992
993
994
995  /**
996   * Performs any necessary processing that should be done whenever a
997   * subordinate entry is moved or renamed as part of a modify DN
998   * operation.  Note that if the entry is to be changed in any way,
999   * the new entry should be directly modified, and the changes made
1000   * should also be added to the provided list of modifications.
1001   * <BR><BR>
1002   * NOTE:  At the present time, OpenDS does not provide support for
1003   * altering entries subordinate to the target of a modify DN
1004   * operation.  While this may be available in the future, current
1005   * plugins should not attempt to alter the new or old entries in any
1006   * way, nor should they attempt to add any modifications to the
1007   * provided list.
1008   *
1009   * @param  modifyDNOperation  The modify DN operation with which the
1010   *                            subordinate entry is associated.
1011   * @param  oldEntry           The subordinate entry prior to the
1012   *                            move/rename operation.
1013   * @param  newEntry           The subordinate enry after the
1014   *                            move/rename operation.
1015   * @param  modifications      A list into which any modifications
1016   *                            made to the target entry should be
1017   *                            placed.
1018   *
1019   * @return  Information about the result of the plugin processing.
1020   */
1021  public PluginResult.SubordinateModifyDN
1022       processSubordinateModifyDN(SubordinateModifyDNOperation
1023                                       modifyDNOperation,
1024                                  Entry oldEntry, Entry newEntry,
1025                                  List<Modification> modifications)
1026  {
1027    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1028        pluginDN, PluginType.SUBORDINATE_MODIFY_DN.getName()).toString());
1029  }
1030
1031
1032
1033  /**
1034   * Performs any necessary processing that should be done whenever a
1035   * subordinate entry is deleted as part of subtree delete operation.
1036   *
1037   * @param  deleteOperation  The delete operation with which the
1038   *                          subordinate entry is associated.
1039   * @param  entry            The subordinate entry being deleted.
1040   *
1041   * @return Information about the result of the plugin processing.
1042   */
1043  public PluginResult.SubordinateDelete
1044       processSubordinateDelete(DeleteOperation
1045         deleteOperation, Entry entry)
1046  {
1047    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1048        pluginDN, PluginType.SUBORDINATE_MODIFY_DN.getName()).toString());
1049  }
1050
1051
1052
1053  /**
1054   * Performs any necessary processing that should be done after the
1055   * Directory Server has completed the core processing for a modify
1056   * DN operation but before the response has been sent to the client.
1057   *
1058   * @param  modifyDNOperation  The modify DN operation for which
1059   *                            processing has completed but no
1060   *                            response has yet been sent.
1061   *
1062   * @return  Information about the result of the plugin processing.
1063   */
1064  public PluginResult.PostOperation
1065       doPostOperation(PostOperationModifyDNOperation
1066                            modifyDNOperation)
1067  {
1068    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1069        pluginDN, PluginType.POST_OPERATION_MODIFY_DN.getName()).toString());
1070  }
1071
1072
1073
1074  /**
1075   * Performs any necessary processing that should be done after the
1076   * Directory Server has completed all processing for a modify DN
1077   * operation and has sent the response to the client.
1078   *
1079   * @param  modifyDNOperation  The modifyDN operation for which
1080   *                            processing has completed and the
1081   *                            response has been sent to the client.
1082   *
1083   * @return  Information about the result of the plugin processing.
1084   */
1085  public PluginResult.PostResponse
1086       doPostResponse(PostResponseModifyDNOperation modifyDNOperation)
1087  {
1088    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1089        pluginDN, PluginType.POST_RESPONSE_MODIFY_DN.getName()).toString());
1090  }
1091
1092
1093
1094  /**
1095   * Performs any necessary processing that should be done after the
1096   * Directory Server has completed processing for a modify DN
1097   * operation performed via synchronization.
1098   *
1099   * @param  modifyDNOperation  The synchronized modify DN operation
1100   *                            for which processing has been
1101   *                            completed.
1102   */
1103  public void doPostSynchronization(
1104              PostSynchronizationModifyDNOperation modifyDNOperation)
1105  {
1106    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1107        pluginDN, PluginType.POST_SYNCHRONIZATION_MODIFY_DN.getName()).toString());
1108  }
1109
1110
1111
1112  /**
1113   * Performs any necessary processing that should be done before the
1114   * Directory Server parses the elements of a search request.
1115   *
1116   * @param  searchOperation  The search operation that has been
1117   *                          requested.
1118   *
1119   * @return  Information about the result of the plugin processing.
1120   *
1121   * @throws CanceledOperationException if this operation should
1122   * be cancelled.
1123   */
1124  public PluginResult.PreParse
1125       doPreParse(PreParseSearchOperation searchOperation)
1126       throws CanceledOperationException {
1127    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1128        pluginDN, PluginType.PRE_PARSE_SEARCH.getName()).toString());
1129  }
1130
1131
1132
1133  /**
1134   * Performs any necessary processing that should be done just before
1135   * the Directory Server performs the core processing for a search
1136   * operation.
1137   *
1138   * @param  searchOperation  The search operation to be processed.
1139   *
1140   * @return  Information about the result of the plugin processing.
1141   *
1142   * @throws CanceledOperationException if this operation should
1143   * be cancelled.
1144   */
1145  public PluginResult.PreOperation
1146       doPreOperation(PreOperationSearchOperation searchOperation)
1147      throws CanceledOperationException {
1148    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1149        pluginDN, PluginType.PRE_OPERATION_SEARCH.getName()).toString());
1150  }
1151
1152
1153
1154  /**
1155   * Performs any necessary processing that should be done before a
1156   * search result entry is sent to a client.  This will be called
1157   * after it has been verified that the entry does actually match the
1158   * search criteria and after access control has been enforced to
1159   * ensure that the entry should be sent and/or to strip out
1160   * attributes/values that the user should not see.
1161   *
1162   * @param  searchOperation  The search operation with which the
1163   *                          search entry is associated.
1164   * @param  searchEntry      The search result entry that is to be
1165   *                          sent to the client.  Its contents may be
1166   *                          altered by the plugin if necessary.
1167   *
1168   * @return  Information about the result of the plugin processing.
1169   */
1170  public PluginResult.IntermediateResponse
1171       processSearchEntry(SearchEntrySearchOperation searchOperation,
1172                          SearchResultEntry searchEntry)
1173  {
1174    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1175        pluginDN, PluginType.SEARCH_RESULT_ENTRY.getName()).toString());
1176  }
1177
1178
1179
1180  /**
1181   * Performs any necessary processing that should be done before a
1182   * search result reference is sent to a client.
1183   *
1184   * @param  searchOperation  The search operation with which the
1185   *                          search result reference is associated.
1186   * @param  searchReference  The search result reference that is to
1187   *                          be sent to the client.  Its contents may
1188   *                          be altered by the plugin if necessary.
1189   *
1190   * @return  Information about the result of the plugin processing.
1191   */
1192  public PluginResult.IntermediateResponse
1193       processSearchReference(SearchReferenceSearchOperation
1194                                   searchOperation,
1195                              SearchResultReference searchReference)
1196  {
1197    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1198        pluginDN, PluginType.SEARCH_RESULT_REFERENCE.getName()).toString());
1199  }
1200
1201
1202
1203  /**
1204   * Performs any necessary processing that should be done after the
1205   * Directory Server has completed the core processing for a search
1206   * operation but before the response has been sent to the client.
1207   *
1208   * @param  searchOperation  The search operation for which
1209   *                          processing has completed but no response
1210   *                          has yet been sent.
1211   *
1212   * @return  Information about the result of the plugin processing.
1213   */
1214  public PluginResult.PostOperation
1215       doPostOperation(PostOperationSearchOperation searchOperation)
1216  {
1217    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1218        pluginDN, PluginType.POST_OPERATION_SEARCH.getName()).toString());
1219  }
1220
1221
1222
1223  /**
1224   * Performs any necessary processing that should be done after the
1225   * Directory Server has completed all processing for a search
1226   * operation and has sent the response to the client.
1227   *
1228   * @param  searchOperation  The search operation for which
1229   *                          processing has completed and the
1230   *                          response has been sent to the client.
1231   *
1232   * @return  Information about the result of the plugin processing.
1233   */
1234  public PluginResult.PostResponse
1235       doPostResponse(PostResponseSearchOperation searchOperation)
1236  {
1237    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1238        pluginDN, PluginType.POST_RESPONSE_SEARCH.getName()).toString());
1239  }
1240
1241
1242
1243  /**
1244   * Performs any necessary processing that should be done before the
1245   * Directory Server parses the elements of an unbind request.
1246   *
1247   * @param  unbindOperation  The unbind operation that has been
1248   *                          requested.
1249   *
1250   * @return  Information about the result of the plugin processing.
1251   */
1252  public PluginResult.PreParse
1253       doPreParse(PreParseUnbindOperation unbindOperation)
1254  {
1255    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1256        pluginDN, PluginType.PRE_PARSE_UNBIND.getName()).toString());
1257  }
1258
1259
1260
1261  /**
1262   * Performs any necessary processing that should be done after the
1263   * Directory Server has completed processing for an unbind
1264   * operation.
1265   *
1266   * @param  unbindOperation  The unbind operation for which
1267   *                          processing has completed.
1268   *
1269   * @return  Information about the result of the plugin processing.
1270   */
1271  public PluginResult.PostOperation
1272       doPostOperation(PostOperationUnbindOperation unbindOperation)
1273  {
1274    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1275        pluginDN, PluginType.POST_OPERATION_UNBIND.getName()).toString());
1276  }
1277
1278
1279
1280  /**
1281   * Performs any necessary processing that should be done before an
1282   * intermediate response message is sent to a client.
1283   *
1284   * @param  intermediateResponse  The intermediate response to be
1285   *                               sent to the client.
1286   *
1287   * @return  Information about the result of the plugin processing.
1288   */
1289  public PluginResult.IntermediateResponse
1290              processIntermediateResponse(
1291                   IntermediateResponse intermediateResponse)
1292  {
1293    throw new UnsupportedOperationException(ERR_PLUGIN_TYPE_NOT_SUPPORTED.get(
1294        pluginDN, PluginType.INTERMEDIATE_RESPONSE.getName()).toString());
1295  }
1296}
1297