Package org.rhq.core.pluginapi.configuration

Examples of org.rhq.core.pluginapi.configuration.ConfigurationFacet


        ConfigurationDefinition resourceConfigDef = resourceType.getResourceConfigurationDefinition();
        assertNotNull(resourceConfigDef, "No resource config is defined for ResourceType " + resourceType + ".");
        System.out.println("=== Loading Resource config for " + resource + "...");
        ResourceContainer resourceContainer = this.pluginContainer.getInventoryManager().getResourceContainer(resource);
        long timeoutMillis = 5000;
        ConfigurationFacet configurationFacet = resourceContainer.createResourceComponentProxy(
            ConfigurationFacet.class, FacetLockType.READ, timeoutMillis, false, false, false);
        return configurationFacet.loadResourceConfiguration();
    }
View Full Code Here


        ConfigurationDefinition resourceConfigDef = resourceType.getResourceConfigurationDefinition();
        assertNotNull(resourceConfigDef, "No resource config is defined for ResourceType " + resourceType + ".");
        System.out.println("=== Updating Resource config for " + resource + "...");
        ResourceContainer resourceContainer = this.pluginContainer.getInventoryManager().getResourceContainer(resource);
        long timeoutMillis = 5000;
        ConfigurationFacet configurationFacet = resourceContainer.createResourceComponentProxy(
            ConfigurationFacet.class, FacetLockType.WRITE, timeoutMillis, false, false, false);
        ConfigurationUpdateReport report = new ConfigurationUpdateReport(resourceConfig);
        configurationFacet.updateResourceConfiguration(report);
        return report;
    }
