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