|
|
|
@ -23,6 +23,19 @@ import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Path("ServiceEndpoint")
|
|
|
|
|
public class ServiceEndpointResource {
|
|
|
|
|
|
|
|
|
|
@GET
|
|
|
|
|
@Path("/{category}")
|
|
|
|
|
@Produces(MediaType.APPLICATION_XML)
|
|
|
|
|
public List<ServiceEndpoint> retrieve(@NotNull @PathParam("category") String resourceCategory) {
|
|
|
|
|
log.info("ServiceEndpoint called with category {} in context {}",resourceCategory, ScopeProvider.instance.get());
|
|
|
|
|
|
|
|
|
|
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
|
|
|
|
|
|
|
|
|
List<ServiceEndpoint> endpoints = client.submit(getQuery(resourceCategory));
|
|
|
|
|
log.debug("retrieved resources are "+endpoints.size());
|
|
|
|
|
return endpoints;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GET
|
|
|
|
|
@Path("/{category}/{name}")
|
|
|
|
@ -72,4 +85,10 @@ public class ServiceEndpointResource {
|
|
|
|
|
return query;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private SimpleQuery getQuery(String resourceCategory){
|
|
|
|
|
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
|
|
|
|
query.addCondition(String.format("$resource/Profile/Category/text() eq '%s'",resourceCategory));
|
|
|
|
|
return query;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|