From 7a6f98492aaeacd4e5a795adc71b75edbc1d126a Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 30 Nov 2006 21:50:39 +0000
Subject: [PATCH] Update the extended operation handler API to provide the ability for custom extended operations to handle their own controls.  The password modify extended operation has been updated to support the LDAP no-op control and the password policy control.

---
 opends/src/server/org/opends/server/api/ExtendedOperationHandler.java |   87 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 87 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/api/ExtendedOperationHandler.java b/opends/src/server/org/opends/server/api/ExtendedOperationHandler.java
index b9e2197..d3d4bcd 100644
--- a/opends/src/server/org/opends/server/api/ExtendedOperationHandler.java
+++ b/opends/src/server/org/opends/server/api/ExtendedOperationHandler.java
@@ -28,6 +28,9 @@
 
 
 
+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;
@@ -53,6 +56,16 @@
 
 
 
+  // 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);
+
+
+
   /**
    * Initializes this extended operation handler based on the
    * information in the provided configuration entry.  It should also
@@ -98,5 +111,79 @@
    */
   public abstract void processExtendedOperation(ExtendedOperation
                                                      operation);
+
+
+
+  /**
+   * Retrieves the OIDs of the controls that may be supported by this
+   * extended operation handler.  It should be overridden by any
+   * extended operation handler which provides special support for one
+   * or more controls.
+   *
+   * @return  The OIDs of the controls that may be supported by this
+   *          extended operation handler.
+   */
+  public Set<String> getSupportedControls()
+  {
+    assert debugEnter(CLASS_NAME, "getSupportedControls");
+
+    return supportedControlOIDs;
+  }
+
+
+
+  /**
+   * Indicates whether this extended operation handler supports the
+   * specified control.
+   *
+   * @param  controlOID  The OID of the control for which to make the
+   *                     determination.
+   *
+   * @return  {@code true} if this extended operation handler does
+   *          support the requested control, or {@code false} if not.
+   */
+  public final boolean supportsControl(String controlOID)
+  {
+    assert debugEnter(CLASS_NAME, "supportsControl",
+                      String.valueOf(controlOID));
+
+    return getSupportedControls().contains(controlOID);
+  }
+
+
+
+  /**
+   * Retrieves the OIDs of the features that may be supported by this
+   * extended operation handler.
+   *
+   * @return  The OIDs of the features that may be supported by this
+   *          extended operation handler.
+   */
+  public Set<String> getSupportedFeatures()
+  {
+    assert debugEnter(CLASS_NAME, "getSupportedFeatures");
+
+    return supportedFeatureOIDs;
+  }
+
+
+
+  /**
+   * Indicates whether this extended operation handler supports the
+   * specified feature.
+   *
+   * @param  featureOID  The OID of the feature for which to make the
+   *                     determination.
+   *
+   * @return  {@code true} if this extended operation handler does
+   *          support the requested feature, or {@code false} if not.
+   */
+  public final boolean supportsFeature(String featureOID)
+  {
+    assert debugEnter(CLASS_NAME, "supportsFeature",
+                      String.valueOf(featureOID));
+
+    return getSupportedFeatures().contains(featureOID);
+  }
 }
 

--
Gitblit v1.10.0