From 0a59528b45ac5e03ab0d8d95f1d8ebf6671f9879 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 10 Jul 2005 07:58:50 +0000 Subject: [PATCH] various helpers --- .../net/hyperic/sigar/OperatingSystem.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/bindings/java/src/net/hyperic/sigar/OperatingSystem.java b/bindings/java/src/net/hyperic/sigar/OperatingSystem.java index d169eeb5..627ccc0b 100644 --- a/bindings/java/src/net/hyperic/sigar/OperatingSystem.java +++ b/bindings/java/src/net/hyperic/sigar/OperatingSystem.java @@ -4,6 +4,9 @@ import java.io.IOException; import java.io.File; import java.io.FileReader; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import java.util.Properties; import java.util.StringTokenizer; @@ -17,7 +20,44 @@ public class OperatingSystem { public static final String NAME_FREEBSD = "FreeBSD"; public static final String NAME_WIN32 = "Win32"; public static final String NAME_OSF1 = "OSF1"; + + public static String[] UNIX_NAMES = { + OperatingSystem.NAME_LINUX, + OperatingSystem.NAME_SOLARIS, + OperatingSystem.NAME_HPUX, + OperatingSystem.NAME_AIX, + OperatingSystem.NAME_MACOSX, + OperatingSystem.NAME_FREEBSD, + }; + + public static String[] WIN32_NAMES = { + OperatingSystem.NAME_WIN32, + }; + public static final String[] NAMES; + + private static Map supportedPlatforms = new HashMap(); + + static { + int len = UNIX_NAMES.length + WIN32_NAMES.length; + String[] all = new String[len]; + System.arraycopy(UNIX_NAMES, 0, all, 0, UNIX_NAMES.length); + all[len-1] = NAME_WIN32; + NAMES = all; + + for (int i=0; i