From 4a261fe8cd3300751284740534c91099604198f6 Mon Sep 17 00:00:00 2001
From: coulbeck <coulbeck@localhost>
Date: Mon, 30 Apr 2007 18:38:13 +0000
Subject: [PATCH] Fix for issue #1464: Getting errors exporting non-userRoot backend IDs. This change fixes export-ldif on the schema backend, but disables it for the config and monitor backends.

---
 opends/src/server/org/opends/server/backends/MonitorBackend.java |   67 +++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/MonitorBackend.java b/opends/src/server/org/opends/server/backends/MonitorBackend.java
index a9d414d..3dd69e2 100644
--- a/opends/src/server/org/opends/server/backends/MonitorBackend.java
+++ b/opends/src/server/org/opends/server/backends/MonitorBackend.java
@@ -941,7 +941,9 @@
   public boolean supportsLDIFExport()
   {
     // We can export all the monitor entries as a point-in-time snapshot.
-    return true;
+    // TODO implementation of export is incomplete
+    // TODO export-ldif reports nonsense for upTime etc.
+    return false;
   }
 
 
@@ -953,6 +955,68 @@
                          LDIFExportConfig exportConfig)
          throws DirectoryException
   {
+    // TODO export-ldif reports nonsense for upTime etc.
+
+    configEntryDN = configEntry.getDN();
+
+
+    // Get the set of user-defined attributes for the configuration entry.  Any
+    // attributes that we don't recognize will be included directly in the base
+    // monitor entry.
+    userDefinedAttributes = new ArrayList<Attribute>();
+    for (List<Attribute> attrs :
+         configEntry.getEntry().getUserAttributes().values())
+    {
+      for (Attribute a : attrs)
+      {
+        if (! isMonitorConfigAttribute(a))
+        {
+          userDefinedAttributes.add(a);
+        }
+      }
+    }
+    for (List<Attribute> attrs :
+         configEntry.getEntry().getOperationalAttributes().values())
+    {
+      for (Attribute a : attrs)
+      {
+        if (! isMonitorConfigAttribute(a))
+        {
+          userDefinedAttributes.add(a);
+        }
+      }
+    }
+
+
+    // Create the set of base DNs that we will handle.  In this case, it's just
+    // the DN of the base monitor entry.
+    try
+    {
+      baseMonitorDN = DN.decode(DN_MONITOR_ROOT);
+    }
+    catch (Exception e)
+    {
+      if (debugEnabled())
+      {
+        debugCaught(DebugLogLevel.ERROR, e);
+      }
+
+      int msgID = MSGID_MONITOR_CANNOT_DECODE_MONITOR_ROOT_DN;
+      String message = getMessage(msgID, getExceptionMessage(e));
+      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
+                                   message, msgID, e);
+    }
+
+    // Construct the set of objectclasses to include in the base monitor entry.
+    monitorObjectClasses = new LinkedHashMap<ObjectClass,String>(2);
+    ObjectClass topOC = DirectoryServer.getObjectClass(OC_TOP, true);
+    monitorObjectClasses.put(topOC, OC_TOP);
+
+    ObjectClass monitorOC = DirectoryServer.getObjectClass(OC_MONITOR_ENTRY,
+                                                           true);
+    monitorObjectClasses.put(monitorOC, OC_MONITOR_ENTRY);
+
+
     // Create the LDIF writer.
     LDIFWriter ldifWriter;
     try
@@ -1011,6 +1075,7 @@
     {
       try
       {
+        // TODO implementation of export is incomplete
       }
       catch (Exception e)
       {

--
Gitblit v1.10.0