private Set<Resource> findResources(Request request, final Predicate predicate,
                                      final Set<ServiceComponentHostRequest> requests)
          throws SystemException, NoSuchResourceException, NoSuchParentResourceException {
    Set<Resource> resources = new HashSet<>();
    Set<String> requestedIds = getRequestPropertyIds(request, predicate);
    // We always need host_name for sch
    requestedIds.add(HOST_NAME);

    Set<ServiceComponentHostResponse> responses = getResources(new Command<Set<ServiceComponentHostResponse>>() {
      @Override
      public Set<ServiceComponentHostResponse> invoke() throws AmbariException {
        return getManagementController().getHostComponents(requests);
      }
    });

    for (ServiceComponentHostResponse response : responses) {
      Resource resource = new ResourceImpl(Resource.Type.HostComponent);
      setResourceProperty(resource, CLUSTER_NAME,
              response.getClusterName(), requestedIds);
      setResourceProperty(resource, SERVICE_NAME,
              response.getServiceName(), requestedIds);
      setResourceProperty(resource, COMPONENT_NAME,
              response.getComponentName(), requestedIds);
      setResourceProperty(resource, DISPLAY_NAME,
              response.getDisplayName(), requestedIds);
      setResourceProperty(resource, HOST_NAME,
              response.getHostname(), requestedIds);
      setResourceProperty(resource, PUBLIC_HOST_NAME,
          response.getPublicHostname(), requestedIds);
      setResourceProperty(resource, STATE,
              response.getLiveState(), requestedIds);
      setResourceProperty(resource, DESIRED_STATE,
              response.getDesiredState(), requestedIds);
      setResourceProperty(resource, VERSION, response.getVersion(),
          requestedIds);
      setResourceProperty(resource, DESIRED_STACK_ID,
              response.getDesiredStackVersion(), requestedIds);
      setResourceProperty(resource, ACTUAL_CONFIGS,
              response.getActualConfigs(), requestedIds);
      setResourceProperty(resource, STALE_CONFIGS,
              response.isStaleConfig(), requestedIds);
      setResourceProperty(resource, RELOAD_CONFIGS,
              response.isReloadConfig(), requestedIds);
      setResourceProperty(resource, UPGRADE_STATE,
              response.getUpgradeState(), requestedIds);
      setResourceProperty(resource, DESIRED_REPOSITORY_VERSION,
          response.getDesiredRepositoryVersion(), requestedIds);

      if (response.getAdminState() != null) {
        setResourceProperty(resource, DESIRED_ADMIN_STATE,
                response.getAdminState(), requestedIds);
      }

      if (null != response.getMaintenanceState()) {
        setResourceProperty(resource, MAINTENANCE_STATE,
                response.getMaintenanceState(), requestedIds);
      }

      resources.add(resource);
    }
    return resources;
  }
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