From 5630d1d870315aa2467a96cd866e996164a2d598 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 10 Jul 2007 17:50:04 +0000
Subject: [PATCH] Update the configuration for the Berkeley DB JE backend to ensure that it will require a valid value for the database logging level.

---
 opends/src/server/org/opends/server/backends/jeb/BackendImpl.java |   39 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java b/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
index 69a15e5..b5e2aad 100644
--- a/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
+++ b/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -56,8 +56,7 @@
 import org.opends.server.core.SearchOperation;
 import org.opends.server.util.LDIFException;
 import org.opends.server.util.Validator;
-import org.opends.server.util.StaticUtils;
-import static org.opends.server.util.StaticUtils.getFileForPath;
+import static org.opends.server.util.StaticUtils.*;
 
 import static org.opends.server.messages.BackendMessages.*;
 import static org.opends.server.messages.MessageHandler.getMessage;
@@ -1391,12 +1390,42 @@
   /**
    * {@inheritDoc}
    */
+  @Override()
+  public boolean isConfigurationAcceptable(Configuration configuration,
+                                           List<String> unacceptableReasons)
+  {
+    JEBackendCfg config = (JEBackendCfg) configuration;
+    return isConfigurationChangeAcceptable(config, unacceptableReasons);
+  }
+
+
+
+  /**
+   * {@inheritDoc}
+   */
   public boolean isConfigurationChangeAcceptable(
       JEBackendCfg cfg,
       List<String> unacceptableReasons)
   {
-    // This listener handles only the changes to the base DNs.
-    // The base DNs are checked by the backend config manager.
+    // Make sure that the logging level value is acceptable.
+    String loggingLevel = cfg.getDatabaseLoggingLevel();
+    if (! (loggingLevel.equals("OFF") ||
+           loggingLevel.equals("SEVERE") ||
+           loggingLevel.equals("WARNING") ||
+           loggingLevel.equals("INFO") ||
+           loggingLevel.equals("CONFIG") ||
+           loggingLevel.equals("FINE") ||
+           loggingLevel.equals("FINER") ||
+           loggingLevel.equals("FINEST") ||
+           loggingLevel.equals("OFF")))
+    {
+      int    msgID   = MSGID_JEB_INVALID_LOGGING_LEVEL;
+      String message = getMessage(msgID,
+                                  String.valueOf(cfg.getDatabaseLoggingLevel()),
+                                  String.valueOf(cfg.dn()));
+      unacceptableReasons.add(message);
+      return false;
+    }
 
     return true;
   }
@@ -1472,7 +1501,7 @@
     }
     catch (Exception e)
     {
-      messages.add(StaticUtils.stackTraceToSingleLineString(e));
+      messages.add(stackTraceToSingleLineString(e));
       ccr = new ConfigChangeResult(DirectoryServer.getServerErrorResultCode(),
                                    false, messages);
       return ccr;

--
Gitblit v1.10.0