@Override
public Set<Resource> getResources(Request request, Predicate predicate)
throws SystemException, UnsupportedPropertyException,
NoSuchResourceException, NoSuchParentResourceException {
final StackServiceRequest stackServiceRequest = getRequest(PredicateHelper
.getProperties(predicate));
Set<String> requestedIds = getRequestPropertyIds(request, predicate);
Set<StackServiceResponse> responses = getResources(new Command<Set<StackServiceResponse>>() {
@Override
public Set<StackServiceResponse> invoke() throws AmbariException {
return getManagementController().getStackServices(
Collections.singleton(stackServiceRequest));
}
});
Set<Resource> resources = new HashSet<Resource>();
for (StackServiceResponse response : responses) {
Resource resource = new ResourceImpl(Resource.Type.StackService);
setResourceProperty(resource, STACK_NAME_PROPERTY_ID,
stackServiceRequest.getStackName(), requestedIds);
setResourceProperty(resource, STACK_VERSION_PROPERTY_ID,
stackServiceRequest.getStackVersion(), requestedIds);
setResourceProperty(resource, SERVICE_NAME_PROPERTY_ID,
response.getServiceName(), requestedIds);
setResourceProperty(resource, USER_NAME_PROPERTY_ID,