com.frightanic.smn.health.SmnHealthCheck Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of open-data-smn Show documentation
Show all versions of open-data-smn Show documentation
An API to serve publicly available data from the SwissMetNet.
package com.frightanic.smn.health;
import com.frightanic.smn.core.GeoAdmin;
import com.codahale.metrics.health.HealthCheck;
import java.io.IOException;
public class SmnHealthCheck extends HealthCheck {
private final GeoAdmin geoAdmin;
public SmnHealthCheck(GeoAdmin geoAdmin) {
this.geoAdmin = geoAdmin;
}
@Override
protected Result check() throws IOException {
if (geoAdmin.getSmnData().getAllRecords().size() > 0) {
return Result.healthy();
} else {
return Result.unhealthy("No SMN data available.");
}
}
}