From b8b6ead66c08c4a50192a0501a5d28521c005f4a Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Mon, 28 Aug 2006 15:02:23 +0000
Subject: [PATCH] Add a mechanism that may be used to determine the operating system on which the server is running, based on parsing the value of the os.name system property. It includes code to try to identify the following operating systems:

---
 opends/src/server/org/opends/server/core/DirectoryServer.java |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 8af3d3e..329f790 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -132,6 +132,7 @@
 import org.opends.server.types.NameForm;
 import org.opends.server.types.ObjectClass;
 import org.opends.server.types.ObjectClassType;
+import org.opends.server.types.OperatingSystem;
 import org.opends.server.types.RDN;
 import org.opends.server.types.ResultCode;
 import org.opends.server.types.WritabilityMode;
@@ -428,6 +429,9 @@
   // The monitor config manager for the Directory Server.
   private MonitorConfigManager monitorConfigManager;
 
+  // The operating system on which the server is running.
+  private OperatingSystem operatingSystem;
+
   // The configuration handler used to manage the password generators.
   private PasswordGeneratorConfigManager passwordGeneratorConfigManager;
 
@@ -515,6 +519,8 @@
     isRunning             = false;
     shuttingDown          = false;
     serverErrorResultCode = ResultCode.OTHER;
+
+    operatingSystem = OperatingSystem.forName(System.getProperty("os.name"));
   }
 
 
@@ -2107,6 +2113,20 @@
 
 
   /**
+   * Retrieves the operating system on which the Directory Server is running.
+   *
+   * @return  The operating system on which the Directory Server is running.
+   */
+  public static OperatingSystem getOperatingSystem()
+  {
+    assert debugEnter(CLASS_NAME, "getOperatingSystem");
+
+    return directoryServer.operatingSystem;
+  }
+
+
+
+  /**
    * Retrieves the thread group that should be used by all threads associated
    * with the Directory Server.
    *

--
Gitblit v1.10.0