Package org.rhq.enterprise.server.auth

Examples of org.rhq.enterprise.server.auth.SubjectManagerLocal


        assertNotNull("Failed create bundle for [name: " + bundleName + "]", bundle);
    }

    void createPackage(String packageName, String resourceTypeName, String pluginName) throws Exception {
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ContentManagerLocal contentMgr = LookupUtil.getContentManager();

        List<PackageType> packageTypes = contentMgr.findPackageTypes(subjectMgr.getOverlord(), resourceTypeName,
            pluginName);
        Package pkg = new Package(packageName, packageTypes.get(0));

        contentMgr.persistPackage(pkg);
    }
View Full Code Here


        contentMgr.persistPackage(pkg);
    }

    ResourceGroup createResourceGroup(String groupName, String resourceTypeName, String pluginName, boolean recursive)
        throws Exception {
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();
        ResourceGroupManagerLocal resourceGroupMgr = LookupUtil.getResourceGroupManager();

        ResourceType resourceType = resourceTypeMgr.getResourceTypeByNameAndPlugin(resourceTypeName, pluginName);

        assertNotNull("Cannot create resource group. Unable to find resource type for [name: " + resourceTypeName
            + ", plugin: " + pluginName + "]", resourceType);

        ResourceGroup resourceGroup = new ResourceGroup(groupName, resourceType);
        resourceGroup.setRecursive(recursive);
        ResourceGroup result = resourceGroupMgr.createResourceGroup(subjectMgr.getOverlord(), resourceGroup);
        groupIds.add(result.getId());
        return result;
    }
View Full Code Here

        groupIds.add(result.getId());
        return result;
    }

    void addResourcesToGroup(ResourceGroup rg, List<Resource> resources) throws Exception {
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
        ResourceGroupManagerLocal resourceGroupMgr = LookupUtil.getResourceGroupManager();
        int[] ids = new int[resources.size()];
        int i = 0;
        for (Resource r : resources) {
            ids[i++] = r.getId();
        }
        resourceGroupMgr.addResourcesToGroup(subjectMgr.getOverlord(), rg.getId(), ids);
    }
View Full Code Here

        }
        resourceGroupMgr.addResourcesToGroup(subjectMgr.getOverlord(), rg.getId(), ids);
    }

    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);
        alertDef.setPriority(AlertPriority.MEDIUM);
        alertDef.setResourceType(resourceType);
        alertDef.setConditionExpression(BooleanExpression.ALL);
        alertDef.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
        alertDef.setRecoveryId(0);

        alertTemplateMgr.createAlertTemplate(subjectMgr.getOverlord(), alertDef, resourceType.getId());
    }
View Full Code Here

        if (rt == null) {
            fail("The following type was not found: " + typeName);
        }

        if (ignore) {
            SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
            typeMgr.setResourceTypeIgnoreFlagAndUninventoryResources(subjectMgr.getOverlord(), rt.getId(), true);
            rt = typeMgr.getResourceTypeByNameAndPlugin(typeName, PLUGIN_NAME);
            if (rt == null) {
                fail("Failed to reload type after ignoring it: " + typeName);
            }
            assert rt.isIgnored() : "Somehow the type didn't get ignored: " + rt;
View Full Code Here

        }

        boolean continueProcessing = true;
        String sid = req.getHeader("RHQ_Session");
        if (sid != null) {
            SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
            try {
                Subject subject = subjectManager.getSubjectBySessionId(Integer.parseInt(sid));
                sessionSubject.set(subject);
            } catch (Exception e) {
                log.trace("Failed to validate request: sessionId was '" + sid + "', requestURL=" + req.getRequestURL());
                continueProcessing = false;
            }
View Full Code Here

    public void afterClassWorkTest() throws Exception {
        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);
        alertDef.setPriority(AlertPriority.MEDIUM);
        alertDef.setResourceType(resourceType);
        alertDef.setConditionExpression(BooleanExpression.ALL);
        alertDef.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
        alertDef.setRecoveryId(0);

        alertTemplateMgr.createAlertTemplate(subjectMgr.getOverlord(), alertDef, resourceType.getId());
    }
View Full Code Here

    private String testSemantic = getRandomString();

    @Override
    protected void beforeMethod() throws Exception {
        tagManager = LookupUtil.getTagManager();
        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
        bundleManager = LookupUtil.getBundleManager();
        overlord = subjectManager.getOverlord();
        TestBundleServerPluginService bundleServerPluginService = new TestBundleServerPluginService(getTempDir(), new TestBundlePluginComponent());
        prepareCustomServerPluginService(bundleServerPluginService);
        bundleServerPluginService.startMasterPluginContainer();
    }
View Full Code Here

        return pluginDescriptor.getAmpsVersion();
    }

    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 + "]");
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.auth.SubjectManagerLocal

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.