From d660328ffe2ad59ccf30b281ec02b3cf718f1c76 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Fri, 20 Mar 2009 17:16:34 +0000
Subject: [PATCH] - [Issue 3827] unable to enable NDB backend dynamically with dsconfig : make sure root virtual attributes are initialized before backends initialization takes places; fix virtual attributes stripping.

---
 opends/src/server/org/opends/server/core/DirectoryServer.java     |    8 ++++----
 opends/src/server/org/opends/server/backends/ndb/BackendImpl.java |   12 +++++++++---
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/ndb/BackendImpl.java b/opends/src/server/org/opends/server/backends/ndb/BackendImpl.java
index 2f7d84a..a5c24eb 100644
--- a/opends/src/server/org/opends/server/backends/ndb/BackendImpl.java
+++ b/opends/src/server/org/opends/server/backends/ndb/BackendImpl.java
@@ -64,6 +64,7 @@
 import org.opends.server.admin.Configuration;
 import org.opends.server.admin.server.ConfigurationChangeListener;
 import org.opends.server.admin.std.meta.GlobalCfgDefn.WorkflowConfigurationMode;
+import org.opends.server.admin.std.meta.VirtualAttributeCfgDefn;
 import org.opends.server.admin.std.server.NdbBackendCfg;
 import org.opends.server.admin.std.server.NdbIndexCfg;
 import org.opends.server.backends.SchemaBackend;
@@ -581,13 +582,18 @@
         operationalAttributes.add(attrName);
       }
     }
+
     // Strip virtual attributes.
     for (VirtualAttributeRule rule :
       DirectoryServer.getVirtualAttributes())
     {
-      String attrName = rule.getAttributeType().getNameOrOID();
-      if (operationalAttributes.contains(attrName)) {
-        operationalAttributes.remove(attrName);
+      if (rule.getConflictBehavior() ==
+        VirtualAttributeCfgDefn.ConflictBehavior.VIRTUAL_OVERRIDES_REAL)
+      {
+        String attrName = rule.getAttributeType().getNameOrOID();
+        if (operationalAttributes.contains(attrName)) {
+          operationalAttributes.remove(attrName);
+        }
       }
     }
 
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 32291ec..efa1d16 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -1340,6 +1340,10 @@
       initializeSchema();
 
 
+      // Initialize all the virtual attribute handlers.
+      initializeVirtualAttributes();
+
+
       // Initialize the core Directory Server configuration.
       coreConfigManager = new CoreConfigManager();
       coreConfigManager.initializeCoreConfig();
@@ -1452,10 +1456,6 @@
       initializeSASLMechanisms();
 
 
-      // Initialize all the virtual attribute handlers.
-      initializeVirtualAttributes();
-
-
       // Initialize all the connection handlers
       // (including the administration connector).
       if (startConnectionHandlers)

--
Gitblit v1.10.0