public RequestStatusResponse start(String cluster, String hostName, Collection<String> installOnlyComponents,
                                     boolean skipFailure, boolean useClusterHostInfo) throws  SystemException,
      UnsupportedPropertyException, NoSuchParentResourceException {

    Map<String, String> requestInfo = new HashMap<>();
    requestInfo.put(CONTEXT, String.format("Start components on host %s", hostName));
    requestInfo.put(CLUSTER_PHASE_PROPERTY, CLUSTER_PHASE_INITIAL_START);
    // see rationale for marking the operation as HostComponent-level at "Install components on host"
    requestInfo.putAll(RequestOperationLevel.propertiesFor(Resource.Type.HostComponent, cluster));
    requestInfo.put(Setting.SETTING_NAME_SKIP_FAILURE, Boolean.toString(skipFailure));

    Predicate clusterPredicate = new EqualsPredicate<>(CLUSTER_NAME, cluster);
    Predicate hostPredicate = new EqualsPredicate<>(HOST_NAME, hostName);
    //Predicate hostPredicate = new OrPredicate(hostPredicates.toArray(new Predicate[hostPredicates.size()]));

    RequestStageContainer requestStages;
    try {
      Map<String, Object> startProperties = new HashMap<>();
      startProperties.put(DESIRED_STATE, "STARTED");
      Request startRequest = PropertyHelper.getUpdateRequest(startProperties, requestInfo);
      // Important to query against desired_state as this has been updated when install stage was created
      // If I query against state, then the getRequest compares predicate prop against desired_state and then when the predicate
      // is later applied explicitly, it gets compared to live_state. Since live_state == INSTALLED == INIT at this point and
      // desired_state == INSTALLED, we will always get 0 matches since both comparisons can't be true :(
      Predicate installedStatePredicate = new EqualsPredicate<>(DESIRED_STATE, "INSTALLED");
      Predicate notClientPredicate = new NotPredicate(new ClientComponentPredicate());
      Predicate clusterAndClientPredicate = new AndPredicate(clusterPredicate, notClientPredicate);
      Predicate hostAndStatePredicate = new AndPredicate(installedStatePredicate, hostPredicate);
      Predicate startPredicate;

      if (installOnlyComponents.isEmpty()) {
        // all installed components should be started
        startPredicate = new AndPredicate(clusterAndClientPredicate, hostAndStatePredicate);
        LOG.info("Starting all non-client components on host: " + hostName);
      } else {
        // any INSTALL_ONLY components should not be started
        List<Predicate> listOfComponentPredicates =
          new ArrayList<>();

        for (String installOnlyComponent : installOnlyComponents) {
          Predicate componentNameEquals = new EqualsPredicate<>(COMPONENT_NAME, installOnlyComponent);
          // create predicate to filter out the install only component
          listOfComponentPredicates.add(new NotPredicate(componentNameEquals));
        }

        Predicate[] arrayOfInstallOnlyPredicates = new Predicate[listOfComponentPredicates.size()];
        // aggregate Predicate of all INSTALL_ONLY component names
        Predicate installOnlyComponentsPredicate = new AndPredicate(listOfComponentPredicates.toArray(arrayOfInstallOnlyPredicates));

        // start predicate must now include the INSTALL_ONLY component predicates, in
        // order to filter out those components for START attempts
        startPredicate = new AndPredicate(clusterAndClientPredicate, hostAndStatePredicate, installOnlyComponentsPredicate);
        LOG.info("Starting all non-client components on host: " + hostName + ", except for the INSTALL_ONLY components specified: " + installOnlyComponents);
      }


      requestStages = doUpdateResources(null, startRequest, startPredicate, true,
          true, useClusterHostInfo);
      notifyUpdate(Resource.Type.HostComponent, startRequest, startPredicate);
      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 start 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