Package org.hyperic.sigar

Examples of org.hyperic.sigar.ProcExe


            // The process is a script - excellent!
            String startScript = (serverParentProcessCommandLine.length > startScriptIndex) ? serverParentProcessCommandLine[startScriptIndex]
                        : null;
            startScriptFile = new File(startScript);
            if (!startScriptFile.isAbsolute()) {
                ProcExe parentProcessExe = serverParentProcess.getExecutable();
                if (parentProcessExe == null) {
                    // TODO: This isn't really generic
                    startScriptFile = new File("bin", startScriptFile.getName());
                } else {
                    String cwd = parentProcessExe.getCwd();
                    startScriptFile = new File(cwd, startScriptFile.getPath());
                    startScriptFile = new File(FileUtils.getCanonicalPath(startScriptFile.getPath()));
                }
            }
        } else {
View Full Code Here


                procState = sigar.getProcState(pid);
            } catch (Exception e) {
                handleSigarCallException(e, "getProcState");
            }

            ProcExe procExe = null;
            try {
                procExe = sigar.getProcExe(pid);
            } catch (Exception e) {
                handleSigarCallException(e, "getProcExe");
            }
View Full Code Here

        }

        //now try to extract the version information by asking the server executable itself
        if (version == null && processInfo != null) {
            try {
                ProcExe executable = processInfo.priorSnaphot().getExecutable();
                if (executable != null) {
                    String postgresExe = executable.getName();
                    ProcessExecution execution = new ProcessExecution(postgresExe);
                    execution.setArguments(new String[] { "--version" });
                    execution.setCaptureOutput(true);
                    ProcessExecutionResults results = systemInfo.executeProcess(execution);
                    String versionInfo = results.getCapturedOutput();
View Full Code Here

        try {
            ProcFd fd = sigar.getProcFd(pid);
            println("open file descriptors=" + fd.getTotal());
        } catch (SigarNotImplementedException e) {}

        ProcExe exe = sigar.getProcExe(pid);
        String name = exe.getName();
        if (name.length() == 0) {
            name = "unknown";
        }
        println("name=" + name);

        println("cwd=" + exe.getCwd());
    }
View Full Code Here

    private void printExe(Sigar sigar, long pid) throws SigarException {
        traceln("\npid=" + pid);       

        try {
            ProcExe exe = sigar.getProcExe(pid);

            String cwd = exe.getCwd();
            traceln("cwd='" + cwd + "'");

            //assertTrue(new File(cwd).isDirectory());

            traceln("exe='" + exe.getName() + "'");

            //assertTrue(new File(exeFile).exists());
        } catch (SigarNotImplementedException e) {
            //ok
        }
View Full Code Here

            sigar.getProcExe(getInvalidPid());
        } catch (SigarException e) {
        }

        try {
            ProcExe exe = sigar.getProcExe(sigar.getPid());

            File exeFile = new File(exe.getName());
            String cwd = exe.getCwd();
            traceln("cwd='" + cwd + "'");

            if (cwd.length() > 0) {
                assertTrue(new File(cwd).isDirectory());
            }

            traceln("exe='" + exe.getName() + "'");

            if (exe.getName().length() > 0) {
                assertTrue(exeFile.exists());

                //win32 has .exe
                assertTrue(exeFile.getName().startsWith("java"));
            }
View Full Code Here

    private void printExe(Sigar sigar, long pid) throws SigarException {
        traceln("\npid=" + pid);       

        try {
            ProcExe exe = sigar.getProcExe(pid);

            String cwd = exe.getCwd();
            traceln("cwd='" + cwd + "'");

            //assertTrue(new File(cwd).isDirectory());

            traceln("exe='" + exe.getName() + "'");

            //assertTrue(new File(exeFile).exists());
        } catch (SigarNotImplementedException e) {
            //ok
        }
View Full Code Here

            sigar.getProcExe(getInvalidPid());
        } catch (SigarException e) {
        }

        try {
            ProcExe exe = sigar.getProcExe(sigar.getPid());

            File exeFile = new File(exe.getName());
            String cwd = exe.getCwd();
            traceln("cwd='" + cwd + "'");

            if (cwd.length() > 0) {
                assertTrue(new File(cwd).isDirectory());
            }

            traceln("exe='" + exe.getName() + "'");

            if (exe.getName().length() > 0) {
                assertTrue(exeFile.exists());

                //win32 has .exe
                assertTrue(exeFile.getName().startsWith("java"));
            }
View Full Code Here

        try {
            ProcFd fd = sigar.getProcFd(pid);
            println("open file descriptors=" + fd.getTotal());
        } catch (SigarNotImplementedException e) {}

        ProcExe exe = sigar.getProcExe(pid);
        String name = exe.getName();
        if (name.length() == 0) {
            name = "unknown";
        }
        println("name=" + name);

        println("cwd=" + exe.getCwd());
    }
View Full Code Here

TOP

Related Classes of org.hyperic.sigar.ProcExe

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.