Browse Source

Feature #21584 added support for /ServiceEndpoint/{category} REST call

Feature/21584
Massimiliano Assante 8 months ago
parent
commit
9043b74320
  1. 4
      CHANGELOG.md
  2. 2
      pom.xml
  3. 19
      src/main/java/org/gcube/informationsystem/icproxy/resources/ServiceEndpointResource.java

4
CHANGELOG.md

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.2.0-SNAPSHOT] - [2021-06-08]
- Feature #21584 added support for /ServiceEndpoint/{category} REST call
## [v1.1.0-SNAPSHOT] - [2016-10-03]
- porting to auth v.2

2
pom.xml

@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.information-system</groupId>
<artifactId>icproxy</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
<name>ICProxy</name>
<packaging>war</packaging>

19
src/main/java/org/gcube/informationsystem/icproxy/resources/ServiceEndpointResource.java

@ -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;
}
}

Loading…
Cancel
Save