// initialize the host map from the known hosts...
provider = getResourceProvider(Resource.Type.Host);
request = PropertyHelper.getReadRequest(HOST_NAME_PROPERTY_ID, HOST_IP_PROPERTY_ID,
HOST_ATTRIBUTES_PROPERTY_ID);
Predicate predicate = new PredicateBuilder().property(HOST_CLUSTER_NAME_PROPERTY_ID).
equals(clusterName).toPredicate();
Set<Resource> hosts = provider.getResources(request, predicate);
Map<String, String> hostMap = clusterHostMap.get(clusterName);
if (hostMap == null) {
hostMap = new HashMap<String, String>();
clusterHostMap.put(clusterName, hostMap);
}
for (Resource host : hosts) {
hostMap.put((String) host.getPropertyValue(HOST_NAME_PROPERTY_ID),
(String) host.getPropertyValue(HOST_IP_PROPERTY_ID));
}
// initialize the host component map and Ganglia server from the known hosts components...
provider = getResourceProvider(Resource.Type.HostComponent);
request = PropertyHelper.getReadRequest(HOST_COMPONENT_HOST_NAME_PROPERTY_ID,
HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID);
predicate = new PredicateBuilder().property(HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID).
equals(clusterName).toPredicate();
Set<Resource> hostComponents = provider.getResources(request, predicate);
Map<String, String> hostComponentMap = clusterHostComponentMap.get(clusterName);