Package org.rhq.core.domain.resource.group

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


            assert !AChildren.isEmpty() : "Expected Children for Node A";

            int AChildResourceTypeId = AChildren.get(0).getResourceType().getId();
            String AChildResourceKey = AChildren.get(0).getResourceKey();

            ClusterKey clusterKey = new ClusterKey(clusterGroup.getId(), AChildResourceTypeId, AChildResourceKey);
            assert clusterKey.getClusterGroupId() == clusterGroup.getId();
            assert clusterKey.getDepth() == 1;
            assert AChildResourceKey.equals(clusterKey.getHierarchy().get(0).getResourceKey());
            assert AChildResourceTypeId == clusterKey.getHierarchy().get(0).getResourceTypeId();
            assert AChildResourceTypeId == ClusterKey.getResourceType(clusterKey);
            assert ClusterKey.valueOf(clusterKey.toString()) != null;

            List<Resource> resources = clusterManager.getAutoClusterResources(subject, clusterKey);

            assert resources.size() == 2;
            assert resources.get(0).getId() != resources.get(1).getId();
            assert resources.get(0).getParentResource().getId() != resources.get(1).getParentResource().getId();
            assert resources.get(0).getParentResource().getId() == nodeA.getId()
                || resources.get(0).getParentResource().getId() == nodeB.getId();
            assert resources.get(1).getParentResource().getId() == nodeA.getId()
                || resources.get(1).getParentResource().getId() == nodeB.getId();

            assertNull(clusterManager.getAutoClusterBackingGroup(subject, clusterKey));

            ResourceGroup backingGroup = clusterManager.createAutoClusterBackingGroup(subject, clusterKey, true);
            assertNotNull(backingGroup);
            assertEquals(backingGroup.getClusterKey(), clusterKey.toString());
            assertEquals(backingGroup.getClusterResourceGroup(), clusterGroup);
            //Set<Resource> backingGroupResources = backingGroup.getExplicitResources();
            // explicitResources for backingGroup is lazy, so we need to hit resourceManager for the answer
            List<Resource> backingGroupResources = resourceManager.findExplicitResourcesByResourceGroup(subject,
                backingGroup, PageControl.getUnlimitedInstance());
View Full Code Here


            Resource AGrandChild = AGrandChildren.get(0);
            int AGrandChildResourceTypeId = AGrandChild.getResourceType().getId();
            String AGrandChildResourceKey = AGrandChild.getResourceKey();

            ClusterKey clusterKey = new ClusterKey(clusterGroup.getId(), AChildResourceTypeId, AChildResourceKey);
            clusterKey.addChildToHierarchy(AGrandChildResourceTypeId, AGrandChildResourceKey);
            assert clusterKey.getClusterGroupId() == clusterGroup.getId();
            assert clusterKey.getDepth() == 2;
            assert AChildResourceKey.equals(clusterKey.getHierarchy().get(0).getResourceKey());
            assert AChildResourceTypeId == clusterKey.getHierarchy().get(0).getResourceTypeId();
            assert AGrandChildResourceKey.equals(clusterKey.getHierarchy().get(1).getResourceKey());
            assert AGrandChildResourceTypeId == clusterKey.getHierarchy().get(1).getResourceTypeId();
            assert AGrandChildResourceTypeId == ClusterKey.getResourceType(clusterKey);
            assert ClusterKey.valueOf(clusterKey.toString()) != null;

            List<Resource> resources = clusterManager.getAutoClusterResources(subject, clusterKey);

            assert resources.size() == 2;
            assert resources.get(0).getId() != resources.get(1).getId();
View Full Code Here

        currentParentResourceGroupId = FacesContextUtility.getOptionalRequestParameter("contextParentGroupId");

        currentResourceGroup = null;

        if (clusterKeyString != null) {
            ClusterKey key = ClusterKey.valueOf(clusterKeyString);
            currentResourceGroup = clusterManager.createAutoClusterBackingGroup(subject, key, false);

        } else if (groupIdString != null) {
            int groupId = Integer.parseInt(groupIdString);
            currentResourceGroup = groupManager.getResourceGroupById(subject, groupId, null);
View Full Code Here

        for (Integer member : members) {
            memberNodes.add(ResourceTreeModelUIBean.load(member.intValue(), resources));
        }

        ResourceGroupTreeNode root = new ResourceGroupTreeNode(group, null);
        root.setClusterKey(new ClusterKey(group.getId()));
        root.addMembers(memberNodes);
        load(root, memberNodes);
        return root;
    }
