From 2b1ccc8723b7cce6708c6f2ac8c10fc1c670b708 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 02 Feb 2007 19:51:36 +0000
Subject: [PATCH] Add initial support for static groups. At present, this does not allow for nested static groups, but it does handle changes to the set of available groups and to group membership while the server is online. It also includes a backend initialization listener API, which makes it possible for components to perform custom processing when a backend is brought online or offline, and this is used to identify all groups at the time that the server is started.
---
opends/src/server/org/opends/server/core/DirectoryServer.java | 125 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 124 insertions(+), 1 deletions(-)
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index c438890..a971890 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -53,6 +53,7 @@
import org.opends.server.api.ApproximateMatchingRule;
import org.opends.server.api.AttributeSyntax;
import org.opends.server.api.Backend;
+import org.opends.server.api.BackendInitializationListener;
import org.opends.server.api.CertificateMapper;
import org.opends.server.api.ChangeNotificationListener;
import org.opends.server.api.ClientConnection;
@@ -355,6 +356,11 @@
private CopyOnWriteArrayList<SynchronizationProvider>
synchronizationProviders;
+ // The set of backend initialization listeners registered with the Directory
+ // Server.
+ private CopyOnWriteArraySet<BackendInitializationListener>
+ backendInitializationListeners;
+
// The set of root DNs registered with the Directory Server.
private CopyOnWriteArraySet<DN> rootDNs;
@@ -386,6 +392,9 @@
// The configuration manager for extended operation handlers.
private ExtendedOperationConfigManager extendedOperationConfigManager;
+ // The group manager for the Directory Server.
+ private GroupManager groupManager;
+
// The configuration manager for identity mappers.
private IdentityMapperConfigManager identityMapperConfigManager;
@@ -615,6 +624,8 @@
directoryServer.monitorProviders =
new ConcurrentHashMap<String,MonitorProvider>();
directoryServer.backends = new TreeMap<String,Backend>();
+ directoryServer.backendInitializationListeners =
+ new CopyOnWriteArraySet<BackendInitializationListener>();
directoryServer.baseDNs = new TreeMap<DN,Backend>();
directoryServer.publicNamingContexts = new TreeMap<DN,Backend>();
directoryServer.privateNamingContexts = new TreeMap<DN,Backend>();
@@ -724,6 +735,12 @@
totalConnections = 0;
+ // Create the plugin config manager, but don't initialize it yet. This will
+ // make it possible to process internal operations before the plugins have
+ // been loaded.
+ pluginConfigManager = new PluginConfigManager();
+
+
// If we have gotten here, then the configuration should be properly
// bootstrapped.
synchronized (directoryServer)
@@ -964,6 +981,10 @@
new RootDNConfigManager().initializeRootDNs();
+ // Initialize the group manager.
+ initializeGroupManager();
+
+
// Initialize all the backends and their associated suffixes.
initializeBackends();
@@ -1899,6 +1920,60 @@
/**
+ * Retrieves the set of backend initialization listeners that have been
+ * registered with the Directory Server. The contents of the returned set
+ * must not be altered.
+ *
+ * @return The set of backend initialization listeners that have been
+ * registered with the Directory Server.
+ */
+ public static Set<BackendInitializationListener>
+ getBackendInitializationListeners()
+ {
+ assert debugEnter(CLASS_NAME, "getBackendInitializationListeners");
+
+ return directoryServer.backendInitializationListeners;
+ }
+
+
+
+ /**
+ * Registers the provided backend initialization listener with the Directory
+ * Server.
+ *
+ * @param listener The backend initialization listener to register with the
+ * Directory Server.
+ */
+ public static void registerBackendInitializationListener(
+ BackendInitializationListener listener)
+ {
+ assert debugEnter(CLASS_NAME, "registerBackendInitializationListener",
+ String.valueOf(listener));
+
+ directoryServer.backendInitializationListeners.add(listener);
+ }
+
+
+
+ /**
+ * Deegisters the provided backend initialization listener with the Directory
+ * Server.
+ *
+ * @param listener The backend initialization listener to deregister with
+ * the Directory Server.
+ */
+ public static void deregisterBackendInitializationListener(
+ BackendInitializationListener listener)
+ {
+ assert debugEnter(CLASS_NAME, "deregisterBackendInitializationListener",
+ String.valueOf(listener));
+
+ directoryServer.backendInitializationListeners.remove(listener);
+ }
+
+
+
+ /**
* Initializes the set of backends defined in the Directory Server.
*
* @throws ConfigException If there is a configuration problem with any of
@@ -1942,6 +2017,45 @@
/**
+ * Initializes the Directory Server group manager.
+ *
+ * @throws ConfigException If there is a configuration problem with any of
+ * the group implementations.
+ *
+ * @throws InitializationException If a problem occurs while initializing
+ * the group manager that is not related to
+ * the server configuration.
+ */
+ public void initializeGroupManager()
+ throws ConfigException, InitializationException
+ {
+ assert debugEnter(CLASS_NAME, "initializeGroupManager");
+
+ groupManager = new GroupManager();
+ groupManager.initializeGroupImplementations();
+
+ // The configuration backend has already been registered by this point
+ // so we need to handle it explicitly.
+ groupManager.performBackendInitializationProcessing(configHandler);
+ }
+
+
+
+ /**
+ * Retrieves the Directory Server group manager.
+ *
+ * @return The Directory Server group manager.
+ */
+ public static GroupManager getGroupManager()
+ {
+ assert debugEnter(CLASS_NAME, "getGroupManager");
+
+ return directoryServer.groupManager;
+ }
+
+
+
+ /**
* Initializes the set of supported controls for the Directory Server.
*
* @throws ConfigException If there is a configuration problem with the
@@ -2203,7 +2317,6 @@
{
assert debugEnter(CLASS_NAME, "initializePlugins");
- pluginConfigManager = new PluginConfigManager();
pluginConfigManager.initializePluginConfig(null);
}
@@ -7121,6 +7234,10 @@
}
+ // Perform any necessary cleanup work for the group manager.
+ directoryServer.groupManager.finalizeGroupManager();
+
+
// Shut down all the other components that may need special handling.
// NYI
@@ -7144,6 +7261,12 @@
{
try
{
+ for (BackendInitializationListener listener :
+ directoryServer.backendInitializationListeners)
+ {
+ listener.performBackendFinalizationProcessing(backend);
+ }
+
backend.finalizeBackend();
// Remove the shared lock for this backend.
--
Gitblit v1.10.0