Example usage for org.apache.commons.lang3 SystemUtils IS_OS_SOLARIS

List of usage examples for org.apache.commons.lang3 SystemUtils IS_OS_SOLARIS

Introduction

In this page you can find the example usage for org.apache.commons.lang3 SystemUtils IS_OS_SOLARIS.

Prototype

boolean IS_OS_SOLARIS

To view the source code for org.apache.commons.lang3 SystemUtils IS_OS_SOLARIS.

Click Source Link

Document

Is true if this is Solaris.

Usage

From source file:edu.jhu.jacana.util.PlatformDetection.java

public PlatformDetection() {
    // resolve OS
    if (SystemUtils.IS_OS_WINDOWS) {
        this.os = OS_WINDOWS;
    } else if (SystemUtils.IS_OS_MAC_OSX) {
        this.os = OS_OSX;
    } else if (SystemUtils.IS_OS_SOLARIS) {
        this.os = OS_SOLARIS;
    } else if (SystemUtils.IS_OS_LINUX) {
        this.os = OS_LINUX;
    } else {/*from   w  w w .j  a  v  a  2s  .c  om*/
        throw new IllegalArgumentException("Unknown operating system " + SystemUtils.OS_NAME);
    }

    // resolve architecture
    Map<String, String> archMap = new HashMap<String, String>();
    archMap.put("x86", ARCH_X86_32);
    archMap.put("i386", ARCH_X86_32);
    archMap.put("i486", ARCH_X86_32);
    archMap.put("i586", ARCH_X86_32);
    archMap.put("i686", ARCH_X86_32);
    archMap.put("x86_64", ARCH_X86_64);
    archMap.put("amd64", ARCH_X86_64);
    archMap.put("powerpc", ARCH_PPC);
    this.arch = archMap.get(SystemUtils.OS_ARCH);
    if (this.arch == null) {
        throw new IllegalArgumentException("Unknown architecture " + SystemUtils.OS_ARCH);
    }
}

From source file:com.sceneControllers.MainWindowSceneController.java

/**
 * Verifies the OS in use// w w w.  j  av  a  2s . com
 *
 * @return OS dependant shutdown string for command line execution.
 */
private String shutdownCommand() {
    if (SystemUtils.IS_OS_WINDOWS) {
        return "shutdown.exe -s -f -t";
    } else if (SystemUtils.IS_OS_AIX) {
        return "shutdown -Fh";
    } else if (SystemUtils.IS_OS_HP_UX) {
        return "shutdown -hy";
    } else if (SystemUtils.IS_OS_IRIX) {
        return "shutdown -y -g";
    } else if (SystemUtils.IS_OS_SOLARIS || SystemUtils.IS_OS_SUN_OS) {
        return "shutdown -y -i5 -g";
    } else if (SystemUtils.IS_OS_FREE_BSD || SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC
            || SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_NET_BSD || SystemUtils.IS_OS_OPEN_BSD
            || SystemUtils.IS_OS_UNIX) {
        return "shutdown -h ";
    } else {
        return "";
    }
}

From source file:de.uni_koeln.spinfo.maalr.sigar.SigarWrapper.java

private static String getSystemArch() {
    String arch = System.getProperty("os.arch");
    if (SystemUtils.IS_OS_MAC_OSX) {
        if (arch.contains("64")) {
            return "universal64";
        }//  w  w  w .  j  a  va  2s.  c  o m
        return "universal";
    }
    if (SystemUtils.IS_OS_WINDOWS) {
        if (arch.contains("64")) {
            return "amd64";
        }
        return "x86";
    }
    if (SystemUtils.IS_OS_AIX) {
        if (arch.contains("64")) {
            return "ppc64";
        }
        return "ppc";
    }
    if (SystemUtils.IS_OS_SOLARIS) {
        if (arch.contains("64")) {
            return "sparc64";
        }
        return "sparc";
    }
    if (SystemUtils.IS_OS_FREE_BSD) {
        if (arch.contains("64")) {
            return "amd64";
        }
        return "x86";
    }
    if (SystemUtils.IS_OS_HP_UX) {
        if (arch.contains("64")) {
            return "ia64";
        }
        return "pa";
    }
    if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_UNIX) {
        if (arch.contains("64")) {
            return "amd64";
        }
        return "x86";
    }

    return null;
}

From source file:de.uni_koeln.spinfo.maalr.sigar.SigarWrapper.java

