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