Map<ParticipantId, Participant> participants = cluster.getParticipantMap();
builder.append("AppName").append(TAB).append(clusterId).append(NEWLINE);
Map<ResourceId, Resource> resources = cluster.getResourceMap();
for (ResourceId resourceId : resources.keySet()) {
builder.append("SERVICE").append(TAB).append(resourceId).append(NEWLINE);
Resource resource = resources.get(resourceId);
Map<ParticipantId, State> serviceStateMap = null;
if (resource != null) {
HelixDataAccessor accessor = connection.createDataAccessor(clusterId);
ExternalView externalView =
accessor.getProperty(accessor.keyBuilder().externalView(resourceId.stringify()));
if (externalView != null) {
serviceStateMap =
externalView.getStateMap(PartitionId.from(resourceId.stringify() + "_0"));
}
}
builder.append(TAB).append("CONTAINER_NAME").append(TAB).append(TAB)
.append("CONTAINER_STATE").append(TAB).append("SERVICE_STATE").append(TAB)
.append("CONTAINER_ID").append(NEWLINE);
for (Participant participant : participants.values()) {
// need a better check
if (!participant.getId().stringify().startsWith(resource.getId().stringify())) {
continue;
}
ContainerConfig containerConfig = participant.getContainerConfig();
ContainerState containerState = ContainerState.UNDEFINED;
ContainerId containerId = ContainerId.from("N/A");