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

Ludovic Poitou
23.17.2011 95798000b6af5e5805d7be753766e6d2fd5cb4aa
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 */
package org.opends.quicksetup.util;
@@ -2485,7 +2486,7 @@
      UserData userData, Set<String> baseDNs, ServerDescriptor server)
  {
    ArrayList<String> cmdLine = new ArrayList<String>();
    String cmdName = getCommandLinePath("dsreplication");
    String cmdName = getCommandLinePath(userData, "dsreplication");
    cmdLine.add(cmdName);
    cmdLine.add("enable");
@@ -2560,50 +2561,31 @@
  /**
   * Returns the full path of the command-line for a given script name.
   * @param userData  the user data.
   * @param scriptBasicName the script basic name (with no extension).
   * @return the full path of the command-line for a given script name.
   */
  private static String getCommandLinePath(String scriptBasicName)
  private static String getCommandLinePath(UserData userData,
                                           String scriptBasicName)
  {
    String cmdLineName;
    if (isWindows())
    {
      cmdLineName = getBinaryDir()+scriptBasicName+".bat";
      cmdLineName = getInstallDir(userData)
          + Installation.WINDOWS_BINARIES_PATH_RELATIVE
          + File.separatorChar
          + scriptBasicName + ".bat";
    }
    else
    {
      cmdLineName = getBinaryDir()+scriptBasicName;
      cmdLineName = getInstallDir(userData)
          + Installation.UNIX_BINARIES_PATH_RELATIVE
          + File.separatorChar
          + scriptBasicName;
    }
    return cmdLineName;
  }
  private static String binDir;
  /**
   * Returns the binary/script directory.
   * @return the binary/script directory.
   */
  private static String getBinaryDir()
  {
    if (binDir == null)
    {
      File f = Installation.getLocal().getBinariesDirectory();
      try
      {
        binDir = f.getCanonicalPath();
      }
      catch (Throwable t)
      {
        binDir = f.getAbsolutePath();
      }
      if (binDir.lastIndexOf(File.separatorChar) != (binDir.length() - 1))
      {
        binDir += File.separatorChar;
      }
    }
    return binDir;
  }
  private static String installDir;
  /**
   * Returns the installation directory.
@@ -2645,7 +2627,7 @@
      UserData userData, Set<String> baseDNs, ServerDescriptor server)
  {
    ArrayList<String> cmdLine = new ArrayList<String>();
    String cmdName = getCommandLinePath("dsreplication");
    String cmdName = getCommandLinePath(userData, "dsreplication");
    cmdLine.add(cmdName);
    cmdLine.add("initialize");
@@ -2774,7 +2756,7 @@
  {
    ArrayList<ArrayList<String>> cmdLines = new ArrayList<ArrayList<String>>();
    String cmdName = getCommandLinePath("dsconfig");
    String cmdName = getCommandLinePath(userData, "dsconfig");
    ArrayList<String> connectionArgs = new ArrayList<String>();
    connectionArgs.add("--hostName");