public RequestStatusResponse install(String cluster, String hostname, Collection<String> skipInstallForComponents,
                                       Collection<String> dontSkipInstallForComponents,
                                       boolean skipFailure, boolean useClusterHostInfo) throws  SystemException,
      UnsupportedPropertyException, NoSuchParentResourceException {

    RequestStageContainer requestStages;
    //for (String host : hosts) {

    Map<String, Object> installProperties = new HashMap<>();

    installProperties.put(DESIRED_STATE, "INSTALLED");
    Map<String, String> requestInfo = new HashMap<>();
    requestInfo.put(CONTEXT, String.format("Install components on host %s", hostname));
    requestInfo.put(CLUSTER_PHASE_PROPERTY, CLUSTER_PHASE_INITIAL_INSTALL);
    // although the operation is really for a specific host, the level needs to be set to HostComponent
    // to make sure that any service in maintenance mode does not prevent install/start on the new host during scale-up
    requestInfo.putAll(RequestOperationLevel.propertiesFor(Resource.Type.HostComponent, cluster));
    addProvisionActionProperties(skipInstallForComponents, dontSkipInstallForComponents, requestInfo);

    Request installRequest = PropertyHelper.getUpdateRequest(installProperties, requestInfo);

    Predicate statePredicate = new EqualsPredicate<>(STATE, "INIT");
    Predicate clusterPredicate = new EqualsPredicate<>(CLUSTER_NAME, cluster);
    // single host
    Predicate hostPredicate = new EqualsPredicate<>(HOST_NAME, hostname);
    //Predicate hostPredicate = new OrPredicate(hostPredicates.toArray(new Predicate[hostPredicates.size()]));
    Predicate hostAndStatePredicate = new AndPredicate(statePredicate, hostPredicate);
    Predicate installPredicate = new AndPredicate(hostAndStatePredicate, clusterPredicate);

    try {
      LOG.info("Installing all components on host: " + hostname);

      // we need send special parameters to send install/start commands with configs
      requestStages = doUpdateResources(null, installRequest, installPredicate, true,
          true, useClusterHostInfo);
      notifyUpdate(Resource.Type.HostComponent, installRequest, installPredicate);
      try {
        requestStages.persist();
      } catch (AmbariException e) {
        throw new SystemException(e.getMessage(), e);
      }
    } catch (NoSuchResourceException e) {
      // shouldn't encounter this exception here
      throw new SystemException("An unexpected exception occurred while processing install hosts",  e);
      }

    return requestStages.getRequestStatusResponse();
  }
Create a  new resource provider for the given management controller.

@param managementController the management controller
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java