View Full Code Here

        ResourceContainer resourceContainer = inventoryManager.getResourceContainer(resource.getId());
        // if we've already checked this resource then just check the children
        if (!rootMemberCheckedSet.contains(resource.getId())) {

            ConfigurationFacet resourceComponent = null;
            ResourceType resourceType = resource.getResourceType();
            boolean debugEnabled = log.isDebugEnabled();

            if (resourceContainer != null && resourceContainer.getAvailability() != null
                && resourceContainer.getAvailability().getAvailabilityType() == AvailabilityType.UP) {

                if (resourceContainer.supportsFacet(ConfigurationFacet.class)) {
                    try {
                        resourceComponent = resourceContainer.createResourceComponentProxy(ConfigurationFacet.class,
                            FacetLockType.NONE, CONFIGURATION_CHECK_TIMEOUT, true, false, true);
                    } catch (PluginContainerException e) {
                        // Expecting when the resource does not support configuration management
                        // Should never happen after above check
                    }
                }

                if (resourceComponent != null) {
                    // Only report availability for committed resources; don't bother with new, ignored or deleted resources.
                    if (resource.getInventoryStatus() == InventoryStatus.COMMITTED
                        && resourceType.getResourceConfigurationDefinition() != null) {

                        long t1 = System.currentTimeMillis();

                        if (debugEnabled) {
                            log.debug("Checking for updated Resource configuration for " + resource + "...");
                        }

                        try {
                            Configuration liveConfiguration = resourceComponent.loadResourceConfiguration();

                            if (liveConfiguration != null) {
                                ConfigurationDefinition configurationDefinition = resourceType
                                    .getResourceConfigurationDefinition();
View Full Code Here

        return configuration;
    }

    private Configuration loadConfigFromFacet(int resourceId, FacetLockType lockType) throws PluginContainerException {
        ConfigurationFacet configFacet = loadConfigurationFacet(resourceId, lockType);

        try {
            return configFacet.loadResourceConfiguration();
        } catch (Exception e) {
            throw new PluginContainerException(e);
        }
    }
View Full Code Here

        }
    }

    public void executeUpdate(int resourceId, Configuration configuration)
        throws PluginContainerException {
        ConfigurationFacet facet = loadConfigurationFacet(resourceId, WRITE);
        ConfigurationUpdateReport report = new ConfigurationUpdateReport(configuration);

        facet.updateResourceConfiguration(report);

        if (ConfigurationUpdateStatus.SUCCESS == report.getStatus()) {
            return;
        }
View Full Code Here

    @Test(groups = "pc.itest.native", priority = 30)
    public void testProcessInfoAccurateAfterProcessRestart() throws Exception {
        Assert.assertEquals(components.size(), 1, "There should be exactly 1 resource discovered");
       
        ConfigurationFacet component = components.iterator().next();
       
        Configuration config = component.loadResourceConfiguration();
       
        int beforeDiscoveryCallCount = config.getSimple(TestComponent.DISCOVERY_CALL_COUNT_PROP).getIntegerValue();
        int beforePid = config.getSimple(TestComponent.CURRENT_PID_PROP).getIntegerValue();
       
        stopTestProcess();  
        startTestProcess();
       
        config = component.loadResourceConfiguration();
       
        int afterDiscoveryCallCount = config.getSimple(TestComponent.DISCOVERY_CALL_COUNT_PROP).getIntegerValue();
        int afterPid = config.getSimple(TestComponent.CURRENT_PID_PROP).getIntegerValue();
       
        Assert.assertEquals(afterDiscoveryCallCount, beforeDiscoveryCallCount + 1, "Only a single discovery call should have been made to refresh the process info");
View Full Code Here

   
    @Test(groups = "pc.itest.native", priority = 30)
    public void testProcessInfoAccurateWhenProcessStopped() throws Exception {
        Assert.assertEquals(components.size(), 1, "There should be exactly 1 resource discovered");
       
        ConfigurationFacet component = components.iterator().next();
       
        Configuration config = component.loadResourceConfiguration();
       
        int beforeDiscoveryCallCount = config.getSimple(TestComponent.DISCOVERY_CALL_COUNT_PROP).getIntegerValue();
       
        stopTestProcess();  
       
        config = component.loadResourceConfiguration();
       
        int afterDiscoveryCallCount = config.getSimple(TestComponent.DISCOVERY_CALL_COUNT_PROP).getIntegerValue();
        int afterPid = config.getSimple(TestComponent.CURRENT_PID_PROP).getIntegerValue();
       
        Assert.assertEquals(afterDiscoveryCallCount, beforeDiscoveryCallCount, "No discovery call should have been made to refresh the process info if the process no longer exists");
View Full Code Here

   
    @Test(groups = "pc.itest.native", priority = 30)
    public void testProcessInfoAccurateAfterProcessStarted() throws Exception {
        Assert.assertEquals(components.size(), 1, "There should be exactly 1 resource discovered");
       
        ConfigurationFacet component = components.iterator().next();
       
        Configuration config = component.loadResourceConfiguration();
       
        int beforeDiscoveryCallCount = config.getSimple(TestComponent.DISCOVERY_CALL_COUNT_PROP).getIntegerValue();
       
        stopTestProcess();  
       
        config = component.loadResourceConfiguration();
       
        int afterDiscoveryCallCount = config.getSimple(TestComponent.DISCOVERY_CALL_COUNT_PROP).getIntegerValue();
        int afterPid = config.getSimple(TestComponent.CURRENT_PID_PROP).getIntegerValue();
       
        Assert.assertEquals(afterDiscoveryCallCount, beforeDiscoveryCallCount, "No discovery call should have been made to refresh the process info if the process no longer exists");
        Assert.assertEquals(afterPid, 0, "The process info should have been nulled out")
       
        startTestProcess();

        config = component.loadResourceConfiguration();
       
        afterDiscoveryCallCount = config.getSimple(TestComponent.DISCOVERY_CALL_COUNT_PROP).getIntegerValue();
        afterPid = config.getSimple(TestComponent.CURRENT_PID_PROP).getIntegerValue();
       
        Assert.assertEquals(afterDiscoveryCallCount, beforeDiscoveryCallCount + 1, "Exactly 1 discovery call should have been made to refresh the process info after the process started again.");
View Full Code Here

TOP

Related Classes of org.rhq.core.pluginapi.configuration.ConfigurationFacet

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.