@Override
  @Transactional
  public Set<Resource> getResources(Request request, Predicate predicate)
      throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {

    final Set<ServiceComponentRequest> requests = new HashSet<>();

    for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
      requests.add(getRequest(propertyMap));
    }

    Set<ServiceComponentResponse> responses = getResources(new Command<Set<ServiceComponentResponse>>() {
      @Override
      public Set<ServiceComponentResponse> invoke() throws AmbariException {
        return getComponents(requests);
      }
    });

    Set<String> requestedIds = getRequestPropertyIds(request, predicate);
    Set<Resource> resources = new HashSet<>();

    for (ServiceComponentResponse response : responses) {
      Resource resource = new ResourceImpl(Resource.Type.Component);
      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, STATE, response.getDesiredState(), requestedIds);
      setResourceProperty(resource, CATEGORY, response.getCategory(), requestedIds);
      setResourceProperty(resource, TOTAL_COUNT, response.getServiceComponentStateCount().get("totalCount"), requestedIds);
      setResourceProperty(resource, STARTED_COUNT, response.getServiceComponentStateCount().get("startedCount"), requestedIds);
      setResourceProperty(resource, INSTALLED_COUNT, response.getServiceComponentStateCount().get("installedCount"), requestedIds);
      setResourceProperty(resource, INSTALLED_AND_MAINTENANCE_OFF_COUNT, response.getServiceComponentStateCount().get("installedAndMaintenanceOffCount"), requestedIds);
      setResourceProperty(resource, INSTALL_FAILED_COUNT, response.getServiceComponentStateCount().get("installFailedCount"), requestedIds);
      setResourceProperty(resource, INIT_COUNT, response.getServiceComponentStateCount().get("initCount"), requestedIds);
      setResourceProperty(resource, UNKNOWN_COUNT, response.getServiceComponentStateCount().get("unknownCount"), requestedIds);
      setResourceProperty(resource, RECOVERY_ENABLED, String.valueOf(response.isRecoveryEnabled()), requestedIds);
      setResourceProperty(resource, DESIRED_STACK, response.getDesiredStackId(), requestedIds);
      setResourceProperty(resource, DESIRED_VERSION, response.getDesiredVersion(), requestedIds);
      setResourceProperty(resource, REPOSITORY_STATE, response.getRepositoryState(), 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/ComponentResourceProvider.java