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

Violette Roche-Montane
07.27.2013 010eb1a3897f43458830cef58270d8196c3a4459
opends/src/server/org/opends/server/tools/RebuildIndex.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions Copyright 2011-2013 ForgeRock AS
 */
package org.opends.server.tools;
import org.opends.messages.Message;
@@ -41,6 +41,7 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.ErrorLogger.logError;
import org.opends.server.loggers.TextWriter;
import org.opends.server.loggers.ErrorLogger;
import org.opends.server.loggers.TextErrorLogPublisher;
@@ -85,6 +86,7 @@
  private StringArgument  tmpDirectory            = null;
  private BooleanArgument rebuildAll              = null;
  private BooleanArgument rebuildDegraded         = null;
  private BooleanArgument clearDegradedState      = null;
  /**
   * Processes the command-line arguments and invokes the rebuild process.
@@ -203,6 +205,10 @@
                    INFO_REBUILDINDEX_DESCRIPTION_REBUILD_DEGRADED.get());
      argParser.addArgument(rebuildDegraded);
      clearDegradedState =
          new BooleanArgument("clearDegradedState", null, "clearDegradedState",
                   INFO_REBUILDINDEX_DESCRIPTION_CLEAR_DEGRADED_STATE.get());
      argParser.addArgument(clearDegradedState);
      tmpDirectory =
           new StringArgument("tmpdirectory", null, "tmpdirectory", false,
@@ -557,6 +563,9 @@
    }
    else
    {
      if(clearDegradedState.isPresent()) {
        rebuildConfig.isClearDegradedState(true);
      }
      rebuildConfig.setRebuildMode(RebuildMode.USER_DEFINED);
    }
@@ -660,6 +669,15 @@
      attributes.add(
              new LDAPAttribute(ATTR_REBUILD_INDEX, values));
    }
    if (clearDegradedState.getValue() != null &&
        !clearDegradedState.getValue().equals(
            clearDegradedState.getDefaultValue())) {
      values = new ArrayList<ByteString>(1);
      values.add(ByteString.valueOf("true"));
      attributes.add(
            new LDAPAttribute(ATTR_REBUILD_INDEX_CLEARDEGRADEDSTATE, values));
    }
  }
  /**