diff --git a/.project b/.project index f0af028..60f0be5 100644 --- a/.project +++ b/.project @@ -30,6 +30,11 @@ + + org.springframework.ide.eclipse.boot.validation.springbootbuilder + + + org.eclipse.jem.workbench.JavaEMFNature diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index d11cd83..c920e3e 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,16 @@ - + + + + + + + + + + + + @@ -46,7 +57,18 @@ - + + + + + + + + + + + + @@ -93,7 +115,18 @@ - + + + + + + + + + + + + @@ -140,7 +173,18 @@ - + + + + + + + + + + + + @@ -187,7 +231,18 @@ - + + + + + + + + + + + + @@ -234,7 +289,24 @@ - + + uses + + + uses + + + + + + + + + + + + + @@ -281,7 +353,18 @@ - + + + + + + + + + + + + @@ -328,7 +411,18 @@ - + + + + + + + + + + + + @@ -375,7 +469,18 @@ - + + + + + + + + + + + + diff --git a/.settings/org.springframework.ide.eclipse.prefs b/.settings/org.springframework.ide.eclipse.prefs new file mode 100644 index 0000000..a12794d --- /dev/null +++ b/.settings/org.springframework.ide.eclipse.prefs @@ -0,0 +1,2 @@ +boot.validation.initialized=true +eclipse.preferences.version=1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8156cb8..fa5a057 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ 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). +## [v2.10.1-SNAPSHOT] + +- Bug fixing StorageID resolver [#28276] +- Added HealthCheckResponse via `microprofile-health-api` (see https://microprofile.io/specifications/microprofile-health/) + ## [v2.10.0] - GeoPortal-Resolver enhancement: implemented share link towards Geoportal Data-Entry facility [#27135] diff --git a/pom.xml b/pom.xml index 84a204b..099c50c 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.gcube.data.transfer uri-resolver - 2.10.0 + 2.10.1-SNAPSHOT war The URI Resolver is an HTTP URI resolver implemented as a REST service which gives access trough HTTP to different gcube Resolvers and gCube Applications. @@ -54,7 +54,8 @@ 2.25.1 - + 2.8.4 1.8 1.8 @@ -81,6 +82,13 @@ common-smartgears + + org.eclipse.microprofile.health + microprofile-health-api + 4.0 + + + org.gcube.core common-smartgears-app diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/StorageIDResolver.java b/src/main/java/org/gcube/datatransfer/resolver/services/StorageIDResolver.java index 2b57600..99d789c 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/StorageIDResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/StorageIDResolver.java @@ -169,6 +169,9 @@ public class StorageIDResolver { //Reading the content size size = metaFile.getSize(); LOG.debug("Read size {} from {}", size, StorageMetadataFile.class.getSimpleName()); + }else { + //Bug fixing #28276 + throw ExceptionManager.notFoundException(httpRequest, "Error on accessing the "+STORAGE_ID+ " '"+storageId+"'. Is it a valid id?", StorageIDResolver.class, help); } //CHECKING TO DEFAULT METADATA diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/UriResolverHealthCheck.java b/src/main/java/org/gcube/datatransfer/resolver/services/UriResolverHealthCheck.java new file mode 100644 index 0000000..0631693 --- /dev/null +++ b/src/main/java/org/gcube/datatransfer/resolver/services/UriResolverHealthCheck.java @@ -0,0 +1,47 @@ +package org.gcube.datatransfer.resolver.services; + +import java.util.Map; +import java.util.Optional; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.eclipse.microprofile.health.HealthCheck; +import org.eclipse.microprofile.health.HealthCheckResponse; +import org.eclipse.microprofile.health.HealthCheckResponse.Status; +import org.eclipse.microprofile.health.Liveness; + +/** + * The Class UriResolverHealthCheck. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it + * + * Oct 15, 2024 + */ +@Path("health") +public class UriResolverHealthCheck implements HealthCheck { + + @GET + @Path("") + @Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) + public Response check() { + + HealthCheckResponse hcr = call(); + return Response.ok().entity(hcr).build(); + } + + /** + * Call. + * + * @return the health check response + */ + @Liveness + @Override + public HealthCheckResponse call() { + + return new HealthCheckResponse("uri-resolver", Status.UP, Optional.empty()); + } +} \ No newline at end of file diff --git a/src/test/java/gis/RuntimeResourceReader.java b/src/test/java/gis/RuntimeResourceReader.java index acdc935..24eabd6 100644 --- a/src/test/java/gis/RuntimeResourceReader.java +++ b/src/test/java/gis/RuntimeResourceReader.java @@ -63,8 +63,10 @@ public class RuntimeResourceReader { ScopeProvider.instance.set(scope); SimpleQuery query = queryFor(ServiceEndpoint.class); - query.addCondition("$resource/Profile/Platform/Name/text() eq '" + platformName + "'"); - query.addCondition("$resource/Profile/Category/text() eq '" + category + "'"); + if (platformName != null) + query.addCondition("$resource/Profile/Platform/Name/text() eq '" + platformName + "'"); + if (category != null) + query.addCondition("$resource/Profile/Category/text() eq '" + category + "'"); if (endPoint != null && !endPoint.isEmpty()) query.addCondition("$resource/Profile/AccessPoint/Interface/Endpoint/text() eq '" + endPoint + "'"); @@ -127,27 +129,28 @@ public class RuntimeResourceReader { // String scope = "/pred4s/preprod/preVRE"; // String scope = "/d4science.research-infrastructures.eu/D4OS/GNA"; - String scope = "/gcube/devsec/devVRE"; - //String scope = "/d4science.research-infrastructures.eu/gCubeApps/Esquiline"; + // String scope = "/gcube/devsec/devVRE"; + String scope = "/d4science.research-infrastructures.eu/gCubeApps/ProtectedAreaImpactMaps"; + // String scope = "/d4science.research-infrastructures.eu/gCubeApps/Esquiline"; // String scope = "/d4science.research-infrastructures.eu/D4OS/ARIADNEplus_Project"; // String platformName = "geonetwork"; // String category = "Gis"; -// String platformName = "GeoServer"; -// String category = "Gis"; + String platformName = "GeoServer"; + String category = null; // String platformName = "postgis"; // String category = "Database"; - String platformName = "postgres"; - String category = "Database"; - +// String platformName = "postgres"; +// String category = "Database"; + // String platformName = "mongodb"; // String category = "Database"; // scope = "/pred4s/preprod/preVRE"; - + // scope = "/d4science.research-infrastructures.eu/D4OS/Blue-Cloud2026Project"; // platformName = "Zenodo"; // category = "Repository";