Examples of SystemInfo


Examples of org.rhq.core.system.SystemInfo

     *
     * TODO GH: Move this to another class (this one is getting too big)
     * @return The discovered platform (which might be a dummy in case of testing)
     */
    private Resource discoverPlatform() {
        SystemInfo systemInfo = SystemInfoFactory.createSystemInfo();
        PluginMetadataManager metadataManager = pluginManager.getMetadataManager();
        Set<ResourceType> platformTypes = metadataManager.getTypesForCategory(ResourceCategory.PLATFORM);

        // This should only ever have 1 or, at most, 2 Resources
        // (always the Java fallback platform, and the native platform if supported).
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

        boolean verbose) {

        try {
            // perform auto-discovery PIQL queries now to see if we can auto-detect resources that are running now
            List<ProcessScanResult> scanResults = new ArrayList<ProcessScanResult>();
            SystemInfo systemInfo = SystemInfoFactory.createSystemInfo();

            Set<ProcessScan> processScans = resourceType.getProcessScans();
            if ((processScans != null) && (processScans.size() > 0)) {
                try {
                    ProcessInfoQuery piq = new ProcessInfoQuery(systemInfo.getAllProcesses());
                    if (processScans != null) {
                        for (ProcessScan processScan : processScans) {
                            List<ProcessInfo> queryResults = piq.query(processScan.getQuery());
                            if ((queryResults != null) && (queryResults.size() > 0)) {
                                for (ProcessInfo autoDiscoveredProcess : queryResults) {
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

        return pluginLifecycleListenerMgr.loadListener(pluginDescriptor, pluginEnvironment);
    }

    private PluginContext createPluginContext(String pluginName) {
        SystemInfo sysInfo = SystemInfoFactory.createSystemInfo();
        File dataDir = new File(pluginContainerConfiguration.getDataDirectory(), pluginName);
        File tmpDir = pluginContainerConfiguration.getTemporaryDirectory();
        String pcName = pluginContainerConfiguration.getContainerName();

        PluginContext context = new PluginContext(pluginName, sysInfo, tmpDir, dataDir, pcName);
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

        return report;
    }

    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;
        if (log.isDebugEnabled()) {
            log.debug("Retrieval of process table took " + elapsedTime + " ms.");
        }
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

    }

    public void init() throws Exception {
        ApacheServerDiscoveryComponent discoveryComponent = new ApacheServerDiscoveryComponent();

        SystemInfo systemInfo = SystemInfoFactory.createSystemInfo();

        ResourceDiscoveryContext<PlatformComponent> discoveryContext = new ResourceDiscoveryContext<PlatformComponent>(
            apacheServerResourceType, null, null, systemInfo, scanProcesses(systemInfo), null,
            PluginContainerDeployment.AGENT);
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

    }

    private ProcessExecutionResults execute(String path, String args) throws InvalidPluginConfigurationException {

        ProcessExecution processExecution = new ProcessExecution(path);
        SystemInfo sysInfo = this.resourceContext.getSystemInformation();

        if (args != null) {
            processExecution.setArguments(args.split(" "));
        }

        processExecution.setCaptureOutput(true);
        processExecution.setWaitForCompletion(1000L);
        processExecution.setKillOnTimeout(true);

        ProcessExecutionResults results = sysInfo.executeProcess(processExecution);

        return results;
    }
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

            OperationResult failure = new OperationResult("Failed to start Cassandra daemon");
            failure.setErrorMessage("Start script does not exists");
            return failure;
        }
        ProcessExecution scriptExe = getProcessExecution(binDir);
        SystemInfo systemInfo = getResourceContext().getSystemInformation();
        ProcessExecutionResults results = systemInfo.executeProcess(scriptExe);
        if (results.getError() == null) {
            return new OperationResult("Successfully started Cassandra daemon");
        } else {
            OperationResult failure = new OperationResult("Failed to start Cassandra daemon");
            failure.setErrorMessage(ThrowableUtil.getAllMessages(results.getError()));
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

        }
    }

    private String getStartScript() {
        ResourceContext<?> context = getResourceContext();
        SystemInfo systemInfo = context.getSystemInformation();

        if (systemInfo.getOperatingSystemType() == WINDOWS) {
            return "cassandra.bat";
        } else {
            return "cassandra";
        }
    }
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

*/
public class KickstartDiscoveryComponent implements ResourceDiscoveryComponent {
    private final Log log = LogFactory.getLog(KickstartDiscoveryComponent.class);

    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) {
        SystemInfo sysinfo = context.getSystemInformation();
        HashSet<DiscoveredResourceDetails> set = new HashSet<DiscoveredResourceDetails>();
        //TODO This will really only work on rpm based systems.
        if (OperatingSystemType.LINUX == sysinfo.getOperatingSystemType()) {
            if (packageExists(sysinfo, "koan")) {
                DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(),
                    "Kickstart", "Kickstart", "1", "Koan Kickstart Engine", null, null);

                set.add(detail);
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

        resource.setPluginConfiguration(configuration);
        ResourceComponent parentResourceComponent = null;
        ResourceContext<?> parentResourceContext = null;
        ResourceDiscoveryComponent resourceDiscoveryComponent = new NothingDiscoveringDiscoveryComponent();
        SystemInfo systemInfo = SystemInfoFactory.createSystemInfo();
        File temporaryDirectory = temp;
        File dataDirectory = temp;
        String pluginContainerName = "rhq";
        EventContext eventContext = new EventContextImpl(resource, eventManager);
        OperationContext operationContext = new OperationContextImpl(0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.