class BlueprintValidatorImpl implements BlueprintValidator {

  @Override
  public void validateTopology() throws InvalidTopologyException {
    LOGGER.info("Validating topology for blueprint: [{}]", blueprint.getName());
    Collection<HostGroup> hostGroups = blueprint.getHostGroups().values();
    Map<String, Map<String, Collection<DependencyInfo>>> missingDependencies = new HashMap<>();

    for (HostGroup group : hostGroups) {
      Map<String, Collection<DependencyInfo>> missingGroupDependencies = validateHostGroup(group);
      if (!missingGroupDependencies.isEmpty()) {
        missingDependencies.put(group.getName(), missingGroupDependencies);
      }
    }

    Collection<String> cardinalityFailures = new HashSet<>();
    Collection<String> services = blueprint.getServices();

    for (String service : services) {
      for (String component : stack.getComponents(service)) {
        Cardinality cardinality = stack.getCardinality(component);
        AutoDeployInfo autoDeploy = stack.getAutoDeployInfo(component);
        if (cardinality.isAll()) {
          cardinalityFailures.addAll(verifyComponentInAllHostGroups(component, autoDeploy));
        } else {
          cardinalityFailures.addAll(verifyComponentCardinalityCount(
            component, cardinality, autoDeploy));
        }
      }
    }

    if (!missingDependencies.isEmpty() || !cardinalityFailures.isEmpty()) {
      generateInvalidTopologyException(missingDependencies, cardinalityFailures);
    }
  }

  public  BlueprintValidatorImpl(Blueprint blueprint);

}