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

jvergara
26.13.2007 c0e776c195406d5bd83fdd683ac73c56fcc8a93f
Centralize the hardcoded strings of the different commands used in the setup and in the control panel in the class Utils.java.
12 files modified
246 ■■■■ changed files
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetup.java 6 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java 12 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 12 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java 3 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/InstallWelcomePanel.java 3 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallLauncher.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java 6 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java 168 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusCli.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelController.java 6 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetup.java
@@ -622,7 +622,8 @@
      {
        try
        {
          String cmd = Utils.isWindows()?"statuspanel.bat":"statuspanel";
          String cmd = Utils.isWindows()?Utils.getWindowsStatusPanelFileName():
              Utils.getUnixStatusPanelFileName();
          String serverPath;
          if (Utils.isWebStart())
          {
@@ -632,7 +633,8 @@
          {
            serverPath = Utils.getInstallPathFromClasspath();
          }
          cmd = Utils.getPath(serverPath, "bin"+File.separator+cmd);
          cmd = Utils.getPath(serverPath, Utils.getBinariesRelativePath()+
                  File.separator+cmd);
          ProcessBuilder pb = new ProcessBuilder(new String[]{cmd});
          Map<String, String> env = pb.environment();
          env.put("JAVA_HOME", System.getProperty("java.home"));
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
@@ -43,10 +43,6 @@
 */
public class InstallLauncher
{
  private static String COMMAND_NAME_WINDOWS = "setup.bat";
  private static String COMMAND_NAME_UNIX = "setup";
  /**
   * The main method which is called by the setup command lines.
   * @param args the arguments passed by the command lines.  In the case
@@ -93,10 +89,10 @@
      String arg;
      if (Utils.isWindows())
      {
        arg = COMMAND_NAME_WINDOWS;
        arg = Utils.getWindowsSetupFileName();
      } else
      {
        arg = COMMAND_NAME_UNIX;
        arg = Utils.getUnixSetupFileName();
      }
      /*
       * This is required because the usage message contains '{' characters that
@@ -142,11 +138,11 @@
    if (Utils.isWindows())
    {
      System.setProperty("org.opends.server.scriptName",
          COMMAND_NAME_WINDOWS);
          Utils.getWindowsSetupFileName());
    } else
    {
      System.setProperty("org.opends.server.scriptName",
          COMMAND_NAME_UNIX);
          Utils.getUnixSetupFileName());
    }
    ArrayList<String> newArgList = new ArrayList<String>();
    if (args != null)
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -870,10 +870,12 @@
    if (Utils.isWindows())
    {
      argList.add(Utils.getPath(getBinariesPath(), "start-ds.bat"));
      argList.add(Utils.getPath(getBinariesPath(),
              Utils.getWindowsStartFileName()));
    } else
    {
      argList.add(Utils.getPath(getBinariesPath(), "start-ds"));
      argList.add(Utils.getPath(getBinariesPath(),
              Utils.getUnixStartFileName()));
    }
    String[] args = new String[argList.size()];
@@ -1043,11 +1045,13 @@
    String cmd;
    if (Utils.isWindows())
    {
      cmd = "bin"+File.separator+"statuspanel.bat";
      cmd = Utils.getBinariesRelativePath()+File.separator+
      Utils.getWindowsStatusPanelFileName();
    }
    else
    {
      cmd = "bin"+File.separator+"statuspanel";
      cmd = Utils.getBinariesRelativePath()+File.separator+
      Utils.getUnixStatusPanelFileName();
    }
    cmd = UIFactory.applyFontToHtml(cmd, UIFactory.INSTRUCTIONS_MONOSPACE_FONT);
    String[] args = {formatter.getFormattedText(getInstallationPath()), cmd};
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -152,9 +152,6 @@
      status = InstallProgressStep.FINISHED_SUCCESSFULLY;
      notifyListeners(null);
      if (false)
        throw new InstallException(InstallException.Type.DOWNLOAD_ERROR,
            getMsg("error-zipinputstreamnull"), null);
    } catch (InstallException ex)
    {
      if (ex.getCause() != null)
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -424,7 +424,7 @@
          try
          {
            copyZipEntry(entry, basePath, zipFirstPath, zipIn,
                ratioBeforeCompleted, ratioWhenCompleted, permissions);
            ratioBeforeCompleted, ratioWhenCompleted, permissions);
          } catch (IOException ioe)
          {
@@ -625,7 +625,8 @@
    } else if (path.endsWith(".sh"))
    {
      perm = "755";
    } else if (path.endsWith("setup") || path.endsWith("uninstall"))
    } else if (path.endsWith(Utils.getUnixSetupFileName()) ||
            path.endsWith(Utils.getUnixUninstallFileName()))
    {
      perm = "755";
    } else
@@ -654,4 +655,3 @@
    return getUserData().getServerLocation();
  }
}
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/InstallWelcomePanel.java
@@ -71,7 +71,8 @@
    {
      msgKey = "welcome-panel-webstart-instructions";
      args = new String[3];
      String cmd = Utils.isWindows()?"setup.bat":"setup";
      String cmd = Utils.isWindows()?Utils.getWindowsSetupFileName():
          Utils.getUnixSetupFileName();
      args[0] = UIFactory.applyFontToHtml(cmd,
          UIFactory.INSTRUCTIONS_MONOSPACE_FONT);
      args[1] = org.opends.server.util.DynamicConstants.COMPACT_VERSION_STRING;
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallLauncher.java
@@ -43,10 +43,6 @@
 */
public class UninstallLauncher
{
  private static String COMMAND_NAME_WINDOWS = "uninstall.bat";
  private static String COMMAND_NAME_UNIX = "uninstall";
  /**
   * The main method which is called by the uninstall command lines.
   * @param args the arguments passed by the command lines.
@@ -183,10 +179,10 @@
    String arg;
    if (Utils.isWindows())
    {
      arg = COMMAND_NAME_WINDOWS;
      arg = Utils.getWindowsUninstallFileName();
    } else
    {
      arg = COMMAND_NAME_UNIX;
      arg = Utils.getUnixUninstallFileName();
    }
    /*
     * This is required because the usage message contains '{' characters that
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java
@@ -636,10 +636,12 @@
    if (Utils.isWindows())
    {
      argList.add(Utils.getPath(getBinariesPath(), "stop-ds.bat"));
      argList.add(Utils.getPath(getBinariesPath(),
              Utils.getWindowsStopFileName()));
    } else
    {
      argList.add(Utils.getPath(getBinariesPath(), "stop-ds"));
      argList.add(Utils.getPath(getBinariesPath(),
              Utils.getUnixStopFileName()));
    }
    String[] args = new String[argList.size()];
    argList.toArray(args);
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -117,6 +117,66 @@
   */
  private static final String CONFIG_FILE_PATH_RELATIVE = "config/config.ldif";
  /**
   * The UNIX setup script file name.
   */
  private static final String UNIX_SETUP_FILE_NAME = "setup";
  /**
   * The Windows setup batch file name.
   */
  private static final String WINDOWS_SETUP_FILE_NAME = "setup.bat";
  /**
   * The UNIX uninstall script file name.
   */
  private static final String UNIX_UNINSTALL_FILE_NAME = "uninstall";
  /**
   * The Windows uninstall batch file name.
   */
  private static final String WINDOWS_UNINSTALL_FILE_NAME = "uninstall.bat";
  /**
   * The UNIX start script file name.
   */
  private static final String UNIX_START_FILE_NAME = "start-ds";
  /**
   * The Windows start batch file name.
   */
  private static final String WINDOWS_START_FILE_NAME = "start-ds.bat";
  /**
   * The UNIX stop script file name.
   */
  private static final String UNIX_STOP_FILE_NAME = "stop-ds";
  /**
   * The Windows stop batch file name.
   */
  private static final String WINDOWS_STOP_FILE_NAME = "stop-ds.bat";
  /**
   * The UNIX status panel script file name.
   */
  private static final String UNIX_STATUSPANEL_FILE_NAME = "statuspanel";
  /**
   * The Windows status panel batch file name.
   */
  private static final String WINDOWS_STATUSPANEL_FILE_NAME = "statuspanel.bat";
  /**
   * The UNIX status command line script file name.
   */
  private static final String UNIX_STATUSCLI_FILE_NAME = "status";
  /**
   * The Windows status command line batch file name.
   */
  private static final String WINDOWS_STATUSCLI_FILE_NAME = "status.bat";
  private Utils()
  {
  }
@@ -1090,6 +1150,114 @@
  }
  /**
   * Returns the name of the UNIX setup script file name.
   * @return the name of the UNIX setup script file name.
   */
  public static String getUnixSetupFileName()
  {
    return UNIX_SETUP_FILE_NAME;
  }
  /**
   * Returns the name of the Windows setup batch file name.
   * @return the name of the Windows setup batch file name.
   */
  public static String getWindowsSetupFileName()
  {
    return WINDOWS_SETUP_FILE_NAME;
  }
  /**
   * Returns the name of the UNIX uninstall script file name.
   * @return the name of the UNIX uninstall script file name.
   */
  public static String getUnixUninstallFileName()
  {
    return UNIX_UNINSTALL_FILE_NAME;
  }
  /**
   * Returns the name of the Windows uninstall batch file name.
   * @return the name of the Windows uninstall batch file name.
   */
  public static String getWindowsUninstallFileName()
  {
    return WINDOWS_UNINSTALL_FILE_NAME;
  }
  /**
   * Returns the name of the UNIX start script file name.
   * @return the name of the UNIX start script file name.
   */
  public static String getUnixStartFileName()
  {
    return UNIX_START_FILE_NAME;
  }
  /**
   * Returns the name of the Windows start batch file name.
   * @return the name of the Windows start batch file name.
   */
  public static String getWindowsStartFileName()
  {
    return WINDOWS_START_FILE_NAME;
  }
  /**
   * Returns the name of the UNIX stop script file name.
   * @return the name of the UNIX stop script file name.
   */
  public static String getUnixStopFileName()
  {
    return UNIX_STOP_FILE_NAME;
  }
  /**
   * Returns the name of the Windows stop batch file name.
   * @return the name of the Windows stop batch file name.
   */
  public static String getWindowsStopFileName()
  {
    return WINDOWS_STOP_FILE_NAME;
  }
  /**
   * Returns the name of the UNIX status panel script file name.
   * @return the name of the UNIX status panel script file name.
   */
  public static String getUnixStatusPanelFileName()
  {
    return UNIX_STATUSPANEL_FILE_NAME;
  }
  /**
   * Returns the name of the Windows status panel batch file name.
   * @return the name of the Windows status panel batch file name.
   */
  public static String getWindowsStatusPanelFileName()
  {
    return WINDOWS_STATUSPANEL_FILE_NAME;
  }
  /**
   * Returns the name of the UNIX status command line script file name.
   * @return the name of the UNIX status command line script file name.
   */
  public static String getUnixStatusCliFileName()
  {
    return UNIX_STATUSCLI_FILE_NAME;
  }
  /**
   * Returns the name of the Windows status command line batch file name.
   * @return the name of the Windows status command line batch file name.
   */
  public static String getWindowsStatusCliFileName()
  {
    return WINDOWS_STATUSCLI_FILE_NAME;
  }
  /**
   * Displays a confirmation message dialog.
  *
  * @param parent
opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusCli.java
@@ -74,10 +74,6 @@
   */
  static int BUG = 2;
  private static String COMMAND_NAME_WINDOWS = "status.bat";
  private static String COMMAND_NAME_UNIX = "status";
  /**
   * The main method which is called by the status command lines.
   * @param args the arguments passed by the status command lines.
@@ -339,10 +335,10 @@
    String arg;
    if (Utils.isWindows())
    {
      arg = COMMAND_NAME_WINDOWS;
      arg = Utils.getWindowsStatusCliFileName();
    } else
    {
      arg = COMMAND_NAME_UNIX;
      arg = Utils.getUnixStatusCliFileName();
    }
    /*
     * This is required because the usage message contains '{' characters that
opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelController.java
@@ -658,10 +658,12 @@
    if (Utils.isWindows())
    {
      argList.add(Utils.getPath(getBinariesPath(), "stop-ds.bat"));
      argList.add(Utils.getPath(getBinariesPath(),
              Utils.getWindowsStopFileName()));
    } else
    {
      argList.add(Utils.getPath(getBinariesPath(), "stop-ds"));
      argList.add(Utils.getPath(getBinariesPath(),
              Utils.getUnixStopFileName()));
    }
    String[] args = new String[argList.size()];
    argList.toArray(args);
opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java
@@ -39,10 +39,6 @@
 */
public class StatusPanelLauncher
{
  private static String COMMAND_NAME_WINDOWS = "statuspanel.bat";
  private static String COMMAND_NAME_UNIX = "statuspanel";
  /**
   * The main method which is called by the control panel command lines.
   * @param args the arguments passed by the command lines.
@@ -124,10 +120,10 @@
    String arg;
    if (Utils.isWindows())
    {
      arg = COMMAND_NAME_WINDOWS;
      arg = Utils.getWindowsStatusPanelFileName();
    } else
    {
      arg = COMMAND_NAME_UNIX;
      arg = Utils.getUnixStatusPanelFileName();
    }
    /*
     * This is required because the usage message contains '{' characters that