@Override
public Set<Resource> getResources(Request request, Predicate predicate)
throws SystemException, UnsupportedPropertyException,
NoSuchResourceException, NoSuchParentResourceException {
final RepositoryRequest repositoryRequest = getRequest(PredicateHelper
.getProperties(predicate));
Set<String> requestedIds = getRequestPropertyIds(request, predicate);
Set<RepositoryResponse> responses = getResources(new Command<Set<RepositoryResponse>>() {
@Override
public Set<RepositoryResponse> invoke() throws AmbariException {
return getManagementController().getRepositories(
Collections.singleton(repositoryRequest));
}
});
Set<Resource> resources = new HashSet<Resource>();
for (RepositoryResponse response : responses) {
Resource resource = new ResourceImpl(Resource.Type.Repository);
setResourceProperty(resource, STACK_NAME_PROPERTY_ID,
repositoryRequest.getStackName(), requestedIds);
setResourceProperty(resource, STACK_VERSION_PROPERTY_ID,
repositoryRequest.getStackVersion(), requestedIds);
setResourceProperty(resource, REPOSITORY_NAME_PROPERTY_ID,
response.getRepoName(), requestedIds);
setResourceProperty(resource, REPOSITORY_BASE_URL_PROPERTY_ID,