introduce docsify; refactor the daemon

This commit is contained in:
Andreas Penski 2020-05-06 16:17:45 +02:00
parent 7dc62012a6
commit 91e4d79953
12 changed files with 1038 additions and 26 deletions

View file

@ -4,6 +4,8 @@ import java.io.IOException;
import com.sun.net.httpserver.HttpExchange;
import de.kosit.validationtool.impl.EngineInformation;
import de.kosit.validationtool.model.daemon.ApplicationType;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -15,13 +17,12 @@ import de.kosit.validationtool.model.daemon.MemoryType;
/**
* Handler that implements a simple health check. Useful for monitoring the service.
*
* @author Andreas Penski`
* @author Andreas Penski
*/
@Slf4j
@RequiredArgsConstructor
class HealthHandler extends BaseHandler {
private final Configuration scenarios;
private final ConversionService conversionService;
@ -34,9 +35,11 @@ class HealthHandler extends BaseHandler {
}
private static HealthType createHealth() {
private HealthType createHealth() {
final HealthType h = new HealthType();
h.setMemory(createMemory());
h.setApplication(createApplication());
h.setStatus(scenarios.getScenarios().size() > 0 ? "UP" : "DOWN");
return h;
}
@ -48,4 +51,12 @@ class HealthHandler extends BaseHandler {
m.setTotalMemory(runtime.totalMemory());
return m;
}
private static ApplicationType createApplication() {
ApplicationType a = new ApplicationType();
a.setBuild(EngineInformation.getBuild());
a.setName(EngineInformation.getName());
a.setVersion(EngineInformation.getVersion());
return a;
}
}