mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
support multiple configuration
This commit is contained in:
parent
730d7fefe9
commit
2e6efdd16f
59 changed files with 1136 additions and 608 deletions
|
|
@ -36,6 +36,8 @@ import de.kosit.validationtool.impl.ConversionService;
|
|||
import de.kosit.validationtool.impl.DefaultCheck;
|
||||
import de.kosit.validationtool.model.daemon.HealthType;
|
||||
|
||||
import net.sf.saxon.s9api.Processor;
|
||||
|
||||
/**
|
||||
* HTTP-Daemon für die Bereitstellung der Prüf-Funktionalität via http.
|
||||
*
|
||||
|
|
@ -76,17 +78,18 @@ public class Daemon {
|
|||
*
|
||||
* @param config the configuration to use
|
||||
*/
|
||||
public void startServer(final Configuration config) {
|
||||
public void startServer(final Processor processor, final Configuration... config) {
|
||||
HttpServer server = null;
|
||||
try {
|
||||
final ConversionService healthConverter = new ConversionService();
|
||||
healthConverter.initialize(HealthType.class.getPackage());
|
||||
final ConversionService converter = new ConversionService();
|
||||
final DefaultCheck check = new DefaultCheck(processor, config);
|
||||
|
||||
server = HttpServer.create(getSocket(), 0);
|
||||
server.createContext("/", createRootHandler(config));
|
||||
server.createContext("/server/health", new HealthHandler(config, healthConverter));
|
||||
server.createContext("/server/config", new ConfigHandler(config, converter));
|
||||
server.createContext("/", createRootHandler(check, processor));
|
||||
server.createContext("/server/health", new HealthHandler(check.getConfiguration(), healthConverter));
|
||||
server.createContext("/server/config", new ConfigHandler(check.getConfiguration(), converter));
|
||||
server.setExecutor(createExecutor());
|
||||
server.start();
|
||||
log.info("Server {} started", server.getAddress());
|
||||
|
|
@ -96,10 +99,9 @@ public class Daemon {
|
|||
}
|
||||
}
|
||||
|
||||
private HttpHandler createRootHandler(final Configuration config) {
|
||||
private HttpHandler createRootHandler(final DefaultCheck check, final Processor processor) {
|
||||
final HttpHandler rootHandler;
|
||||
final DefaultCheck check = new DefaultCheck(config);
|
||||
final CheckHandler checkHandler = new CheckHandler(check, config.getContentRepository().getProcessor());
|
||||
final CheckHandler checkHandler = new CheckHandler(check, processor);
|
||||
if (this.guiEnabled) {
|
||||
final GuiHandler gui = new GuiHandler();
|
||||
rootHandler = new RoutingHandler(checkHandler, gui);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue