From dee7f091733d204ef08bc1fe982c7d27ca4cf933 Mon Sep 17 00:00:00 2001 From: lucio Date: Wed, 24 Jan 2024 16:29:03 +0100 Subject: [PATCH] added info to message --- .classpath | 13 +------------ .settings/org.eclipse.jdt.core.prefs | 6 +++--- pom.xml | 8 ++++---- .../api/response/HealthCheckResponse.java | 5 +++++ .../response/HealthCheckResponseBuilder.java | 19 ++++++++++++++++--- 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.classpath b/.classpath index 002ad57..4559ca0 100644 --- a/.classpath +++ b/.classpath @@ -6,11 +6,6 @@ - - - - - @@ -18,13 +13,7 @@ - - - - - - - + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 2f5cc74..2af1e7b 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=11 diff --git a/pom.xml b/pom.xml index 9949304..26e25ef 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ maven-parent org.gcube.tools - 1.1.0 + 1.2.0 @@ -16,8 +16,8 @@ gCube Health API - 1.8 - 1.8 + 11 + 11 @@ -25,7 +25,7 @@ org.gcube.distribution gcube-bom - 3.0.0-SNAPSHOT + 3.0.0 pom import diff --git a/src/main/java/org/gcube/common/health/api/response/HealthCheckResponse.java b/src/main/java/org/gcube/common/health/api/response/HealthCheckResponse.java index 86a1b4d..bd8c641 100644 --- a/src/main/java/org/gcube/common/health/api/response/HealthCheckResponse.java +++ b/src/main/java/org/gcube/common/health/api/response/HealthCheckResponse.java @@ -26,6 +26,8 @@ public class HealthCheckResponse { //protected ErrorType errorType; protected String errorMessage; + + protected String info; public Status getStatus() { return status; @@ -39,5 +41,8 @@ public class HealthCheckResponse { return errorMessage; } + public String getInfo() { + return info; + } } diff --git a/src/main/java/org/gcube/common/health/api/response/HealthCheckResponseBuilder.java b/src/main/java/org/gcube/common/health/api/response/HealthCheckResponseBuilder.java index 19fc96c..62b824c 100644 --- a/src/main/java/org/gcube/common/health/api/response/HealthCheckResponseBuilder.java +++ b/src/main/java/org/gcube/common/health/api/response/HealthCheckResponseBuilder.java @@ -16,11 +16,12 @@ public class HealthCheckResponseBuilder { healthCheckResponse.name = name; } - public BuildPart up() { + public SuccessPart up() { healthCheckResponse.status = Status.UP; - return new BuildPart(); + return new SuccessPart(); } + public ErrorPart down() { healthCheckResponse.status = Status.DOWN; return new ErrorPart(); @@ -44,13 +45,25 @@ public class HealthCheckResponseBuilder { private ErrorPart() {} - public BuildPart withMessage(String message) { + public BuildPart error(String message) { healthCheckResponse.errorMessage = message; return new BuildPart(); } } + public class SuccessPart extends BuildPart{ + + private SuccessPart() {} + + public BuildPart info(String info) { + healthCheckResponse.info = info; + return new BuildPart(); + } + + } + + public class BuildPart{ private BuildPart() {};