Package org.rhq.core.system

Examples of org.rhq.core.system.SystemInfo


    public void testCommandRecipe() throws Exception {
        File testDir = getTestDir("testcommand");
        File echoOutput = new File(testDir, "out.txt");
        echoOutput.getParentFile().mkdirs();

        SystemInfo sysinfo = SystemInfoFactory.createSystemInfo();
        if (sysinfo.getOperatingSystemType() == OperatingSystemType.WINDOWS) {
            addRecipeCommand("command cmd /C \"echo helloWorld > '" + echoOutput.getAbsolutePath() + "'\"");
        } else {
            addRecipeCommand("command sh -c \"echo helloWorld > '" + echoOutput.getAbsolutePath() + "'\"");
        }
View Full Code Here


        return parseRecipeNow(context);
    }

    private ProcessingRecipeContext createRecipeContext(File testDir) {
        Map<PackageVersion, File> packageVersionFiles = null; // TODO not used yet
        SystemInfo sysinfo = SystemInfoFactory.createSystemInfo();
        String cwd = testDir.getAbsolutePath();

        // need a dummy deployment

        ResourceType resourceType = new ResourceType("name", "plugin", ResourceCategory.PLATFORM, null);
View Full Code Here

    /**
     * AutoDiscoveryExecutor method.
     */
    private List<ProcessInfo> getProcessInfos() {
        SystemInfo systemInfo = SystemInfoFactory.createSystemInfo();
        log.debug("Retrieving process table...");
        long startTime = System.currentTimeMillis();
        List<ProcessInfo> processInfos = null;
        try {
            processInfos = systemInfo.getAllProcesses();
        } catch (UnsupportedOperationException uoe) {
            log.debug("Cannot perform process scan - not supported on this platform. (" + systemInfo.getClass() + ")");
        }
        long elapsedTime = System.currentTimeMillis() - startTime;
        log.debug("Retrieval of process table took " + elapsedTime + " ms.");
        return processInfos;
    }
View Full Code Here

    /**
     * AutoDiscoveryExecutor method.
     */
    private List<ProcessInfo> getProcessInfos() {
        SystemInfo systemInfo = SystemInfoFactory.createSystemInfo();
        log.debug("Retrieving process table...");
        long startTime = System.currentTimeMillis();
        List<ProcessInfo> processInfos = null;
        try {
            processInfos = systemInfo.getAllProcesses();
        } catch (UnsupportedOperationException uoe) {
            log.debug("Cannot perform process scan - not supported on this platform. (" + systemInfo.getClass() + ")");
        }
        long elapsedTime = System.currentTimeMillis() - startTime;
        log.debug("Retrieval of process table took " + elapsedTime + " ms.");
        return processInfos;
    }
View Full Code Here

import org.rhq.core.system.SystemInfo;

public class SolarisPlatformDiscoveryComponent extends PlatformDiscoveryComponent {
    protected boolean isPlatformSupported(ResourceDiscoveryContext context) {
        try {
            SystemInfo systemInfo = context.getSystemInformation();

            return systemInfo.getOperatingSystemType() == OperatingSystemType.SOLARIS;
        } catch (Exception e) {
        }

        return false;
    }
View Full Code Here

    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<PlatformComponent> discoveryContext)
        throws Exception {

        Set<DiscoveredResourceDetails> results = new LinkedHashSet<DiscoveredResourceDetails>();

        SystemInfo sysInfo = discoveryContext.getSystemInformation();
        if (!sysInfo.isNative()) {
            log.debug("Skipping " + discoveryContext.getResourceType().getName()
                + " discovery, since native system info is not available.");
            return results;
        }

        for (FileSystemInfo fsInfo : sysInfo.getFileSystems()) {
            FileSystem fs = fsInfo.getFileSystem();
            int fsType = fs.getType();
            // We only support local, network (nfs), lofs, or tmpfs filesystems - skip any other types.
            switch (fsType) {
            case FileSystem.TYPE_LOCAL_DISK:
View Full Code Here

import org.rhq.core.system.SystemInfo;

public class MacOSXPlatformDiscoveryComponent extends PlatformDiscoveryComponent {
    protected boolean isPlatformSupported(ResourceDiscoveryContext context) {
        try {
            SystemInfo systemInfo = context.getSystemInformation();

            return systemInfo.getOperatingSystemType() == OperatingSystemType.OSX;
        } catch (Exception e) {
        }

        return false;
    }
View Full Code Here

                    + exitValue + ". Stdout was:\n" + stdout + "\n\nStderr was:\n" + stderr);
        } catch (IllegalThreadStateException e) {
            //expected
        }

        SystemInfo sysInfo = SystemInfoFactory.createSystemInfo();
        List<ProcessInfo> processes = sysInfo.getAllProcesses();

        for (ProcessInfo pi : processes) {
            String[] cl = pi.getCommandLine();
            if (Arrays.equals(cl, commandLine)) {
                FakeServerProcess ret = new FakeServerProcess();
View Full Code Here

           }
       }
   }

   private DirUsage getDirectoryInfo() {
       SystemInfo systemInfo = resourceContext.getSystemInformation();
       return systemInfo.getDirectoryUsage(resourceContext.getResourceKey());
   }
View Full Code Here

import org.rhq.core.system.SystemInfo;

public class LinuxPlatformDiscoveryComponent extends PlatformDiscoveryComponent {
    protected boolean isPlatformSupported(ResourceDiscoveryContext context) {
        try {
            SystemInfo systemInfo = context.getSystemInformation();

            return systemInfo.getOperatingSystemType() == OperatingSystemType.LINUX;
        } catch (Exception e) {
        }

        return false;
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.system.SystemInfo

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.