private void addToAvailable(ManifestService manifestService, StackInfo stack, Set<String> components) {
    ServiceInfo service = stack.getService(manifestService.serviceName);

    if (!m_availableMap.containsKey(manifestService.serviceName)) {
      String display = (null == service) ? manifestService.serviceName: service.getDisplayName();

      AvailableService available = new AvailableService(manifestService.serviceName, display);
      m_availableMap.put(manifestService.serviceName, available);
    }

    AvailableService as = m_availableMap.get(manifestService.serviceName);
    as.getVersions().add(new AvailableVersion(manifestService.version,
        manifestService.versionId,
        manifestService.releaseVersion,
        buildComponents(service, components)));
  }
Helper method to use a {@link ManifestService} to generate the available services structure
@param manifestService          the ManifestService instance
@param stack       the stack object
@param components  the set of components for the service
ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java