Examples of ResourceGroup


Examples of org.rhq.core.domain.resource.group.ResourceGroup

        List<ResourceGroup> groups = resourceGroupManager.findResourceGroupsByCriteria(subject, c);
        if (null == groups || groups.isEmpty()) {
            throw new IllegalArgumentException("Invalid groupId [" + groupId
                + "]. It must be an existing compatible group whose members must be able to support bundle deployments");
        }
        ResourceGroup group = entityManager.find(ResourceGroup.class, groups.get(0).getId());

        checkDeployBundleAuthz(subject, bundle.getId(), groupId);

        // check that the resource group is compatible with the bundle type
        Set<ResourceType> targetedResourceTypes = bundle.getBundleType().getExplicitlyTargetedResourceTypes();

        if (!targetedResourceTypes.isEmpty() && !targetedResourceTypes.contains(group.getResourceType())) {
            // the bundle type defines that it explicitly targets certain resource types but the current group
            // is not of that resource type.
            throw new IllegalArgumentException("Bundle of type [" + bundle.getBundleType().getName()
                + "] is incompatible with resource type " + group.getResourceType());
        }

        // check that the destination specification is compatible with the bundle type
        String bundleType = bundle.getBundleType().getName();
        ResourceType rt = group.getResourceType();
        ResourceTypeBundleConfiguration bundleConfig = rt.getResourceTypeBundleConfiguration();
        boolean found = false;
        for (ResourceTypeBundleConfiguration.BundleDestinationSpecification spec : bundleConfig
            .getAcceptableBundleDestinationSpecifications(bundleType)) {
View Full Code Here

Examples of org.rhq.core.domain.resource.group.ResourceGroup

    @Override
    @RequiredPermission(Permission.MANAGE_SECURITY)
    public void addRolesToResourceGroup(Subject subject, int groupId, int[] roleIds) {
        if ((roleIds != null) && (roleIds.length > 0)) {
            ResourceGroup group = entityManager.find(ResourceGroup.class, groupId);
            if (group == null) {
                throw new IllegalArgumentException("Could not find resourceGroup[" + groupId + "] to add roles to");
            }
            group.getRoles().size(); // load them in

            for (Integer roleId : roleIds) {
                Role role = entityManager.find(Role.class, roleId);
                if (role == null) {
                    throw new IllegalArgumentException("Tried to add role[" + roleId + "] to resourceGroup[" + groupId
                        + "], but role was not found");
                }
                group.addRole(role);
            }
        }

        return;
    }
View Full Code Here

Examples of org.rhq.core.domain.resource.group.ResourceGroup

        if (null == newDeployment) {
            throw new IllegalArgumentException("Invalid bundleDeploymentId: " + bundleDeploymentId);
        }

        BundleDestination destination = newDeployment.getDestination();
        ResourceGroup group = destination.getGroup();

        // Create and persist updates for each of the group members.
        Set<Resource> groupMembers = group.getExplicitResources();
        if (groupMembers.isEmpty()) {
            throw new IllegalArgumentException("Destination [" + destination
                + "] group has no members. Invalid deployment destination");
        }

        checkDeployBundleAuthz(subject, newDeployment.getBundleVersion().getBundle().getId(), group.getId());

        for (Resource groupMember : groupMembers) {
            try {
                scheduleBundleResourceDeployment(subject, newDeployment, groupMember, isCleanDeployment, isRevert);
            } catch (Throwable t) {
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.