fix_28276 #9

Merged
francesco.mangiacrapa merged 11 commits from fix_28276 into master 2024-10-16 11:11:33 +02:00
8 changed files with 199 additions and 21 deletions

View File

@ -30,6 +30,11 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>

View File

@ -24,6 +24,17 @@
@ -71,6 +82,17 @@
@ -118,6 +140,17 @@
@ -165,6 +198,17 @@
@ -212,6 +256,17 @@
@ -234,6 +289,23 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-client-1.2.2.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-client/geoportal-client">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="geoportal-common-1.1.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-common/geoportal-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -306,6 +378,17 @@
@ -353,6 +436,17 @@
@ -400,6 +494,17 @@

View File

@ -0,0 +1,2 @@
boot.validation.initialized=true
eclipse.preferences.version=1

View File

@ -4,6 +4,11 @@
All notable changes to this project will be documented in this file. 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). 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] ## [v2.10.0]
- GeoPortal-Resolver enhancement: implemented share link towards Geoportal Data-Entry facility [#27135] - GeoPortal-Resolver enhancement: implemented share link towards Geoportal Data-Entry facility [#27135]

12
pom.xml
View File

@ -9,7 +9,7 @@
</parent> </parent>
<groupId>org.gcube.data.transfer</groupId> <groupId>org.gcube.data.transfer</groupId>
<artifactId>uri-resolver</artifactId> <artifactId>uri-resolver</artifactId>
<version>2.10.0</version> <version>2.10.1-SNAPSHOT</version>
<packaging>war</packaging> <packaging>war</packaging>
<description>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.</description> <description>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.</description>
@ -54,7 +54,8 @@
<properties> <properties>
<jersey.version>2.25.1</jersey.version> <jersey.version>2.25.1</jersey.version>
<!-- Using 2.8.4 because storagehub-model.1.1.1 uses indirectly this version via jsersey-media-json --> <!-- Using 2.8.4 because storagehub-model.1.1.1 uses indirectly this version
via jsersey-media-json -->
<jackson.version>2.8.4</jackson.version> <jackson.version>2.8.4</jackson.version>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
@ -81,6 +82,13 @@
<artifactId>common-smartgears</artifactId> <artifactId>common-smartgears</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.microprofile.health</groupId>
<artifactId>microprofile-health-api</artifactId>
<version>4.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.core</groupId> <groupId>org.gcube.core</groupId>
<artifactId>common-smartgears-app</artifactId> <artifactId>common-smartgears-app</artifactId>

View File

@ -169,6 +169,9 @@ public class StorageIDResolver {
//Reading the content size //Reading the content size
size = metaFile.getSize(); size = metaFile.getSize();
LOG.debug("Read size {} from {}", size, StorageMetadataFile.class.getSimpleName()); 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 //CHECKING TO DEFAULT METADATA

View File

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

View File

@ -63,8 +63,10 @@ public class RuntimeResourceReader {
ScopeProvider.instance.set(scope); ScopeProvider.instance.set(scope);
SimpleQuery query = queryFor(ServiceEndpoint.class); SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Platform/Name/text() eq '" + platformName + "'"); if (platformName != null)
query.addCondition("$resource/Profile/Category/text() eq '" + category + "'"); 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()) if (endPoint != null && !endPoint.isEmpty())
query.addCondition("$resource/Profile/AccessPoint/Interface/Endpoint/text() eq '" + endPoint + "'"); query.addCondition("$resource/Profile/AccessPoint/Interface/Endpoint/text() eq '" + endPoint + "'");
@ -127,21 +129,22 @@ public class RuntimeResourceReader {
// String scope = "/pred4s/preprod/preVRE"; // String scope = "/pred4s/preprod/preVRE";
// String scope = "/d4science.research-infrastructures.eu/D4OS/GNA"; // String scope = "/d4science.research-infrastructures.eu/D4OS/GNA";
String scope = "/gcube/devsec/devVRE"; // String scope = "/gcube/devsec/devVRE";
//String scope = "/d4science.research-infrastructures.eu/gCubeApps/Esquiline"; 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 scope = "/d4science.research-infrastructures.eu/D4OS/ARIADNEplus_Project";
// String platformName = "geonetwork"; // String platformName = "geonetwork";
// String category = "Gis"; // String category = "Gis";
// String platformName = "GeoServer"; String platformName = "GeoServer";
// String category = "Gis"; String category = null;
// String platformName = "postgis"; // String platformName = "postgis";
// String category = "Database"; // String category = "Database";
String platformName = "postgres"; // String platformName = "postgres";
String category = "Database"; // String category = "Database";
// String platformName = "mongodb"; // String platformName = "mongodb";
// String category = "Database"; // String category = "Database";