Package org.rhq.core.pc.inventory

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


            if (inventoryBinaryFile == null) {
                if (dumpTypesOnly) {
                    Set<ResourceType> rootTypes = pc.getPluginManager().getMetadataManager().getRootTypes();
                    InventoryPrinter.outputAllResourceTypes(exportWriter, dumpXml, rootTypes);
                } else {
                    ResourceContainer rc = null;
                    if (id != null) {
                        rc = pc.getInventoryManager().getResourceContainer(id);
                        if (rc == null) {
                            out.println(MSG.getMsg(AgentI18NResourceKeys.INVENTORY_INVALID_RESOURCE_ID, id));
                            return;
View Full Code Here


                for (AvailabilityReport.Datum avail : avails) {
                    boolean isUp = avail.getAvailabilityType() == AvailabilityType.UP;

                    // lookup the heavy-weight resource object
                    int resourceId = avail.getResourceId();
                    ResourceContainer resourceContainer = inventoryManager.getResourceContainer(resourceId);
                    Resource resource = resourceContainer.getResource();

                    PropertyMap map = new PropertyMap("resourceAvailability");
                    map.put(new PropertySimple("resourceId", Integer.valueOf(resource.getId())));
                    map.put(new PropertySimple("resourceName", resource.getName()));
                    map.put(new PropertySimple("isAvailable", Boolean.valueOf(isUp)));
View Full Code Here

                if (resourceId == null) {
                    discovery(pcName, out, pluginName, resourceTypeName, verbose);
                } else {
                    // specifying a resource ID implies we must ignore -r and -p (since type/plugin is determined by the resource)
                    InventoryManager im = PluginContainer.getInstance().getInventoryManager();
                    ResourceContainer resourceContainer = im.getResourceContainer(resourceId);
                    if (resourceContainer != null) {
                        Resource resource = resourceContainer.getResource();
                        PluginContainerConfiguration pcc = agentConfig.getPluginContainerConfiguration();
                        RuntimeDiscoveryExecutor scanner = new RuntimeDiscoveryExecutor(im, pcc, resource);
                        InventoryReport report = scanner.call();
                        out.println(MSG.getMsg(AgentI18NResourceKeys.DISCOVERY_RESOURCE_SERVICES, resource.getName()));
                        printInventoryReport(report, out, verbose);
View Full Code Here

                }
            }

            PluginComponentFactory componentFactory = PluginContainer.getInstance().getPluginComponentFactory();
            InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
            ResourceContainer platformContainer = inventoryManager.getResourceContainer(inventoryManager.getPlatform());
            ResourceComponent platformComponent = inventoryManager.getResourceComponent(inventoryManager.getPlatform());
            ResourceDiscoveryComponent discoveryComponent = componentFactory.getDiscoveryComponent(resourceType,
                platformContainer);

            ResourceDiscoveryContext context = new ResourceDiscoveryContext(resourceType, platformComponent,
                platformContainer.getResourceContext(), systemInfo, scanResults, Collections.EMPTY_LIST, pcName,
                PluginContainerDeployment.AGENT);

            Set<DiscoveredResourceDetails> discoveredResources;
            discoveredResources = inventoryManager.invokeDiscoveryComponent(platformContainer, discoveryComponent, context);
            if (discoveredResources != null) {
View Full Code Here

        }

        int resourceId = resource.getId();

        if (resourceId != 0) {
            ResourceContainer container = this.inventoryManager.getResourceContainer(resourceId);
            if (container != null) {
                Set<MeasurementScheduleRequest> schedules = container.getMeasurementSchedule();
                if (schedules != null) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Rescheduling: " + resource.getId());
                    }
                    scheduleCollection(resourceId, schedules);
View Full Code Here

     * @param scheduleRequests
     */
    @Override
    public synchronized void updateCollection(Set<ResourceMeasurementScheduleRequest> scheduleRequests) {
        for (ResourceMeasurementScheduleRequest resourceRequest : scheduleRequests) {
            ResourceContainer resourceContainer = inventoryManager.getResourceContainer(resourceRequest.getResourceId());
            if (resourceContainer != null) {
                // Update (not overwrite) measurement schedule data ...
                resourceContainer.updateMeasurementSchedule(resourceRequest.getMeasurementSchedules());
                // ... and then reschedule collection
                scheduleCollection(resourceRequest.getResourceId(), resourceRequest.getMeasurementSchedules());
                if (resourceRequest.getAvailabilitySchedule() != null) {
                    // Set availability schedule data  if present
                    // This method also triggers a reschedule of availability check
                    resourceContainer.setAvailabilitySchedule(resourceRequest.getAvailabilitySchedule());
                }
            } else {
                // This will happen when the server sends down schedules to an agent with a cleaned inventory
                // Its ok to skip these because the agent will request a reschedule once its been able to synchronize
                // and add these to inventory
View Full Code Here

     * @param scheduleRequests
     */
    @Override
    public synchronized void scheduleCollection(Set<ResourceMeasurementScheduleRequest> scheduleRequests) {
        for (ResourceMeasurementScheduleRequest resourceRequest : scheduleRequests) {
            ResourceContainer resourceContainer = inventoryManager.getResourceContainer(resourceRequest.getResourceId());
            if (resourceContainer != null) {
                // Set measurement schedule data ...
                resourceContainer.setMeasurementSchedule(resourceRequest.getMeasurementSchedules());
                // ... and then reschedule collection
                scheduleCollection(resourceRequest.getResourceId(), resourceRequest.getMeasurementSchedules());
                // Set availability schedule data
                // This method also triggers a reschedule of availability check
                resourceContainer.setAvailabilitySchedule(resourceRequest.getAvailabilitySchedule());
            } else {
                // This will happen when the server sends down schedules to an agent with a cleaned inventory
                // It's ok to skip these because the agent will request a reschedule once its been able to synchronize
                // and add these to inventory
                LOG.debug("Resource container was null, could not schedule collection for resource "
View Full Code Here

        if (requests.size() == 0) {
            // There's no need to even call getValues() on the ResourceComponent if the list of metric names is empty.
            return Collections.emptySet();
        }
        MeasurementFacet measurementFacet;
        ResourceContainer resourceContainer = inventoryManager.getResourceContainer(resourceId);
        if (resourceContainer == null) {
            LOG.warn("Can not get resource container for resource with id " + resourceId);
            return Collections.emptySet();
        }
        Resource resource = resourceContainer.getResource();
        ResourceType resourceType = resource.getResourceType();
        if (resourceType.getMetricDefinitions().isEmpty())
            return Collections.emptySet();

        try {
View Full Code Here

                    this.measurementManager.rescheduleLateCollections(requests);
                    return report;
                }

                Integer resourceId = next.getResourceId();
                ResourceContainer container = im.getResourceContainer(resourceId);
                if (container.getResourceComponentState() != ResourceContainer.ResourceComponentState.STARTED
                    || container.getAvailability() == null
                    || container.getAvailability().getAvailabilityType() == AvailabilityType.DOWN) {
                    // Don't collect metrics for resources that are down
                    if (log.isDebugEnabled()) {
                        log.debug("Measurements not collected for inactive resource component: "
                            + container.getResource());
                    }
                } else {
                    MeasurementFacet measurementComponent = ComponentUtil
                        .getComponent(resourceId, MeasurementFacet.class, FacetLockType.READ,
                            MeasurementManager.FACET_METHOD_TIMEOUT, true, true, true);

                    if (log.isDebugEnabled()) {
                        scheduleHistory.addRequests(requests);
                    }

                    getValues(measurementComponent, report, requests, container.getResource());
                }

                this.measurementManager.reschedule(requests);

                report.incrementCollectionTime(System.currentTimeMillis() - start);
View Full Code Here

        if (isCommitted && (0 == serverResource.getId())) {
            return null;
        }

        InventoryManager im = this.pluginContainer.getInventoryManager();
        ResourceContainer container = im.getResourceContainer(serverResource);
        if (null == container) {
            return null;
        }

        try {
View Full Code Here

TOP

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

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.