diff --git a/geoportal-service/pom.xml b/geoportal-service/pom.xml index e521417..94a9dd0 100644 --- a/geoportal-service/pom.xml +++ b/geoportal-service/pom.xml @@ -158,7 +158,7 @@ org.eclipse.microprofile.health microprofile-health-api - 4.0 + 2.2 diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/GeoportalHealthCheck.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/GeoportalHealthCheck.java index 5343a76..9530ebc 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/GeoportalHealthCheck.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/GeoportalHealthCheck.java @@ -11,7 +11,7 @@ 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.HealthCheckResponse.State; import org.eclipse.microprofile.health.Liveness; import org.gcube.application.cms.implementations.ImplementationProvider; import org.gcube.application.geoportal.common.model.configuration.MongoConnection; @@ -40,7 +40,7 @@ public class GeoportalHealthCheck implements HealthCheck { @Override public HealthCheckResponse call() { - return new HealthCheckResponse("geooportal-service", Status.UP, Optional.empty()); + return new HealthCheckResponse("geooportal-service", State.UP, Optional.empty()); } @GET @@ -62,7 +62,7 @@ public class GeoportalHealthCheck implements HealthCheck { ScopeProvider.instance.set(context); mongo = ImplementationProvider.get().getProvidedObjectByClass(Mongo.class); buildHCRProvider = appendMongoInfo(buildHCRProvider, mongo.getConnection()); - buildHCRProvider.setStatus(Status.UP); + buildHCRProvider.setState(State.UP); MongoIterable collections = mongo.getTheClient().getDatabase(mongo.getConnection().getDatabase()) .listCollectionNames(); log.info("listCollectionNames is null: {}", collections == null); @@ -74,7 +74,7 @@ public class GeoportalHealthCheck implements HealthCheck { } return buildHCRProvider.buildHealthCheckResponse(); } catch (Exception e) { - buildHCRProvider.setStatus(Status.DOWN); + buildHCRProvider.setState(State.DOWN); if (mongo != null) { MongoConnection connection = null; try { diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/check/HealthCheckResponseGeoportalProvider.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/check/HealthCheckResponseGeoportalProvider.java index 7ec1ac5..a744dad 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/check/HealthCheckResponseGeoportalProvider.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/rest/check/HealthCheckResponseGeoportalProvider.java @@ -5,7 +5,7 @@ import java.util.Map; import java.util.Optional; import org.eclipse.microprofile.health.HealthCheckResponse; -import org.eclipse.microprofile.health.HealthCheckResponse.Status; +import org.eclipse.microprofile.health.HealthCheckResponse.State; import lombok.extern.slf4j.Slf4j; @@ -20,9 +20,9 @@ import lombok.extern.slf4j.Slf4j; public class HealthCheckResponseGeoportalProvider { private String name; - private Status status; private Optional> data; private Map myMap; + private State state; /** * Instantiates a new health check response geoportal provider. @@ -38,55 +38,30 @@ public class HealthCheckResponseGeoportalProvider { * @param status the status * @param data the data */ - public HealthCheckResponseGeoportalProvider(String name, Status status, Optional> data) { + public HealthCheckResponseGeoportalProvider(String name, State state, Optional> data) { this.name = name; - this.status = status; + this.state = state; this.data = data; } - /** - * Gets the name. - * - * @return the name - */ public String getName() { return name; } - /** - * Gets the status. - * - * @return the status - */ - public Status getStatus() { - return status; - } - - /** - * Gets the data. - * - * @return the data - */ public Optional> getData() { return data; } - /** - * Sets the name. - * - * @param name the new name - */ + public State getState() { + return state; + } + public void setName(String name) { this.name = name; } - /** - * Sets the status. - * - * @param status the new status - */ - public void setStatus(Status status) { - this.status = status; + public void setState(State state) { + this.state = state; } /** @@ -111,10 +86,10 @@ public class HealthCheckResponseGeoportalProvider { public HealthCheckResponse buildHealthCheckResponse() { if (myMap != null) data = Optional.of(myMap); - - log.info("data are: "+data); - - return new HealthCheckResponse(name, status, data); + + log.info("data are: " + data); + + return new HealthCheckResponse(name, state, data); } }