From 11c5b708d2668174a94512c0936dbcbc3cfeeca8 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 02 Nov 2007 16:04:31 +0000
Subject: [PATCH] Update the server root DSE to include the supportedLDAPVersion attribute.

---
 opends/src/server/org/opends/server/core/DirectoryServer.java |   79 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 79 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 3305fc7..10a98cc 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -438,6 +438,10 @@
   // policy implementation.
   private ConcurrentHashMap<DN, RetentionPolicy> retentionPolicies;
 
+  // The set supported LDAP protocol versions.
+  private ConcurrentHashMap<Integer,List<ConnectionHandler>>
+               supportedLDAPVersions;
+
   // The set of extended operation handlers registered with the server (mapped
   // between the OID of the extended operation and the handler).
   private ConcurrentHashMap<String,ExtendedOperationHandler>
@@ -924,6 +928,8 @@
                                    <SynchronizationProviderCfg>>();
       directoryServer.supportedControls = new TreeSet<String>();
       directoryServer.supportedFeatures = new TreeSet<String>();
+      directoryServer.supportedLDAPVersions =
+           new ConcurrentHashMap<Integer,List<ConnectionHandler>>();
       directoryServer.virtualAttributes =
            new CopyOnWriteArrayList<VirtualAttributeRule>();
       directoryServer.connectionHandlers =
@@ -7050,6 +7056,79 @@
 
 
   /**
+   * Retrieves the supported LDAP versions for the Directory Server.
+   *
+   * @return  The supported LDAP versions for the Directory Server.
+   */
+  public static Set<Integer> getSupportedLDAPVersions()
+  {
+    return directoryServer.supportedLDAPVersions.keySet();
+  }
+
+
+
+  /**
+   * Registers the provided LDAP protocol version as supported within the
+   * Directory Server.
+   *
+   * @param  supportedLDAPVersion  The LDAP protocol version to register as
+   *                               supported.
+   * @param  connectionHandler     The connection handler that supports the
+   *                               provided LDAP version.  Note that multiple
+   *                               connection handlers can provide support for
+   *                               the same LDAP versions.
+   */
+  public static synchronized void registerSupportedLDAPVersion(
+                                       int supportedLDAPVersion,
+                                       ConnectionHandler connectionHandler)
+  {
+    List<ConnectionHandler> handlers =
+         directoryServer.supportedLDAPVersions.get(supportedLDAPVersion);
+    if (handlers == null)
+    {
+      handlers = new LinkedList<ConnectionHandler>();
+      handlers.add(connectionHandler);
+      directoryServer.supportedLDAPVersions.put(supportedLDAPVersion, handlers);
+    }
+    else
+    {
+      if (! handlers.contains(connectionHandler))
+      {
+        handlers.add(connectionHandler);
+      }
+    }
+  }
+
+
+
+  /**
+   * Deregisters the provided LDAP protocol version as supported within the
+   * Directory Server.
+   *
+   * @param  supportedLDAPVersion  The LDAP protocol version to deregister.
+   * @param  connectionHandler     The connection handler that no longer
+   *                               supports the provided LDAP version.
+   */
+  public static synchronized void deregisterSupportedLDAPVersion(
+                                       int supportedLDAPVersion,
+                                       ConnectionHandler connectionHandler)
+  {
+    List<ConnectionHandler> handlers =
+         directoryServer.supportedLDAPVersions.get(supportedLDAPVersion);
+    if (handlers != null)
+    {
+      handlers.remove(connectionHandler);
+      if (handlers.isEmpty())
+      {
+        directoryServer.supportedLDAPVersions.remove(supportedLDAPVersion);
+      }
+    }
+  }
+
+
+
+
+  /**
    * Retrieves the set of identity mappers defined in the Directory Server
    * configuration, as a mapping between the DN of the configuration entry and
    * the identity mapper.

--
Gitblit v1.10.0