org.rhq.core.domain.resource.group
Class ClusterKey

java.lang.Object
  extended by org.rhq.core.domain.resource.group.ClusterKey
All Implemented Interfaces:
Serializable

public class ClusterKey
extends Object
implements Serializable

A ClusterKey represents an AutoCluster of resources in a Cluster Hierarchy. Given the key it is possible to determine specific membership of the AutoCluster at any time. It represents the Cluster Root (a Compatible Group) and the hierarchy of resource cluster nodes. Each level of the hierarchy represents a resource cluster node defined by a Plugin|ResourceType|ResourceKey tuple.

The ClusterKey has the following form:

 
  Expressed iteratively:
  
  CompatibleGroupId::ResourceTypeId1:ResourceKey1::ResourceTypeId2:ResourceKey2:: ... ::ResourceTypeIdN:ResourceKeyN
  
  Expressed Recursively:
  
  Depth-1 AutoCluster  CompatibleGroupId::ResourceTypeId1:ResourceKey1
  Depth-N AutoCluster  ::ResourceTypeIdN:ResourceKeyN
 

See Also:
Serialized Form

Nested Class Summary
static class ClusterKey.Node
          Immutable class representing a node in an AutoCluster hierarchy.
 
Constructor Summary
ClusterKey()
           
ClusterKey(ClusterKey parentKey, int childResourceTypeId, String childResourceKey)
          Construct a new ClusterKey for a child AutoCluster of the provided parentKey
ClusterKey(int clusterResourceGroupId)
          Construct ClusterKey with to-be-defined Hierarcrhy
ClusterKey(int clusterResourceGroupId, int resourceTypeId, String resourceKey)
          Construct ClusterKey for a top level AutoCluster
 
Method Summary
 List<ClusterKey.Node> addChildToHierarchy(int childResourceTypeId, String childResourceKey)
          Increase depth of hierarchy with new child node.
 boolean equals(Object o)
           
 int getClusterGroupId()
           
 int getDepth()
           
 List<ClusterKey.Node> getHierarchy()
           
 String getKey()
           
static int getResourceType(ClusterKey clusterKey)
           
 int hashCode()
           
 void setDepth(int newDepth)
           
 String toString()
          format: see class doc, used delimiters ClusterKey.DELIM_NODE and ClusterKey.DELIM
static ClusterKey valueOf(String clusterKey)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClusterKey

public ClusterKey()

ClusterKey

public ClusterKey(int clusterResourceGroupId)
Construct ClusterKey with to-be-defined Hierarcrhy


ClusterKey

public ClusterKey(int clusterResourceGroupId,
                  int resourceTypeId,
                  String resourceKey)
Construct ClusterKey for a top level AutoCluster


ClusterKey

public ClusterKey(ClusterKey parentKey,
                  int childResourceTypeId,
                  String childResourceKey)
Construct a new ClusterKey for a child AutoCluster of the provided parentKey

Method Detail

getClusterGroupId

public int getClusterGroupId()

getHierarchy

public List<ClusterKey.Node> getHierarchy()

addChildToHierarchy

public List<ClusterKey.Node> addChildToHierarchy(int childResourceTypeId,
                                                 String childResourceKey)
Increase depth of hierarchy with new child node.

Parameters:
childResourceTypeId -
childResourceKey -
Returns:
The updated hierarchy

getDepth

public int getDepth()
Returns:
the depth of the AutoCluster hierarchy. Just another way of getting the hierarchy size.

setDepth

public void setDepth(int newDepth)
Parameters:
newDepth - > 0, keep only the hierarchy up to an including the specified depth.

getKey

public String getKey()

toString

public String toString()
format: see class doc, used delimiters ClusterKey.DELIM_NODE and ClusterKey.DELIM

Overrides:
toString in class Object

valueOf

public static ClusterKey valueOf(String clusterKey)

getResourceType

public static int getResourceType(ClusterKey clusterKey)
Parameters:
clusterKey -
Returns:
The ResourceType id of the resource group this clusterKey defines.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.