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

kenneth_suter
16.56.2007 46f64d6b7b18945b4d609fabe9ac87b3f6cb8f30
This commit gets the QuickSetup installer working again by specifying the server root during the directory configuration.  This is addressed by adding a hidden arg to ConfigureDS for the server root that the installer uses for the specification of the directory.

This also fixes SchemaConfigManager so that it doesn' throw an NPE if the server root happens to not be specified and the schema directory cannot be determined.
6 files modified
43 ■■■■■ changed files
opends/src/messages/messages/tools.properties 2 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 3 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/DirectoryServer.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/SchemaConfigManager.java 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/ConfigureDS.java 21 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/ToolConstants.java 9 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/tools.properties
@@ -2166,3 +2166,5 @@
 semicolon is not followed by an integer.  The semicolon will be assumed to be \
 part of the value and not a delimiter to separate the value from its relative \
 weight
FATAL_ERR_INITIALIZE_SERVER_ROOT_1293=An unexpected error occured \
  attempting to set the server's root directory to %s: %s
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -839,6 +839,9 @@
      }
    }
    argList.add("-R");
    argList.add(getInstallation().getRootDirectory().getAbsolutePath());
    String[] args = new String[argList.size()];
    argList.toArray(args);
    try
opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -791,7 +791,7 @@
   * @throws  InitializationException  If the Directory Server is currently
   *                                   running.
   */
  private void setEnvironmentConfig(DirectoryEnvironmentConfig config)
  public void setEnvironmentConfig(DirectoryEnvironmentConfig config)
          throws InitializationException
  {
    if (isRunning)
opends/src/server/org/opends/server/core/SchemaConfigManager.java
@@ -117,7 +117,11 @@
  {
    File schemaDir =
              DirectoryServer.getEnvironmentConfig().getSchemaDirectory();
    if (schemaDir != null) {
    return schemaDir.getAbsolutePath();
    } else {
      return null;
    }
  }
@@ -212,7 +216,7 @@
    try
    {
      if (! schemaDir.exists())
      if (schemaDirPath == null || ! schemaDir.exists())
      {
        Message message = ERR_CONFIG_SCHEMA_NO_SCHEMA_DIR.get(schemaDirPath);
        throw new InitializationException(message);
opends/src/server/org/opends/server/tools/ConfigureDS.java
@@ -32,6 +32,7 @@
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;
import java.io.File;
import org.opends.server.api.ConfigHandler;
import org.opends.server.config.BooleanConfigAttribute;
@@ -46,6 +47,8 @@
import org.opends.server.protocols.ldap.LDAPResultCode;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryEnvironmentConfig;
import org.opends.server.types.InitializationException;
import org.opends.server.util.SetupUtils;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.ArgumentParser;
@@ -170,6 +173,7 @@
    StringArgument    trustManagerProviderDN;
    StringArgument    certNickName;
    StringArgument    keyManagerPath;
    StringArgument    serverRoot;
    Message toolDescription = INFO_CONFIGDS_TOOL_DESCRIPTION.get();
    ArgumentParser argParser = new ArgumentParser(CLASS_NAME, toolDescription,
@@ -290,6 +294,14 @@
                                      INFO_DESCRIPTION_USAGE.get());
      argParser.addArgument(showUsage);
      argParser.setUsageArgument(showUsage);
      serverRoot = new StringArgument("serverRoot",
              ToolConstants.OPTION_SHORT_SERVER_ROOT,
              ToolConstants.OPTION_LONG_SERVER_ROOT,
              false, false, true, "{serverRootDir}", null, null,
              null);
      serverRoot.setHidden(true);
      argParser.addArgument(serverRoot);
    }
    catch (ArgumentException ae)
    {
@@ -377,6 +389,15 @@
      return 1;
    }
    if (serverRoot.isPresent()) {
      DirectoryEnvironmentConfig env = DirectoryServer.getEnvironmentConfig();
      String root = serverRoot.getValue();
      try {
        env.setServerRoot(new File(serverRoot.getValue()));
      } catch (InitializationException e) {
        ERR_INITIALIZE_SERVER_ROOT.get(root, e.getMessageObject());
      }
    }
    // Initialize the Directory Server configuration handler using the
    // information that was provided.
opends/src/server/org/opends/server/tools/ToolConstants.java
@@ -636,5 +636,14 @@
  */
 public static final String OPTION_VALUE_SET = "{PROP:VAL}";
  /**
   * Value for the server root option short form.
   */
  public static final Character OPTION_SHORT_SERVER_ROOT = 'R';
  /**
   * Value for the server root option long form.
   */
  public static final String OPTION_LONG_SERVER_ROOT = "serverRoot";
}