@Override
  public void validate(ClusterTopology topology) throws InvalidTopologyException {

    // there is no hive configured in the blueprint, nothing to do (does the validator apply?)
    if (!topology.getBlueprint().getServices().contains(HIVE_SERVICE)) {
      LOGGER.info(" [{}] service is not listed in the blueprint, skipping hive service validation.", HIVE_SERVICE);
      return;
    }

    Configuration clusterConfiguration = topology.getConfiguration();

    // hive database settings are missing (this should never be the case, defaults come from the stack def.)
    if (!clusterConfiguration.getAllConfigTypes().contains(HIVE_ENV)) {
      String errorMessage = String.format(" [ %s ] config type is missing from the service [ %s ]. HIVE service validation failed.", HIVE_ENV, HIVE_SERVICE);
      LOGGER.error(errorMessage);
      throw new InvalidTopologyException(errorMessage);
    }

    // hive database has custom configuration, skipping validation
    if (!HIVE_DB_DEFAULT.equals(clusterConfiguration.getPropertyValue(HIVE_ENV, HIVE_DB_PROPERTY))) {
      LOGGER.info("Custom hive database settings detected. HIVE service validation succeeded.");
      return;
    }

    // hive database settings need the mysql-server component in the blueprint
    if (!topology.getBlueprint().getComponents(HIVE_SERVICE).contains(MYSQL_SERVER_COMPONENT)) {
      String errorMessage = String.format("Component [%s] must explicitly be set in the blueprint when hive database " +
        "is configured with the current settings. HIVE service validation failed.", MYSQL_SERVER_COMPONENT);
      LOGGER.error(errorMessage);
      throw new InvalidTopologyException(errorMessage);
    }
  }
Validates hive service related setup before provisioning the cluster.
ambari-server/src/main/java/org/apache/ambari/server/topology/validators/HiveServiceValidator.java