mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
10.50.2007 5630d1d870315aa2467a96cd866e996164a2d598
Update the configuration for the Berkeley DB JE backend to ensure that it will
require a valid value for the database logging level.

OpenDS Issue Number: 1899
2 files modified
53 ■■■■■ changed files
opends/src/server/org/opends/server/backends/jeb/BackendImpl.java 39 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/messages/JebMessages.java 14 ●●●●● patch | view | raw | blame | history
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;
opends/src/server/org/opends/server/messages/JebMessages.java
@@ -1207,6 +1207,14 @@
  public static final int MSGID_JEB_IMPORT_CREATE_TMPDIR_ERROR =
      CATEGORY_MASK_JEB | SEVERITY_MASK_SEVERE_ERROR | 155;
  /**
   * The message ID of the message that will be used if an invalid logging level
   * was requested.  This takes two arguments, which are the invalid logging
   * level and the configuration entry DN.
   */
  public static final int MSGID_JEB_INVALID_LOGGING_LEVEL =
       CATEGORY_MASK_JEB | SEVERITY_MASK_SEVERE_ERROR | 156;
  /**
   * Associates a set of generic messages with the message IDs defined in this
@@ -1244,6 +1252,12 @@
                    "for ID %s");
    registerMessage(MSGID_JEB_DATABASE_EXCEPTION,
                    "Database exception: %s");
    registerMessage(MSGID_JEB_INVALID_LOGGING_LEVEL,
                    "The database logging level string '%s' provided for " +
                    "configuration entry '%s' is invalid.  The value must " +
                    "be one of OFF, SEVERE, WARNING, INFO, CONFIG, FINE, " +
                    "FINER, FINEST, or ALL.  Note that these values are " +
                    "case sensitive");
    registerMessage(MSGID_CONFIG_DESCRIPTION_INDEX_ATTRIBUTE,
                    "The attribute type name of the attribute index");
    registerMessage(MSGID_CONFIG_DESCRIPTION_INDEX_TYPE,