@Override
  public Map<ClusterTopology, List<LogicalRequest>> getAllRequests() {
    //todo: we only currently support a single request per ambari instance so there should only
    //todo: be a single cluster topology
    Map<ClusterTopology, List<LogicalRequest>> allRequests = new HashMap<>();
    Collection<TopologyRequestEntity> entities = topologyRequestDAO.findAll();

    Map<Long, ClusterTopology> topologyRequests = new HashMap<>();
    for (TopologyRequestEntity entity : entities) {
      TopologyRequest replayedRequest = new ReplayedTopologyRequest(entity, blueprintFactory);
      ClusterTopology clusterTopology = topologyRequests.get(replayedRequest.getClusterId());
      if (clusterTopology == null) {
        try {
          clusterTopology = new ClusterTopologyImpl(ambariContext, replayedRequest);
          if (entity.getProvisionAction() != null) {
            clusterTopology.setProvisionAction(entity.getProvisionAction());
          }
          topologyRequests.put(replayedRequest.getClusterId(), clusterTopology);
          allRequests.put(clusterTopology, new ArrayList<>());
        } catch (InvalidTopologyException e) {
          throw new RuntimeException("Failed to construct cluster topology while replaying request: " + e, e);
        }
      } else {
        // ensure all host groups are provided in the combined cluster topology
        for (Map.Entry<String, HostGroupInfo> groupInfoEntry : replayedRequest.getHostGroupInfo().entrySet()) {
          String name = groupInfoEntry.getKey();
          if (! clusterTopology.getHostGroupInfo().containsKey(name)) {
            clusterTopology.getHostGroupInfo().put(name, groupInfoEntry.getValue());
          }
        }
      }

      TopologyLogicalRequestEntity logicalRequestEntity = entity.getTopologyLogicalRequestEntity();
      if (logicalRequestEntity != null) {
        try {
          Long logicalId = logicalRequestEntity.getId();

          //todo: fix initialization of ActionManager.requestCounter to account for logical requests
          //todo: until this is fixed, increment the counter for every recovered logical request
          //todo: this will cause gaps in the request id's after recovery
          ambariContext.getNextRequestId();
          allRequests.get(clusterTopology).add(logicalRequestFactory.createRequest(
                  logicalId, replayedRequest, clusterTopology, logicalRequestEntity));
        } catch (AmbariException e) {
          throw new RuntimeException("Failed to construct logical request during replay: " + e, e);
        }
      }

    }

    return allRequests;
  }
Implementation which uses Ambari Database DAO and Entity objects for persistence
of topology related information.
ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java