private Set<TopologyComponent> getTopologyComponentRepos(Long clusterId) throws AmbariException {
    Set<TopologyComponent> topologyComponents = new HashSet<>();
    Cluster cl = clusters.getCluster(clusterId);
    for (Service service : cl.getServices().values()) {
      for (ServiceComponent component : service.getServiceComponents().values()) {
        Map<String, ServiceComponentHost> componentsMap = component.getServiceComponentHosts();
        if (!componentsMap.isEmpty()) {

          //TODO will be a need to change to multi-instance usage
          ServiceComponentHost sch = componentsMap.entrySet().iterator().next().getValue();

          String serviceName = sch.getServiceName();
          String componentName = sch.getServiceComponentName();

          TopologyComponent topologyComponent = TopologyComponent.newBuilder()
              .setComponentName(sch.getServiceComponentName())
              .setServiceName(sch.getServiceName())
              .setCommandParams(ambariManagementController.getTopologyCommandParams(cl.getClusterId(), serviceName, componentName, sch))
              .setComponentLevelParams(ambariManagementController.getTopologyComponentLevelParams(clusterId,
                  serviceName, componentName, cl.getSecurityType()))
              .build();
          topologyComponents.add(topologyComponent);
        }
      }
    }
    return topologyComponents;
  }
Is used during agent registering to provide base info about clusters topology.
@return filled TopologyUpdateEvent with info about all components and hosts in all clusters
ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/TopologyHolder.java