Package org.rhq.enterprise.server.resource

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


    }

    @Override
    public void setResourceError(ResourceError resourceError) {
        try {
            ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
            resourceManager.addResourceError(resourceError);
        } catch (RuntimeException re) {
            log.error("Failed to persist Resource error [" + resourceError + "].", re);
            throw re;
        }
    }
View Full Code Here


        }
    }

    @Override
    public void clearResourceConfigError(int resourceId) {
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
        resourceManager.clearResourceConfigError(resourceId);
    }
View Full Code Here

        return results;
    }

    @Override
    public void setResourceEnablement(int resourceId, boolean setEnabled) {
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
        Subject overlord = LookupUtil.getSubjectManager().getOverlord();
        if (setEnabled) {
            resourceManager.enableResources(overlord, new int[] { resourceId });
        } else {
            resourceManager.disableResources(overlord, new int[] { resourceId });
        }
    }
View Full Code Here

        JobDataMap jobDataMap = jobDetail.getJobDataMap();
        return jobDataMap.getIntFromString(DATAMAP_INT_RESOURCE_ID);
    }

    private boolean isResourceUncommitted(JobDetail jobDetail) {
        ResourceManagerLocal resourceMgr = LookupUtil.getResourceManager();
        int resourceId = getResourceId(jobDetail);

        try {
            Resource resource = resourceMgr.getResource(getOverlord(), resourceId);
            return isResourceUncommitted(resource);

        } catch (ResourceNotFoundException e) {
            return true;
        }
View Full Code Here

            super(view, beanName, true);
        }

        public PageList<Resource> fetchDataForPage(PageControl pc) {
            Subject subject = EnterpriseFacesContextUtility.getSubject();
            ResourceManagerLocal manager = LookupUtil.getResourceManager();
            int repoId = Integer.parseInt(FacesContextUtility.getRequiredRequestParameter("id"));
            String search = FacesContextUtility
                .getOptionalRequestParameter("repoUnsubscriptionsListForm:searchStringFilter");
            String category = FacesContextUtility
                .getOptionalRequestParameter("repoUnsubscriptionsListForm:searchCategoryFilter");
            ResourceCategory categoryEnum = ResourceCategory.PLATFORM;

            if (search != null && search.trim().equals("")) {
                search = null;
            }

            if (category != null) {
                categoryEnum = ResourceCategory.valueOf(category);
            }

            PageList<Resource> results = manager.findAvailableResourcesForRepo(subject, repoId, search, categoryEnum,
                pc);

            //PageList<ResourceComposite> results = manager.findResourceComposites(subject, categoryEnum, null, null, search, pc);

            return results;
View Full Code Here

            // get the resources to operate on, ordered or not
            List<Resource> resourcesToOperateOn;
            if (schedule.getExecutionOrder() != null) {
                resourcesToOperateOn = schedule.getExecutionOrder();
            } else {
                ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
                PageControl pageControl = PageControl.getUnlimitedInstance();
                resourcesToOperateOn = resourceManager.findExplicitResourcesByResourceGroup(user, group, pageControl);
            }

            // now create detail composites from the resource list
            List<ResourceOperationDetailsComposite> resourceComposites = new ArrayList<ResourceOperationDetailsComposite>();
            getUserWithSession(user, true); // refresh our session to reset the timeout clock
View Full Code Here

    @Override
    public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
        ResourceLineageComponent resourceLineage = (ResourceLineageComponent) component;
        ResponseWriter writer = facesContext.getResponseWriter();
        long monitorId = HibernatePerformanceMonitor.get().start();
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
        List<Resource> ancestorResources = resourceManager.getResourceLineage(resourceLineage.getResourceId());
        HibernatePerformanceMonitor.get().stop(monitorId, "ResourceLineage renderer");
        if (ancestorResources.isEmpty()) {
            throw new IllegalStateException(
                "The list of ancestor resources should always contain at least one resource - the resource whose lineage was requested.");
        }
View Full Code Here

        List<Property> allMissing = new ArrayList<Property>();
        allMissing.addAll(missingUsersList.getList());
        allMissing.addAll(missingScriptsList.getList());

        if (allMissing.size() > 0) {
            ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();

            List<DisambiguationReport<Property>> disambiguated = resourceManager.disambiguate(allMissing,
                new IntExtractor<Property>() {
                    @Override
                    public int extract(Property object) {
                        PropertyMap map = (PropertyMap) object;
                        return map.getSimple(PROP_RESOURCE_ID).getIntegerValue();
View Full Code Here

    @Override
    public SenderResult send(Alert alert) {
        String category = alertParameters.getSimpleValue("log4JCategory", this.getClass().getName());
        Logger logger = Logger.getLogger(category);
        AlertManagerLocal alertManager = LookupUtil.getAlertManager();
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();

        List lineage = resourceManager.getResourceLineage(alert.getAlertDefinition().getResource().getId());
        String platformName = ((Resource)lineage.get(0)).getName();
        String conditions = alertManager.prettyPrintAlertConditions(alert, false).replace('\n', ' ');
        String alertURL = alertManager.prettyPrintAlertURL(alert);
        StringBuilder message = new StringBuilder();
        message.append("ALERT,");
View Full Code Here

    @Test(enabled = TEST_ENABLED)
    public void testResourceCriteriaBounded() throws Exception {
        ArrayList<GroupAvailCounts> gacs = new ArrayList<LargeGroupCriteriaTest.GroupAvailCounts>();
        gacs.add(new GroupAvailCounts(1100, 0, 0, 0)); // purposefully over 1,000, avails don't really matter

        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
        AuthorizationManagerLocal authManager = LookupUtil.getAuthorizationManager();

        env = new ArrayList<LargeGroupEnvironment>(gacs.size());

        LargeGroupEnvironment lgeWithTypes = null;
        for (GroupAvailCounts gac : gacs) {
            env.add(createLargeGroupWithNormalUserRoleAccessWithInventoryStatus(lgeWithTypes, gac.total, gac.down,
                gac.unknown, gac.disabled, gac.uncommitted, Permission.CONFIGURE_READ));
            lgeWithTypes = env.get(0);
        }

        ResourceCriteria criteria = new ResourceCriteria();
        List<Resource> result;

        SessionTestHelper.simulateLogin(env.get(0).normalSubject);

        criteria.addFilterParentResourceId(lgeWithTypes.platformResource.getId());
        criteria.setPageControl(PageControl.getUnlimitedInstance());
        result = resourceManager.findResourcesByCriteria(env.get(0).normalSubject, criteria);
        assert null != result;
        assert result.size() == 1100 : "Expected unbounded query to return all 1100 resources";

        result = resourceManager.findResourcesByCriteriaBounded(env.get(0).normalSubject, criteria, 2000, 100);
        assert null != result;
        assert result.size() == 1100 : "Expected 2000/100 bounded query to return all 1100 resources";

        result = resourceManager.findResourcesByCriteriaBounded(env.get(0).normalSubject, criteria, 1100, 100);
        assert null != result;
        assert result.size() == 1100 : "Expected 1100/100 bounded query to return all 1100 resources";

        result = resourceManager.findResourcesByCriteriaBounded(env.get(0).normalSubject, criteria, 0, 0);
        assert null != result;
        assert result.size() == 200 : "Expected default (1000/200) bounded query to return 200 resources";

        result = resourceManager.findResourcesByCriteriaBounded(env.get(0).normalSubject, criteria, 0, 500);
        assert null != result;
        assert result.size() == 500 : "Expected default (1000)/500) bounded query to return 500 resources";

        result = resourceManager.findResourcesByCriteriaBounded(env.get(0).normalSubject, criteria, 100, 200);
        assert null != result;
        assert result.size() == 100 : "Expected 100/200 bounded query to return 100 resources";
    }
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.