@Override
  public TopologyUpdateEvent getCurrentData() throws AmbariException {
    TreeMap<String, TopologyCluster> topologyClusters = new TreeMap<>();
    for (Cluster cl : clusters.getClusters().values()) {
      Collection<Host> clusterHosts = cl.getHosts();
      Set<TopologyComponent> topologyComponents = new HashSet<>();
      Set<TopologyHost> topologyHosts = new HashSet<>();
      for (Host host : clusterHosts) {
        topologyHosts.add(new TopologyHost(host.getHostId(), host.getHostName(),
            host.getRackInfo(), host.getIPv4()));
      }
      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();

            Set<String> hostNames = cl.getHosts(sch.getServiceName(), sch.getServiceComponentName());
            Set<Long> hostOrderIds = clusterHosts.stream()
              .filter(h -> hostNames.contains(h.getHostName()))
              .map(Host::getHostId)
              .collect(Collectors.toSet());
            Set<String> hostOrderNames = clusterHosts.stream()
              .filter(h -> hostNames.contains(h.getHostName()))
              .map(Host::getHostName)
              .collect(Collectors.toSet());
            String serviceName = sch.getServiceName();
            String componentName = sch.getServiceComponentName();

            TopologyComponent topologyComponent = TopologyComponent.newBuilder()
                .setComponentName(sch.getServiceComponentName())
                .setServiceName(sch.getServiceName())
                .setHostIdentifiers(hostOrderIds, hostOrderNames)
                .setComponentLevelParams(ambariManagementController.getTopologyComponentLevelParams(cl.getClusterId(), serviceName,
                    componentName, cl.getSecurityType()))
                .setCommandParams(ambariManagementController.getTopologyCommandParams(cl.getClusterId(), serviceName, componentName, sch))
                .build();
            topologyComponents.add(topologyComponent);
          }
        }
      }
      topologyClusters.put(Long.toString(cl.getClusterId()),
          new TopologyCluster(topologyComponents, topologyHosts));
    }
    return new TopologyUpdateEvent(topologyClusters, UpdateEventType.CREATE);
  }
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