This commit is contained in:
Francesco Mangiacrapa 2024-10-16 17:13:41 +02:00
parent 984c3edf31
commit 52d456a9b3
2 changed files with 7 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import org.gcube.application.geoportal.service.engine.providers.ucd.ProfileMap;
import org.gcube.application.geoportal.service.engine.providers.ucd.SingleISResourceUCDProvider; import org.gcube.application.geoportal.service.engine.providers.ucd.SingleISResourceUCDProvider;
import org.gcube.application.geoportal.service.engine.providers.ucd.UCDManager; import org.gcube.application.geoportal.service.engine.providers.ucd.UCDManager;
import org.gcube.application.geoportal.service.model.internal.db.Mongo; import org.gcube.application.geoportal.service.model.internal.db.Mongo;
import org.gcube.application.geoportal.service.rest.GeoportalHealthCheck;
import org.gcube.application.geoportal.service.rest.Plugins; import org.gcube.application.geoportal.service.rest.Plugins;
import org.gcube.application.geoportal.service.rest.ProfiledDocuments; import org.gcube.application.geoportal.service.rest.ProfiledDocuments;
import org.gcube.application.geoportal.service.rest.UseCaseDescriptors; import org.gcube.application.geoportal.service.rest.UseCaseDescriptors;
@ -53,6 +54,7 @@ public class GeoPortalService extends ResourceConfig{
registerClasses(ProfiledDocuments.class); registerClasses(ProfiledDocuments.class);
registerClasses(UseCaseDescriptors.class); registerClasses(UseCaseDescriptors.class);
registerClasses(Plugins.class); registerClasses(Plugins.class);
registerClasses(GeoportalHealthCheck.class);
//registerClasses(DocsGenerator.class); //registerClasses(DocsGenerator.class);
log.info("Setting implementations .. "); log.info("Setting implementations .. ");

View File

@ -21,14 +21,17 @@ import org.gcube.common.scope.api.ScopeProvider;
import com.mongodb.client.MongoIterable; import com.mongodb.client.MongoIterable;
import lombok.extern.slf4j.Slf4j;
@Path("/health") @Path("/health")
@Slf4j
public class GeoportalHealthCheck implements HealthCheck { public class GeoportalHealthCheck implements HealthCheck {
@GET @GET
@Path("") @Path("")
@Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
public Response check() { public Response check() {
log.info("Check called");
HealthCheckResponse hcr = call(); HealthCheckResponse hcr = call();
return Response.ok().entity(hcr).build(); return Response.ok().entity(hcr).build();
} }
@ -44,7 +47,7 @@ public class GeoportalHealthCheck implements HealthCheck {
@Path("/mongo") @Path("/mongo")
@Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
public Response checkDatabase(@QueryParam("context") String context) { public Response checkDatabase(@QueryParam("context") String context) {
log.info("checkDatabase called in the context {}", context);
if (context == null) if (context == null)
return Response.status(400).entity("'context' paramater (e.g. '/gcube/devsec/devVRE' is required").build(); return Response.status(400).entity("'context' paramater (e.g. '/gcube/devsec/devVRE' is required").build();