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

jvergara
13.06.2009 6237ff7fac6167dded7c181a3a096f074f5fd420
Fix for issue 4273 (server does not work as service if Windows UAC enabled in Windows Server 2008)
The problem was that the code assumed that the only windows OS supporting UAC was Windows Vista. This was the case before Windows 2008 came out. The fix consists on creating a method that allows identifying which OS versions of vista support UAC and which do not.
4 files modified
56 ■■■■ changed files
opends/src/server/org/opends/server/tools/ConfigureWindowsService.java 17 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/StartWindowsService.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/StopWindowsService.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/SetupUtils.java 35 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/ConfigureWindowsService.java
@@ -433,7 +433,7 @@
    String[] cmd;
    if (isVista())
    if (SetupUtils.hasUAC())
    {
      cmd = new String[] {
          getLauncherBinaryFullPath(),
@@ -518,7 +518,7 @@
    Message msg;
    String serverRoot = getServerRoot();
    String[] cmd;
    if (isVista())
    if (SetupUtils.hasUAC())
    {
      cmd = new String[] {
          getLauncherBinaryFullPath(),
@@ -598,7 +598,7 @@
    int returnValue;
    Message msg;
    String[] cmd;
    if (isVista())
    if (SetupUtils.hasUAC())
    {
      cmd = new String[] {
          getLauncherBinaryFullPath(),
@@ -831,15 +831,4 @@
  {
    return getServerRoot()+"\\lib\\winlauncher.exe";
  }
  /**
   * Indicates whether the underlying operating system is Windows Vista.
   *
   * @return  {@code true} if the underlying operating system is Windows
   *          Vista, or {@code false} if not.
   */
  private static boolean isVista()
  {
    return SetupUtils.isVista();
  }
}
opends/src/server/org/opends/server/tools/StartWindowsService.java
@@ -115,7 +115,7 @@
    else
    {
      String[] cmd;
      if (SetupUtils.isVista())
      if (SetupUtils.hasUAC())
      {
        cmd= new String[] {
            ConfigureWindowsService.getLauncherBinaryFullPath(),
opends/src/server/org/opends/server/tools/StopWindowsService.java
@@ -119,7 +119,7 @@
    else
    {
      String[] cmd;
      if (SetupUtils.isVista())
      if (SetupUtils.hasUAC())
      {
        cmd= new String[] {
            ConfigureWindowsService.getLauncherBinaryFullPath(),
opends/src/server/org/opends/server/util/SetupUtils.java
@@ -292,6 +292,41 @@
    }
    return isVista;
  }
  /**
   * Indicates whether the underlying operating system is Windows 2008.
   *
   * @return  {@code true} if the underlying operating system is Windows
   *          2008, or {@code false} if not.
   */
  public static boolean isWindows2008()
  {
    boolean isWindows2008;
    String os = System.getProperty("os.name");
    if (os != null)
    {
      isWindows2008 = isWindows() &&
      (os.toLowerCase().indexOf("server 2008") != -1);
    }
    else
    {
      isWindows2008 = false;
    }
    return isWindows2008;
  }
  /**
   * Indicates whether the underlying operating system has UAC (User Access
   * Control).
   *
   * @return  {@code true} if the underlying operating system has UAC (User
   * Access Control), or {@code false} if not.
   */
  public static boolean hasUAC()
  {
    return SetupUtils.isVista() || SetupUtils.isWindows2008();
  }
  /**
   * Returns a String representation of the OS we are running.
   * @return a String representation of the OS we are running.