private void deleteHostComponentsForServiceComponent(ServiceComponent sc, ServiceComponentRequest request,
                                                       DeleteHostComponentStatusMetaData deleteMetaData) throws AmbariException {
    for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
      if (!sch.getDesiredState().isRemovableState()) {
        deleteMetaData.setAmbariException(new AmbariException("Found non removable host component when trying to delete service component." +
            " To remove host component, it must be in DISABLED/INIT/INSTALLED/INSTALL_FAILED/UNKNOWN" +
            "/UNINSTALLED/INSTALLING state."
            + ", request=" + request.toString()
            + ", current state=" + sc.getDesiredState() + "."));
        return;
      }
    }

    for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
      sch.delete(deleteMetaData);
    }
  }
Get a component request object from a map of property values.

@param properties  the predicate

@return the component request object
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java