Package com.sun.grid.installer.util.cmd

Examples of com.sun.grid.installer.util.cmd.SimpleLocalCommand


        if (!file.exists()) {
            return null;
        }

        // call 'ls -la' command...
        SimpleLocalCommand cmd = new SimpleLocalCommand("ls -la " + filePath);
        cmd.execute();

        // in case of failure try /usr/bin/ls -la...
        if (cmd.getExitValue() != Config.EXIT_VAL_SUCCESS) {
            cmd = new SimpleLocalCommand("/usr/bin/ls -la " + filePath);
            cmd.execute();
        }

        if (cmd.getExitValue() != Config.EXIT_VAL_SUCCESS) {
            Debug.trace("Failed to execute 'ls -la " + filePath + "'. Out:"
                    + cmd.getOutput().toString() + " Err:" + cmd.getError().toString());
            return null;
        }

        // process output
        Vector<String> result = cmd.getOutput();
        String line = "";
        if (file.isFile() && result.size() != 0) {
            line = result.firstElement();
        } else if (result.size() >= 2) {
            line = result.get(1);
View Full Code Here


    public static String getUserId(String sgeRoot, String architecture) {
        String userId = "";

        try {
            String command = sgeRoot + "/" + architecture + "/uidgid";
            SimpleLocalCommand cmd = new SimpleLocalCommand(command, "-euid");
            cmd.execute();

            if (cmd.getExitValue() == EXIT_VAL_SUCCESS) {
                userId = cmd.getOutput().firstElement().trim();

                Debug.trace("Id of the executor user is '" + userId + "'.");
            } else {
                Debug.error("Failed to get the user id of executor user! Error: " + cmd.getError());
            }
        } catch (Exception e) {
            Debug.error("Failed to get the user id of executor user! " + e);
        }
View Full Code Here

     * Opens a browser.
     * @param url The url to open in the browser
     * @return true only if the a browser was found and the startup was successful. False otherwise.
     */
    public static boolean openBrowser(String url) {
        SimpleLocalCommand command = null;
        if (OsVersion.IS_OSX && OsVersion.IS_MAC) {
            command = new SimpleLocalCommand("open " + url);
            command.execute();
            if (command.getExitValue() == 0) {
                return true;
            }
        } else if (OsVersion.IS_WINDOWS) {
            command = new SimpleLocalCommand("cmd /C start " + url);
            command.execute();
            if (command.getExitValue() == 0) {
                return true;
            }
        } else {
            String[] browsers = new String[]{"firefox", "opera", "mozilla", "netscape",
            "htmlview", "xdg-open", "gnome-open", "kfmclient openURL", "call-browser",
            "konqueror", "epiphany"};

            for (String browser : browsers) {
                command = new SimpleLocalCommand(3000, browser, url);
                command.execute();
                if (command.getExitValue() == 0) {
                    return true;
                }
            }

        }
View Full Code Here

TOP

Related Classes of com.sun.grid.installer.util.cmd.SimpleLocalCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.