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