class RootServiceResourceProvider extends ReadOnlyResourceProvider {

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

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

    if (predicate == null) {
      requests.add(getRequest(Collections.emptyMap()));
    } else {
      for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
        requests.add(getRequest(propertyMap));
      }
    }

    Set<String> requestedIds = getRequestPropertyIds(request, predicate);

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

    Set<Resource> resources = new HashSet<>();

    for (RootServiceResponse response : responses) {
      Resource resource = new ResourceImpl(Resource.Type.RootService);
      setResourceProperty(resource, SERVICE_NAME_PROPERTY_ID, response.getServiceName(), requestedIds);
      resources.add(resource);
    }

    return resources;
  }

  protected  RootServiceResourceProvider(AmbariManagementController managementController);

}