From 0faf17d946c2a2ac09df26bceae8296b63f1e2cd Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Thu, 16 Jun 2005 22:38:14 +0000 Subject: [PATCH] add VendorCodeName, use it for osx description --- .../net/hyperic/sigar/OperatingSystem.java | 19 ++++++++++++++++++- .../src/net/hyperic/sigar/cmd/Version.java | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/bindings/java/src/net/hyperic/sigar/OperatingSystem.java b/bindings/java/src/net/hyperic/sigar/OperatingSystem.java index 19ae5949..008da21d 100644 --- a/bindings/java/src/net/hyperic/sigar/OperatingSystem.java +++ b/bindings/java/src/net/hyperic/sigar/OperatingSystem.java @@ -40,6 +40,7 @@ public class OperatingSystem { private String vendor; private String vendorVersion; private String vendorName; + private String vendorCodeName; private String dataModel; private String cpuEndian; @@ -78,6 +79,12 @@ public class OperatingSystem { os.vendorVersion = "NT"; } os.name = "Win32"; + if (os.vendorVersion.equals("XP")) { + os.codeName = "Whistler"; + } + else if (os.vendorVersion.equals("2003")) { + os.codeName = "Whistler Server"; + } } else if (os.name.equals("SunOS")) { os.type = TYPE_SOLARIS; @@ -108,6 +115,12 @@ public class OperatingSystem { os.type = TYPE_MACOSX; os.name = NAME_MACOSX; os.vendor = "Apple"; + if (os.version.equals("10.4")) { + os.vendorCodeName = "Tiger"; + } + else if (os.version.equals("10.3")) { + os.vendorCodeName = "Panther"; + } } else if (os.name.equals(NAME_FREEBSD)) { os.type = TYPE_FREEBSD; @@ -140,7 +153,7 @@ public class OperatingSystem { return this.vendorName + " " + this.vendorVersion; case TYPE_MACOSX: //"Mac OS X 10.4" - return this.vendorName + " " + this.version; + return this.vendorName + " " + this.vendorCodeName; case TYPE_WIN32: //"Microsoft Windows 2003" return this.vendor + " Windows " + this.vendorVersion; @@ -178,6 +191,10 @@ public class OperatingSystem { return this.vendorName; } + public String getVendorCodeName() { + return this.vendorCodeName; + } + public String getDataModel() { return this.dataModel; } diff --git a/bindings/java/src/net/hyperic/sigar/cmd/Version.java b/bindings/java/src/net/hyperic/sigar/cmd/Version.java index 3553ffbf..e9aec287 100644 --- a/bindings/java/src/net/hyperic/sigar/cmd/Version.java +++ b/bindings/java/src/net/hyperic/sigar/cmd/Version.java @@ -63,6 +63,9 @@ public class Version extends SigarCommandBase { os.println("OS patch level......" + sys.getPatchLevel()); os.println("OS vendor..........." + sys.getVendor()); os.println("OS vendor version..." + sys.getVendorVersion()); + if (sys.getVendorCodeName() != null) { + os.println("OS code name........" + sys.getVendorCodeName()); + } os.println("OS data model......." + sys.getDataModel()); os.println("OS cpu endian......." + sys.getCpuEndian());