Package org.rhq.core.pc.inventory

Examples of org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocation


    }

    @Override
    public Set<ResourcePackageDetails> getLastDiscoveredResourcePackages(int resourceId) {
        // Get the resource component
        ResourceContainer container = inventoryManager.getResourceContainer(resourceId);

        // Nothing to do if the container doesn't exist or isn't running, so punch out
        if ((container == null)
            || (ResourceContainer.ResourceComponentState.STARTED != container.getResourceComponentState())) {
            throw new RuntimeException("Container is non-existent or is not running for resource id [" + resourceId
                + "]");
        }

        return container.getInstalledPackages();
    }
View Full Code Here


         * discovery is being run. In such a case, this item cannot be removed from the queue (as it is out of the queue
         * while running) but will still be added at the end of the this call.
         */

        // Make sure the resource still exists, otherwise don't bother rescheduling
        ResourceContainer resourceContainer = inventoryManager.getResourceContainer(
            discoveryInfo.getResourceId());

        if (resourceContainer != null) {
            boolean debugEnabled = LOG.isDebugEnabled();

View Full Code Here

        // The plugin should at least return an empty set, but check for null too.
        if (details == null) {
            return null;
        }

        ResourceContainer container = inventoryManager.getResourceContainer(resourceId);

        Set<ResourcePackageDetails> updatedPackageSet = new HashSet<ResourcePackageDetails>(details);
        Set<ResourcePackageDetails> existingInstalledPackagesSet = new HashSet<ResourcePackageDetails>(
            container.getInstalledPackages());

        // Strip out content that have been removed (i.e. not returned on the latest discovery)
        int originalPackageCount = existingInstalledPackagesSet.size();
        existingInstalledPackagesSet.retainAll(updatedPackageSet);
        int removedPackagesCount = originalPackageCount - existingInstalledPackagesSet.size();
        if (removedPackagesCount > 0) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Removed [" + removedPackagesCount + "] obsolete packages for resource id [" + resourceId
                    + "]");
            }
        }

        // Strip from updated list content that are already known for the resource, we don't need to do anything
        updatedPackageSet.removeAll(existingInstalledPackagesSet);

        // Remaining content in updated list are "new" content
        if (!updatedPackageSet.isEmpty()) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Found [" + updatedPackageSet.size() + "] new packages for resource id [" + resourceId + "]");
            }
        }

        // Add new content (yes, existingInstalledPackagesSet is same as details, but use the container's reference)
        existingInstalledPackagesSet.addAll(updatedPackageSet);

        // Add merged (current) list to the resource container
        container.setInstalledPackages(existingInstalledPackagesSet);

        // Package and send to server
        ContentDiscoveryReport report = new ContentDiscoveryReport();
        report.addAllDeployedPackages(existingInstalledPackagesSet);
        report.setResourceId(resourceId);
View Full Code Here

        // if we've used up our allotted time, just stop
        if (System.currentTimeMillis() > stopTime) {
            return false;
        }

        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
                    }
View Full Code Here

                public void stop() {
                }
            };
        }
        String className = pluginManager.getMetadataManager().getComponentClass(resourceType);
        ResourceContainer resourceContainer = inventoryManager.getResourceContainer(resource);
        if (resourceContainer == null) {
            throw new PluginContainerException("Resource container not found for " + resource + " - cannot create ResourceComponent.");
        }
        ClassLoader resourceClassloader = resourceContainer.getResourceClassLoader();
        if (resourceClassloader == null) {
            throw new PluginContainerException("Resource classLoader not found for " + resource + " - cannot create ResourceComponent.");
        }
        ResourceComponent component = (ResourceComponent) instantiateClass(resourceClassloader, className);
View Full Code Here

                return Thread.currentThread().getContextClassLoader();
            }

            // information about the resource's parent
            Resource parentResource = resource.getParentResource();
            ResourceContainer parentContainer;

            if (parentResource != null) {
                parentContainer = inventoryManager.getResourceContainer(parentResource);
                if (parentContainer == null) {
                    throw new PluginContainerException("Missing container for parent " + parentResource + " of "
View Full Code Here

        if (r.getId() == 0) {
            log.debug("Will not reschedule drift detection for " + r + ". It is not sync'ed yet.");
            return;
        }

        ResourceContainer container = inventoryMgr.getResourceContainer(r.getId());
        if (container == null) {
            log.debug("No resource container found for " + r + ". Unable to reschedule drift detection schedules.");
            return;
        }

        log.debug("Rescheduling drift detection for " + r);
        for (DriftDefinition d : container.getDriftDefinitions()) {
            try {
                syncWithServer(r, d);
                schedulesQueue.addSchedule(new DriftDetectionSchedule(r.getId(), d));

            } catch (Throwable t) {
View Full Code Here

        if (added) {
            if (log.isDebugEnabled()) {
                log.debug(schedule + " has been added to " + schedulesQueue);
            }
            ResourceContainer container = inventoryManager.getResourceContainer(resourceId);
            if (container != null) {
                container.addDriftDefinition(driftDefinition);
            }
        } else {
            log.warn("Failed to add " + schedule + " to " + schedulesQueue);
        }
    }
View Full Code Here

                log.debug("Removed change set directory " + changeSetDir.getAbsolutePath());
            }
        });
        if (schedule != null) {
            ResourceContainer container = inventoryManager.getResourceContainer(resourceId);
            if (container != null) {
                container.removeDriftDefinition(schedule.getDriftDefinition());
            }
        }

        if (log.isDebugEnabled()) {
            log.debug("Removed " + schedule + " from the queue " + schedulesQueue);
View Full Code Here

                unpinDefinition(updatedSchedule);
            }
        }

        InventoryManager inventoryMgr = PluginContainer.getInstance().getInventoryManager();
        ResourceContainer container = inventoryMgr.getResourceContainer(resourceId);
        if (container != null) {
            container.addDriftDefinition(driftDefinition);
        }

        if(driftDefinition.getInterval() < pluginContainerConfiguration.getDriftDetectionPeriod()) {
            Resource resource = inventoryManager.getResourceContainer(resourceId).getResource();
            inventoryManager.handleInvalidPluginConfigurationResourceError(resource, new Throwable("Drift interval was set to " + driftDefinition.getInterval()
View Full Code Here

TOP

Related Classes of org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocation

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.