Package org.rhq.enterprise.server.resource

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


        afterClassWork();
    }

    void createAlertTemplate(String name, String resourceTypeName, String pluginName) throws Exception {
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();
        AlertTemplateManagerLocal alertTemplateMgr = LookupUtil.getAlertTemplateManager();

        ResourceType resourceType = resourceTypeMgr.getResourceTypeByNameAndPlugin(resourceTypeName, pluginName);
        assertNotNull("Cannot create alert template. Unable to find resource type for [name: " + resourceTypeName +
            ", plugin: " + pluginName + "]", resourceType);

        AlertDefinition alertDef = new AlertDefinition();
        alertDef.setName(name);
View Full Code Here


    }

    protected ResourceType assertResourceTypeAssociationEquals(String resourceTypeName, String plugin,
        String propertyName, List<String> expected) throws Exception {
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();

        String fetch = "fetch" + WordUtils.capitalize(propertyName);
        ResourceTypeCriteria criteria = new ResourceTypeCriteria();
        criteria.addFilterName(resourceTypeName);
        criteria.addFilterPluginName(plugin);
        criteria.setStrict(true);
        criteria.fetchBundleConfiguration(true);
        criteria.fetchDriftDefinitionTemplates(true);
        MethodUtils.invokeMethod(criteria, fetch, true);

        List<ResourceType> resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(),
            criteria);
        assertEquals("too many types!", 1, resourceTypes.size());
        ResourceType resourceType = resourceTypes.get(0);
        Set<String> expectedSet = new HashSet<String>(expected);
        List<String> missing = new ArrayList<String>();
View Full Code Here

     * @param typeName type to ignore
     * @param pluginName the plugin where the type is defined
     */
    protected void ignoreType(String typeName, String pluginName) {
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeManagerLocal typeMgr = LookupUtil.getResourceTypeManager();
        ResourceType rt = typeMgr.getResourceTypeByNameAndPlugin(typeName, pluginName);
        if (rt == null) {
            fail("Should have had a resource type named [" + typeName + "] from plugin [" + pluginName + "]");
        }
        typeMgr.setResourceTypeIgnoreFlagAndUninventoryResources(subjectMgr.getOverlord(), rt.getId(), true);

        // sanity check - make sure the type really got ignored
        rt = typeMgr.getResourceTypeByNameAndPlugin(typeName, pluginName);
        if (!rt.isIgnored()) {
            fail("Should have ignored resource type [" + rt + "]");
        }

        return;
View Full Code Here

            + pluginsToBeRegistered);
        this.namesOfPluginsToBeRegistered.removeAll(pluginsToBeRegistered);

        // load resource facets cache
        try {
            ResourceTypeManagerLocal typeManager = LookupUtil.getResourceTypeManager();
            typeManager.reloadResourceFacetsCache();
        } catch (Throwable t) {
            log.error("Could not load ResourceFacets cache", t);
        }

        // Trigger vacuums on some tables as the initial deployment might have changed a lot of things.
View Full Code Here

     * @param  resourceTypeId a {@link org.rhq.core.domain.resource.ResourceType} id
     *
     * @return a <code>ResourceFacets</code> object for the resource type with the specified id
     */
    public static ResourceFacets getResourceFacets(int resourceTypeId) {
        ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();
        return resourceTypeManager.getResourceFacets(resourceTypeId);

    }
View Full Code Here

                createConfigBean.setConfiguration(this.retryCreateItem.getConfiguration());
                break;
            }
            }
        } else {
            ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();
            int resourceTypeId = EnterpriseFacesContextUtility.getResourceType().getId();
            try {
                resourceType = resourceTypeManager.getResourceTypeById(subject, resourceTypeId);
            } catch (ResourceTypeNotFoundException e) {
                FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR,
                    "Could not retrieve resource type for resource type id: " + resourceTypeId);
                return OUTCOME_NO_TYPE;
            }
View Full Code Here

        return items;
    }

    private ResourceType lookupResourceType() {
        ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();
        Subject subject = EnterpriseFacesContextUtility.getSubject();
        ResourceType resourceType;
        try {
            resourceType = resourceTypeManager.getResourceTypeById(subject, getResourceTypeId());
        } catch (ResourceTypeNotFoundException e) {
            throw new IllegalStateException(e); // generally should never happen
        }

        return resourceType;
View Full Code Here

        int resourceTypeId = Integer.parseInt(string);

        Subject subject = EnterpriseFacesContextUtility.getSubject();

        try {
            ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();
            ResourceType resourceType = resourceTypeManager.getResourceTypeById(subject, resourceTypeId);

            return resourceType;
        } catch (ResourceTypeNotFoundException e) {
            throw new RuntimeException("Error loading resource type: " + resourceTypeId, e);
        }
View Full Code Here

        return selectItems;
    }

    private ResourceType lookupResourceType() {
        ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();
        Subject subject = EnterpriseFacesContextUtility.getSubject();
        ResourceType resourceType = null;
        try {
            resourceType = resourceTypeManager.getResourceTypeById(subject, getResourceTypeId());
        } catch (ResourceTypeNotFoundException e) {
            throw new IllegalStateException(e); // generally should never happen
        }

        return resourceType;
View Full Code Here

            EntityManager entityManager = getEntityManager();

            ContentManagerLocal contentManager = LookupUtil.getContentManager();
            ContentSourceManagerLocal contentSourceManager = LookupUtil.getContentSourceManager();
            RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
            ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();
            SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
            Subject overlord = subjectManager.getOverlord();

            // protect if it aleady exists due to a failed run
            contentSourceType = contentSourceManager.getContentSourceType("testType");
            if (null == contentSourceType) {
                // Create a sample content source type that will be used in this test
                contentSourceType = new ContentSourceType("testType");
                entityManager.persist(contentSourceType);
                entityManager.flush();
            }

            // protect if it aleady exists due to a failed run
            ContentSource cs1 = contentSourceManager.getContentSourceByNameAndType(overlord, "contentSource1",
                "testType");
            if (null == cs1) {
                // A repo sync will query all providers for that repo, so add multiple providers
                cs1 = new ContentSource("contentSource1", contentSourceType);
                cs1.setDownloadMode(DownloadMode.DATABASE);
                cs1 = contentSourceManager.simpleCreateContentSource(overlord, cs1);
            }
            ContentSource cs2 = contentSourceManager.getContentSourceByNameAndType(overlord, "contentSource2",
                "testType");
            if (null == cs2) {
                cs2 = new ContentSource("contentSource2", contentSourceType);
                cs2.setDownloadMode(DownloadMode.DATABASE);
                cs2 = contentSourceManager.simpleCreateContentSource(overlord, cs2);
            }

            pluginService.associateContentProvider(cs1, contentProvider1);
            pluginService.associateContentProvider(cs2, contentProvider2);

            repoContentSources.add(cs1);
            repoContentSources.add(cs2);

            // Create the package type packages will be created against
            resourceType = resourceTypeManager.getResourceTypeByNameAndPlugin(TestContentProvider.RESOURCE_TYPE_NAME,
                TestContentProvider.RESOURCE_TYPE_PLUGIN_NAME);
            if (null == resourceType) {
                resourceType = new ResourceType(TestContentProvider.RESOURCE_TYPE_NAME,
                    TestContentProvider.RESOURCE_TYPE_PLUGIN_NAME, ResourceCategory.PLATFORM, null);
                entityManager.persist(resourceType);
View Full Code Here

TOP

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

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.