View Full Code Here

                    childGroupNode.addMember(node);
                    childGroupNode.setClusterKey(parentNode.getClusterKey());

                } else if (level instanceof ResourceFlyweight) {
                    ResourceFlyweight res = (ResourceFlyweight) level;
                    ClusterKey parentKey = parentNode.getClusterKey();
                    ClusterKey key = null;
                    if (parentKey == null) {
                        key = new ClusterKey(((ResourceGroup) parentNode.getData()).getId(), res.getResourceType()
                            .getId(), res.getResourceKey());
                    } else {
                        key = new ClusterKey(parentKey, res.getResourceType().getId(), res.getResourceKey());
                    }
                    ResourceGroupTreeNode childGroupNode = children.get(key);

                    if (childGroupNode == null) {
                        childGroupNode = new ResourceGroupTreeNode(key, parentNode);
View Full Code Here

        return null;
    }

    private boolean preopen(ResourceGroupTreeNode resourceTreeNode, CurrentSelection currentSelection, boolean setOpenState) {
        ResourceGroup currentGroup = currentSelection.resourceGroup;
        ClusterKey selectedClusterKey = currentSelection.clusterKey;
       
        boolean ret = false;
        for (ResourceGroupTreeNode child : resourceTreeNode.getChildren()) {
            if (child.getData() instanceof ClusterKey) {
                if (((ClusterKey) child.getData()).equals(selectedClusterKey)) {
View Full Code Here

        ResourceGroupTreeNode node = (ResourceGroupTreeNode) tree.getRowData(tree.getRowKey());

        if (node.getData() instanceof ResourceGroup) {
            return (currentSelection.resourceGroup.getId() == ((ResourceGroup) node.getData()).getId());
        } else if (node.getData() instanceof ClusterKey) {
            ClusterKey key = (ClusterKey) node.getData();

            if (currentSelection.clusterKey != null && currentSelection.clusterKey.equals(key)) {
                return true;
            }
        }
View Full Code Here

                            // this should not be necessary but for otherwise the top node does not always show selected
                            treeGrid.markForRedraw();
                        }

                    } else if (newNode.isAutoClusterNode()) {
                        ClusterKey key = newNode.getClusterKey();
                        Log.debug("Selecting autocluster group [" + key + "]...");
                        currentNodeId = newNode.getID();
                        // the user selected a cluster node - let's switch to that cluster group view
                        selectClusterGroup(key);
View Full Code Here

            CoreGUI.goToView(viewPath);
        }
    }

    private ResourceGroupEnhancedTreeNode loadTree(ClusterFlyweight root) {
        ClusterKey rootKey = new ClusterKey(root.getGroupId());
        ResourceGroupEnhancedTreeNode fakeRoot = new ResourceGroupEnhancedTreeNode("fakeRootNode");
        fakeRoot.setID(FAKE_ROOT_ID);

        String groupName = rootResourceGroup.getName();
        String escapedGroupName = StringUtility.escapeHtml(groupName);
        ResourceGroupEnhancedTreeNode rootNode = new ResourceGroupEnhancedTreeNode(escapedGroupName);
        rootNode.setID(rootKey.getKey());
        rootNode.setParentID(fakeRoot.getID());

        ResourceType rootResourceType = typeMap.get(rootResourceGroup.getResourceType().getId());
        rootNode.setResourceType(rootResourceType);
View Full Code Here

                for (ClusterFlyweight child : children) {
                    ResourceGroupEnhancedTreeNode node = createClusterGroupNode(parentKey, childType, child);
                    nodesByType.add(node);

                    if (!child.getChildren().isEmpty()) {
                        ClusterKey key = node.getClusterKey();
                        loadTree(node, child, key); // recurse
                    }
                }

                // Insert an autoTypeGroup node if the type is not a singleton.
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.resource.group.ClusterKey

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.