Package org.rhq.enterprise.server.resource

Examples of org.rhq.enterprise.server.resource.ResourceManagerLocal


        return metricSummaries;
    }

    private List<AutoGroupComposite> getResourceChildren(Resource resource, Subject subject) {
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
        List<AutoGroupComposite> children = resourceManager.findChildrenAutoGroups(subject, resource.getId());

        AutoGroupComposite resourceGroupComposite = resourceManager.getResourceAutoGroup(subject, resource.getId());
        if (resourceGroupComposite != null)
            resourceGroupComposite.setMainResource(true);
        else
            return new ArrayList<AutoGroupComposite>();

        // now increase everyone's depth by one to account for the resource
        for (AutoGroupComposite child : children) {
            child.setDepth(child.getDepth() + 1);
        }

        children.add(0, resourceGroupComposite);

        Resource parentResource = resourceManager.getParentResource(resource.getId());
        AutoGroupComposite parentGroupComposite = null;
        if (parentResource != null) {
            parentGroupComposite = resourceManager.getResourceAutoGroup(subject, parentResource.getId());
        }

        if (parentGroupComposite != null) {
            // now increase everyone's depth by one to account for the parent
            for (AutoGroupComposite child : children) {
View Full Code Here


    /**
     * Get a list of the individual 'child resources' of that autogroup.
     */
    private List<AutoGroupComposite> getAutoGroupChildren(Subject subject, int parentId, int resourceTypeId) {
        List<AutoGroupComposite> children = new ArrayList<AutoGroupComposite>();
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
        ResourceTypeManagerLocal resourceTypeMananger = LookupUtil.getResourceTypeManager();
        Resource parentResource = resourceManager.getResourceById(subject, parentId);
        ResourceType resourceType = null;
        try {
            resourceType = resourceTypeMananger.getResourceTypeById(subject, resourceTypeId);
        } catch (ResourceTypeNotFoundException e) {
            return children; // empty list if we don't know the child type
        }

        if ((resourceType != null) && (parentResource != null)) {

            // first get the resources in the autogroup
            List<ResourceWithAvailability> resourcesForAutoGroup = resourceManager.findResourcesByParentAndType(subject,
                parentResource, resourceType);

            int i = 0;
            int[] resourceIds = new int[resourcesForAutoGroup.size()];
            for (ResourceWithAvailability resourceInAutoGroup : resourcesForAutoGroup) {
                int id = resourceInAutoGroup.getResource().getId();
                resourceIds[i++] = id;
            }

            // And then the composite to return
            List<AutoGroupComposite> composites = resourceManager.findResourcesAutoGroups(subject, resourceIds);

            return composites;
        }

        return children; // empty
View Full Code Here

            request.setAttribute(AttrConstants.NUM_CHILD_RESOURCES_ATTR, resourceCount);
            request.setAttribute(AttrConstants.METRIC_SUMMARIES_ATTR, metrics);
            request.setAttribute(AttrConstants.METRIC_SUMMARIES_ATTR_TRAIT, metricsTrait);

            //getResourceCurrentHealths  GroupMemberHealthSummaries
            ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
            PageList<ResourceHealthComposite> groupMemberHealthSummaries = resourceManager.findResourceHealth(user
                .getSubject(), resourceIds, new PageControl());
            request.setAttribute(AttrConstants.GROUP_MEMBER_HEALTH_SUMMARIES_ATTR, groupMemberHealthSummaries);

            // populate the form
            //displayForm.setupCategoryList(metrics);
View Full Code Here

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
        RSSFeed feed = getNewRSSFeed(request);
        ResourceManagerLocal manager = LookupUtil.getResourceManager();

        // Set title
        MessageResources res = getResources(request);
        feed.setTitle(res.getMessage("dash.home.ResourceHealth"));

        // Get the resources health
        WebUser user = getWebUser(request);
        if (user != null) {
            WebUserPreferences preferences = user.getWebPreferences();
            FavoriteResourcePortletPreferences favoriteResourcePreferences = preferences
                .getFavoriteResourcePortletPreferences();

            PageList<ResourceHealthComposite> results = manager.findResourceHealth(user.getSubject(),
                favoriteResourcePreferences.asArray(), PageControl.getUnlimitedInstance());

            if ((results != null) && (results.size() > 0)) {
                PageList<DisambiguationReport<ResourceHealthComposite>> list = DisambiguatedResourceListUtil.disambiguate(manager, results, ViewAction.RESOURCE_ID_EXTRACTOR);
               
View Full Code Here

            PageControl pc = WebUtility.getPageControl(request);

            FavoriteResourcePortletPreferences favoriteResourcePreferences = preferences
                .getFavoriteResourcePortletPreferences();

            ResourceManagerLocal manager = LookupUtil.getResourceManager();
            PageList<ResourceHealthComposite> lst = manager.findResourceHealth(user.getSubject(), favoriteResourcePreferences.asArray(), pc);
           
            list = DisambiguatedResourceListUtil.disambiguate(manager, lst, RESOURCE_ID_EXTRACTOR);
           
            showAvailability = favoriteResourcePreferences.showAvailability;
            showAlerts = favoriteResourcePreferences.showAlerts;
View Full Code Here

                timeRange = getResources(request).getMessage("dash.home.ProblemResources.timeRangeUnlimited");
            }

            try {
                MeasurementProblemManagerLocal problemManager = LookupUtil.getMeasurementProblemManager();
                ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
                long start = System.currentTimeMillis();
                PageList<ProblemResourceComposite> list = problemManager.findProblemResources(subject, begin, new PageControl(0,
                    problemResourcePreferences.range));
               
                disambiguatedList = DisambiguatedResourceListUtil.disambiguate(
View Full Code Here

                measurementSchedules = scheduleManager.getMeasurementScheduleCompositesByContext(subject, EntityContext
                    .forAutoGroup(parent, type), pageControl);

                request.setAttribute("type", type);
                request.setAttribute("parent", parent);
                ResourceManagerLocal resMgr = LookupUtil.getResourceManager();
                Resource parentRes = resMgr.getResourceById(subject, parent);
                request.setAttribute("parentName", parentRes.getName());
            } else if (resourceId > 0) {
                boolean monitoringConfigured = isMonitoringConfigured(resourceId);
                //request.setAttribute(AttrConstants.MONITOR_ENABLED_ATTR, monitoringConfigured);
                if (monitoringConfigured) {
View Full Code Here

        WebUser webUser = SessionUtils.getWebUser(request.getSession());
        Subject subject = webUser.getSubject();

        try {
            ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();

            PageList<Resource> childServers = resourceManager.findChildResourcesByCategoryAndInventoryStatus(subject,
                resource, ResourceCategory.SERVER, InventoryStatus.COMMITTED, PageControl.getUnlimitedInstance());
            request.setAttribute(Constants.CHILD_SERVERS_ATTR, childServers);

            PageList<Resource> childServices = resourceManager.findChildResourcesByCategoryAndInventoryStatus(subject,
                resource, ResourceCategory.SERVICE, InventoryStatus.COMMITTED, PageControl.getUnlimitedInstance());
            request.setAttribute(Constants.CHILD_SERVICES_ATTR, childServices);

            // TODO: Get list of all groups that contain this resource.
            // TODO: Construct a serverType -> serverList map.
View Full Code Here

                invalidIntegerStrings = add(invalidIntegerStrings, resourceIdString);
            }
        }

        // ask the server to delete the doomed resources
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
        List<Integer> deletedResourceIds = resourceManager.uninventoryResources(subject, ArrayUtils
            .unwrapCollection(doomedResourceIds));

        // a doomed resource is one that we asked to be deleted.
        // a deleted resource is one that was actually deleted.
        // if a doomed resource ID is not found in the list of deleted resources, it was probably a non-existing resource
View Full Code Here

        return;
    }

    private void generatePlatformsReport() throws Exception {
        Subject user = getOverlord();
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();

        ResourceCategory category = ResourceCategory.PLATFORM;
        int committed = resourceManager.getResourceCountByCategory(user, category, InventoryStatus.COMMITTED);
        int ignored = resourceManager.getResourceCountByCategory(user, category, InventoryStatus.IGNORED);
        int deleted = resourceManager.getResourceCountByCategory(user, category, InventoryStatus.DELETED);
        int uninventoried = resourceManager.getResourceCountByCategory(user, category, InventoryStatus.UNINVENTORIED);

        File file = new File(this.reportDir, "platforms.txt");
        PrintStream ps = new PrintStream(file);
        try {
            printHeader(ps);
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.resource.ResourceManagerLocal

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.