private static String getSystemSuffix() {
    if (SystemUtils.IS_OS_AIX) {
        return "aix-5.so";
    }/*w  ww. ja  v a  2  s .c  o  m*/
    if (SystemUtils.IS_OS_FREE_BSD) {
        return "freebsd-6.so";
    }
    if (SystemUtils.IS_OS_HP_UX) {
        return "hpux-11.sl";
    }
    if (SystemUtils.IS_OS_WINDOWS) {
        return "winnt.dll";
    }
    if (SystemUtils.IS_OS_MAC_OSX) {
        return "macosx.dylib";
    }
    if (SystemUtils.IS_OS_SOLARIS) {
        return "solaris.so";
    }
    if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_UNIX) {
        return "linux.so";
    }
    throw new RuntimeException("Unknown OS: " + System.getProperty("os.name"));
}

From source file:ch.vorburger.exec.ManagedProcessTest.java

protected SomeSelfTerminatingExec someSelfTerminatingExec() throws ManagedProcessException {
    SomeSelfTerminatingExec r = new SomeSelfTerminatingExec();
    if (SystemUtils.IS_OS_WINDOWS) {
        r.proc = new ManagedProcessBuilder("cmd.exe").addArgument("/C").addArgument("dir").addArgument("/X")
                .build();/*from  w w w.  j  a v a  2 s  .  c  om*/
        r.msgToWaitFor = "bytes free";
    } else if (SystemUtils.IS_OS_SOLARIS) {
        r.proc = new ManagedProcessBuilder("true").addArgument("--version").build();
        r.msgToWaitFor = "true (GNU coreutils)";
    } else if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC) {
        r.proc = new ManagedProcessBuilder("echo")
                .addArgument("\"Lorem ipsum dolor sit amet, consectetur adipisci elit, "
                        + " sed eiusmod tempor incidunt ut \nlabore et dolore magna aliqua.\"")
                .build();
        r.msgToWaitFor = "incidunt";
    } else {
        throw new ManagedProcessException("Unexpected Platform, improve the test dude...");
    }

    return r;
}

From source file:cz.babi.desktop.remoteme.common.Controller.java

/**
 * Shut down computer/*  ww w  . j  a  v a 2 s.  c  o m*/
 */
public void doShutdown() {
    if (Common.DEBUG)
        LOGGER.debug("[doShutdown]");

    String shutdownCommand = null;

    if (SystemUtils.IS_OS_AIX)
        shutdownCommand = "shutdown -Fh now";
    else if (SystemUtils.IS_OS_FREE_BSD || SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC
            || SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_NET_BSD || SystemUtils.IS_OS_OPEN_BSD
            || SystemUtils.IS_OS_UNIX)
        shutdownCommand = "shutdown -h now";
    else if (SystemUtils.IS_OS_HP_UX)
        shutdownCommand = "shutdown -hy 1";
    else if (SystemUtils.IS_OS_IRIX)
        shutdownCommand = "shutdown -y -g 1";
    else if (SystemUtils.IS_OS_SOLARIS || SystemUtils.IS_OS_SUN_OS)
        shutdownCommand = "shutdown -y -i5 -g0";
    else if (SystemUtils.IS_OS_WINDOWS_XP || SystemUtils.IS_OS_WINDOWS_VISTA || SystemUtils.IS_OS_WINDOWS_7
            || System.getProperty("os.name").startsWith("win"))
        shutdownCommand = "shutdown.exe -s -t 0";
    else {
        if (Common.DEBUG)
            LOGGER.debug("[doShutdown][Unknown OS.]");
        return;
    }

    try {
        Runtime.getRuntime().exec(shutdownCommand);
    } catch (IOException e) {
        if (Common.ERROR)
            LOGGER.error("[doShutdown][Ups. Can not shut down pc.]");
    }
}

From source file:org.codice.alliance.distribution.sdk.video.stream.mpegts.MpegTsUdpClient.java

private static String getBundledFFmpegBinaryPath() {
    if (SystemUtils.IS_OS_LINUX) {
        return "linux/ffmpeg";
    } else if (SystemUtils.IS_OS_MAC) {
        return "osx/ffmpeg";
    } else if (SystemUtils.IS_OS_SOLARIS) {
        return "solaris/ffmpeg";
    } else if (SystemUtils.IS_OS_WINDOWS) {
        return "windows/ffmpeg.exe";
    } else {//from  w  ww  .  ja  v  a  2 s. c om
        throw new IllegalStateException("OS is not Linux, Mac, Solaris, or Windows."
                + " No FFmpeg binary is available for this OS, so the plugin will not work.");
    }
}