diff --git a/legacy-caching-rest-client/pom.xml b/legacy-caching-rest-client/pom.xml index b46a28a5..2341544c 100644 --- a/legacy-caching-rest-client/pom.xml +++ b/legacy-caching-rest-client/pom.xml @@ -91,11 +91,6 @@ - - fi.vm.sade.java-utils - opintopolku-healthcheck-api - 0.3.0-SNAPSHOT - fi.vm.sade.java-utils java-legacy-cas diff --git a/legacy-caching-rest-client/src/main/java/fi/vm/sade/javautils/legacy_caching_rest_client/CachingRestClient.java b/legacy-caching-rest-client/src/main/java/fi/vm/sade/javautils/legacy_caching_rest_client/CachingRestClient.java index 421f01e7..348b224b 100644 --- a/legacy-caching-rest-client/src/main/java/fi/vm/sade/javautils/legacy_caching_rest_client/CachingRestClient.java +++ b/legacy-caching-rest-client/src/main/java/fi/vm/sade/javautils/legacy_caching_rest_client/CachingRestClient.java @@ -15,7 +15,6 @@ import fi.vm.sade.javautils.cas.CasClient; import fi.vm.sade.javautils.legacy_cxf_cas.PERA; -import fi.vm.sade.javautils.healthcheck.HealthChecker; import fi.vm.sade.javautils.legacy_cxf_cas.ui.portlet.security.ProxyAuthenticator; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.io.IOUtils; diff --git a/legacy-caching-rest-client/src/main/java/fi/vm/sade/javautils/legacy_caching_rest_client/HealthChecker.java b/legacy-caching-rest-client/src/main/java/fi/vm/sade/javautils/legacy_caching_rest_client/HealthChecker.java new file mode 100644 index 00000000..c4a04fac --- /dev/null +++ b/legacy-caching-rest-client/src/main/java/fi/vm/sade/javautils/legacy_caching_rest_client/HealthChecker.java @@ -0,0 +1,37 @@ +package fi.vm.sade.javautils.legacy_caching_rest_client; + +/** + * Healthcheckiin kuuluva tarkastaja, jonka roolina on tarkastaa yksi kohde healthcheckin yhteydessä. + * SpringAwareHealthCheckServlet kutsuu spring application contextista löytyviä tämän HealthChecker -interfacen toteuttavia beaneja. + * checkHealth -metodin palauttama objekti serialisoidaan JSON:ksi, ja liitetään healthcheckin checks -osioon kentäksi [beanName]. + * Mikäli tarkastuksessa on virhe, checkHealth -metodin tulee heittää sitä poikkeus (jonka message kuvaa virhetilannetta). + * Tällöin poikkeuksen message liitetään healthcheck tulokseen, ja koko healthcheckin tila on ERREOR. + * + * Esim: + * + * @Component("solrIndexed") + * public class SolrIndexedCheck implements HealthChecker { + * Object checkHealth() throws Throwable { + * // tarkastetaan tässä onko solr indeksoitu + * return new LinkedHashMap(){{ put("status", "OK"); put("previouslyIndexed", timestamp); }} + * } + * } + * + * ...johtaa tällaiseen healthcheck tulokseen... + * + * { + * "status": "OK", + * "checks": { + * "solrIndexed": {"status": "OK", "timestamp": [timestamp]} + * } + * } + * + * @see SpringAwareHealthCheckServlet (in other module) + */ +public interface HealthChecker { + /** + * @return something json-serializable that describes the state of this checker + * @throws Throwable if there is health check error + */ + Object checkHealth() throws Throwable; +} diff --git a/legacy-cxf-cas/pom.xml b/legacy-cxf-cas/pom.xml index fdf4f95b..86b59a73 100644 --- a/legacy-cxf-cas/pom.xml +++ b/legacy-cxf-cas/pom.xml @@ -15,11 +15,6 @@ - - fi.vm.sade.java-utils - opintopolku-healthcheck-api - 0.3.0-SNAPSHOT - fi.vm.sade.java-utils java-legacy-cas @@ -76,10 +71,6 @@ - - fi.vm.sade.java-utils - opintopolku-healthcheck-api - fi.vm.sade.java-utils java-legacy-cas diff --git a/opintopolku-healthcheck-api/pom.xml b/opintopolku-healthcheck-api/pom.xml deleted file mode 100644 index c86e13ef..00000000 --- a/opintopolku-healthcheck-api/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - 4.0.0 - - fi.vm.sade.java-utils - java-utils - 0.3.0-SNAPSHOT - .. - - - opintopolku-healthcheck-api - 0.3.0-SNAPSHOT - jar - diff --git a/pom.xml b/pom.xml index a30fdbbd..fcdd0249 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,6 @@ 0.3.0-SNAPSHOT pom - opintopolku-healthcheck-api java-properties oid-generator tcp-utils diff --git a/spring-aware-health-check-servlet/pom.xml b/spring-aware-health-check-servlet/pom.xml index d79c4bfe..e5956ed4 100644 --- a/spring-aware-health-check-servlet/pom.xml +++ b/spring-aware-health-check-servlet/pom.xml @@ -8,7 +8,7 @@ .. spring-aware-health-check-servlet - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT jar @@ -73,11 +73,6 @@ legacy-caching-rest-client 0.6.0-SNAPSHOT - - fi.vm.sade.java-utils - opintopolku-healthcheck-api - 0.3.0-SNAPSHOT - fi.vm.sade.java-utils java-cache @@ -137,10 +132,6 @@ fi.vm.sade.java-utils legacy-caching-rest-client - - fi.vm.sade.java-utils - opintopolku-healthcheck-api - fi.vm.sade.java-utils java-cache diff --git a/opintopolku-healthcheck-api/src/main/java/fi/vm/sade/javautils/healthcheck/HealthChecker.java b/spring-aware-health-check-servlet/src/main/java/fi/vm/sade/javautils/healthcheck/HealthChecker.java similarity index 100% rename from opintopolku-healthcheck-api/src/main/java/fi/vm/sade/javautils/healthcheck/HealthChecker.java rename to spring-aware-health-check-servlet/src/main/java/fi/vm/sade/javautils/healthcheck/HealthChecker.java diff --git a/spring-aware-health-check-servlet/src/main/java/fi/vm/sade/javautils/healthcheck/SpringAwareHealthCheckServlet.java b/spring-aware-health-check-servlet/src/main/java/fi/vm/sade/javautils/healthcheck/SpringAwareHealthCheckServlet.java index 08ca169e..a5c17be7 100644 --- a/spring-aware-health-check-servlet/src/main/java/fi/vm/sade/javautils/healthcheck/SpringAwareHealthCheckServlet.java +++ b/spring-aware-health-check-servlet/src/main/java/fi/vm/sade/javautils/healthcheck/SpringAwareHealthCheckServlet.java @@ -2,7 +2,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import fi.vm.sade.javautils.healthcheck.HealthChecker; import fi.vm.sade.security.SimpleCache; import org.slf4j.Logger; import org.slf4j.LoggerFactory;