Examples of SystemInfo


Examples of org.rhq.core.system.SystemInfo

import org.rhq.core.system.SystemInfo;

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

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

        return false;
    }
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

public class WindowsPlatformDiscoveryComponent extends PlatformDiscoveryComponent {
    @Override
    protected boolean isPlatformSupported(ResourceDiscoveryContext context) {
        try {
            SystemInfo systemInfo = context.getSystemInformation();
            OperatingSystemType osType = systemInfo.getOperatingSystemType();

            boolean windows = (osType == OperatingSystemType.WINDOWS);

            return windows;
        } catch (Exception e) {
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) {
        if (!isPlatformSupported(context)) {
            return Collections.emptySet();
        }

        SystemInfo systemInfo = context.getSystemInformation();

        // platform resources will use the plugin container name as its key.
        // we are guaranteed this string is unique across all agents/plugin containers.
        // (it is usually the hostname, but is not guaranteed to be)
        String key = determineResourceKey(context);

        // build the resource name
        String name = determineResourceName(context);

        // use the platform type description as the description for this resource
        String description = context.getResourceType().getDescription();

        String version;
        try {
            version = systemInfo.getOperatingSystemName() + " " + systemInfo.getOperatingSystemVersion();
        } catch (Exception e) {
            version = "?";
        }

        Configuration config = context.getDefaultPluginConfiguration();
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

import org.rhq.core.system.SystemInfo;

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

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

        return false;
    }
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

     * @throws InvalidPluginConfigurationException
     */
    protected ProcessExecutionResults executeExecutable(String args, long wait, boolean captureOutput,
        boolean killOnTimeout) throws InvalidPluginConfigurationException {

        SystemInfo sysInfo = this.resourceContext.getSystemInformation();
        Configuration pluginConfig = this.resourceContext.getPluginConfiguration();
        ProcessExecutionResults results = executeExecutable(sysInfo, pluginConfig, args, wait, captureOutput,
            killOnTimeout, escapeChar);

        if (LOG.isDebugEnabled()) {
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

        Assert.assertEquals(processes.size(), 0, "Failed to kill " + processes.size() + " " + getServerResourceType()
            + " processes: " + processes);
    }

    private List<ProcessInfo> getServerProcesses() {
        SystemInfo systemInfo = SystemInfoFactory.createSystemInfo();
        return systemInfo
            .getProcesses("arg|*|match=org\\.jboss\\.as\\..+,arg|-Djboss.socket.binding.port-offset|match="
                + getPortOffset());
    }
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

    private final Log log = LogFactory.getLog(this.getClass());

    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<PlatformComponent> discoveryContext) {
        Set<DiscoveredResourceDetails> results = new HashSet<DiscoveredResourceDetails>();

        SystemInfo sysInfo = discoveryContext.getSystemInformation();
        if (!sysInfo.isNative()) {
            log.debug("Skipping " + discoveryContext.getResourceType().getName() +
                    " discovery, since native system info is not available.");
            return results;
        }
       
        int numberOfCpus = sysInfo.getNumberOfCpus();
        for (int i = 0; i < numberOfCpus; i++) {
            CpuInformation cpuInfo = sysInfo.getCpu(i);
            DiscoveredResourceDetails details = new DiscoveredResourceDetails(discoveryContext.getResourceType(), // resourceType
                String.valueOf(i), // resourceKey
                "CPU " + i, // resourceName
                cpuInfo.getCpuInfo().getModel(), // resourceVersion
                cpuInfo.getCpuInfo().getVendor() + ' ' + cpuInfo.getCpuInfo().getModel(), // resourceDescription
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

    public OperationResult invokeOperation(String name, Configuration params) throws Exception {
        if (name.equals(EXECUTE_OPERATION)) {
            OperationResult operationResult = new OperationResult();

            File scriptFile = getScriptFile();
            SystemInfo systemInfo = this.resourceContext.getSystemInformation();
            ProcessExecution processExecution = ProcessExecutionUtility.createProcessExecution(scriptFile);

            processExecution.setWaitForCompletion(1000L * 60 * 60); // 1 hour
            processExecution.setCaptureOutput(true);

            // TODO: Make the script's cwd configurable, but default it to the
            // directory containing the script.
            processExecution.setWorkingDirectory(scriptFile.getParent());

            setEnvironmentVariables(processExecution);
            setCommandLineArguments(params, processExecution);

            if (log.isDebugEnabled()) {
                log.debug(processExecution);
            }

            ProcessExecutionResults processExecutionResults = systemInfo.executeProcess(processExecution);
            if (processExecutionResults.getError() != null) {
                throw new Exception(processExecutionResults.getError());
            }

            Integer exitCode = processExecutionResults.getExitCode();
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

        }

        try {
            String jbossHomeDir = resourceContext.getParentResourceComponent().getResourceContext()
                .getPluginConfiguration().getSimpleValue(ApplicationServerPluginConfigurationProperties.HOME_DIR, null);
            SystemInfo systemInfo = resourceContext.getSystemInformation();
            ProfileServiceConnection profileServiceConnection = resourceContext.getParentResourceComponent()
                .getConnection();

            ScriptDeployer deployer = new ScriptDeployer(jbossHomeDir, systemInfo, new RemoteDownloader(
                resourceContext, true, profileServiceConnection));
View Full Code Here

Examples of org.rhq.core.system.SystemInfo

    public OperationResult invokeOperation(String name, Configuration params) throws Exception {
        if (name.equals(EXECUTE_OPERATION)) {
            OperationResult operationResult = new OperationResult();

            File scriptFile = getScriptFile();
            SystemInfo systemInfo = this.resourceContext.getSystemInformation();
            ProcessExecution processExecution = ProcessExecutionUtility.createProcessExecution(scriptFile);

            processExecution.setWaitForCompletion(1000L * 60 * 60); // 1 hour
            processExecution.setCaptureOutput(true);

            // TODO: Make the script's cwd configurable, but default it to the directory containing the script.
            processExecution.setWorkingDirectory(scriptFile.getParent());

            setEnvironmentVariables(processExecution);
            setCommandLineArguments(params, processExecution);

            if (log.isDebugEnabled()) {
                log.debug(processExecution);
            }

            ProcessExecutionResults processExecutionResults = systemInfo.executeProcess(processExecution);
            if (processExecutionResults.getError() != null) {
                throw new Exception(processExecutionResults.getError());
            }

            Integer exitCode = processExecutionResults.getExitCode();
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.