From d737629521c16e5e8b9e36ad6dd11c976e9385e0 Mon Sep 17 00:00:00 2001
From: coulbeck <coulbeck@localhost>
Date: Mon, 09 Apr 2007 18:52:45 +0000
Subject: [PATCH] Migrate the ExtendedOperationConfigManager to the new configuration framework.

---
 opendj-sdk/opends/src/server/org/opends/server/api/ExtendedOperationHandler.java |   89 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 74 insertions(+), 15 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/api/ExtendedOperationHandler.java b/opendj-sdk/opends/src/server/org/opends/server/api/ExtendedOperationHandler.java
index 109d6fd..ae48759 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/api/ExtendedOperationHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/api/ExtendedOperationHandler.java
@@ -31,12 +31,11 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import org.opends.server.config.ConfigEntry;
 import org.opends.server.config.ConfigException;
 import org.opends.server.core.ExtendedOperation;
+import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.InitializationException;
-
-
+import org.opends.server.admin.std.server.ExtendedOperationHandlerCfg;
 
 
 /**
@@ -44,19 +43,26 @@
  * implemented by a Directory Server module that implements the
  * functionality required for one or more types of extended
  * operations.
+ *
+ * @param <T> The configuration class that will be provided to
+ *            initialize the handler.
  */
-public abstract class ExtendedOperationHandler
+public abstract class
+     ExtendedOperationHandler<T extends ExtendedOperationHandlerCfg>
 {
 
 
+  /**
+   * The default set of supported control OIDs for this extended
+   * operation.
+   */
+  protected Set<String> supportedControlOIDs = new HashSet<String>(0);
 
-  // The default set of supported control OIDs for this extended
-  // operation.
-  private Set<String> supportedControlOIDs = new HashSet<String>(0);
-
-  // The default set of supported feature OIDs for this extended
-  // operation.
-  private Set<String> supportedFeatureOIDs = new HashSet<String>(0);
+  /**
+   * The default set of supported feature OIDs for this extended
+   * operation.
+   */
+  protected Set<String> supportedFeatureOIDs = new HashSet<String>(0);
 
 
 
@@ -66,9 +72,9 @@
    * register itself with the Directory Server for the particular
    * kinds of extended operations that it will process.
    *
-   * @param  configEntry  The configuration entry that contains the
-   *                      information to use to initialize this
-   *                      extended operation handler.
+   * @param  config  The extended operation handler configuration that
+   *                 contains the information to use to initialize
+   *                 this extended operation handler.
    *
    * @throws  ConfigException  If an unrecoverable problem arises in
    *                           the process of performing the
@@ -80,7 +86,7 @@
    *                                   configuration.
    */
   public abstract void
-       initializeExtendedOperationHandler(ConfigEntry configEntry)
+       initializeExtendedOperationHandler(T config)
          throws ConfigException, InitializationException;
 
 
@@ -167,5 +173,58 @@
   {
     return getSupportedFeatures().contains(featureOID);
   }
+
+  /**
+   * If the extended operation handler defines any supported controls
+   * and/or features, then register them with the server.
+   *
+   */
+  protected void registerControlsAndFeatures()
+  {
+    Set<String> controlOIDs = getSupportedControls();
+    if (controlOIDs != null)
+    {
+      for (String oid : controlOIDs)
+      {
+        DirectoryServer.registerSupportedControl(oid);
+      }
+    }
+
+    Set<String> featureOIDs = getSupportedFeatures();
+    if (featureOIDs != null)
+    {
+      for (String oid : featureOIDs)
+      {
+        DirectoryServer.registerSupportedFeature(oid);
+      }
+    }
+  }
+
+
+  /**
+   * If the extended operation handler defines any supported controls
+   * and/or features, then deregister them with the server.
+   */
+  protected void deregisterControlsAndFeatures()
+  {
+    Set<String> controlOIDs = getSupportedControls();
+    if (controlOIDs != null)
+    {
+      for (String oid : controlOIDs)
+      {
+        DirectoryServer.deregisterSupportedControl(oid);
+      }
+    }
+
+    Set<String> featureOIDs = getSupportedFeatures();
+    if (featureOIDs != null)
+    {
+      for (String oid : featureOIDs)
+      {
+        DirectoryServer.deregisterSupportedFeature(oid);
+      }
+    }
+  }
+
 }
 

--
Gitblit v1.10.0