From 857b6c396cebac76000bd2bee5498e4de2d47d28 Mon Sep 17 00:00:00 2001 From: Philipp Liegl Date: Thu, 28 Feb 2019 17:13:01 +0100 Subject: [PATCH 1/4] MINOR fixed broken link in readme file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 04c9faf..7d00831 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Eine zu prüfende Datei durchläuft die folgenden Schritte # Verwendung Das Prüftool steht in zwei Varianten zur Verfügung: -- als [Standalone-Version](#verwendung-als-anwendung), die von der Kommandozeile aus aufgerufen werden kann +- als [Standalone-Version](#verwendung-als-standalone-anwendung), die von der Kommandozeile aus aufgerufen werden kann - als [Bibliothek](#verwendung-als-bibliothek), die in eigene Anwendungen integriert werden kann ## Voraussetzungen From 516c1685719b3af9d9938e0ad94f2669f327bc58 Mon Sep 17 00:00:00 2001 From: Andreas Penski Date: Mon, 25 Mar 2019 11:21:01 +0100 Subject: [PATCH 2/4] Update README.md --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f4a508f..0d5ed43 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,26 @@ erzeugen lässt. Die InputFactory erzeugt für jedes Eingabe-Objekt eine Prüfsu verwendete Algorithmus ist über die `read`-Methoden der `InputFactory` definierbar. Standardmäßig wird _SHA-256_ des JDK verwendet +## Verwendung des Daemon-Mode +Das Prüftool stellt auch eine HTTP-Schnittstelle bereit, über die die Funktionalität angesprochen werden kann. Dazu wird die Anwendung +im _Daemon-Mode_ gestartet: + + +```shell +java -jar validationtool--standalone.jar -s -D +``` + +In der Default-Konfiguration stellt dieser Aufruf einen HTTP-Server unter _localhost_ und Port 8080 bereit. + +Host und Port lassen sich anpassen: + +```shell +java -jar validationtool--standalone.jar -s -D -H 192.168.1.x -P 8081 +``` + +Im Daemon-Mode nimmt der HTTP-Server POST-Anfragen unter `/` entgegen, verarbeitet den darüber bereitgestellten Prüfling und gibt das Ergebnis-Dokument als Antwort zurück. +Zur Integration in Monitoring-Systeme wird eine Health-Check angeboten. Dieser ist über einen GET-Request unter `/health` erreichbar. + # Build-Anweisungen Das Projekt wird mit Apache Maven gebaut. @@ -226,7 +246,7 @@ Die Erstellung dieser Empfehlung kann *je Prüfszenario* konfiguriert werden, in ``` In diesem Beispiel werden die Fehlercodes `BR-15` (Teil der EN) und `BR-DE-3` (Teil der CIUS XRechnung) für den -Bewertungsschritt von ihrem eigentlicher Rolle *error* auf *warning* geändert. Ein Dokument, welches eine oder +Bewertungsschritt von ihrer eigentlicher Rolle *error* auf *warning* geändert. Ein Dokument, welches eine oder beide dieser Regeln verletzt (und ansonsten keine *error*-Meldungen erzeugt) erhielte damit abweichend vom Standardverhalten die Bewertung *accept*. From a461c3f2b78b383cb9b9bcf6a4ffb0ef5294aab4 Mon Sep 17 00:00:00 2001 From: "Andreas Penski (init)" Date: Fri, 10 May 2019 10:19:38 +0200 Subject: [PATCH 3/4] (fix) add schematron validation (was accidentally removed) --- .../validationtool/impl/DefaultCheck.java | 59 ++++++++++--------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/src/main/java/de/kosit/validationtool/impl/DefaultCheck.java b/src/main/java/de/kosit/validationtool/impl/DefaultCheck.java index 9408dc3..4c0aeb6 100644 --- a/src/main/java/de/kosit/validationtool/impl/DefaultCheck.java +++ b/src/main/java/de/kosit/validationtool/impl/DefaultCheck.java @@ -33,6 +33,7 @@ import de.kosit.validationtool.impl.tasks.CreateReportAction; import de.kosit.validationtool.impl.tasks.DocumentParseAction; import de.kosit.validationtool.impl.tasks.ScenarioSelectionAction; import de.kosit.validationtool.impl.tasks.SchemaValidationAction; +import de.kosit.validationtool.impl.tasks.SchematronValidationAction; import de.kosit.validationtool.impl.tasks.ValidateReportInputAction; import de.kosit.validationtool.model.reportInput.CreateReportInput; import de.kosit.validationtool.model.reportInput.DocumentIdentificationType; @@ -56,40 +57,42 @@ public class DefaultCheck implements Check { private static final String ENGINE_VERSION = "1.0.0"; @Getter - private ScenarioRepository repository; + private final ScenarioRepository repository; @Getter - private ContentRepository contentRepository; + private final ContentRepository contentRepository; - private ConversionService conversionService; + private final ConversionService conversionService; @Getter - private List checkSteps; + private final List checkSteps; /** * Erzeugt eine neue Instanz mit der angegebenen Konfiguration. * * @param configuration die Konfiguration */ - public DefaultCheck(CheckConfiguration configuration) { - Processor processor = ObjectFactory.createProcessor(); - conversionService = new ConversionService(); - contentRepository = new ContentRepository(processor, configuration.getScenarioRepository()); - repository = new ScenarioRepository(processor, contentRepository); - repository.initialize(configuration); - checkSteps = new ArrayList<>(); - checkSteps.add(this::createDocumentIdentification); - checkSteps.add(new DocumentParseAction()); - checkSteps.add(new ScenarioSelectionAction(repository)); - checkSteps.add(new SchemaValidationAction()); - checkSteps.add(new ValidateReportInputAction(conversionService, contentRepository.getReportInputSchema())); - checkSteps.add(new CreateReportAction(processor, conversionService, repository, configuration.getScenarioRepository())); + public DefaultCheck(final CheckConfiguration configuration) { + final Processor processor = ObjectFactory.createProcessor(); + this.conversionService = new ConversionService(); + this.contentRepository = new ContentRepository(processor, configuration.getScenarioRepository()); + this.repository = new ScenarioRepository(processor, this.contentRepository); + this.repository.initialize(configuration); + this.checkSteps = new ArrayList<>(); + this.checkSteps.add(DefaultCheck::createDocumentIdentification); + this.checkSteps.add(new DocumentParseAction()); + this.checkSteps.add(new ScenarioSelectionAction(this.repository)); + this.checkSteps.add(new SchemaValidationAction()); + this.checkSteps.add(new SchematronValidationAction(configuration.getScenarioRepository())); + this.checkSteps.add(new ValidateReportInputAction(this.conversionService, this.contentRepository.getReportInputSchema())); + this.checkSteps + .add(new CreateReportAction(processor, this.conversionService, this.repository, configuration.getScenarioRepository())); } protected static CreateReportInput createReport() { - CreateReportInput type = new CreateReportInput(); - EngineType e = new EngineType(); + final CreateReportInput type = new CreateReportInput(); + final EngineType e = new EngineType(); e.setName(ENGINE_NAME); type.setEngine(e); type.setTimestamp(ObjectFactory.createTimestamp()); @@ -98,16 +101,16 @@ public class DefaultCheck implements Check { } @Override - public XdmNode checkInput(Input input) { - CheckAction.Bag t = new CheckAction.Bag(input, createReport()); + public XdmNode checkInput(final Input input) { + final CheckAction.Bag t = new CheckAction.Bag(input, createReport()); return runCheckInternal(t); } - protected XdmNode runCheckInternal(CheckAction.Bag t) { - long started = System.currentTimeMillis(); + protected XdmNode runCheckInternal(final CheckAction.Bag t) { + final long started = System.currentTimeMillis(); log.info("Checking content of {}", t.getInput().getName()); - for (final CheckAction action : checkSteps) { - long start = System.currentTimeMillis(); + for (final CheckAction action : this.checkSteps) { + final long start = System.currentTimeMillis(); if (!action.isSkipped(t)) { action.check(t); } @@ -124,9 +127,9 @@ public class DefaultCheck implements Check { return t.getReport(); } - private boolean createDocumentIdentification(CheckAction.Bag transporter) { - DocumentIdentificationType i = new DocumentIdentificationType(); - DocumentIdentificationType.DocumentHash h = new DocumentIdentificationType.DocumentHash(); + private static boolean createDocumentIdentification(final CheckAction.Bag transporter) { + final DocumentIdentificationType i = new DocumentIdentificationType(); + final DocumentIdentificationType.DocumentHash h = new DocumentIdentificationType.DocumentHash(); h.setHashAlgorithm(transporter.getInput().getDigestAlgorithm()); h.setHashValue(transporter.getInput().getHashCode()); i.setDocumentHash(h); From 4b8c456d24f6ac9f688fa6a798c8c2a21b7dd800 Mon Sep 17 00:00:00 2001 From: "Andreas Penski (init)" Date: Mon, 25 Mar 2019 11:33:42 +0100 Subject: [PATCH 4/4] (chore) jaxb als optional deklariert --- NOTICE | 2 +- pom.xml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NOTICE b/NOTICE index a6b2a58..da41683 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ KoSIT Prüf-Tool -Copyright 2017 Koordinierungsstelle für IT-Standards +Copyright 2019 Koordinierungsstelle für IT-Standards This product includes software developed by Koordinierungsstelle für IT-Standards (http://www.kosit.de/). \ No newline at end of file diff --git a/pom.xml b/pom.xml index a4d0d04..7e9cd9c 100644 --- a/pom.xml +++ b/pom.xml @@ -95,6 +95,7 @@ org.glassfish.jaxb jaxb-runtime 2.3.2 + true org.assertj @@ -229,7 +230,7 @@ src/assembly/assembly-full.xml true - true + false target/ target/assembly/full