Examples of ResourceManagerLocal


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

                Long.valueOf(30000), new Long(mdef.getDefaultInterval()));

            //ok, and now test that the platform resource schedule was updated as well

            //get the resource id first
            ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
            ResourceCriteria rcrit = new ResourceCriteria();
            rcrit.addFilterResourceTypeName(RESOURCE_TYPE_NAME);
            List<Resource> platforms = resourceManager.findResourcesByCriteria(freshUser(), rcrit);

            assertEquals("Unexpected number of platform resources found.", 1, platforms.size());

            int platformResourceId = platforms.get(0).getId();
View Full Code Here

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

                distroNameDef.getDefaultInterval());

            //ok, and now test that the platform resource schedule was NOT updated because it was configured not to.

            //get the resource id first
            ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
            ResourceCriteria rcrit = new ResourceCriteria();
            rcrit.addFilterResourceTypeName(RESOURCE_TYPE_NAME);
            List<Resource> platforms = resourceManager.findResourcesByCriteria(freshUser(), rcrit);

            assertEquals("Unexpected number of platform resources found.", 1, platforms.size());

            int platformResourceId = platforms.get(0).getId();
View Full Code Here

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


    @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = { "plugin.resource.metadata.test",
        "RemoveTypes" })
    public void deleteResources() {
        ResourceManagerLocal resourceMgr = LookupUtil.getResourceManager();
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();

        ResourceCriteria criteria = new ResourceCriteria();
        criteria.addFilterResourceTypeName("ServerC");
        criteria.addFilterPluginName("RemoveTypesPlugin");

        List<Resource> resources = resourceMgr.findResourcesByCriteria(subjectMgr.getOverlord(), criteria);

        assertTrue("Did not expect to find any more that three resources. Database might need to be reset",
            resources.size() < 4);

        // We won't do anything more rigorous that making sure the resources were marked uninventoried.
View Full Code Here

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

    private void deleteNewResource(Resource resource) throws Exception {
        if (null != resource) {

            try {
                ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();

                // invoke bulk delete on the resource to remove any dependencies not defined in the hibernate entity model
                // perform in-band and out-of-band work in quick succession
                List<Integer> deletedIds = resourceManager.uninventoryResource(overlord, resource.getId());
                for (Integer deletedResourceId : deletedIds) {
                    resourceManager.uninventoryResourceAsyncWork(overlord, deletedResourceId);
                }

                // now dispose of other hibernate entities
                getTransactionManager().begin();
View Full Code Here

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

     * Given a resource ID, this gets all resource types for all ancestors in that resource's lineage.
     */
    @Override
    public ArrayList<ResourceType> getResourceTypesForResourceAncestors(int resourceId) throws RuntimeException {
        try {
            ResourceManagerLocal manager = LookupUtil.getResourceManager();
            List<ResourceLineageComposite> lineage = manager.getResourceLineage(getSessionSubject(), resourceId);
            ArrayList<ResourceType> types = new ArrayList<ResourceType>(lineage.size());
            for (ResourceLineageComposite composite : lineage) {
                types.add(composite.getResource().getResourceType());
            }
            return SerialUtility.prepare(types, "ResourceTypes.getResourceTypesForResourceAncestors");
View Full Code Here

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

        try {
            ResourceType rt = getResourceType(rtName);

            if (null != rt) {
                Subject overlord = getOverlord();
                ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();

                // delete any resources first
                ResourceCriteria c = new ResourceCriteria();
                c.setStrict(true);
                c.addFilterResourceTypeId(rt.getId());
                c.addFilterInventoryStatus(InventoryStatus.NEW);
                List<Resource> doomedResources = resourceManager.findResourcesByCriteria(overlord, c);
                c.addFilterInventoryStatus(InventoryStatus.DELETED);
                doomedResources.addAll(resourceManager.findResourcesByCriteria(overlord, c));
                c.addFilterInventoryStatus(InventoryStatus.UNINVENTORIED);
                doomedResources.addAll(resourceManager.findResourcesByCriteria(overlord, c));
                // invoke bulk delete on the resource to remove any dependencies not defined in the hibernate entity model
                // perform in-band and out-of-band work in quick succession
                for (Resource doomed : doomedResources) {
                    List<Integer> deletedIds = resourceManager.uninventoryResource(overlord, doomed.getId());
                    for (Integer deletedResourceId : deletedIds) {
                        resourceManager.uninventoryResourceAsyncWork(overlord, deletedResourceId);
                    }
                }

                // Measurement defs go away via cascade remove
View Full Code Here

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

    private void deleteNewResource(Resource resource) throws Exception {
        if (null != resource) {

            try {
                ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();

                // invoke bulk delete on the resource to remove any dependencies not defined in the hibernate entity model
                // perform in-band and out-of-band work in quick succession
                Subject overlord = LookupUtil.getSubjectManager().getOverlord();
                List<Integer> deletedIds = resourceManager.uninventoryResource(overlord, resource.getId());
                for (Integer deletedResourceId : deletedIds) {
                    resourceManager.uninventoryResourceAsyncWork(overlord, deletedResourceId);
                }

                // now dispose of other hibernate entities
                getTransactionManager().begin();
                em = getEntityManager();
View Full Code Here

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

    }

    @Override
    public Set<Resource> getResources(Set<Integer> resourceIds, boolean includeDescendants) {
        long start = System.currentTimeMillis();
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
        Set<Resource> resources = new HashSet<Resource>();
        for (Integer resourceId : resourceIds) {
            Resource resource = resourceManager.getResourceTree(resourceId, includeDescendants);
            if (isVisibleInInventory(resource)) {
                resource = convertToPojoResource(resource, includeDescendants);
                cleanoutResource(resource);
                resources.add(resource);
            }
View Full Code Here

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

        // get all of them, don't limit to default paging
        criteria.clearPaging();
        criteria.fetchResourceType(true);
        criteria.fetchPluginConfiguration(true);

        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
        Subject overlord = LookupUtil.getSubjectManager().getOverlord();
        List<Resource> result = resourceManager.findResourcesByCriteria(overlord, criteria);

        if (log.isDebugEnabled()) {
            log.debug("Performance: get ResourcesAsList [" + resourceIds + "], timing ("
                + (System.currentTimeMillis() - start) + ")ms");
        }
View Full Code Here

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

    }

    @Override
    public Map<Integer, InventoryStatus> getInventoryStatus(int rootResourceId, boolean descendents) {
        long start = System.currentTimeMillis();
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
        Map<Integer, InventoryStatus> statuses = resourceManager.getResourceStatuses(rootResourceId, descendents);
        if (log.isDebugEnabled()) {
            log.debug("Performance: get inventory statuses for [" + statuses.size() + "] timing ("
                + (System.currentTimeMillis() - start) + ")ms");
        }
        return statuses;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.