Compare commits

..

187 commits
v1.4.2 ... main

Author SHA1 Message Date
Renzo Kottmann
86d9ddfa2b Merge branch 'release/1.6.x' into 'main'
Release/1.6.2

See merge request kosit/validator!110
2026-02-17 16:57:40 +01:00
Renzo Kottmann
955d608f56 [maven-release-plugin] prepare for next development iteration 2026-02-17 16:43:17 +01:00
Renzo Kottmann
1572ea34e9 [maven-release-plugin] prepare release v1.6.2 2026-02-17 16:42:55 +01:00
Renzo Kottmann
e7a64227a2 Merge branch 'release/1.6.x' of https://projekte.kosit.org/kosit/validator into release/1.6.x 2026-02-17 16:28:21 +01:00
Philip Helger
a52bab4c69 Updated changelog for 1.6.2 2026-02-17 16:20:30 +01:00
Philip Helger
20c2ce71c1 Added license in addition to #180 2026-02-17 16:20:30 +01:00
Philip Helger
752ceb228d Resolve "Improve provided licenses in standalone JAR (Github 173)" 2026-02-17 16:20:30 +01:00
Philip Helger
c5c40c2009 Fixing Maven Assembly Output contains wrong XML Resolver JAR 2026-02-17 16:20:30 +01:00
Philip Helger
57ae444857 Update Validator 1.6.x dependencies to the latest versions 2026-02-17 16:20:30 +01:00
Philip Helger
1f5d79c027 Merge branch '178-maven-assembly-output-contains-wrong-jar' into 'release/1.6.x'
Resolve "Maven Assembly Output contains wrong JAR"

See merge request kosit/validator!106
2026-02-10 17:01:07 +01:00
Philip Helger
1fe8159c2b Fixing Maven Assembly Output contains wrong XML Resolver JAR 2026-02-10 17:01:07 +01:00
Philip Helger
2a3a099058 Merge branch '179-update-1-6-dependencies-to-the-latest-versions' into 'release/1.6.x'
Resolve "Update 1.6 dependencies to the latest versions"

See merge request kosit/validator!107
2026-02-10 16:55:47 +01:00
Philip Helger
44c455ba86 Update Validator 1.6.x dependencies to the latest versions 2026-02-10 16:55:47 +01:00
Philip Helger
82fdcabe3d Merge branch 'release/1.6.x' into 'main'
1.6.1 Release

See merge request kosit/validator!105
2026-02-05 12:53:43 +01:00
Renzo Kottmann
03e5be34b8 [maven-release-plugin] prepare for next development iteration 2026-02-05 12:25:33 +01:00
Renzo Kottmann
3b4765e9c1 [maven-release-plugin] prepare release v1.6.1 2026-02-05 12:25:11 +01:00
Philip Helger
06f6a77648 Merged 2026-02-05 11:57:42 +01:00
Philip Helger
cd1494747a Removed "Unreleased" 2026-02-05 11:52:06 +01:00
Philip Helger
a3fd64c946 Prepared for release 2026-02-05 11:52:06 +01:00
Philip Helger
7bd423c458 Resolve "Wrong Schematron/XSLTs lead to positive validation result (GitHub 165)" 2026-02-05 11:52:06 +01:00
Philip Helger
155d3dc692 Added changelog for #106 2026-02-05 11:52:06 +01:00
Philip Helger
e2c3f5eea3 Resolve "scenario.xsd: Match Element darf nicht leer sein" 2026-02-05 11:52:06 +01:00
Philip Helger
53f16f5199 Fix/owasp oom 2026-02-05 11:52:06 +01:00
Philip Helger
f43f0d32ac Resolve "Question: does the "standalone" JAR need to be in the assembly ZIP?" 2026-02-05 11:51:32 +01:00
Philip Helger
c29dd78b48 Resolve "Maven Central pom.xml is dependency-reduced" 2026-02-05 11:51:32 +01:00
Philip Helger
9f25e20108 Owasp using Java 21 2025-11-14 10:25:33 +01:00
Renzo Kottmann
938c87112d Merge branch 'release/1.6.x' into 'main'
Updated API code snippet in readme for GitHub #117

See merge request kosit/validator!89
2025-11-07 15:24:07 +01:00
Philip Helger
f482d4d213 Updated API code snippet in readme for GitHub #117 2025-11-07 15:24:06 +01:00
Philip Helger
0e944616a5 Merge branch 'release/1.6.x' into 'main'
Update links to source code to current locations

See merge request kosit/validator!88
2025-11-07 13:00:53 +01:00
Renzo Kottmann
29766cf34b chore: Minor correction 2025-11-07 11:17:32 +01:00
Renzo Kottmann
091c2c643c Add Unreleased section to Changelog 2025-11-07 11:17:06 +01:00
Renzo Kottmann
535d88c829 [maven-release-plugin] prepare for next development iteration 2025-11-06 13:32:55 +01:00
Renzo Kottmann
f338f5f5f5 [maven-release-plugin] prepare release v1.6.0 2025-11-06 13:32:47 +01:00
Renzo Kottmann
32bec7c749 chore: add release date for 1.6.0 to Changelog 2025-11-06 13:23:14 +01:00
Renzo Kottmann
bbe93c965c Merge branch 'release/1.6.x' of https://projekte.kosit.org/kosit/validator into release/1.6.x 2025-11-05 18:34:11 +01:00
Renzo Kottmann
9601f921e5 chore: bump exec plugin to 3.6.2, use successCode for broken daemon shutdown 2025-11-05 18:32:34 +01:00
Renzo Kottmann
f412f72110 chore: bump exec plugin to 3.6.2, use successCode for broken daemon shutdown 2025-11-05 18:31:08 +01:00
Philip Helger
53a967f4a8 Official images 2025-11-05 14:01:29 +01:00
Philip Helger
140b6d009d Re-added Java 25 2025-11-05 13:55:49 +01:00
Philip Helger
f2d77b01e9 Version bump 2025-11-05 13:51:41 +01:00
Renzo Kottmann
6524c07631 Merge branch 'cleansing-ph-1.6' into 'release/1.6.x'
Replaced deprecated methods etc.

See merge request kosit/validator!77
2025-10-24 12:27:20 +02:00
Philip Helger
0b22c3ea91 Replaced deprecated methods etc. 2025-10-24 12:27:20 +02:00
Philip Helger
c030aaff02 Back to 24 2025-10-22 16:02:20 +02:00
Philip Helger
70f6026196 Add Java 25 instead of 24 2025-10-22 15:57:36 +02:00
Philip Helger
1da41a718f Enforcing specific Java versions for compilation 2025-10-22 15:54:07 +02:00
Philip Helger
be9dcaac03 Using release instead of source/target 2025-10-22 15:37:21 +02:00
Philip Helger
e6d537f78a Merge branch 'release/1.6.x' of https://projekte.kosit.org/kosit/validator.git into release/1.6.x 2025-10-22 15:33:37 +02:00
Philip Helger
9774dddb17 Lombok update for Java 25 2025-10-22 15:33:29 +02:00
Renzo Kottmann
1c5c3ab66f Add github #127 to changelog.md 2025-10-22 15:19:06 +02:00
Renzo Kottmann
8b869a7804 Merge branch '127-custom-error-level-java-result' into 'release/1.6.x'
Added custom error level to Result object.

See merge request kosit/validator!81
2025-10-22 14:59:35 +02:00
Marija Stojanovic
9ed443ffdb Added custom error level to Result object. 2025-10-22 14:59:35 +02:00
andreb
3c6b4d2e2e Merge branch 'main' into release/1.6.x
# Conflicts:
#	README.md
2025-10-06 09:08:21 +02:00
Philip Helger
da0478f838 Fixed typo 2025-09-12 11:06:17 +02:00
Philip Helger
3d783857ab Updated to new JS component versions; #153 2025-09-10 19:38:40 +02:00
Philip Helger
1f859bc678 Using XEinkauf instead of XOEV 2025-09-10 19:29:17 +02:00
Philip Helger
e90e4be6f0 Updated 2025-09-10 19:09:46 +02:00
Philip Helger
6bd4839495 Fixed Javadoc error 2025-09-10 18:58:46 +02:00
Philip Helger
2e8ce6869b Fixed link 2025-09-10 18:55:16 +02:00
Philip Helger
5e31f0fcdc Fixed links 2025-09-10 18:47:44 +02:00
Philip Helger
2f90992249 Fixed formatting 2025-09-10 18:43:17 +02:00
Philip Helger
88a7102df8 Version bump to Docusaur 3.x (#153) 2025-09-10 15:58:45 +02:00
Philip Helger
709da29fe9 Updated changelog 2025-09-10 15:39:35 +02:00
Philip Helger
446e1726d4 Latest docusaurus 2.x 2025-09-10 15:17:56 +02:00
Philip Helger
87f297f6e3 Updated examples + links 2025-09-10 14:55:27 +02:00
Philip Helger
705b0b2501 Updated examples + links 2025-09-10 14:52:29 +02:00
yunussozeri
714e5e7803 Update links to source code to current locations
The links were old and not redirecting to the correct location
2025-09-10 14:38:57 +02:00
yunussozeri
1ed9377b83
Update links to source code to current locations
The links were old and not redirecting to the correct location
2025-09-08 14:43:51 +02:00
Renzo Kottmann
93a64223b8 minor grammar in README.md
(cherry picked from commit a96751e08f)

Co-authored-by: Renzo Kottmann <renzo.kottmann@finanzen.bremen.de>
2025-09-04 12:07:23 +02:00
Renzo Kottmann
a96751e08f minor grammar in README.md 2025-09-04 12:06:19 +02:00
Renzo Kottmann
5bbc0eb98f Merge branch 'readme-update-16' into 'release/1.6.x'
Updated readme

See merge request kosit/validator!80
2025-09-03 16:36:36 +02:00
Philip Helger
36e425388d Updated readme 2025-09-03 16:36:36 +02:00
Renzo Kottmann
16c6784c5b Merge branch 'version-badge' into 'main'
Added Maven Central badge

See merge request kosit/validator!78
2025-09-03 16:28:51 +02:00
Philip Helger
52e42fe6dc Removed ToC 2025-09-03 16:23:12 +02:00
Philip Helger
78e5d3d4ee Added badge, roadmap, contributors and license 2025-09-03 16:22:22 +02:00
Philip Helger
162339d485 Added Maven Central badge 2025-09-03 15:30:37 +02:00
Philip Helger
51e573f02c Removed Java8 file 2025-08-29 17:28:20 +02:00
Philip Helger
100644fb38 Format fix from https://github.com/itplr-kosit/validator/pull/153 2025-08-29 17:28:06 +02:00
Philip Helger
1bda64f610 Removed Java 8 from GitLab 2025-08-29 17:24:34 +02:00
Philip Helger
0be3eac6ed Fixed git branch name 2025-08-29 17:23:15 +02:00
Philip Helger
f082d48dd8 Different version between API and impl 2025-08-29 17:19:04 +02:00
Philip Helger
4e0a1e1fc5 Merge remote-tracking branch 'origin/release/1.5.x' into release/1.6.x 2025-08-29 17:14:00 +02:00
Renzo Kottmann
fda9de5b3e Merge branch 'release/1.5.x' into 'main'
v1.5.2 release back to main

See merge request kosit/validator!75
2025-08-29 17:08:31 +02:00
Renzo Kottmann
c906adf39b [maven-release-plugin] prepare for next development iteration 2025-08-29 15:59:27 +02:00
Renzo Kottmann
e5f2298293 [maven-release-plugin] prepare release v1.5.2 2025-08-29 15:59:19 +02:00
Renzo Kottmann
561d719b28 Merge branch 'release/1.5.x' of https://projekte.kosit.org/kosit/validator into release/1.5.x 2025-08-29 15:49:56 +02:00
Renzo Kottmann
c0f823f399 Prepare for release 1.5.2 2025-08-29 15:49:32 +02:00
Renzo Kottmann
6a60bc561a Merge branch '148-regression-distribution-zip-does-not-contain-validator-jar' into 'release/1.5.x'
Resolve "Regression: distribution zip does not contain validator*.jar"

See merge request kosit/validator!74
2025-08-29 15:48:53 +02:00
Renzo Kottmann
3aab435d8e Resolve "Regression: distribution zip does not contain validator*.jar" 2025-08-29 15:48:52 +02:00
Renzo Kottmann
1e6f96dfad [maven-release-plugin] prepare for next development iteration 2025-08-29 10:52:23 +02:00
Renzo Kottmann
fc31e98da9 [maven-release-plugin] prepare release v1.5.1 2025-08-29 10:52:10 +02:00
Renzo Kottmann
05079676b5 Changed name in pom.xml 2025-08-29 10:47:10 +02:00
Philip Helger
e444a60695 Re-added latest POM changes 2025-08-29 10:45:58 +02:00
Philip Helger
cf10fa09e5 Changed back to validator 2025-08-29 10:44:12 +02:00
Renzo Kottmann
4a15af6ef2 [maven-release-plugin] rollback the release of v1.5.1 2025-08-29 10:32:39 +02:00
Philip Helger
da42b9e404 [maven-release-plugin] rollback the release of v1.5.1 2025-08-29 10:31:41 +02:00
Philip Helger
2dd5e0dbb0 [maven-release-plugin] prepare for next development iteration 2025-08-29 10:31:26 +02:00
Philip Helger
be30c80617 [maven-release-plugin] prepare release v1.5.1 2025-08-29 10:31:24 +02:00
Philip Helger
90b860d8ec [maven-release-plugin] rollback the release of v1.5.1 2025-08-29 10:29:32 +02:00
Philip Helger
eb7fc87f07 [maven-release-plugin] prepare for next development iteration 2025-08-29 10:29:22 +02:00
Philip Helger
f4f0d9eceb [maven-release-plugin] prepare release v1.5.1 2025-08-29 10:28:37 +02:00
Philip Helger
269862503e Added Maven Central plugin 2025-08-29 10:27:42 +02:00
Renzo Kottmann
02d12b614e Merge branch '151-release-docs' into 'release/1.5.x'
Release documentation update

See merge request kosit/validator!73
2025-08-29 10:15:40 +02:00
Philip Helger
740a880276 Release documentation update 2025-08-29 10:15:40 +02:00
Renzo Kottmann
da7515a055 Merge branch '146-write-changelog-for-1-5-1' into 'release/1.5.x'
Resolve "write changelog for 1.5.1"

See merge request kosit/validator!72
2025-08-28 13:53:06 +02:00
Philip Helger
05c3d9ea09 Resolve "write changelog for 1.5.1" 2025-08-28 13:53:06 +02:00
Renzo Kottmann
d4d1aaea51 Merge branch '145-if-the-cli-is-invoked-without-any-parameter-the-usage-is-shown-twice' into 'release/1.5.x'
Resolve "If the CLI is invoked without any parameter, the usage is shown twice"

See merge request kosit/validator!71
2025-08-27 18:14:09 +02:00
Philip Helger
5e57c3e978 Resolve "If the CLI is invoked without any parameter, the usage is shown twice" 2025-08-27 18:14:09 +02:00
Renzo Kottmann
22910c1ca0 Merge branch '130-check-result-to-stdout-causes-an-exception' into 'release/1.5.x'
Resolve "Check result to stdout causes an exception"

See merge request kosit/validator!70
2025-08-27 17:40:46 +02:00
Philip Helger
911b9a3291 Resolve "Check result to stdout causes an exception" 2025-08-27 17:40:46 +02:00
Renzo Kottmann
7eaf9bcc09 Merge branch '129-api-doc-supdate' into 'release/1.5.x'
Resolve #129 - Api Doc Updates

See merge request kosit/validator!69
2025-08-27 17:30:08 +02:00
Philip Helger
122b647853 Resolve #129 - Api Doc Updates 2025-08-27 17:30:08 +02:00
Philip Helger
a8a3fd100c Checking only for "Usage:" but as a constant; No ANSI codes! 2025-08-27 17:08:19 +02:00
Philip Helger
7a7712188d WiP Sysout debugging 2025-08-27 16:21:12 +02:00
Renzo Kottmann
ce65c99f6c Merge branch '62-surefire-test-error' into 'release/1.5.x'
Resolve "Surefire Test Error running de.kosit.validationtool.impl.xml.RemoteResolvingStrategyTest fails without http.proxy setting"

See merge request kosit/validator!68
2025-08-27 15:15:59 +02:00
Marija Stojanovic
6698e6b865 Resolve "Surefire Test Error running de.kosit.validationtool.impl.xml.RemoteResolvingStrategyTest fails without http.proxy setting" 2025-08-27 15:15:59 +02:00
Renzo Kottmann
edde0f5134 Merge branch '104-backwards-incompatibility-problem-from-1-4-2-to-1-5-0' into 'release/1.5.x'
Resolve "Backwards incompatibility problem from 1.4.2 to 1.5.0"

See merge request kosit/validator!66
2025-08-19 18:05:54 +02:00
Philip Helger
e4d4ee44e5 Resolve "Backwards incompatibility problem from 1.4.2 to 1.5.0" 2025-08-19 18:05:54 +02:00
Renzo Kottmann
a45563e41a [maven-release-plugin] rollback the release of v1.5.1 2025-08-19 16:12:50 +02:00
Philip Helger
3edc5c6ae4 Constant cache key 2025-08-19 15:42:51 +02:00
Renzo Kottmann
6cc9a6eea7 Merge branch '144-create-maven-release-profile-for-releasing-to-maven-central' into 'release/1.5.x'
Resolve "Create Maven release profile for releasing to Maven Central"

See merge request kosit/validator!67
2025-08-19 15:41:52 +02:00
Philip Helger
5bbb5b373d Resolve "Create Maven release profile for releasing to Maven Central" 2025-08-19 15:41:52 +02:00
Renzo Kottmann
b24e97e43f Merge branch '131-unsupportedoperationexception-because-of-read-only-list' into 'release/1.5.x'
Resolve "UnsupportedOperationException because of read-only List"

See merge request kosit/validator!65
2025-08-13 18:27:06 +02:00
Philip Helger
361ed5863d Resolve "UnsupportedOperationException because of read-only List" 2025-08-13 18:27:06 +02:00
Philip Helger
0092c2f0e1 Merge branch '140-prepare-pom-xml-to-be-able-to-release-to-maven-central' into 'release/1.5.x'
Resolve "Prepare pom.xml to be able to release to Maven Central"

See merge request kosit/validator!62
2025-08-13 17:58:22 +02:00
Philip Helger
ef6ea7a92c Resolve "Prepare pom.xml to be able to release to Maven Central" 2025-08-13 17:58:21 +02:00
Renzo Kottmann
864c36b3c2 Merge branch '136-remove-ide-project-folders-from-git' into 'release/1.5.x'
Resolve "Remove IDE project folders from git"

See merge request kosit/validator!63
2025-08-13 17:00:31 +02:00
Philip Helger
7bfd3309d1 Resolve "Remove IDE project folders from git" 2025-08-13 17:00:30 +02:00
Philip Helger
827eded0ed Merge branch 'issue/137' into 'release/1.5.x'
Resolve #137

See merge request kosit/validator!59
2025-08-08 12:08:29 +02:00
Philip Helger
910320a5f1 Resolve #137 2025-08-08 12:08:29 +02:00
Renzo Kottmann
6950a98f09 Merge branch 'issue/141' into 'release/1.5.x'
Using https URL

See merge request kosit/validator!60
2025-08-08 10:24:30 +02:00
Philip Helger
acd7740846 Using https URL 2025-08-07 11:11:33 +02:00
andreb
e3ac6cdb39 initalize 1.6.x migrate to jakarta 2025-07-29 08:16:48 +02:00
andreb
96c1d346ee initalize 1.6.x migrate to jakarta 2025-07-28 17:04:56 +02:00
Andre Babinsky
de41d61b04 Merge branch '110-gitlab-ci-umgebung-reaktivieren' into 'release/1.5.x'
GitLab CI-Umgebung reaktivieren

See merge request kosit/validator!58
2025-07-25 07:04:59 +00:00
Andre Babinsky
40f6f4a296 GitLab CI-Umgebung reaktivieren 2025-07-25 07:04:59 +00:00
Andre Babinsky
0b2d812dd1 Merge branch '109-komponente-upgrade-fur-1-5' into 'release/1.5.x'
upgrade dependencies and plugins

See merge request kosit/validator!57
2025-07-25 06:48:45 +00:00
andreb
98c2e1c18c upgrade dependencies and plugins 2025-07-23 13:29:34 +02:00
Philip Helger
4ce8f4de58 Updated versions 2025-04-09 19:25:35 +02:00
Renzo Kottmann
5a1ca79ed8 WIP: bump apache.common.io to v2.18.0 2025-04-09 18:41:31 +02:00
apenski
5184f86c5e Prepare Release 1.5.0 2022-12-02 15:38:28 +01:00
apenski
2b4e7fc4ba (chore) update year 2022-12-02 15:37:32 +01:00
apenski
935a85ad40 Merge remote-tracking branch 'origin/main' 2022-12-02 11:27:57 +01:00
apenski
95173e5799 Merge branch '#100_Make_createReport_optional' 2022-12-02 11:27:18 +01:00
apenski
cf10d2e1cd (chore) Versionsupdates bei Test-Komponenten 2022-12-02 11:27:10 +01:00
Andreas Penski
c70cd52512 Merge branch '#100_Make_createReport_optional' into 'main'
#100 make create report optional

See merge request kosit/validator!54
2022-11-28 08:34:42 +00:00
Andreas Penski
874a01fa22 https://github.com/itplr-kosit/validator/issues/100 Make createReport optional 2022-11-28 08:34:42 +00:00
apenski
9a3e48ced4 Merge branch 'main' into #100_Make_createReport_optional
# Conflicts:
#	CHANGELOG.md
2022-11-28 09:05:24 +01:00
apenski
f8217922d1 (chore) Changelog 2022-11-28 08:59:18 +01:00
apenski
02a2b526fc (fix) update dev dependency 2022-11-18 09:54:23 +01:00
Andreas Penski
9d6c4cac9e Merge branch '97-ersetzen-von-docsify-oder-deaktivieren-um-vulnaribility-loszuwerden' into 'main'
Resolve #97 "Ersetzen von docsify oder Deaktivieren um Vulnaribility loszuwerden"

See merge request kosit/validator!48
2022-11-18 07:21:57 +00:00
Andreas Penski
219aeaa1b7 Resolve https://projekte.kosit.org/kosit/validator/-/issues/97 "Replace docsify from UI" 2022-11-18 07:21:56 +00:00
apenski
a10cc14d06 (chore) common build only on LTS platforms, other periodically 2022-11-16 08:35:23 +01:00
Andreas Penski
e102c73a68 Merge branch 'fix_java_19_build' into 'main'
Fix java 19 build

See merge request kosit/validator!53
2022-11-16 07:33:17 +00:00
Andreas Penski
2743e1d6b4 Fix java 19 build 2022-11-16 07:33:17 +00:00
apenski
f717f00369 (chore) adapt identity.xsl 2022-11-15 16:05:51 +01:00
Andreas Penski
ca81eb7375 Merge branch 'adapt_tests' into 'main'
Adapt tests

See merge request kosit/validator!52
2022-11-10 11:41:37 +00:00
Andreas Penski
b115dc1c4b Test only supported JDKs 2022-11-10 11:41:37 +00:00
apenski
55ec1dc560 make report optional 2022-11-09 16:35:38 +01:00
apenski
9f3ded6e5b Merge remote-tracking branch 'origin/main' 2022-11-09 16:10:29 +01:00
apenski
a5ad131335 (chore) fix build 2022-11-09 16:10:19 +01:00
Andreas Penski
bb4aa5c0d3 Merge branch 'reduce_jobs_in_mr' into 'main'
Trigger Helper Jobs only in main branch

See merge request kosit/validator!51
2022-11-09 15:05:20 +00:00
Andreas Penski
5cc93f8783 Trigger Helper Jobs only in main branch 2022-11-09 15:05:19 +00:00
Andreas Penski
a5d34b515f Merge branch 'bugfix/#101_Role_is_null_in_FailedAssert' into 'main'
Resolve https://github.com/itplr-kosit/validator/issues/101 Role is null in failed assert

See merge request kosit/validator!50
2022-11-09 14:39:41 +00:00
Andreas Penski
9ecb114510 Resolve https://github.com/itplr-kosit/validator/issues/101 Role is null in failed assert 2022-11-09 14:39:41 +00:00
Andreas Penski
bad3be78e9 Merge branch 'restructure_build' into 'main'
Restructure build process

See merge request kosit/validator!49
2022-11-09 12:59:14 +00:00
Andreas Penski
a1300e0f6f Restructure build process 2022-11-09 12:59:14 +00:00
apenski
d019642ba5 Dependency Updates 2022-11-09 11:20:47 +01:00
apenski
b244f73d3a (Fix) https://projekte.kosit.org/kosit/validator/-/issues/95 NPE when using empty repository definition (-r "") 2022-11-09 09:02:15 +01:00
apenski
38ab54438c https://projekte.kosit.org/kosit/validator/-/issues/93 (Fix) No usage information necessary when validation fails 2022-11-09 08:27:01 +01:00
apenski
0281d94929 Upgrade Saxon to 11.4 2022-11-08 08:32:11 +01:00
apenski
bf50b6ff49 Bump pico cli to 4.7.0 2022-11-07 16:45:04 +01:00
apenski
78b88d04da Bump jaxb-ri to 2.3.7 2022-11-07 16:44:49 +01:00
apenski
be456a0c9b Test java 18 2022-11-07 16:44:08 +01:00
Andreas Penski
6988abbb13 Merge branch 'update-copyright-header' into 'main'
Update Copyright

See merge request kosit/validator!47
2022-11-07 15:35:20 +00:00
apenski
f283f5204e Update Copyright 2022-11-07 16:09:12 +01:00
Renzo Kottmann
7e64fe909b Add warning about GUI as show case 2022-01-11 10:18:26 +00:00
Andreas Penski
7bffb32eb6 Merge branch 'optimize_ci' into 'master'
Optimize ci

See merge request kosit/validator!44
2021-08-20 12:01:57 +00:00
Andreas Penski
346428968d Optimize ci 2021-08-20 12:01:57 +00:00
Andreas Penski (init)
38f3bdf699 (chore) build image with dependencies 2021-08-18 16:56:38 +02:00
Andreas Penski (init)
a7924517a5 (chore) build image with dependencies 2021-08-18 16:34:52 +02:00
Andreas Penski (init)
eda9120bce (chore) build image with dependencies 2021-08-18 16:27:30 +02:00
Andreas Penski (init)
9417080dd7 (fix) build image creation 2021-08-18 16:13:12 +02:00
Andreas Penski (init)
6f5ecc9a59 Merge remote-tracking branch 'origin/master' 2021-05-21 13:17:25 +02:00
Andreas Penski
9973304a2a Merge branch 'multiple_configurations' into 'master'
Support Multiple configuration

See merge request kosit/validator!41
2021-05-21 11:16:20 +00:00
Andreas Penski
2e6efdd16f support multiple configuration 2021-05-21 11:16:20 +00:00
Andreas Penski (init)
511265bb10 (chore) further reduce memory consumption 2021-05-21 13:14:08 +02:00
Andreas Penski (init)
730d7fefe9 [maven-release-plugin] prepare for next development iteration 2021-05-20 16:36:59 +02:00
318 changed files with 27677 additions and 3242 deletions

16
.gitignore vendored
View file

@ -5,7 +5,6 @@
# Log file # Log file
*.log *.log
.idea
#*.iml #*.iml
# Package Files # # Package Files #
@ -35,9 +34,22 @@ src/generated
.project .project
.classpath .classpath
.factorypath .factorypath
.settings .idea/
.settings/
.externalToolBuilders/
.vscode .vscode
*.code-workspace *.code-workspace
*.xpr *.xpr
# Testing stuff # Testing stuff
xrechnung xrechnung
# Mac stuff
.DS_Store
andre*-simple.xml
somePrefix*.xml
zz
# 2.0 stuff
api/
cli/
core/

View file

@ -1,25 +1,47 @@
image: maven:latest image: maven:latest
variables: variables:
BUILD_PROPS: "-Dbuild.revision=$CI_COMMIT_SHA -Dbuild.branch=$CI_COMMIT_REF_NAME -Dbuild.number=$CI_PIPELINE_IID " BUILD_PROPS: "-Dbuild.revision=$CI_COMMIT_SHA -Dbuild.branch=$CI_COMMIT_REF_NAME -Dbuild.number=$CI_PIPELINE_IID -Dfile.encoding=UTF-8 -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false"
MAVEN_CLI_OPTS: " --batch-mode -Dfile.encoding=UTF-8 -s .mvn/settings.xml -Dmaven.repo.local=.mvn/repository -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false" MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true -Xmx6g"
MAVEN_CLI_OPTS: " --batch-mode --update-snapshots --errors --fail-at-end --show-version -s .mvn/settings.xml"
MAVEN_CLI_OPTS_CENTRAL: " --batch-mode --show-version -s .mvn/settings-maven-central.xml"
before_script: before_script:
- export CI_JOB_TIMESTAMP="-Dbuild.timestamp=$(date --utc --iso-8601=seconds)" - export CI_JOB_TIMESTAMP="-Dbuild.timestamp=$(date --utc --iso-8601=seconds)"
cache: cache:
key: maven # Change the cache key if major dependencies change
key: constant160
paths: paths:
- .mvn/repository - .m2/repository
java-11: # Basic Java build steps
.java:
stage: build stage: build
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11 needs:
- job: java-11
artifacts: false
script: script:
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify - mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
retry: 2 artifacts:
name: artifacts
when: on_failure
paths:
- target/*.jar
reports:
junit:
- target/surefire-reports/*.xml
- target/failsafe-reports/*.xml
java-11:
extends: .java
image: maven:3-eclipse-temurin-11-alpine
needs: [ ]
script:
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP install
artifacts: artifacts:
name: java-11 name: java-11
when: always
paths: paths:
- target/*.jar - target/*.jar
- target/*.zip - target/*.zip
@ -28,114 +50,52 @@ java-11:
- target/surefire-reports/*.xml - target/surefire-reports/*.xml
- target/failsafe-reports/*.xml - target/failsafe-reports/*.xml
java-11-openj9:
stage: build
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11-openj9
script:
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
retry: 2
artifacts:
name: java-11-openj9
paths:
- target/*.jar
reports:
junit:
- target/surefire-reports/*.xml
- target/failsafe-reports/*.xml
java8:
stage: build
image: $CI_REGISTRY_IMAGE/maven:3-jdk-8
script:
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
retry: 2
artifacts:
name: java-8
paths:
- target/*.jar
reports:
junit:
- target/surefire-reports/*.xml
- target/failsafe-reports/*.xml
java-8-openj9:
stage: build
image: $CI_REGISTRY_IMAGE/maven:3-jdk-8-openj9
script:
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
retry: 2
artifacts:
name: java-8-open-j9
paths:
- target/*.jar
reports:
junit:
- target/surefire-reports/*.xml
- target/failsafe-reports/*.xml
java-15:
stage: build
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-15
script:
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
retry: 2
artifacts:
when: on_failure
name: java-15
paths:
- target/*
reports:
junit:
- target/surefire-reports/*.xml
- target/failsafe-reports/*.xml
java-16:
stage: build
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-16
script:
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
retry: 2
artifacts:
when: on_failure
name: java-16
paths:
- target/*
reports:
junit:
- target/surefire-reports/*.xml
- target/failsafe-reports/*.xml
java-17: java-17:
stage: build extends: .java
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-17 image: maven:3-eclipse-temurin-17-alpine
script:
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
retry: 2
artifacts:
when: on_failure
name: java-17
paths:
- target/*
reports:
junit:
- target/surefire-reports/*.xml
- target/failsafe-reports/*.xml
java-21:
extends: .java
image: maven:3-eclipse-temurin-21-alpine
java-25:
extends: .java
image: maven:3-eclipse-temurin-25-alpine
# Rare Java stuff
.java_extended:
extends: .java
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
# Note: the openj9 images don't exist for Java 17, 21 or 25
# Removed because the latest public image is 11.0.11 which is not comaptible to the Lombok requirement of 11.0.23
#java-11-openj9:
# extends: .java_extended
# image: maven:3-jdk-11-openj9
# Deploy Java 11 build on Maven Central
deploy-java-11-snapshot:
extends: java-11
script:
- mvn $MAVEN_CLI_OPTS_CENTRAL -P release-snapshot deploy
# Deploy Java 11 build to KoSIT repository (manually)
deploy: deploy:
stage: deploy stage: deploy
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11 image: maven:3-eclipse-temurin-11-alpine
dependencies: needs:
- java-11 - job: java-11
script: script:
- export PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - export PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}.zip -DgroupId=kosit -DartifactId=validator -Dclassifier="distribution" -Dversion=${PROJECT_VERSION} -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}.zip -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dclassifier="distribution" -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-javadoc.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="javadoc" -Dversion=${PROJECT_VERSION} -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}-javadoc.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dclassifier="javadoc" -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-standalone.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="standalone" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}-standalone.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dclassifier="standalone" -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-java8-standalone.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="java8-standalone" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}-sources.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dclassifier="sources" -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-sources.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="sources" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
when: manual when: manual
# Build Docker images and upload to KoSIT registry
create-build-image: create-build-image:
stage: deploy stage: deploy
image: docker:latest image: docker:latest
@ -145,6 +105,31 @@ create-build-image:
script: script:
- apk add bash - apk add bash
- bash .mvn/createBuildImages.sh - bash .mvn/createBuildImages.sh
when: manual rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "main"
changes:
- .mvn/createBuildImages.sh
# Run OWASP checks - expensive so only on main branch
owasp-check:
stage: test
image: maven:3-eclipse-temurin-21-alpine
needs: [ ]
# set job timeout to 1 hour - it's required when new rules are downloaded
timeout: 1h
variables:
RUNNER_SCRIPT_TIMEOUT: 1h
script:
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP validate -Powasp-check
artifacts:
name: artifacts
reports:
codequality:
- target/dependency-check-report.html
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "main"
changes:
- pom.xml
- owasp-suppressions.xml

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CheckStyle-IDEA">
<option name="configuration">
<map>
<entry key="checkstyle-version" value="8.16" />
<entry key="copy-libs" value="true" />
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
<entry key="scan-before-checkin" value="false" />
<entry key="scanscope" value="JavaOnly" />
<entry key="suppress-errors" value="false" />
</map>
</option>
</component>
</project>

15
.idea/compiler.xml generated
View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="validationtool" />
<module name="validator" />
</profile>
</annotationProcessing>
</component>
</project>

View file

@ -1,6 +0,0 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT)&#10;&#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10; http://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License." />
<option name="myName" value="KoSIT Validator" />
</copyright>
</component>

View file

@ -1,7 +0,0 @@
<component name="CopyrightManager">
<settings default="KoSIT Validator">
<module2copyright>
<element module="All" copyright="KoSIT Validator" />
</module2copyright>
</settings>
</component>

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EclipseCodeFormatterProjectSettings">
<option name="projectSpecificProfile">
<ProjectSpecificProfile>
<option name="disabledFileTypes" value="xml" />
<option name="formatSeletedTextInAllFileTypes" value="false" />
<option name="formatter" value="ECLIPSE" />
<option name="importOrderConfigFilePath" value="$PROJECT_DIR$/.settings/org.eclipse.jdt.ui.prefs" />
<option name="importOrderFromFile" value="true" />
<option name="pathToConfigFileJava" value="$PROJECT_DIR$/formatter.xml" />
<option name="selectedJavaProfile" value="init" />
<option name="useForLiveTemplates" value="true" />
</ProjectSpecificProfile>
</option>
</component>
</project>

11
.idea/encodings.xml generated
View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/model" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/target/generated-sources/xjc" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

89
.idea/misc.xml generated
View file

@ -1,89 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" value="$PROJECT_DIR$/target" />
</component>
<component name="MarkdownProjectSettings">
<PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="LINE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true">
<PanelProvider>
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
</PanelProvider>
</PreviewSettings>
<ParserSettings>
<PegdownExtensions>
<option name="ABBREVIATIONS" value="false" />
<option name="ANCHORLINKS" value="true" />
<option name="ATXHEADERSPACE" value="true" />
<option name="AUTOLINKS" value="true" />
<option name="DEFINITIONS" value="false" />
<option name="FENCED_CODE_BLOCKS" value="true" />
<option name="FOOTNOTES" value="false" />
<option name="HARDWRAPS" value="false" />
<option name="INSERTED" value="false" />
<option name="QUOTES" value="false" />
<option name="RELAXEDHRULES" value="true" />
<option name="SMARTS" value="false" />
<option name="STRIKETHROUGH" value="true" />
<option name="SUBSCRIPT" value="false" />
<option name="SUPERSCRIPT" value="false" />
<option name="SUPPRESS_HTML_BLOCKS" value="false" />
<option name="SUPPRESS_INLINE_HTML" value="false" />
<option name="TABLES" value="true" />
<option name="TASKLISTITEMS" value="true" />
<option name="TOC" value="false" />
<option name="WIKILINKS" value="true" />
</PegdownExtensions>
<ParserOptions>
<option name="COMMONMARK_LISTS" value="false" />
<option name="DUMMY" value="false" />
<option name="EMOJI_SHORTCUTS" value="true" />
<option name="FLEXMARK_FRONT_MATTER" value="false" />
<option name="GFM_TABLE_RENDERING" value="true" />
<option name="GITBOOK_URL_ENCODING" value="false" />
<option name="GITHUB_EMOJI_URL" value="false" />
<option name="GITHUB_LISTS" value="true" />
<option name="GITHUB_WIKI_LINKS" value="true" />
<option name="JEKYLL_FRONT_MATTER" value="false" />
<option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
</ParserOptions>
</ParserSettings>
<HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true">
<GeneratorProvider>
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
</GeneratorProvider>
<headerTop />
<headerBottom />
<bodyTop />
<bodyBottom />
</HtmlSettings>
<CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true">
<StylesheetProvider>
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
</StylesheetProvider>
<ScriptProviders />
<cssText />
</CssSettings>
<HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" />
<LinkMapSettings>
<textMaps />
</LinkMapSettings>
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="NodePackageJsonFileManager">
<packageJsonPaths />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="false" project-jdk-name="14" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="jetbrains.communicator.idea.IdProvider" IDEtalkID="4B2DA906C3A7DF4F7B6EA28093E19A3F" />
</project>

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SaveActionSettings">
<option name="actions">
<set>
<option value="activate" />
<option value="activateOnShortcut" />
<option value="activateOnBatch" />
<option value="organizeImports" />
<option value="reformatChangedCode" />
<option value="rearrange" />
<option value="fieldCanBeFinal" />
<option value="localCanBeFinal" />
<option value="methodMayBeStatic" />
<option value="unqualifiedFieldAccess" />
<option value="missingOverrideAnnotation" />
<option value="useBlocks" />
</set>
</option>
<option name="configurationPath" value="" />
</component>
</project>

6
.idea/vcs.xml generated
View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View file

@ -1,6 +1,22 @@
#!/usr/bin/env bash #!/usr/bin/env bash
TAGS=("3-openjdk-16" "3-jdk-11" "3-jdk-11-openj9" "3-jdk-8" "3-jdk-8-openj9", "3-openjdk-15", "3-openjdk-17") #
# Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
TAGS=("3-jdk-8" "3-jdk-8-openj9" "3-eclipse-temurin-11-alpine" "3-jdk-11-openj9" "3-eclipse-temurin-17-alpine" "3-eclipse-temurin-21-alpine" "3-eclipse-temurin-24-alpine")
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
for i in "${TAGS[@]}" for i in "${TAGS[@]}"
@ -8,7 +24,7 @@ do
echo Creating build image for "$i" echo Creating build image for "$i"
{ {
echo "FROM maven:${i}" echo "FROM maven:${i}"
} >> Dockerfile } >>Dockerfile
docker build -t "$CI_REGISTRY_IMAGE/maven:$i" . docker build -t "$CI_REGISTRY_IMAGE/maven:$i" .
docker push "$CI_REGISTRY_IMAGE/maven:${i}" docker push "$CI_REGISTRY_IMAGE/maven:${i}"
rm Dockerfile rm Dockerfile

View file

@ -1 +1 @@
-Xms128m -Xmx512m -Xms128m -Xmx256m

View file

@ -0,0 +1,11 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>central</id>
<username>${MVN_CENTRAL_USER}</username>
<password>${MAVEN_CENTRAL_TOKEN}</password>
</server>
</servers>
</settings>

View file

@ -1,36 +1,6 @@
<!-- <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
~ Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
~ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<!--
~ Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<servers> <servers>
<server> <server>
<id>gitlab-maven</id> <id>gitlab-maven</id>

File diff suppressed because one or more lines are too long

View file

@ -1,31 +0,0 @@
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<!--
~ Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<servers>
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>Job-Token</name>
<value>${env.CI_JOB_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>

View file

@ -2,24 +2,125 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## 1.6.2 - 2026-02-17
### Changed
- (BUILD) [GitHub #173]( https://github.com/itplr-kosit/validator/issues/173) The JAR files now contain details on the used third-party component licenses. Thanks to @cech12
- (BUILD) [GitHub #169](https://github.com/itplr-kosit/validator/issues/169) The `.zip` file created from `maven-assembly-plugin` now contains the correct xml-resolver dependencies. Thanks to @landrix for pointing that out
- (BUILD) [#179](https://projekte.kosit.org/kosit/validator/-/issues/179) Updated all dependencies to the latest suitable versions
## 1.6.1 - 2026-02-05
### Changed
- (CORE) [#106](https://projekte.kosit.org/kosit/validator/-/issues/106) The `match` element in `scenarios.xml` is required to have at least one character (per XSD change)
- (BUILD) [#176](https://projekte.kosit.org/kosit/validator/-/issues/176) The Maven Central deployed `pom.xml` properly includes runtime dependencies
- (BUILD) [#175](https://projekte.kosit.org/kosit/validator/-/issues/175) The `.zip` file created from `maven-assembly-plugin` no longer contains the standalone validator, which reduces its size to 50%
## 1.6.0 - 2025-11-07
### Added
- (CORE) [GitHub #127](https://github.com/itplr-kosit/validator/issues/127) New API method `Result.getCustomFailedAsserts()` to access failed asserts with custom error levels
### Fixed
- (DOC) [GitHub PR#166](https://github.com/itplr-kosit/validator/pull/166) Fixed broken links in `docs/api.md`
### Changed
- (CORE) Migration from javax to jakarta xml bind
- (DOC) [GitHub PR#132](https://github.com/itplr-kosit/validator/pull/132) Updated the link to the example Validator scenario configuration
- (BUILD) Support for *building and compilation* is restricted to the following Java versions:
- Java 11: any version &ge; 11.0.23
- Java 12 to 16 will not work
- Java 17: any version &ge; 17.0.11
- Java 18 to 20 will not work
- Any version from Java 21 onwards will work
- The reason for this is the usage of the `-proc:full` compiler parameter which in turn is needed for Lombok usage in JDK 23+.
### Removed
- (CORE) java 8 support. new default jdk 11
## 1.5.2 - 2025-09-01
### Fixed
- (BUILD) [#148](https://projekte.kosit.org/kosit/validator/-/issues/148) Regression that due to renaming from `validationtool` to `validator` the distribution zip did not contain all jars anymore
## 1.5.1 - 2025-09-01
### Fixed
- (CORE) [#130](https://projekte.kosit.org/kosit/validator/-/issues/130) Check result to stdout causes an exception. This also fixes [GitHub #131](https://github.com/itplr-kosit/validator/issues/131)
- (CORE) [#131](https://projekte.kosit.org/kosit/validator/-/issues/131) `UnsupportedOperationException` because of read-only list. This also fixes [GitHub #136](https://github.com/itplr-kosit/validator/issues/136)
- (CLI) [#104](https://projekte.kosit.org/kosit/validator/-/issues/104) made the usage of the `-r` parameter optional, if only one unnamed scenario is used
- (CLI) [#145](https://projekte.kosit.org/kosit/validator/-/issues/145) If the CLI is invoked without any parameter, the usage is shown twice
- (DOC) [#129](https://projekte.kosit.org/kosit/validator/-/issues/129) API documentation is outdated. This also fixes [GitHub #130](https://github.com/itplr-kosit/validator/issues/130)
- (BUILD) [#62](https://projekte.kosit.org/kosit/validator/-/issues/62) Surefire Test Error running `de.kosit.validationtool.impl.xml.RemoteResolvingStrategyTest` fails without `http.proxy` setting
- (BUILD) [#110](https://projekte.kosit.org/kosit/validator/-/issues/110) reactivated the GitLab CI environment
### Added
- (BUILD) [#140](https://projekte.kosit.org/kosit/validator/-/issues/140) prepare pom.xml to be able to release to Maven Central
- (BUILD) [#144](https://projekte.kosit.org/kosit/validator/-/issues/144) created a Maven profile to release on Maven Central
### Changed
- (CORE) [#109](https://projekte.kosit.org/kosit/validator/-/issues/109) dependencies were updated to the latest Java 1.8 compatible versions
- Bump [Saxon HE](https://www.saxonica.com/documentation11/documentation.xml) to 12.8
- Bump [jaxb-ri](https://github.com/eclipse-ee4j/jaxb-ri) to 2.3.9
- Bump [SLF4J](https://www.slf4j.org/) to 2.0.17
- (CORE) [#136](https://projekte.kosit.org/kosit/validator/-/issues/136) removed IDE project folders from git
- (BUILD) [#135](https://projekte.kosit.org/kosit/validator/-/issues/135) protected specific git branches
- (BUILD) [#137](https://projekte.kosit.org/kosit/validator/-/issues/137) GitLab CI should only run on Java LTS versions as well as the latest Java version
- (BUILD) [#147](https://projekte.kosit.org/kosit/validator/-/issues/147) Change Maven coordinates from `de.kosit:validationtool` to `org.kosit:validator`
## 1.5.0
### Fixed
- (CLI) [#93](https://projekte.kosit.org/kosit/validator/-/issues/93) Remove usage information, when validation failed
- (CLI) [#95](https://projekte.kosit.org/kosit/validator/-/issues/95) NPE when using empty repository definition (-r "")
- (CORE) [GitHub #101](https://github.com/itplr-kosit/validator/issues/101) Role is null in FailedAssert
### Added
- (CLI) Support for multiple configurations and multiple repositories. See [cli documentation](docs/cli.md) for details
- (API) Possibility to use preconfigured Saxon `Processor` instance for validation
### Changed
- (CORE) [GitHub #100](https://github.com/itplr-kosit/validator/issues/100) Make createReport optional
- (DAEMON) UI rewrite based on [Docusaurs](https://docusaurus.io)
- (API) [ResolvingConfigurationStrategy.java#getProcessor()](de/kosit/validationtool/api/ResolvingConfigurationStrategy) is removed.
- (CORE) Bump [Saxon HE](https://www.saxonica.com/documentation11/documentation.xml) to 11.4
- (CORE) Bump [jaxb-ri](https://github.com/eclipse-ee4j/jaxb-ri) to 2.3.7
- (CORE) Various other dependency updates. See pom.xml
- (CORE) CLI parsing based on pico-cli, commons-cli is removed
## 1.4.2 ## 1.4.2
### Fixed ### Fixed
- [CLI] [#74](https://projekte.kosit.org/kosit/validator/-/issues/74) fix ansi output of the cli version - (CLI) [#74](https://projekte.kosit.org/kosit/validator/-/issues/74) fix ansi output of the cli version
- [#80](https://github.com/itplr-kosit/validator/issues/80) using classloader to initialize jaxb context (to support usage in OSGi - [#80](https://github.com/itplr-kosit/validator/issues/80) using classloader to initialize jaxb context (to support
usage in OSGi
environments) environments)
- [#75] (https://github.com/itplr-kosit/validator/issues/75) Improve logging on invalid documents - [#75](https://github.com/itplr-kosit/validator/issues/75) Improve logging on invalid documents
## 1.4.1 ## 1.4.1
### Fixed ### Fixed
- Allow more than 3 customLevel elements in scenarios (see xrechnung - Allow more than 3 customLevel elements in scenarios (see xrechnung
configuration [ issue 49](https://github.com/itplr-kosit/validator-configuration-xrechnung/issues/49)) configuration [issue 49](https://github.com/itplr-kosit/validator-configuration-xrechnung/issues/49))
- Remove saxon signature from java8 uber-jar (see [67](https://github.com/itplr-kosit/validator/issues/67)) - Remove saxon signature from java8 uber-jar (see [67](https://github.com/itplr-kosit/validator/issues/67))
## 1.4.0 ## 1.4.0
@ -28,7 +129,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- date conversion when - date conversion when
using [ConfigurationBuilder#date(Date)](https://github.com/itplr-kosit/validator/blob/d7beb1040418ae5cbeb9427532fd87482f55756c/src/main/java/de/kosit/validationtool/config/ConfigurationBuilder.java#L109) using [ConfigurationBuilder#date(Date)](https://github.com/itplr-kosit/validator/blob/d7beb1040418ae5cbeb9427532fd87482f55756c/src/main/java/de/kosit/validationtool/config/ConfigurationBuilder.java#L109)
- [CLI] [#51](https://github.com/itplr-kosit/validator/issues/51) Suffix of report xml is missing - (CLI) [#51](https://github.com/itplr-kosit/validator/issues/51) Suffix of report xml is missing
- [#53](https://github.com/itplr-kosit/validator/issues/53) Fix copyright and licensing information - [#53](https://github.com/itplr-kosit/validator/issues/53) Fix copyright and licensing information
- [#56](https://github.com/itplr-kosit/validator/issues/56) `namespace` element content needs trimming - [#56](https://github.com/itplr-kosit/validator/issues/56) `namespace` element content needs trimming
- [DAEMON] [#57](https://github.com/itplr-kosit/validator/issues/57) Reading large inputs correctly - [DAEMON] [#57](https://github.com/itplr-kosit/validator/issues/57) Reading large inputs correctly
@ -36,75 +137,94 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- read saxon XdmNode with InputFactory - read saxon XdmNode with InputFactory
- [CLI] custom output without the various log messages - (CLI) custom output without the various log messages
- [CLI] options to set the log level (`-X` = full debug output, `-l <level>` set a specific level) - (CLI) options to set the log level (`-X` = full debug output, `-l <level>` set a specific level)
- [CLI] return code ist <> 0 on rejected results - (CLI) return code is not 0 on rejected results
- [CLI] read (single) test target from stdin - (CLI) read (single) test target from stdin
- [DAEMON] name inputs via request URI - [DAEMON] name inputs via request URI
### Changed ### Changed
- InputFactory has methods to read any java.xml.transform.Source as Input not only StreamSources - InputFactory has methods to read any java.xml.transform.Source as Input not only StreamSources
- InputFactory uses a generated UUID as name for SourceInput, if no "real" name can be derived - InputFactory uses a generated UUID as name for SourceInput, if no "real" name can be derived
- saxon dependency update (minor, 9.9.1-7) - saxon dependency update (minor, 9.9.1-7)
- [DAEMON] proper status codes when returning results (see [daemon documentation](./docs/daemon.md#status-codes)) - [DAEMON] proper status codes when returning results (see [daemon documentation](./docs/daemon.md#status-codes))
## 1.3.1 ## 1.3.1
### Fixed ### Fixed
- `getFailedAsserts()` and `isSchematronValid()` in [DefaultResult.java](https://github.com/itplr-kosit/validator/blob/master/src/main/java/de/kosit/validationtool/impl/DefaultResult.java)
do not reflect actual schematron validation result - `getFailedAsserts()` and `isSchematronValid()`
- processing aborts on schematron execution errors (e.g. errors within schematron logic). The validator now generates a report in such cases. in [DefaultResult.java](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/impl/DefaultResult.java)
do not reflect actual schematron validation result
- processing aborts on schematron execution errors (e.g. errors within schematron logic). The validator now generates a
report in such cases.
- exception while resolving when using XSLT's `unparsed-text()` function within report generation - exception while resolving when using XSLT's `unparsed-text()` function within report generation
### Added ### Added
- [CLI] summary report
- (CLI) summary report
### Changed ### Changed
- engine info contains version number of the validator (configurations can output this in the report for maintainance puposes)
- engine info contains version number of the validator (configurations can output this in the report for maintainance
puposes)
- options to customize serialized report file names (cmdline only) via `--report-prefix` and `--report-postfix` - options to customize serialized report file names (cmdline only) via `--report-prefix` and `--report-postfix`
- remove unused dependency Apache Commons HTTP - remove unused dependency Apache Commons HTTP
## 1.3.0 ## 1.3.0
### Added ### Added
- Added a builder style configuration API to configure scenarios - Added a builder style configuration API to configure scenarios
- Added an option to configure xml security e.g. to load from http sources or not from a specific repository - Added an option to configure xml security e.g. to load from http sources or not from a specific repository
(so loading is configurable less restrictive, default strategy is to only load from a local repository) (so loading is configurable less restrictive, default strategy is to only load from a local repository)
- Support java.xml.transform.Source as Input - Support java.xml.transform.Source as Input
### Changed ### Changed
- Inputs are NOT read into memory (e.g. Byte-Array) prior processing within the validator. This reduces memory consumption.
- Inputs are NOT read into memory (e.g. Byte-Array) prior processing within the validator. This reduces memory
consumption.
- Overall processing of xml files is based on Saxon s9api. No JAXP or SAX classes are used by - Overall processing of xml files is based on Saxon s9api. No JAXP or SAX classes are used by
the validator (this further improves performance and memory consumption) the validator (this further improves performance and memory consumption)
### Deprecations ### Deprecations
- CheckConfiguration is deprecated now. Use Configuration.load(...) or Configuration.build(...) - CheckConfiguration is deprecated now. Use Configuration.load(...) or Configuration.build(...)
## 1.2.1 ## 1.2.1
### Fixed ### Fixed
- Validator is creating invalid createReportInput xml in case of no scenario match - Validator is creating invalid createReportInput xml in case of no scenario match
## 1.2.0 ## 1.2.0
### Added ### Added
- Provide access to schematron result through [Result.java](https://github.com/itplr-kosit/validator/blob/master/src/main/java/de/kosit/validationtool/api/Result.java) - Provide access to schematron result
through [Result.java](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/api/Result.java)
- *Result#getFailedAsserts()* returns a list of failed asserts found by schematron - *Result#getFailedAsserts()* returns a list of failed asserts found by schematron
- *Result#isSchematronValid()* convinience access to evaluate whether schematron was processed without any *FailedAsserts* - *Result#isSchematronValid()* convinience access to evaluate whether schematron was processed without any *
FailedAsserts*
### Changed ### Changed
- *Result#getAcceptRecommendation()* does not _only_ work when _acceptMatch_ is configured in the scenario - *Result#getAcceptRecommendation()* does not *only* work when *acceptMatch* is configured in the scenario
- schema correctness is a precondition, if the checked instance is not valid, this evaluates to _REJECTED_ - schema correctness is a precondition, if the checked instance is not valid, this evaluates to *REJECTED*
- if _acceptMatch_ is configured, the result is based on the boolean result of the xpath expression evaluated against the generated report - if *acceptMatch* is configured, the result is based on the boolean result of the xpath expression evaluated against
- if *no* _acceptMatch_ is configured, the result is based on evaluation of schema and schematron correctness the generated report
- _UNDEFINED_ is only returned, when processing is stopped somehow - if *no* *acceptMatch* is configured, the result is based on evaluation of schema and schematron correctness
- *Result#isAcceptable()* can now evaluate to true, when no _acceptMatch_ is configured (see above) - *UNDEFINED* is only returned, when processing is stopped somehow
- *Result#isAcceptable()* can now evaluate to true, when no *acceptMatch* is configured (see above)
## 1.1.3 ## 1.1.3
### Fixed ### Fixed
- XXE vulnerability when reading xml documents with Saxon [#44](https://github.com/itplr-kosit/validator/issues/44) - XXE vulnerability when reading xml documents with Saxon [#44](https://github.com/itplr-kosit/validator/issues/44)
- validator unintentionally stopped when schematron processing has errors. See [#41](https://github.com/itplr-kosit/validator/issues/41). - validator unintentionally stopped when schematron processing has errors.
See [#41](https://github.com/itplr-kosit/validator/issues/41).
## 1.1.2 ## 1.1.2
@ -127,10 +247,10 @@ the validator (this further improves performance and memory consumption)
### Added ### Added
- Enhanced API-Usage e.g. return _Result_ object with processing information - Enhanced API-Usage e.g. return *Result* object with processing information
- Support loading scenarios and content from a JAR-File - Support loading scenarios and content from a JAR-File
- Simple Daemon-Mode exposing validation functionality via http - Simple Daemon-Mode exposing validation functionality via http
- cli option to serialize the 'report input' xml document to _cwd_ (current working directory) - cli option to serialize the 'report input' xml document to *cwd* (current working directory)
- Documentation in `docs` folder - Documentation in `docs` folder
### Changed ### Changed
@ -150,7 +270,8 @@ the validator (this further improves performance and memory consumption)
### Changed ### Changed
- Removed XRechnung configuration from release artifacts and source (moved to [own repository](https://github.com/itplr-kosit/validator-configuration-xrechnung) ) - Removed XRechnung configuration from release artifacts and source (moved
to [own repository](https://github.com/itplr-kosit/validator-configuration-xrechnung) )
## 1.0.0 ## 1.0.0

30
NOTICE
View file

@ -1,5 +1,29 @@
KoSIT Validator KoSIT XML Validator
Copyright 2017-2020 Koordinierungsstelle für IT-Standards (KoSIT) Copyright 2017-2026 Koordinierungsstelle für IT-Standards (KoSIT)
This product includes software developed by This product includes software developed by
Koordinierungsstelle für IT-Standards (https://www.xoev.de/). Koordinierungsstelle für IT-Standards (<https://xeinkauf.de/>).
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Licensed under Apache 2.0
This product includes software developed at
Fusesource (http://fusesource.github.io/jansi/).
Licensed under Apache 2.0
This product includes software developed at
Remko Popma (https://picocli.info/).
Licensed under Apache 2.0
This product includes software developed at
Saxonica (https://github.com/Saxonica/Saxon-HE).
Licensed under MPL 2.0
This product includes software developed at
Eclipse Foundation (https://github.com/eclipse-ee4j/jaxb-ri).
Licensed under EDL 1.0
This product includes software developed at
QOS.ch (https://www.slf4j.org/).
Licensed under MIT

133
README.md
View file

@ -1,82 +1,85 @@
# KoSIT Validator # KoSIT Validator
- [Introduction](#introduction)
- [Validation Configurations](#validation-configurations) [![Maven Central](https://img.shields.io/maven-central/v/org.kosit/validator)](https://central.sonatype.com/artifact/org.kosit/validator)
* [Third Party Validation Configurations](#third-party-validation-configurations) [![Apache 2.0 license](https://img.shields.io/badge/license-Apache%202-blue)](https://www.apache.org/licenses/LICENSE-2.0)
- [Usage](#usage)
* [Standalone Command-Line Interface](#standalone-command-line-interface)
* [Application User Interface (API / embedded usage)](#application-user-interface--api---embedded-usage-)
* [Daemon-Mode](#daemon-mode)
- [Packages](#packages)
## Introduction ## Introduction
The validator is an XML validation engine to validate and process XML files in various formats. It basically does the following in order:
1. identify actual xml format The Validator is an XML validation engine to validate and process XML files in various formats. It basically does the following in order:
1. validate the xml file (using schema and schematron rules)
1. generate a custom report / extract custom data from the xml file 1. identify actual XML format
1. validate the XML file (using schema and schematron rules)
1. generate a custom report / extract custom data from the XML file
1. compute an acceptance status (according the supplied schema and rules) 1. compute an acceptance status (according the supplied schema and rules)
The validator depends on self defined [scenarios](docs/configurations.md) which are used to fully configure the process. The Validator depends on self defined [scenarios](docs/configurations.md) in order to fully configure the whole process.
It always creates a [validation report in XML](docs/configurations.md#validators-report). The actual content of this is controlled by the scenario. It always creates a [validation report in XML](docs/configurations.md#validators-report). The actual content of the report can also be controlled by the scenario.
See [architecture](docs/architecture.md) for information about the actual validation process. See [architecture](docs/architecture.md) for information about the whole validation process.
## Validation configurations ## Validation configurations
The validator is just an engine and does not know anything about XML documents and has no own validation rules. The Validator is just an engine and does not know anything about XML documents and has no own validation rules.
Validation rules and details are defined in [validation scenarios](docs/configurations.md) which are used to fully configure the validation process. Validation rules and details are defined in [validation scenarios](docs/configurations.md) which are used to fully configure the validation process.
All configurations are self-contained modules which are deployed and developed on their own. All configurations are self-contained modules which are deployed and developed on their own.
### Third party validation configurations ### Example validation configurations
Currently, there are two public third party validation configurations available. Here are some public validation configurations:
* Validation Configuration for [XRechnung](http://www.xoev.de/de/xrechnung): * Validation Configuration for [XRechnung](https://xeinkauf.de/xrechnung/):
* Source code is available on [GitHub](https://github.com/itplr-kosit/validator-configuration-xrechnung) * Source code is available on [GitHub](https://github.com/itplr-kosit/validator-configuration-xrechnung)
* [Releases](https://github.com/itplr-kosit/validator-configuration-xrechnung/releases) can also be downloaded * [Releases](https://github.com/itplr-kosit/validator-configuration-xrechnung/releases) can also be downloaded
* Validation Configuration for [Peppol BIS Billing](https://docs.peppol.eu/poacc/billing/3.0/):
* Source code is available on [GitHub](https://github.com/itplr-kosit/validator-configuration-bis)
* [Releases](https://github.com/itplr-kosit/validator-configuration-bis/releases) can also be downloaded
* Validation Configuration for [XGewerbeanzeige](https://xgewerbeanzeige.de/) * Validation Configuration for [XGewerbeanzeige](https://xgewerbeanzeige.de/)
* Source code is available on [GitHub](https://github.com/itplr-kosit/validator-configuration-xgewerbeanzeige) * Source code is available on [GitHub](https://github.com/itplr-kosit/validator-configuration-xgewerbeanzeige)
* [Releases](https://github.com/itplr-kosit/validator-configuration-xgewerbeanzeige/releases) can also be downloaded * [Releases](https://github.com/itplr-kosit/validator-configuration-xgewerbeanzeige/releases) can also be downloaded
## Usage ## Usage
The validator can be used in three different ways: The Validator can be used in three different ways:
* as standalone application running from the cli * as standalone application running from the CLI
* as library embedded within a custom application * as library embedded within a custom application
* as a daemon providing a http interface * as a daemon providing an http interface
### Standalone Command-Line Interface ### Standalone Command Line Interface (CLI)
**Important hint**: since v1.5.1 the filename has been changed from `validationtool-*` to `validator-*`
The general way using the CLI is: The general way using the CLI is:
```shell ```shell
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] [FILE] [FILE] [FILE] ... java -jar validator-<version>-standalone.jar -s <scenario-config-file> [-r <repository-path>]
[OPTIONS] [FILE] [FILE] [FILE] ...
``` ```
The help option displays further CLI options to customize the process: The help option displays further CLI options to customize the process:
```shell ```shell
java -jar validationtool-<version>-standalone.jar --help java -jar validator-<version>-standalone.jar --help
``` ```
A concrete example with a specific validator configuration can be found on A concrete example with a specific Validator configuration can be found on
[GitHub](https://github.com/itplr-kosit/validator-configuration-xrechnung) [validator-configuration-bis](https://github.com/itplr-kosit/validator-configuration-bis)
The [CLI documentation](./docs/cli.md) shows further configuration options. The [CLI documentation](./docs/cli.md) shows further configuration options.
### Application User Interface (API / embedded usage) ### Application User Interface (API / embedded usage)
The validator can also be used in own Java Applications via the API. An example use of the API as follows: The Validator can also be used in own Java Applications via the API. An example use of the API as follows:
```java ```java
Path scenarios = Paths.get("scenarios.xml"); URL scenarios = this.getClass().getClassLoader().getResource("scenarios.xml");
Configuration config = Configuration.load(scenarios.toUri()); Configuration config = Configuration.load(scenarios.toURI()).build(ProcessorProvider.getProcessor());
Input document = InputFactory.read(testDocument);
Check validator = new DefaultCheck(config); Check validator = new DefaultCheck(config);
Result validationResult = validator.checkInput(document);
Input document = InputFactory.read(testDocument);
Result report = validator.checkInput(document);
// examine the result here // examine the result here
``` ```
@ -84,15 +87,14 @@ Result validationResult = validator.checkInput(document);
The [API documentation](./docs/api.md) shows further configuration options. The [API documentation](./docs/api.md) shows further configuration options.
**Note:** With Java 11+, you need to include a dependency to `org.glassfish.jaxb:jaxb-runtime` in your project explicitly, **Note:** With Java 11+, you need to include a dependency to `org.glassfish.jaxb:jaxb-runtime` in your project explicitly,
as that dependency is marked `optional` in this project and as that dependency is marked `optional` in this project and will thus not be resolved transitively.
will thus not be resolved transitively.
### Daemon-Mode ### Daemon-Mode
You can also start the validator as a HTTP-Server. Just start it in _Daemon-Mode_ with the `-D` option. You can also start the validator as a HTTP-Server. Just start it in _Daemon-Mode_ with the `-D` option.
```shell ```shell
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D java -jar validator-<version>-standalone.jar -s <scenario-config-file> -D
``` ```
@ -100,9 +102,58 @@ The [daemon documentation](./docs/daemon.md) shows more usage details and furthe
## Packages ## Packages
The validator distribution contains the following artifacts: The Validator distribution contains the following artifacts:
1. **validationtool-`<version>`.jar**: Java library for embedded use within an application 1. **validator-`<version>`.jar**: Java library for embedded use within an application
1. **validationtool-`<version`>-standalone.jar**: Uber-JAR for standalone usage containing all dependencies in one jar file. This file comes with JAXB *embedded* and can be used with Java 8 and Java >= 11) 1. **validator-`<version>`-standalone.jar**: Uber-JAR for standalone usage containing all dependencies in one jar file. This file comes with JAXB *embedded* and can be used with Java >= 11)
1. **validationtool-`<version`>-java8-standalone.jar**: Uber-JAR for standalone usage with Java JDK 8 containing all dependencies in one jar file. This file file *does not* contain JAXB and depends on the bundled version of the JDK. 1. **libs/**: directory containing all (incl. optional) dependencies of the validator
1. **libs/***: directory containing all (incl. optional) dependencies of the validator
## Installation
Download from the following sources is possible:
* GitHub releases: https://github.com/itplr-kosit/validator/releases
* This release contains a ZIP file with all the different JAR variants
* Maven Central with the below coordinates (replace `x.y.z` with the actual version to use)
```xml
<dependency>
<groupId>org.kosit</groupId>
<artifactId>validator</artifactId>
<version>x.y.z</version>
</dependency>
```
To use the standalone version with Maven coordinates, add the respective classifier:
```xml
<dependency>
<groupId>org.kosit</groupId>
<artifactId>validator</artifactId>
<version>x.y.z</version>
<classifier>standalone</classifier>
</dependency>
```
## Roadmap
This section describes the next steps planned in the Validator development.
* Version 1.5.x is frozen - no maintainance, no support
* Version 1.6.x - no feature development, but maintainance and best-effort support
* Develop version 2.0.0 which will include major API incompatibilities - Winter 2025
* Rework scenarios.xml
* Rework report output engine
* Change the output type to [XVRL](https://github.com/xproc/xvrl)-based document types &rarr; this implies that existing XSL templates need to be updated
* Consider multi Schematron engine support
* Extract the daemon mode into its own submodule
* Consider extracting the CLI into its own submodule
* The release of version 2.0.0 implies a feature-freeze for version 1.6
## Authors & Acknowledgements
We are thankful to numerous third-party [contributors](https://github.com/itplr-kosit/validator/graphs/contributors).
## License
The Validator is licensed under the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0).

View file

@ -2,4 +2,4 @@
## German ## German
In seiner 23. Sitzung hat der [IT-Planungsrat](https://www.it-planungsrat.de) mit [Beschluss 2017/22 (6a)](https://www.it-planungsrat.de/SharedDocs/Sitzungen/DE/2017/Sitzung_23.html?pos=3) die [Koordinierungsstelle für IT-Standards (KoSIT)](https://www.xoev.de/) im Rahmen des Betriebs des Standards XRechnung mit der dauerhaften„…Bereitstellung eines Moduls zur Konformitätsprüfung elektronischer Rechnungen als offene Referenzimplementierung sowie …“ aller zugehöriger Artefakte beauftragt. Im Rahmen dieser Beauftragung wurde die hier bereitgestellte Software "Prüftool" (Engl. Validator) entwickelt und (vor-) konfiguriert. In seiner 23. Sitzung hat der [IT-Planungsrat](https://www.it-planungsrat.de) mit [Beschluss 2017/22 (6a)](https://www.it-planungsrat.de/SharedDocs/Sitzungen/DE/2017/Sitzung_23.html?pos=3) die [Koordinierungsstelle für IT-Standards (KoSIT)](https://xeinkauf.de/) im Rahmen des Betriebs des Standards XRechnung mit der dauerhaften„…Bereitstellung eines Moduls zur Konformitätsprüfung elektronischer Rechnungen als offene Referenzimplementierung sowie …“ aller zugehöriger Artefakte beauftragt. Im Rahmen dieser Beauftragung wurde die hier bereitgestellte Software "Prüftool" (Engl. Validator) entwickelt und (vor-) konfiguriert.

View file

@ -12,8 +12,8 @@ Then you can declare the dependency as follows:
```xml ```xml
<dependency> <dependency>
<groupId>de.kosit</groupId> <groupId>org.kosit</groupId>
<artifactId>validationtool</artifactId> <artifactId>validator</artifactId>
<version>${validator.version}</version> <version>${validator.version}</version>
</dependency> </dependency>
``` ```
@ -22,10 +22,12 @@ Then you can declare the dependency as follows:
```js ```js
dependencies { dependencies {
compile group: 'de.kosit', name: 'validationtool', version: '1.1.0' compile group: 'org.kosit', name: 'validator', version: '1.5.1'
} }
``` ```
Hint: prior to v1.5.1 the group ID was `de.kosit` and the artifact ID was `validationtool`.
## Usage ## Usage
Prerequisite for use is a valid [scenario definition](configurations.md) and the a folder with all necessary artifacts for validation (repository) either on the filesystem or on the classpath. Prerequisite for use is a valid [scenario definition](configurations.md) and the a folder with all necessary artifacts for validation (repository) either on the filesystem or on the classpath.
@ -33,34 +35,39 @@ Prerequisite for use is a valid [scenario definition](configurations.md) and the
The following example demonstrates loading scenario.xml and whole configuration from classpath and validating one XML document: The following example demonstrates loading scenario.xml and whole configuration from classpath and validating one XML document:
```java ```java
package org.kosit.validator.example; package de.kosit.validationtool.docs;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import org.w3c.dom.Document;
import de.kosit.validationtool.api.Check; import de.kosit.validationtool.api.Check;
import de.kosit.validationtool.api.Configuration; import de.kosit.validationtool.api.Configuration;
import de.kosit.validationtool.api.Input; import de.kosit.validationtool.api.Input;
import de.kosit.validationtool.api.InputFactory; import de.kosit.validationtool.api.InputFactory;
import de.kosit.validationtool.api.Result; import de.kosit.validationtool.api.Result;
import de.kosit.validationtool.impl.DefaultCheck; import de.kosit.validationtool.impl.DefaultCheck;
import org.w3c.dom.Document; import de.kosit.validationtool.impl.xml.ProcessorProvider;
/**
* Example code that is used in the docs/api.md file
*/
public class StandardExample { public class StandardExample {
public void run(Path testDocument) throws URISyntaxException { public void run(final Path testDocument) throws URISyntaxException {
// Load scenarios.xml from classpath // Load scenarios.xml from classpath
URL scenarios = this.getClass().getClassLoader().getResource("scenarios.xml"); final URL scenarios = this.getClass().getClassLoader().getResource("examples/simple/scenarios-with-relative-paths.xml");
// Load the rest of the specific Validator configuration from classpath // Load the rest of the specific Validator configuration from classpath
Configuration config = Configuration.load(scenarios.toURI()).build(); final Configuration config = Configuration.load(scenarios.toURI()).build(ProcessorProvider.getProcessor());
// Use the default validation procedure // Use the default validation procedure
Check validator = new DefaultCheck(config); final Check validator = new DefaultCheck(config);
// Validate a single document // Validate a single document
Input document = InputFactory.read(testDocument); final Input document = InputFactory.read(testDocument);
// Get Result including information about the whole validation // Get Result including information about the whole validation
Result report = validator.checkInput(document); final Result report = validator.checkInput(document);
System.out.println("Is processing succesful=" + report.isProcessingSuccessful()); System.out.println("Is processing succesful=" + report.isProcessingSuccessful());
// Get report document if processing was successful // Get report document if processing was successful
Document result = null; Document result = null;
@ -70,37 +77,41 @@ public class StandardExample {
// continue processing results... // continue processing results...
} }
public static void main(String[] args) throws Exception { public static void main(final String[] args) throws Exception {
// Use e.g. "src/test/resources/examples/simple/input/foo.xml"
if (args.length == 0) {
throw new IllegalStateException("Provide a test document filename on the commandline");
}
// Path of document for validation // Path of document for validation
Path testDoc = Paths.get(args[0]); final Path testDoc = Paths.get(args[0]);
StandardExample example = new StandardExample(); final StandardExample example = new StandardExample();
// run example validation // run example validation
example.run(testDoc); example.run(testDoc);
} }
} }
``` ```
The `Result` interface has convenience methods to retrieve details about XSD validation errors and Schematron messages and other processing results. See The `Result` interface has convenience methods to retrieve details about XSD validation errors and Schematron messages and other processing results. See
[Result.java](https://github.com/itplr-kosit/validator/blob/master/src/main/java/de/kosit/validationtool/api/Result.java) for details. [Result.java](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/api/Result.java) for details.
Initializing all XML artifacts and XSLT-executables is expensive. The `Check` instance is *threadsafe* and keeps all artifacts. Therefore, Initializing all XML artifacts and XSLT-executables is expensive. The `Check` instance is *threadsafe* and keeps all artifacts. Therefore,
we recommend the re-use of a `Check` instance. we recommend the re-use of a `Check` instance.
Beside the validator's configuration the only input are instances of [Input](https://github.com/itplr-kosit/validator/blob/master/src/main/java/de/kosit/validationtool/api/Input.java) Beside the validator's configuration the only input are instances of [Input](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/api/Input.java)
which can be created by various methods of the [InputFactory](https://github.com/itplr-kosit/validator/blob/master/src/main/java/de/kosit/validationtool/api/InputFactory.java). which can be created by various methods of the [InputFactory](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/api/InputFactory.java).
The [InputFactory](https://github.com/itplr-kosit/validator/blob/master/src/main/java/de/kosit/validationtool/api/InputFactory.java) The [InputFactory](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/api/InputFactory.java)
calculates a hash sum for each Input which is also written to the Report. _SHA-256_ from the JDK is the default algorithm. calculates a hash sum for each Input which is also written to the Report. _SHA-256_ from the JDK is the default algorithm.
It can be changed using other `read`-methods of [InputFactory](https://github.com/itplr-kosit/validator/blob/master/src/main/java/de/kosit/validationtool/api/InputFactory.java). It can be changed using other `read`-methods of [InputFactory](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/api/InputFactory.java).
The main interface [Check.java](https://github.com/itplr-kosit/validator/blob/master/src/main/java/de/kosit/validationtool/api/Check.java) The main interface [Check.java](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/api/Check.java)
allows using a batch interface (processing list of [Inputs](https://github.com/itplr-kosit/validator/blob/master/src/main/java/de/kosit/validationtool/api/Input.java)). allows using a batch interface (processing list of [Inputs](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/api/Input.java)).
However, there is no parallel processing implemented at the moment. However, there is no parallel processing implemented at the moment.
## Accept Recommendation and Accept Match ## Accept Recommendation and Accept Match
A tri-state object [AcceptRecommendation](https://github.com/itplr-kosit/validator/blob/master/src/main/java/de/kosit/validationtool/api/AcceptRecommendation.java) A tri-state object [AcceptRecommendation](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/api/AcceptRecommendation.java)
can be retrieved from the [Result](https://github.com/itplr-kosit/validator/blob/master/src/main/java/de/kosit/validationtool/api/Result.java) using `getAcceptRecommendation()`. can be retrieved from the [Result](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/api/Result.java) using `getAcceptRecommendation()`.
The three defined states are: The three defined states are:
@ -134,24 +145,34 @@ Instead of pre-configured [scenario files](configurations.md) it is possible to
A simple configuration looks like this: A simple configuration looks like this:
```java ```java
import static de.kosit.validationtool.config.ConfigurationBuilder.*; package de.kosit.validationtool.docs;
import de.kosit.validationtool.api.Configuration;
import java.net.URI;
import java.nio.file.Path;
import static de.kosit.validationtool.config.ConfigurationBuilder.fallback;
import static de.kosit.validationtool.config.ConfigurationBuilder.report;
import static de.kosit.validationtool.config.ConfigurationBuilder.scenario;
import static de.kosit.validationtool.config.ConfigurationBuilder.schema;
import static de.kosit.validationtool.config.ConfigurationBuilder.schematron;
import java.net.URI;
import java.nio.file.Paths;
import de.kosit.validationtool.api.Check;
import de.kosit.validationtool.api.Configuration;
import de.kosit.validationtool.impl.DefaultCheck;
import de.kosit.validationtool.impl.xml.ProcessorProvider;
/**
* Example code that is used in the docs/api.md file
*/
public class MyValidator { public class MyValidator {
public static void main(String[] args) { public static void main(final String[] args) {
Configuration config = Configuration.create().name("myconfiguration") final Configuration config = Configuration.create().name("myconfiguration")
.with(scenario("firstScenario") .with(scenario("firstScenario").match("//myNode").validate(schema("Sample Schema").schemaLocation(URI.create("simple.xsd")))
.match("//myNode") .validate(schematron("my rules").source("myRules.xsl")).with(report("my report").source("report.xsl")))
.validate(schema("Sample Schema").schemaLocation(URI.create("simple.xsd"))) .with(fallback().name("default-report").source("fallback.xsl")).useRepository(Paths.get("/opt/myrepository"))
.validate(schematron("my rules").source("myRules.xsl")) .build(ProcessorProvider.getProcessor());
.with(report("my report").source("report.xsl"))) final Check validator = new DefaultCheck(config);
.with(fallback().name("default-report").source("fallback.xsl"))
.useRepository(Paths.get("/opt/myrepository"))
.build();
Check validator = new DefaultCheck(config);
// .. run your checks // .. run your checks
} }
} }
@ -174,37 +195,34 @@ When using XML related technologies you are supposed to handle certain security
* disables DTD validation completely * disables DTD validation completely
* allows loading/resolving only from a configured local content repository (a specific folder) * allows loading/resolving only from a configured local content repository (a specific folder)
* tries to prevent known XML security issues (see [OWASP XML_Security_Cheat_Sheet.html](https://cheatsheetseries.owasp.org/cheatsheets/XML_Security_Cheat_Sheet.html)) * tries to prevent known XML security issues (see [OWASP XML_Security_Cheat_Sheet.html](https://cheatsheetseries.owasp.org/cheatsheets/XML_Security_Cheat_Sheet.html))
* only works with OpenJDK based XML stacks
However, you can configure certain aspects related to resolving and security yourself. The validator uses a single interface for accessing or creating the necessary XML API objects like `SchemaFactory`, `Validator`,`URIResolver` or `Processor`: [ResolvingConfigurationStrategy.java](https://github.com/itplr-kosit/validator/tree/master/src/main/java/de/kosit/validationtool/api/ResolvingConfigurationStrategy.java) However, you can configure certain aspects related to resolving and security yourself. The validator uses a single interface for accessing or creating the necessary XML API objects like `SchemaFactory`, `Validator`,`URIResolver` or `Processor`: [ResolvingConfigurationStrategy.java](https://github.com/itplr-kosit/validator/tree/main/src/main/java/de/kosit/validationtool/api/ResolvingConfigurationStrategy.java)
There are 3 implementations available out of the box: There are 3 implementations available out of the box:
1. [StrictRelativeResolvingStrategy.java](https://github.com/itplr-kosit/validator/tree/master/src/main/java/de/kosit/validationtool/impl/xml/StrictRelativeResolvingStrategy.java) 1. [StrictRelativeResolvingStrategy.java](https://github.com/itplr-kosit/validator/tree/main/src/main/java/de/kosit/validationtool/impl/xml/StrictRelativeResolvingStrategy.java)
which is the **default**, prevents known XML attacks and only allows loading from a specific local repository location which is the **default**, prevents known XML attacks and only allows loading from a specific local repository location
1. [StrictLocalResolvingStrategy.java](https://github.com/itplr-kosit/validator/tree/master/src/main/java/de/kosit/validationtool/impl/xml/StrictLocalResolvingStrategy.java) 1. [StrictLocalResolvingStrategy.java](https://github.com/itplr-kosit/validator/tree/main/src/main/java/de/kosit/validationtool/impl/xml/StrictLocalResolvingStrategy.java)
which opens the first strategy to load resources from local locations which opens the first strategy to load resources from local locations
1. [RemoteResolvingStrategy.java](https://github.com/itplr-kosit/validator/tree/master/src/main/java/de/kosit/validationtool/impl/xml/RemoteResolvingStrategy.java) 1. [RemoteResolvingStrategy.java](https://github.com/itplr-kosit/validator/tree/main/src/main/java/de/kosit/validationtool/impl/xml/RemoteResolvingStrategy.java)
which further opens the second to load resources also from remote locations via http and https which further opens the second to load resources also from remote locations via http and https
You can configure usage of one of these implementations using the `ResolvingMode` via You can configure usage of one of these implementations using the `ResolvingMode` via
````java ```java
Conifuguration config = Configuration.load(URI.create("myscenarios.xml")) final Configuration config = Configuration.load(URI.create("myscenarios.xml")).setResolvingMode(ResolvingMode.STRICT_LOCAL)
.resolvingMode(ResolvingMode.STRICT_LOCAL) .build(ProcessorProvider.getProcessor());
.build(); ```
````
If you decide to implement your own strategy, you can configure this via: If you decide to implement your own strategy, you can configure this via:
````java ```java
Conifuguration config = Configuration.load(URI.create("myscenarios.xml")) final Configuration config = Configuration.load(URI.create("myscenarios.xml"))
.resolvingStrategy(new MyCustomResolvingConfigurationStrategy()) .setResolvingStrategy(new MyCustomResolvingConfigurationStrategy()).build(ProcessorProvider.getProcessor());
.build(); ```
````
--- ---
:warning: **Attention:** If you decide to implement a custom strategy you need to handle XML security risks on your own. Please make sure, that you prevent XXE and other kind of attacks. Consider using [BaseResolvingStrategy.java](https://github.com/itplr-kosit/validator/tree/master/src/main/java/de/kosit/validationtool/impl/xml/BaseResolvingStrategy.java) and the protected methods within to disable certain features. :warning: **Attention:** If you decide to implement a custom strategy you need to handle XML security risks on your own. Please make sure, that you prevent XXE and other kind of attacks. Consider using [BaseResolvingStrategy.java](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/impl/xml/BaseResolvingStrategy.java) and the protected methods within to disable certain features.
--- ---

View file

@ -1,33 +1,54 @@
# Validator CLI # Validator Command Line Interface (CLI)
The validator comes with a commandline interface (CLI) which allows validating any number of input xml files. The `validator` comes with a command line interface (CLI) which allows validating any number of input XML files.
**Important hint**: since v1.5.1 the filename has been changed from `validationtool-*` to `validator-*`
The general way using the CLI is: The general way using the CLI is:
```shell ```shell
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] [FILE] [FILE] [FILE] ... java -jar validator-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] [FILE] [FILE] [FILE] ...
``` ```
The validator can also read the xml file from the standard input The validator can also read the XML file from the standard input
```shell script
# via redirection
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] < my-input.xml
# read from pipe
cat my-input.xml | validationtool-<version>-standalone.jar -s <scenario-config-file> [OPTIONS]
```
The help option displays further CLI options to customize the process:
```shell ```shell
java -jar validationtool-<version>-standalone.jar --help # via redirection
java -jar validator-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] < my-input.xml
# read from pipe
cat my-input.xml | validator-<version>-standalone.jar -s <scenario-config-file> [OPTIONS]
```
The help option displays further CLI options:
```shell
java -jar validator-<version>-standalone.jar --help
```
You can also use multiple scenario configurations and multiple repositories with resources for these. The validator either supports
supplying the parameters in order or using named configuration. Valid usages are
```shell
# multiple scenarios, implicit repository
java -jar validator-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> [OPTIONS] [FILE]
# multiple scenarios, single defined repository
java -jar validator-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> -r <path-to-repo> [OPTIONS] [FILE]
# multiple scenarios, multiple repositories ordered
java -jar validator-<version>-standalone.jar -s <scenario-config-file1> -r <path-to-repo1> -s <scenario-config-file2> -r <path-to-repo2> [OPTIONS] [FILE]
java -jar validator-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> -r <path-to-repo1> -r <path-to-repo2> [OPTIONS] [FILE]
# multiple scenarios, multiple repositories (named)
java -jar validator-<version>-standalone.jar -s "NAME1=<scenario-config-file1>" -s "NAME2=<scenario-config-file2>" -r "NAME1=<path-to-repo1>" -r "NAME2=<path-to-repo2>" [OPTIONS] [FILE]
``` ```
## Special features ## Special features
Besides the obvious functionality of validating, the cli provides additional functionality to customize the processing: Besides the obvious functionality of validating, the cli provides additional functionality to customize the processing:
|name | option | description | | name | option | description |
| - | - | - | | - | - | - |
| [Daemon mode](daemon.md) | `-D` | Starts the validator in daemon mode as an HTTP service | | [Daemon mode](daemon.md) | `-D` | Starts the validator in daemon mode as an HTTP service |
| print mode | `-p` | Print the report to stdout | | print mode | `-p` | Print the report to stdout |
@ -35,12 +56,11 @@ Besides the obvious functionality of validating, the cli provides additional fun
| print memory stats | `-m` | Prints some memory usage information. Mainly for debugging purposes on processing huge xml files | | print memory stats | `-m` | Prints some memory usage information. Mainly for debugging purposes on processing huge xml files |
| check assertions | `-c <file>` | Check assertions on the generated reports. This is mainly useful for scenario developers. Ask KoSIT for documentation, if you want to use this feauture | | check assertions | `-c <file>` | Check assertions on the generated reports. This is mainly useful for scenario developers. Ask KoSIT for documentation, if you want to use this feauture |
## Return codes ## Return codes
| code | description | | code | description |
|-|-| |-|-|
| 0 | All validated xml files are acceptable according to the scenario configurations | | 0 | All validated xml files are acceptable according to the scenario configurations or application usage was requested |
| positive integer | Number of rejected (e.g. not acceptable) xml files according to the scenario configurations| | positive integer | Number of rejected (e.g. not acceptable) xml files according to the scenario configurations|
| -1 | Parsing error. The commandline arguments specified are incorrect | | -1 | Parsing error. The commandline arguments specified are incorrect |
| -2 | Configuration error. There is an error loading the configuration and/or validation targets | | -2 | Configuration error. There is an error loading the configuration and/or validation targets |

View file

@ -8,8 +8,10 @@ and should work with OpenJDK based distributions. Keep this in mind, if you want
To use the validator daemon as is, start the _Daemon-Mode_ with the `-D` option and supply a suitable To use the validator daemon as is, start the _Daemon-Mode_ with the `-D` option and supply a suitable
[validator configuration](configurations.md). [validator configuration](configurations.md).
**Important hint**: since v1.5.1 the filename has been changed from `validationtool-*` to `validator-*`
```shell ```shell
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D java -jar validator-<version>-standalone.jar -s <scenario-config-file> -D
``` ```
Per default the HTTP-Server listens on _localhost_ at Port 8080. Per default the HTTP-Server listens on _localhost_ at Port 8080.
@ -17,7 +19,7 @@ Per default the HTTP-Server listens on _localhost_ at Port 8080.
You can configure the daemon with `-H` for IP Adress and `-P` for port number: You can configure the daemon with `-H` for IP Adress and `-P` for port number:
```shell ```shell
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D -H 192.168.1.x -P 8081 java -jar validator-<version>-standalone.jar -s <scenario-config-file> -D -H 192.168.1.x -P 8081
``` ```
## Customized usage ## Customized usage
@ -122,6 +124,10 @@ The validation service can be integrated in monitoring solutions like `Icinga` o
## GUI ## GUI
| :warning: The GUI is just for Show Casing and not to be used in production environments |
|---|
The daemon provides a simple GUI when issuing `GET` requests providing the following: The daemon provides a simple GUI when issuing `GET` requests providing the following:
1. usage information 1. usage information
@ -131,5 +137,5 @@ The daemon provides a simple GUI when issuing `GET` requests providing the follo
The GUI can be disabled using the API (see above) or via CLI: The GUI can be disabled using the API (see above) or via CLI:
```shell script ```shell script
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D --disable-gui java -jar validator-<version>-standalone.jar -s <scenario-config-file> -D --disable-gui
``` ```

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- <!--
~ Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) ~ Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
~ ~
~ Licensed under the Apache License, Version 2.0 (the "License"); ~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License. ~ you may not use this file except in compliance with the License.

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
~ Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) ~ Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
~ ~
~ Licensed under the Apache License, Version 2.0 (the "License"); ~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License. ~ you may not use this file except in compliance with the License.
@ -21,6 +21,6 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.kosit.validationtool</groupId> <groupId>de.kosit.validationtool</groupId>
<artifactId>packaged-test-scenarios</artifactId> <artifactId>packaged-test-scenarios</artifactId>
<version>1.0.1</version> <version>1.0.2</version>
<description>POM was created from install:install-file</description> <description>POM was created from install:install-file</description>
</project> </project>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
~ Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) ~ Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
~ ~
~ Licensed under the Apache License, Version 2.0 (the "License"); ~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License. ~ you may not use this file except in compliance with the License.
@ -19,10 +19,10 @@
<groupId>de.kosit.validationtool</groupId> <groupId>de.kosit.validationtool</groupId>
<artifactId>packaged-test-scenarios</artifactId> <artifactId>packaged-test-scenarios</artifactId>
<versioning> <versioning>
<release>1.0.1</release> <release>1.0.2</release>
<versions> <versions>
<version>1.0.1</version> <version>1.0.2</version>
</versions> </versions>
<lastUpdated>20200507064929</lastUpdated> <lastUpdated>20201007064929</lastUpdated>
</versioning> </versioning>
</metadata> </metadata>

5
owasp-suppressions.xml Normal file
View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
</suppressions>

374
pom.xml
View file

@ -1,29 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!--
~ Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<name>KoSIT XML Prüftool Implementierung</name> <name>KoSIT XML Validator</name>
<groupId>de.kosit</groupId> <groupId>org.kosit</groupId>
<version>1.4.2</version> <artifactId>validator</artifactId>
<version>1.6.3-SNAPSHOT</version>
<artifactId>validationtool</artifactId>
<description>KoSIT XML Validator against XSD and Schematron based on defined scenarios.</description> <description>KoSIT XML Validator against XSD and Schematron based on defined scenarios.</description>
<developers> <developers>
<!-- In alphabetical order by last name --> <!-- In alphabetical order by last name -->
@ -31,13 +15,13 @@
<id>fabian.buettner</id> <id>fabian.buettner</id>
<name>Fabian Büttner</name> <name>Fabian Büttner</name>
<organization>KoSIT</organization> <organization>KoSIT</organization>
<organizationUrl>http://www.xoev.de</organizationUrl> <organizationUrl>https://xoev.de/</organizationUrl>
</developer> </developer>
<developer> <developer>
<id>renzo.kottmann</id> <id>renzo.kottmann</id>
<name>Renzo Kottmann</name> <name>Renzo Kottmann</name>
<organization>KoSIT</organization> <organization>KoSIT</organization>
<organizationUrl>http://www.xoev.de</organizationUrl> <organizationUrl>https://xeinkauf.de</organizationUrl>
<roles> <roles>
<role>Product Owner</role> <role>Product Owner</role>
</roles> </roles>
@ -54,18 +38,40 @@
</developers> </developers>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.jacoco>0.8.7</version.jacoco> <version.assertj>3.27.7</version.assertj>
<version.jaxb>2.3.4</version.jaxb> <version.commons-io>2.21.0</version.commons-io>
<version.lombok>1.18.20</version.lombok> <version.commons-lang>3.20.0</version.commons-lang>
<version.saxon-he>9.9.1-7</version.saxon-he> <version.jacoco>0.8.13</version.jacoco>
<version.slf4j>1.7.25</version.slf4j> <version.jaxb-api>4.0.4</version.jaxb-api>
<version.jaxb-impl>4.0.6</version.jaxb-impl>
<version.lombok>1.18.42</version.lombok>
<version.mockito>5.21.0</version.mockito>
<version.owasp-dependency-check>12.1.8</version.owasp-dependency-check>
<!-- 6.0.0 requires Java 17+ -->
<version.rest-assured>5.5.7</version.rest-assured>
<version.saxon-he>12.9</version.saxon-he>
<version.slf4j>2.0.17</version.slf4j>
<version.jaxb-maven-plugin>4.0.11</version.jaxb-maven-plugin>
</properties> </properties>
<repositories> <repositories>
<repository> <repository>
<id>project.local</id> <id>project.local</id>
<name>project</name> <name>project</name>
<url>file:${project.basedir}/libs</url> <url>file:${project.basedir}/libs</url>
</repository> </repository>
<repository>
<name>Central Portal Snapshots</name>
<id>central-portal-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
@ -75,27 +81,26 @@
<version>${version.lombok}</version> <version>${version.lombok}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>${version.saxon-he}</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>${version.slf4j}</version> <version>${version.slf4j}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-cli</groupId> <groupId>net.sf.saxon</groupId>
<artifactId>commons-cli</artifactId> <artifactId>Saxon-HE</artifactId>
<version>1.4</version> <version>${version.saxon-he}</version>
</dependency>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.7.7</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.fusesource.jansi</groupId> <groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId> <artifactId>jansi</artifactId>
<version>1.18</version> <version>2.4.2</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
@ -108,50 +113,54 @@
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.10</version> <version>${version.commons-lang}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.glassfish.jaxb</groupId> <groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId> <artifactId>jaxb-runtime</artifactId>
<version>${version.jaxb}</version> <version>${version.jaxb-impl}</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${version.jaxb-api}</version>
</dependency>
<dependency> <dependency>
<groupId>org.assertj</groupId> <groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId> <artifactId>assertj-core</artifactId>
<version>3.16.1</version> <version>${version.assertj}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.13.1</version> <version>4.13.2</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.7</version> <version>${version.commons-io}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.rest-assured</groupId> <groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId> <artifactId>rest-assured</artifactId>
<version>4.3.1</version> <version>${version.rest-assured}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId> <artifactId>mockito-core</artifactId>
<version>3.3.3</version> <version>${version.mockito}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.kosit.validationtool</groupId> <groupId>de.kosit.validationtool</groupId>
<artifactId>packaged-test-scenarios</artifactId> <artifactId>packaged-test-scenarios</artifactId>
<version>1.0.1</version> <version>1.0.2</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
@ -166,11 +175,68 @@
</resource> </resource>
</resources> </resources>
<pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.10.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.8</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- for PR 152 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<propertiesEncoding>ISO-8859-1</propertiesEncoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.4.0</version>
<executions>
<execution>
<id>copy-license-notice</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>NOTICE</include>
</includes>
</resource>
</resources>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId> <artifactId>build-helper-maven-plugin</artifactId>
<version>3.1.0</version> <version>3.6.1</version>
<executions> <executions>
<execution> <execution>
<id>reserve-network-port</id> <id>reserve-network-port</id>
@ -190,7 +256,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId> <artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version> <version>3.6.1</version>
<executions> <executions>
<execution> <execution>
<id>enforce-versions</id> <id>enforce-versions</id>
@ -200,8 +266,19 @@
<configuration> <configuration>
<rules> <rules>
<requireMavenVersion> <requireMavenVersion>
<version>[3.3.9,)</version> <!-- minimum for OWASP check-->
<version>[3.6.3,)</version>
</requireMavenVersion> </requireMavenVersion>
<requireJavaVersion>
<!-- Required for "-proc:full" required for Lombok:
Any Java 11 (LTS) >= 11.0.23
No Java 12 to 16
Any Java 17 (LTS) >= 17.0.11
No Java 18 to 20
Any Java 21 or higher
-->
<version>[11.0.23,12),[17.0.11,18),[21,)</version>
</requireJavaVersion>
</rules> </rules>
</configuration> </configuration>
</execution> </execution>
@ -210,78 +287,69 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <version>3.14.0</version>
<configuration> <configuration>
<source>1.8</source> <release>11</release>
<target>1.8</target>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
<!-- This is required for Lombok only since JDK 23
Was backported to 17.0.11 and 11.0.23.
See: https://inside.java/2024/06/18/quality-heads-up/
-->
<proc>full</proc>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version> <version>3.6.1</version>
<executions> <executions>
<execution> <execution>
<id>jdk11+</id>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>shade</goal> <goal>shade</goal>
</goals> </goals>
<configuration> <configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<shadedArtifactAttached>true</shadedArtifactAttached> <shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>standalone</shadedClassifierName> <shadedClassifierName>standalone</shadedClassifierName>
<transformers> <transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>de.kosit.validationtool.cmd.CommandLineApplication</mainClass> <mainClass>de.kosit.validationtool.cmd.CommandLineApplication</mainClass>
</transformer> </transformer>
</transformers>
<filters> <!--
<filter> Some open source producers (including the Apache Software Foundation) include a copy of their
<artifact>*:*</artifact> license in the META-INF directory. These are conventionally named either LICENSE,LICENSE.txt
<excludes> or LICENSE.md. When merging these dependencies, adding these resources may cause confusion.
<exclude>META-INF/*.SF</exclude> The ApacheLicenseResourceTransformer ensures that duplicate licenses (named according to this
<exclude>META-INF/*.DSA</exclude> convention) are not merged.
<exclude>META-INF/*.RSA</exclude> Technically it simply avoids adding them into the final JAR.
<exclude>**/module-info.class</exclude> We don't need the detailed licensed in the shaded JAR.
</excludes> -->
</filter> <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
</filters>
</configuration> <!--
</execution> Some licenses (including the Apache License, Version 2) require that notices are preserved by
<execution> downstream distributors. ApacheNoticeResourceTransformer automates the assembly of an
<id>jdk8</id> appropriate NOTICE.
<phase>package</phase> Technically it merges all NOTICE files together
<goals> -->
<goal>shade</goal> <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
</goals> <addHeader>false</addHeader>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>java8-standalone</shadedClassifierName>
<artifactSet>
<excludes>
<exclude>org.glassfish.jaxb:jaxb-runtime</exclude>
<exclude>com.sun.istack:istack-commons-runtime</exclude>
<exclude>com.sun.xml.fastinfoset:FastInfoset</exclude>
<exclude>jakarta.activation:jakarta.activation-api</exclude>
<exclude>jakarta.xml.bind:jakarta.xml.bind-api</exclude>
<exclude>org.jvnet.staxex:stax-ex</exclude>
<exclude>org.glassfish.jaxb:txw2</exclude>
</excludes>
</artifactSet>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>de.kosit.validationtool.cmd.CommandLineApplication</mainClass>
</transformer> </transformer>
</transformers> </transformers>
<filters> <filters>
<filter> <filter>
<artifact>*:*</artifact> <artifact>*:*</artifact>
<excludes> <excludes>
<!-- E.g. MANIFEST.MF -->
<exclude>META-INF/*.MF</exclude>
<!-- Required for JAR signing artefacts -->
<exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude> <exclude>META-INF/*.RSA</exclude>
<!-- We're breaking the Java module system -->
<exclude>**/module-info.class</exclude> <exclude>**/module-info.class</exclude>
</excludes> </excludes>
</filter> </filter>
@ -294,7 +362,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version> <version>3.7.1</version>
<executions> <executions>
<execution> <execution>
<id>full_dist</id> <id>full_dist</id>
@ -317,9 +385,9 @@
<!-- Generate model classes --> <!-- Generate model classes -->
<plugin> <plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId> <groupId>org.jvnet.jaxb</groupId>
<artifactId>maven-jaxb2-plugin</artifactId> <artifactId>jaxb-maven-plugin</artifactId>
<version>0.14.0</version> <version>${version.jaxb-maven-plugin}</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@ -337,20 +405,12 @@
</args> </args>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.jvnet.jaxb2_commons</groupId> <groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb2-basics</artifactId> <artifactId>jaxb-plugins</artifactId>
<version>0.11.1</version> <version>${version.jaxb-maven-plugin}</version>
</plugin> </plugin>
</plugins> </plugins>
</configuration> </configuration>
<dependencies>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>${version.jaxb}</version>
<optional>true</optional>
</dependency>
</dependencies>
</plugin> </plugin>
<!-- Integrate code coverage --> <!-- Integrate code coverage -->
@ -412,17 +472,23 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version> <version>3.5.3</version>
<configuration> <configuration>
<!--suppress MavenModelInspection --> <!--suppress MavenModelInspection -->
<argLine>-Dfile.encoding=UTF-8 ${jacocoSurefire}</argLine> <argLine>-Dfile.encoding=UTF-8 ${jacocoSurefire}</argLine>
<systemProperties>
<property>
<name>java.net.useSystemProxies</name>
<value>true</value>
</property>
</systemProperties>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>3.1.0</version> <version>3.3.1</version>
<executions> <executions>
<execution> <execution>
<id>attach-sources</id> <id>attach-sources</id>
@ -436,7 +502,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId> <artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version> <version>3.1.1</version>
<configuration> <configuration>
<tagNameFormat>v@{project.version}</tagNameFormat> <tagNameFormat>v@{project.version}</tagNameFormat>
</configuration> </configuration>
@ -445,7 +511,7 @@
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version> <version>3.6.2</version>
<executions> <executions>
<execution> <execution>
<id>run</id> <id>run</id>
@ -456,14 +522,19 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<inheritIo>true</inheritIo>
<!-- have to catch exit codes, cause daemon throws 1 if shutdown is not proper-->
<successCodes>0,1</successCodes>
<executable>java</executable> <executable>java</executable>
<longClasspath>false</longClasspath> <longClasspath>false</longClasspath>
<async>true</async> <async>true</async>
<asyncDestroyOnShutdown>true</asyncDestroyOnShutdown> <asyncDestroyOnShutdown>true</asyncDestroyOnShutdown>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
<arguments> <arguments>
<!--suppress MavenModelInspection --> <!--suppress MavenModelInspection -->
<argument>${jacocoFailsafe}</argument> <argument>${jacocoFailsafe}</argument>
<argument>-Xmx256m</argument> <argument>-Xmx128m</argument>
<argument>-classpath</argument> <argument>-classpath</argument>
<classpath /> <classpath />
<argument>de.kosit.validationtool.cmd.CommandLineApplication</argument> <argument>de.kosit.validationtool.cmd.CommandLineApplication</argument>
@ -482,12 +553,12 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version> <version>3.1.0</version>
<configuration> <configuration>
<target> <target>
<!-- schlafen um den Start des Daemon abzuwarten --> <!-- schlafen um den Start des Daemon abzuwarten -->
<sleep seconds="10" /> <sleep seconds="10" />
<echo>${jacoco.tcp.port}</echo> <echo>jacoco.tcp.port=${jacoco.tcp.port}</echo>
</target> </target>
</configuration> </configuration>
<executions> <executions>
@ -503,7 +574,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.1</version> <version>3.5.3</version>
<executions> <executions>
<execution> <execution>
<id>test-it</id> <id>test-it</id>
@ -522,9 +593,9 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version> <version>3.11.2</version>
<configuration> <configuration>
<source>8</source> <source>11</source>
<doclint>none</doclint> <doclint>none</doclint>
</configuration> </configuration>
<executions> <executions>
@ -571,8 +642,8 @@
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions> <executions>
<execution> <execution>
<id>sign-artifacts</id> <id>sign-artifacts</id>
@ -583,18 +654,58 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>owasp-check</id>
<build>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${version.owasp-dependency-check}</version>
<configuration>
<!-- Specifies if the build should be failed if a CVSS score
above a specified level is identified.
The default is 11 which means since the CVSS scores are 0-10,
by default the build will never fail.-->
<failBuildOnCVSS>0</failBuildOnCVSS>
<suppressionFiles>
<suppressionFile>${project.basedir}/owasp-suppressions.xml</suppressionFile>
</suppressionFiles>
<!-- ref to CI CD variable -->
<nvdApiKey>${NVD_API_KEY}</nvdApiKey>
</configuration>
<executions>
<execution>
<phase>
validate
</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile> <profile>
<id>format</id> <id>format</id>
<activation><activeByDefault>false</activeByDefault></activation> <activation>
<activeByDefault>false</activeByDefault>
</activation>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>net.revelc.code.formatter</groupId> <groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId> <artifactId>formatter-maven-plugin</artifactId>
<version>2.12.2</version> <version>2.13.0</version>
<executions> <executions>
<execution> <execution>
<id>maven-formatting</id> <id>maven-formatting</id>
@ -611,6 +722,17 @@
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile>
<id>release-snapshot</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles> </profiles>
<reporting> <reporting>
@ -620,12 +742,14 @@
</reporting> </reporting>
<scm> <scm>
<connection>https://github.com/itplr-kosit/validationtool.git</connection> <connection>scm:git:https://github.com/itplr-kosit/validator.git</connection>
<developerConnection>scm:git:https://projekte.kosit.org/kosit/validator.git</developerConnection> <developerConnection>scm:git:https://projekte.kosit.org/kosit/validator.git</developerConnection>
<tag>v1.4.2</tag> <tag>release/1.6.x</tag>
<url>https://github.com/itplr-kosit/validator</url> <url>https://github.com/itplr-kosit/validator</url>
</scm> </scm>
<url>https://github.com/itplr-kosit/validator</url> <url>https://github.com/itplr-kosit/validator</url>
<licenses> <licenses>
<license> <license>
<name>Apache License, Version 2.0</name> <name>Apache License, Version 2.0</name>
@ -633,12 +757,4 @@
<distribution>repo</distribution> <distribution>repo</distribution>
</license> </license>
</licenses> </licenses>
<distributionManagement>
<repository>
<id>sonatype-nexus-staging</id>
<name>Nexus Release Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>
</project> </project>

18
server/ui/.eslintignore Normal file
View file

@ -0,0 +1,18 @@
**/build/
**/dist/
**/coverage/
**/.nyc_output
**/.husky
**/.vscode
**/.webpack
packages/electron/out
**/node_modules/
**/tmp/
**/package-lock.json
**/pnpm-lock.yaml
**/yarn.lock
**/package.json
**/tsconfig.json
**/*.html
packages/*/types
.docusaurus

55
server/ui/.eslintrc Normal file
View file

@ -0,0 +1,55 @@
{
"plugins": ["prettier", "@typescript-eslint/eslint-plugin", "react"],
"extends": [
"airbnb",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended"
],
"rules": {
"indent": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/consistent-type-imports": [
"error",
{ "prefer": "type-imports" }
],
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off",
"react/jsx-filename-extension": "off",
"react/jsx-one-expression-per-line": "off",
"react/function-component-definition": "off",
"react/jsx-no-useless-fragment": "off",
"import/extensions": "off",
"import/no-unresolved": "off",
"no-console": "warn",
"no-shadow": "off",
"no-continue": "off",
"no-restricted-syntax": "off",
"@typescript-eslint/no-shadow": ["error"],
"import/no-relative-packages": "off"
},
"env": {
"es6": true,
"browser": true,
"node": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"settings": {
"react": {
"version": "17.0"
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
}
}
}
}

20
server/ui/.gitignore vendored Normal file
View file

@ -0,0 +1,20 @@
# Dependencies
/node_modules
# Production
/build
# Generated files
.docusaurus
.cache-loader
# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

20
server/ui/.prettierignore Normal file
View file

@ -0,0 +1,20 @@
**/build/
**/dist/
**/build/
**/coverage/
**/.nyc_output
**/.husky
**/.vscode
**/.webpack
packages/electron/out
**/node_modules/
**/tmp
**/package-lock.json
**/pnpm-lock.yaml
**/yarn.lock
**/package.json
packages/*/types
**/*.yaml
**/*.yml
docs
.docusaurus

6
server/ui/.prettierrc.js Normal file
View file

@ -0,0 +1,6 @@
module.exports = {
trailingComma: "all",
useTabs: true,
proseWrap: "always",
endOfLine: "auto",
};

27
server/ui/README.md Normal file
View file

@ -0,0 +1,27 @@
# Website
This folder contains the ui, served by the daemon version of the validator. At
the moment, this is generated within this module and copied to the actual source
location of the daemon. There are plans to modularize the whole validator source
in the future so that this will be done by build process.
This ui is built using [Docusaurus 3](https://docusaurus.io/), a modern static
website generator.
### Local Development
```shell
$ npm start
```
This command starts a local development server and opens up a browser window.
Most changes are reflected live without having to restart the server.
### Build
```shell
$ npm run build
```
This command generates static content into the `build` directory and must be
copied to `src/main/resources/ui`

View file

@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};

51
server/ui/docs/api.md Normal file
View file

@ -0,0 +1,51 @@
---
sidebar_position: 2
---
# API Usage
The validation service listens to `POST`-requests to any server uri. You need to supply the xml/object to validate in
the post body.
The service expects a single plain input in the post body, e.g. `multipart/form-data` is not supported.
Examples:
* `cURL`
```shell script
curl --location --request POST 'http://localhost:8080' \
--header 'Content-Type: application/xml' \
--data-binary '@/target.xml'
```
* `Java` (Apache HttpClient)
```java
HttpClient httpClient=HttpClientBuilder.create().build();
HttpPost postRequest=new HttpPost("http://localhost:8080/");
FileEntity entity=new FileEntity(Paths.get("some.xml").toFile(),ContentType.APPLICATION_XML);
postRequest.setEntity(entity);
HttpResponse response=httpClient.execute(postRequest);
System.out.println(IOUtils.toString(response.getEntity().getContent()));
```
* `JavaScript`
```javascript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/xml");
var file = "<file contents here>";
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: file,
redirect: 'follow'
};
fetch("http://localhost:8080", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
```

250
server/ui/docs/changelog.md Normal file
View file

@ -0,0 +1,250 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## 1.6.0
### Fixed
- (DOC) [GitHub PR#166](https://github.com/itplr-kosit/validator/pull/166) Fixed broken links in `docs/api.md`
### Changed
- (CORE) Migration from javax to jakarta xml bind
- (DOC) [GitHub PR#132](https://github.com/itplr-kosit/validator/pull/132) Updated the link to the example Validator scenario configuration
### Removed
- (CORE) java 8 support. new default jdk 11
## 1.5.2 - 2025-09-01
### Fixed
- (BUILD) [#148](https://projekte.kosit.org/kosit/validator/-/issues/148) Regression that due to renaming from `validationtool` to `validator` the distribution zip did not contain all jars anymore
## 1.5.1 - 2025-09-01
### Fixed
- (CORE) [#130](https://projekte.kosit.org/kosit/validator/-/issues/130) Check result to stdout causes an exception. This also fixes [GitHub #131](https://github.com/itplr-kosit/validator/issues/131)
- (CORE) [#131](https://projekte.kosit.org/kosit/validator/-/issues/131) `UnsupportedOperationException` because of read-only list. This also fixes [GitHub #136](https://github.com/itplr-kosit/validator/issues/136)
- (CLI) [#104](https://projekte.kosit.org/kosit/validator/-/issues/104) made the usage of the `-r` parameter optional, if only one unnamed scenario is used
- (CLI) [#145](https://projekte.kosit.org/kosit/validator/-/issues/145) If the CLI is invoked without any parameter, the usage is shown twice
- (DOC) [#129](https://projekte.kosit.org/kosit/validator/-/issues/129) API documentation is outdated. This also fixes [GitHub #130](https://github.com/itplr-kosit/validator/issues/130)
- (BUILD) [#62](https://projekte.kosit.org/kosit/validator/-/issues/62) Surefire Test Error running `de.kosit.validationtool.impl.xml.RemoteResolvingStrategyTest` fails without `http.proxy` setting
- (BUILD) [#110](https://projekte.kosit.org/kosit/validator/-/issues/110) reactivated the GitLab CI environment
### Added
- (BUILD) [#140](https://projekte.kosit.org/kosit/validator/-/issues/140) prepare pom.xml to be able to release to Maven Central
- (BUILD) [#144](https://projekte.kosit.org/kosit/validator/-/issues/144) created a Maven profile to release on Maven Central
### Changed
- (CORE) [#109](https://projekte.kosit.org/kosit/validator/-/issues/109) dependencies were updated to the latest Java 1.8 compatible versions
- Bump [Saxon HE](https://www.saxonica.com/documentation11/documentation.xml) to 12.8
- Bump [jaxb-ri](https://github.com/eclipse-ee4j/jaxb-ri) to 2.3.9
- Bump [SLF4J](https://www.slf4j.org/) to 2.0.17
- (CORE) [#136](https://projekte.kosit.org/kosit/validator/-/issues/136) removed IDE project folders from git
- (BUILD) [#135](https://projekte.kosit.org/kosit/validator/-/issues/135) protected specific git branches
- (BUILD) [#137](https://projekte.kosit.org/kosit/validator/-/issues/137) GitLab CI should only run on Java LTS versions as well as the latest Java version
- (BUILD) [#147](https://projekte.kosit.org/kosit/validator/-/issues/147) Change Maven coordinates from `de.kosit:validationtool` to `org.kosit:validator`
## 1.5.0
### Fixed
- (CLI) [#93](https://projekte.kosit.org/kosit/validator/-/issues/93) Remove usage information, when validation failed
- (CLI) [#95](https://projekte.kosit.org/kosit/validator/-/issues/95) NPE when using empty repository definition (-r "")
- (CORE) [GitHub #101](https://github.com/itplr-kosit/validator/issues/101) Role is null in FailedAssert
### Added
- (CLI) Support for multiple configurations and multiple repositories. See [cli documentation](docs/cli.md) for details
- (API) Possibility to use preconfigured Saxon `Processor` instance for validation
### Changed
- (CORE) [GitHub #100](https://github.com/itplr-kosit/validator/issues/100) Make createReport optional
- (DAEMON) UI rewrite based on [Docusaurs](https://docusaurus.io)
- (API) [ResolvingConfigurationStrategy.java#getProcessor()](de/kosit/validationtool/api/ResolvingConfigurationStrategy) is removed.
- (CORE) Bump [Saxon HE](https://www.saxonica.com/documentation11/documentation.xml) to 11.4
- (CORE) Bump [jaxb-ri](https://github.com/eclipse-ee4j/jaxb-ri) to 2.3.7
- (CORE) Various other dependency updates. See pom.xml
- (CORE) CLI parsing based on pico-cli, commons-cli is removed
## 1.4.2
### Fixed
- (CLI) [#74](https://projekte.kosit.org/kosit/validator/-/issues/74) fix ansi output of the cli version
- [#80](https://github.com/itplr-kosit/validator/issues/80) using classloader to initialize jaxb context (to support
usage in OSGi
environments)
- [#75](https://github.com/itplr-kosit/validator/issues/75) Improve logging on invalid documents
## 1.4.1
### Fixed
- Allow more than 3 customLevel elements in scenarios (see xrechnung
configuration [issue 49](https://github.com/itplr-kosit/validator-configuration-xrechnung/issues/49))
- Remove saxon signature from java8 uber-jar (see [67](https://github.com/itplr-kosit/validator/issues/67))
## 1.4.0
### Fixed
- date conversion when
using [ConfigurationBuilder#date(Date)](https://github.com/itplr-kosit/validator/blob/d7beb1040418ae5cbeb9427532fd87482f55756c/src/main/java/de/kosit/validationtool/config/ConfigurationBuilder.java#L109)
- (CLI) [#51](https://github.com/itplr-kosit/validator/issues/51) Suffix of report xml is missing
- [#53](https://github.com/itplr-kosit/validator/issues/53) Fix copyright and licensing information
- [#56](https://github.com/itplr-kosit/validator/issues/56) `namespace` element content needs trimming
- [DAEMON] [#57](https://github.com/itplr-kosit/validator/issues/57) Reading large inputs correctly
### Added
- read saxon XdmNode with InputFactory
- (CLI) custom output without the various log messages
- (CLI) options to set the log level (`-X` = full debug output, `-l <level>` set a specific level)
- (CLI) return code is not 0 on rejected results
- (CLI) read (single) test target from stdin
- [DAEMON] name inputs via request URI
### Changed
- InputFactory has methods to read any java.xml.transform.Source as Input not only StreamSources
- InputFactory uses a generated UUID as name for SourceInput, if no "real" name can be derived
- saxon dependency update (minor, 9.9.1-7)
- [DAEMON] proper status codes when returning results (see [daemon documentation](./docs/daemon.md#status-codes))
## 1.3.1
### Fixed
- `getFailedAsserts()` and `isSchematronValid()`
in [DefaultResult.java](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/impl/DefaultResult.java)
do not reflect actual schematron validation result
- processing aborts on schematron execution errors (e.g. errors within schematron logic). The validator now generates a
report in such cases.
- exception while resolving when using XSLT's `unparsed-text()` function within report generation
### Added
- (CLI) summary report
### Changed
- engine info contains version number of the validator (configurations can output this in the report for maintainance
puposes)
- options to customize serialized report file names (cmdline only) via `--report-prefix` and `--report-postfix`
- remove unused dependency Apache Commons HTTP
## 1.3.0
### Added
- Added a builder style configuration API to configure scenarios
- Added an option to configure xml security e.g. to load from http sources or not from a specific repository
(so loading is configurable less restrictive, default strategy is to only load from a local repository)
- Support java.xml.transform.Source as Input
### Changed
- Inputs are NOT read into memory (e.g. Byte-Array) prior processing within the validator. This reduces memory
consumption.
- Overall processing of xml files is based on Saxon s9api. No JAXP or SAX classes are used by
the validator (this further improves performance and memory consumption)
### Deprecations
- CheckConfiguration is deprecated now. Use Configuration.load(...) or Configuration.build(...)
## 1.2.1
### Fixed
- Validator is creating invalid createReportInput xml in case of no scenario match
## 1.2.0
### Added
- Provide access to schematron result
through [Result.java](https://github.com/itplr-kosit/validator/blob/main/src/main/java/de/kosit/validationtool/api/Result.java)
- _Result#getFailedAsserts()_ returns a list of failed asserts found by schematron
- _Result#isSchematronValid()_ convinience access to evaluate whether schematron was processed without any _
FailedAsserts_
### Changed
- _Result#getAcceptRecommendation()_ does not _only_ work when _acceptMatch_ is configured in the scenario
- schema correctness is a precondition, if the checked instance is not valid, this evaluates to _REJECTED_
- if _acceptMatch_ is configured, the result is based on the boolean result of the xpath expression evaluated against
the generated report
- if _no_ _acceptMatch_ is configured, the result is based on evaluation of schema and schematron correctness
- _UNDEFINED_ is only returned, when processing is stopped somehow
- _Result#isAcceptable()_ can now evaluate to true, when no _acceptMatch_ is configured (see above)
## 1.1.3
### Fixed
- XXE vulnerability when reading xml documents with Saxon [#44](https://github.com/itplr-kosit/validator/issues/44)
- validator unintentionally stopped when schematron processing has errors.
See [#41](https://github.com/itplr-kosit/validator/issues/41).
## 1.1.2
### Fixed
- NPE in Result.getReportDocument for malformed xml input
## 1.1.1
### Added
- Convenience method for accessing information about well-formedness in Result
- Convenience method for accessing information about schema validation result in Result
### Fixed
- NPE when validating non-XML files
## 1.1.0
### Added
- Enhanced API-Usage e.g. return _Result_ object with processing information
- Support loading scenarios and content from a JAR-File
- Simple Daemon-Mode exposing validation functionality via http
- cli option to serialize the 'report input' xml document to _cwd_ (current working directory)
- Documentation in `docs` folder
### Changed
- Use s9api (e.g. XdmNode) internally for loading and holding xml objects (further memory optimization)
- Builds with java 8 and >= 11
- Packages for java8 and java >= 11 (with jaxb included)
- Translated README.md
## 1.0.2
### Fixed
- Memory issues when validating multiple targets
## 1.0.1
### Changed
- Removed XRechnung configuration from release artifacts and source (moved
to [own repository](https://github.com/itplr-kosit/validator-configuration-xrechnung) )
## 1.0.0
- Initial Release

View file

@ -0,0 +1,24 @@
---
sidebar_position: 1
---
# Configurations
The validator needs a scenario configuration for working properly.
Here are some public validation configurations:
* Validation Configuration for [XRechnung](https://xeinkauf.de/xrechnung/):
* Source code is available on [GitHub](https://github.com/itplr-kosit/validator-configuration-xrechnung)
* [Releases](https://github.com/itplr-kosit/validator-configuration-xrechnung/releases) can also be downloaded
* Validation Configuration for [Peppol BIS Billing](https://docs.peppol.eu/poacc/billing/3.0/):
* Source code is available on [GitHub](https://github.com/itplr-kosit/validator-configuration-bis)
* [Releases](https://github.com/itplr-kosit/validator-configuration-bis/releases) can also be downloaded
* Validation Configuration for [XGewerbeanzeige](https://xgewerbeanzeige.de/)
* Source code is available on [GitHub](https://github.com/itplr-kosit/validator-configuration-xgewerbeanzeige)
* [Releases](https://github.com/itplr-kosit/validator-configuration-xgewerbeanzeige/releases) can also be downloaded
For creating custom configurations
see [configuration documentation](https://github.com/itplr-kosit/validator/blob/main/docs/configurations.md)
for details

View file

@ -0,0 +1,184 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/*
* Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const lightCodeTheme = require("prism-react-renderer").themes.github;
const darkCodeTheme = require("prism-react-renderer").themes.dracula;
const pkg = require("./package.json");
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "KoSIT Validator Daemon",
tagline: "Validating any XML",
url: "https://your-docusaurus-test-site.com",
baseUrl: "/",
onBrokenLinks: "log",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.svg",
customFields: {
// We fake a base endpoint here, so that our proxy works in development mode.
// It does not seem to work when trying to proxy requests to the root, so we
// need to create a base path to proxy against
apiBase: process.env.NODE_ENV === "development" ? "/api" : "/",
},
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "KoSIT", // Usually your GitHub org/user name.
projectName: "Validator", // Usually your repo name.
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
},
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve("./sidebars.js"),
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: "https://github.com/itplr-kosit/validator/server/ui",
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
style: "primary",
title: "Validator Daemon",
logo: {
alt: "KoSIT Validator Daemon",
src: "img/logo.svg",
},
items: [
{
type: "doc",
docId: "api",
position: "left",
label: "Documentation",
},
{
to: "config",
position: "left",
label: "Validator configuration",
},
{
to: "health",
position: "left",
label: "Health information",
},
],
},
footer: {
style: "dark",
links: [
{
title: "Docs",
items: [
{
label: "Configuration",
to: "/docs/configurations",
},
{
label: "API",
to: "/docs/api",
},
],
},
{
title: "Community",
items: [
{
label: "GitHub",
href: "https://github.com/itplr-kosit/validator",
},
{
label: "Issues",
href: "https://github.com/itplr-kosit/validator/issues",
},
],
},
{
title: "More",
items: [
{
label: "KoSIT",
href: "https://xeinkauf.de",
},
{
label: "XRechnung",
href: "https://xeinkauf.de/xrechnung/",
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Koordinierungstelle für IT-Standards (KoSIT)`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
plugins: [
/** @type {import('@docusaurus/types').PluginModule} */
(
// For the development environment to work, we need to proxy all requests
// that are not meant to fetch static content (js, css, html files), to
// the backend server. The dev server makes tht a little hard for us, as
// it does not allow us to just proxy all requests that don't match any
// static file. That's why we prefix every request with `/api`, and remove
// it again when forwarding the request. In ptoduction mode, the endpoint
// will be just `/` (see `config.customFields.apiBase`)
function proxyPlugin() {
return {
name: "custom-docusaurus-plugin",
configureWebpack() {
return {
devServer: {
proxy: {
"/api": {
target: pkg.apiProxy,
pathRewrite: { "^/api": "" },
},
},
},
};
},
};
}
),
],
};
module.exports = config;

21491
server/ui/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

68
server/ui/package.json Normal file
View file

@ -0,0 +1,68 @@
{
"name": "validator-frontend",
"version": "0.0.0",
"private": true,
"apiProxy": "http://localhost:8080",
"scripts": {
"docusaurus": "docusaurus",
"start": "cross-env NODE_ENV=development docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc",
"checkFormatting": "prettier . --check",
"format": "prettier . --write",
"lint": "eslint . && npm run checkFormatting",
"lint:fix": "npm run format && eslint . --fix"
},
"dependencies": {
"@docusaurus/core": "^3.8.1",
"@docusaurus/preset-classic": "^3.8.1",
"@mdx-js/react": "^3.1.1",
"@mui/icons-material": "^7.3.2",
"clsx": "^2.1.1",
"js-file-download": "^0.4.12",
"prism-react-renderer": "^2.4.1",
"react": "^19.1.1",
"react-dom": "^19.1.1",
"react-dropzone": "^14.3.8"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.8.1",
"@tsconfig/docusaurus": "^2.0.3",
"@typescript-eslint/eslint-plugin": "^8.43.0",
"@typescript-eslint/parser": "^8.43.0",
"cross-env": "^10.0.0",
"eslint": "^9.35.0",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"prettier": "^3.6.2",
"typescript": "^5.9.2"
},
"browserslist": {
"production": [
"> 0.5%",
"last 2 versions",
"Firefox ESR",
"not dead"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"engines": {
"node": ">=18.0"
},
"overrides": {}
}

33
server/ui/sidebars.js Normal file
View file

@ -0,0 +1,33 @@
/**
* Creating a sidebar enables you to:
- create an ordered group of docs
- render a sidebar for each doc of that group
- provide next/previous navigation
The sidebars can be generated from the filesystem, or explicitly defined here.
Create as many sidebars as you want.
*/
// @ts-check
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{ type: "autogenerated", dirName: "." }],
// But you can create a sidebar manually
/*
tutorialSidebar: [
'intro',
'hello',
{
type: 'category',
label: 'Tutorial',
items: ['tutorial-basics/create-a-document'],
},
],
*/
};
module.exports = sidebars;

View file

@ -0,0 +1,105 @@
:where(.button) {
--button-shadow: var(--ifm-global-shadow-lw);
--button-accent-shadow: var(--ifm-global-shadow-md);
--button-text-color: var(--text-accent-bg-0);
--button-background-color: var(--surface-accent-3);
--button-background-color-hover: var(--surface-accent-4);
--button-background-color-disabled: var(--surface-4);
--button-accent-shadow-opacity: 0;
}
:where([data-theme="dark"] .button) {
--button-shadow: none;
--button-accent-shadow: none;
--button-text-color: var(--text-accent-bg-0);
--button-background-color: var(--surface-accent-4);
--button-background-color-hover: var(--surface-accent-3);
--button-background-color-disabled: var(--surface-5);
--button-accent-shadow-opacity: 0;
}
.button {
position: relative;
background: var(--button-background-color);
font-family: inherit;
font-size: 1rem;
font-size: 0.875rem;
text-transform: uppercase;
color: var(--button-text-color);
font-weight: var(--ifm-font-weight-semibold);
border: none;
padding: 0 1.25em;
height: 2.25em;
line-height: 1;
border-radius: var(--border-radius-small);
box-shadow: var(--button-shadow);
cursor: pointer;
transition: color 150ms ease, background-color 150ms ease;
}
.button::before {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
box-shadow: var(--button-accent-shadow);
opacity: var(--button-accent-shadow-opacity);
transition: opacity 200ms ease;
}
.button:where(:hover, :focus) {
--button-background-color: var(--button-background-color-hover);
}
.button:not([disabled]):where(:hover, :focus) {
--button-accent-shadow-opacity: 1;
}
.button:not([disabled]):where(:active) {
--button-accent-shadow-opacity: 0.5;
}
.button[disabled] {
--button-background-color: var(--button-background-color-disabled);
cursor: auto;
}
.spinnerWrapper {
opacity: 0;
pointer-events: none;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: grid;
place-content: center;
background: #ffffff55;
backdrop-filter: blur(1px);
transition: opacity 150ms ease;
}
.loading .spinnerWrapper {
opacity: 1;
}
.spinner {
--_size: 1.75rem;
--_thickness: 3px;
width: var(--_size);
height: var(--_size);
border: var(--_thickness) solid var(--button-text-color);
border-bottom-color: transparent;
border-radius: 50%;
animation: spin 1100ms infinite cubic-bezier(0.5, 0.1, 0.5, 0.9);
}
@keyframes spin {
0% {
rotate: 0deg;
}
100% {
rotate: 360deg;
}
}

View file

@ -0,0 +1,44 @@
import clsx from "clsx";
import type { ButtonHTMLAttributes, DetailedHTMLProps, JSX, ReactNode } from "react";
import React from "react";
import type { ExtendProps } from "../util/types";
import styles from "./Button.module.css";
type HTMLButtonProps = DetailedHTMLProps<
ButtonHTMLAttributes<HTMLButtonElement>,
HTMLButtonElement
>;
type ButtonProps = ExtendProps<
HTMLButtonProps,
{
children: ReactNode;
type?: "button" | "submit" | "reset";
className?: string;
loading?: boolean;
}
>;
function Button({
children,
type = "button",
className,
loading = false,
...props
}: ButtonProps): JSX.Element {
return (
<button
{...props}
className={clsx(styles.button, loading && styles.loading, className)}
// eslint-disable-next-line react/button-has-type
type={type}
aria-busy={loading}
>
<div className={styles.spinnerWrapper} aria-hidden>
<div className={styles.spinner} />
</div>
{children}
</button>
);
}
export default Button;

View file

@ -0,0 +1,3 @@
import Button from "./Button";
export default Button;

View file

@ -0,0 +1,89 @@
.codeblock {
box-shadow: inset var(--ifm-global-shadow-lw);
margin: 0;
}
.wrapper {
position: relative;
}
:where(.buttonWrapper) {
--codeblock-button-text-color: var(--text-main);
--codeblock-button-background-color: var(--surface-2);
--codeblock-button-background-color-hover: var(--surface-accent-1);
--codeblock-button-separator-color: var(--surface-4);
--codeblock-button-border-color: var(--codeblock-button-separator-color);
--codeblock-button-icon-size: 1.5rem;
--codeblock-button-size: 2rem;
--codeblock-button-shadow: var(--ifm-global-shadow-tl);
}
:where([data-theme="dark"] .buttonWrapper) {
--codeblock-button-text-color: var(--text-0);
--codeblock-button-background-color: var(--surface-6);
--codeblock-button-background-color-hover: var(--surface-5);
--codeblock-button-separator-color: var(--codeblock-button-text-color);
--codeblock-button-shadow: var(--ifm-global-shadow-tl);
--codeblock-button-shadow: none;
}
.button {
position: relative;
width: var(--codeblock-button-size);
height: var(--codeblock-button-size);
background: var(--codeblock-button-background-color);
font-family: inherit;
font-size: 1rem;
font-size: 0.875rem;
text-transform: uppercase;
color: var(--codeblock-button-text-color);
font-weight: var(--ifm-font-weight-semibold);
border: none;
padding: 0;
height: 2.25em;
line-height: 1;
border-radius: var(--border-radius-small);
border-radius: 0;
cursor: pointer;
transition: color 200ms ease, background-color 200ms ease;
}
.button:not(:first-child) {
border-left: 1px solid var(--codeblock-button-separator-color);
}
.button:first-child {
border-top-left-radius: var(--border-radius-small);
border-bottom-left-radius: var(--border-radius-small);
}
.button:last-child {
border-top-right-radius: var(--border-radius-small);
border-bottom-right-radius: var(--border-radius-small);
}
.button:hover,
.button:focus {
background: var(--codeblock-button-background-color-hover);
}
.button svg {
width: var(--codeblock-button-icon-size);
height: var(--codeblock-button-icon-size);
}
.buttonWrapper {
position: absolute;
display: flex;
top: 1rem;
right: 1rem;
z-index: 1;
box-shadow: var(--codeblock-button-shadow);
border: 1px solid var(--codeblock-button-border-color);
border-radius: var(--border-radius-small);
opacity: 0.75;
transition: opacity 300ms ease;
}
.buttonWrapper:hover,
.buttonWrapper:focus-within {
opacity: 1;
}

View file

@ -0,0 +1,118 @@
import React, { JSX, useEffect, useState } from "react";
import type { PrismTheme, Language } from "prism-react-renderer";
import { Highlight, themes } from "prism-react-renderer";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import clsx from "clsx";
import downloadFile from "js-file-download";
import styles from "./Codeblock.module.css";
type ThemeValue = "light" | "dark";
const getTheme = () =>
(document.documentElement.dataset.theme || "light") as ThemeValue;
function useGlobalTheme() {
const [theme, setTheme] = useState<ThemeValue>(getTheme);
useEffect(() => {
const mo = new MutationObserver(() => {
setTheme(getTheme());
});
mo.observe(document.documentElement, {
subtree: false,
attributeFilter: ["data-theme"],
});
return () => mo.disconnect();
});
return theme;
}
function Codeblock({
children,
language = "markup",
enableCopy = false,
download,
}: {
children: string;
language?: Language;
enableCopy?: boolean;
download?: { fileName: string; mime: string };
}): JSX.Element {
const { siteConfig } = useDocusaurusContext();
const theme = useGlobalTheme();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const codeThemeLight = (siteConfig.themeConfig.prism as any)
.theme as PrismTheme;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const codeThemeDark = (siteConfig.themeConfig.prism as any)
.darkTheme as PrismTheme;
const codeTheme = theme === "light" ? codeThemeLight : codeThemeDark;
const handleCopy = async () => {
try {
navigator.clipboard.writeText(children);
} catch {
// Copying did unfortunately not work, but we'll not crash the app
// beacause of that...
}
};
const handleDownload = () => {
if (!download || !download.fileName || !download.mime) return;
downloadFile(children, download.fileName, download.mime);
};
return (
<div className={styles.wrapper}>
<Highlight
code={children}
language={language}
theme={codeTheme}
>
{({ className, style, tokens, getLineProps, getTokenProps }) => (
<pre className={clsx(className, styles.codeblock)} style={style}>
{tokens.map((line, i) => (
// eslint-disable-next-line react/jsx-key
<div {...getLineProps({ line, key: i })}>
{line.map((token, key) => (
// eslint-disable-next-line react/jsx-key
<span {...getTokenProps({ token, key })} />
))}
</div>
))}
</pre>
)}
</Highlight>
{(enableCopy || download) && (
<div className={styles.buttonWrapper}>
{enableCopy && (
<button
className={styles.button}
type="button"
aria-label="Copy content"
title="Copy content"
onClick={handleCopy}
>
<svg aria-hidden="true" viewBox="0 0 24 24" fill="currentColor">
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" />
</svg>
</button>
)}
{download && (
<button
className={styles.button}
type="button"
aria-label="Download content as file"
title="Download content as file"
onClick={handleDownload}
>
<svg aria-hidden="true" viewBox="0 0 24 24" fill="currentColor">
<path d="M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z" />
</svg>
</button>
)}
</div>
)}
</div>
);
}
export default Codeblock;

View file

@ -0,0 +1,3 @@
import Codeblock from "./Codeblock";
export default Codeblock;

View file

@ -0,0 +1,94 @@
:where(.dropzone) {
--dropzone-color-text: var(--text-faded);
--dropzone-icon-active: var(--text-accent-2);
--dropzone-color-background: var(--surface-2);
--dropzone-color-background-active: var(--surface-accent-0);
--dropzone-color-border: var(--color-border);
--dropzone-color-border-active: var(--color-border-accent);
--dropzone-opacity-hover-preview: 0;
--dropzone-shadow-opacity: 0;
--dropzone-border-size: 0.2rem;
}
:where([data-theme="dark"] .dropzone) {
--dropzone-color-text: var(--text-0);
--dropzone-icon-active: var(--text-accent-0);
--dropzone-color-background: transparent;
--dropzone-color-background-active: var(--surface-accent-5);
}
.dropzone {
position: relative;
cursor: pointer;
width: 100%;
height: 15em;
color: var(--dropzone-color-text);
background: var(--dropzone-color-background);
border: var(--dropzone-border-size) dashed var(--dropzone-color-border);
border-radius: var(--border-radius-medium);
display: flex;
align-items: center;
justify-content: center;
box-shadow: var(--ifm-global-shadow-lw);
}
.dropzone::before {
content: "";
position: absolute;
pointer-events: none;
top: 0;
right: 0;
bottom: 0;
left: 0;
box-shadow: var(--ifm-global-shadow-md);
z-index: -1;
opacity: var(--dropzone-shadow-opacity);
transition: opacity 200ms ease;
}
.active {
--dropzone-opacity-hover-preview: 0.8;
--dropzone-shadow-opacity: 1;
}
.hasFiles {
--dropzone-color-background: var(--dropzone-color-background-active);
--dropzone-color-border: var(--dropzone-color-border-active);
--dropzone-shadow-opacity: 0.25;
}
.fileHoverPreview {
--dropzone-color-background: var(--dropzone-color-background-active);
--dropzone-color-border: var(--dropzone-color-border-active);
position: absolute;
top: calc(-1 * var(--dropzone-border-size));
right: calc(-1 * var(--dropzone-border-size));
bottom: calc(-1 * var(--dropzone-border-size));
left: calc(-1 * var(--dropzone-border-size));
display: flex;
justify-content: center;
align-items: center;
color: var(--dropzone-color-text);
background: var(--dropzone-color-background);
border: var(--dropzone-border-size) dashed var(--dropzone-color-border);
border-radius: var(--border-radius-medium);
opacity: var(--dropzone-opacity-hover-preview);
transition: opacity 150ms ease-in-out;
}
.icon {
font-size: 3rem;
width: 1em;
height: 1em;
}
.fileHoverIcon {
font-size: 5rem;
color: var(--dropzone-icon-active);
}
.uploadIcon {
color: var(--dropzone-color-text);
margin-right: 0.5rem;
}

View file

@ -0,0 +1,80 @@
/* eslint-disable react/jsx-props-no-spreading */
import React, { JSX } from "react";
import clsx from "clsx";
import type { DropEvent } from "react-dropzone";
import { useDropzone } from "react-dropzone";
import type { DropzoneProps, RejectionType } from "./types";
import styles from "./Dropzone.module.css";
const Dropzone = ({
accept,
children,
className,
activeClassName,
multiple = false,
name,
onDrop,
hasSelectedFiles,
...props
}: DropzoneProps): JSX.Element => {
const handleDrop = (
accepted: File[],
fileRejections: RejectionType[],
event: DropEvent,
) => {
const rejected = fileRejections.map((rejection) => rejection.file);
onDrop(accepted, rejected, event);
};
const {
getRootProps,
getInputProps,
isDragActive,
isDragAccept,
isDragReject,
} = useDropzone({ accept, multiple, onDrop: handleDrop, ...props });
return (
<div
{...getRootProps()}
className={clsx(
styles.dropzone,
isDragActive && styles.active,
hasSelectedFiles && styles.hasFiles,
className,
isDragActive && activeClassName,
)}
data-testid="dropzone"
data-is-drag-active={isDragActive}
data-is-drag-accepted={isDragAccept}
data-is-drag-rejected={isDragReject}
data-has-files={hasSelectedFiles}
>
<div
className={clsx(
styles.fileHoverPreview,
isDragActive && styles.previewActive,
)}
>
<svg
className={clsx(styles.icon, styles.fileHoverIcon)}
fill="currentColor"
aria-hidden="true"
viewBox="0 0 24 24"
>
<path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z" />
</svg>
</div>
<svg
className={clsx(styles.icon, styles.uploadIcon)}
fill="currentColor"
aria-hidden="true"
viewBox="0 0 24 24"
>
<path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z" />
</svg>
{children}
<input name={name} {...getInputProps()} data-testid="dropzone-input" />
</div>
);
};
export default Dropzone;

View file

@ -0,0 +1,5 @@
import Dropzone from "./Dropzone";
export { default as useDropzone } from "./useDropzone";
export default Dropzone;

View file

@ -0,0 +1,24 @@
import type { ReactNode, RefAttributes } from "react";
import type {
DropEvent,
DropzoneProps as ReactDropzoneProps,
DropzoneRef,
} from "react-dropzone";
import type { ExtendProps } from "../util/types";
export interface RejectionType {
file: File;
}
export type DropzoneProps = ExtendProps<
ReactDropzoneProps & RefAttributes<DropzoneRef>,
{
children?: ReactNode;
className?: string;
activeClassName?: string;
multiple?: boolean;
hasSelectedFiles?: boolean;
name?: string;
onDrop: (accepted: File[], rejections: File[], event: DropEvent) => void;
}
>;

View file

@ -0,0 +1,53 @@
import { useCallback, useMemo, useState } from "react";
interface DropzoneHelpers {
selectedFiles: File[];
rejectedFiles: File[];
hasSelectedFiles: boolean;
getProps: () => {
onDrop: (accepted: File[], rejected: File[]) => void;
multiple: boolean;
accept: string | string[];
hasSelectedFiles: boolean;
};
reset: () => void;
}
function useDropzone({
multiple = false,
accept,
}: {
multiple?: boolean;
accept: string | string[];
}): DropzoneHelpers {
const [selectedFiles, setSelectedFiles] = useState<File[]>([]);
const [rejectedFiles, setRejectedFiles] = useState<File[]>([]);
const hasSelectedFiles = selectedFiles.length > 0;
const getProps = useMemo(() => {
const handleDrop = (accepted: File[], rejected: File[]) => {
setSelectedFiles(accepted);
if (rejected.length === 0) {
setRejectedFiles([]);
} else {
setRejectedFiles(rejected);
}
};
return () => ({
onDrop: handleDrop,
multiple,
accept,
hasSelectedFiles,
});
}, [accept, hasSelectedFiles, multiple]);
const reset = useCallback(() => {
setSelectedFiles([]);
setRejectedFiles([]);
}, []);
return { selectedFiles, rejectedFiles, hasSelectedFiles, getProps, reset };
}
export default useDropzone;

View file

@ -0,0 +1,16 @@
.errorDisplay {
background-color: var(--red-3);
color: var(--text-accent-bg-0);
padding: 0.75em 1.25em;
border-radius: var(--ifm-global-radius);
box-shadow: var(--ifm-global-shadow-lw);
margin: 1em 0;
display: flex;
flex-direction: column;
gap: 0.75em;
}
.title {
display: block;
line-height: 1;
}

View file

@ -0,0 +1,20 @@
import type { ReactNode } from "react";
import React from "react";
import styles from "./ErrorDisplay.module.css";
function ErrorDisplay({
title,
children,
}: {
title: string;
children?: ReactNode;
}): JSX.Element {
return (
<div role="alert" className={styles.errorDisplay}>
<strong className={styles.title}>{title}</strong>
{children}
</div>
);
}
export default ErrorDisplay;

View file

@ -0,0 +1,3 @@
import ErrorDisplay from "./ErrorDisplay";
export default ErrorDisplay;

View file

@ -0,0 +1,3 @@
.headline {
font-size: 3rem;
}

View file

@ -0,0 +1,30 @@
import type { JSX, ReactNode } from "react";
import React from "react";
import Layout from "@theme/Layout";
import styles from "./PageLayout.module.css";
function PageLayout({
children,
layoutDescription,
description,
title,
headline,
}: {
children: ReactNode;
layoutDescription: string;
description: string;
headline: string;
title?: string;
}): JSX.Element {
return (
<Layout description={layoutDescription} title={title}>
<main className="container padding-top--md padding-bottom--lg">
<h1 className={styles.headline}>{headline}</h1>
<p>{description}</p>
{children}
</main>
</Layout>
);
}
export default PageLayout;

View file

@ -0,0 +1,3 @@
import PageLayout from "./PageLayout";
export default PageLayout;

View file

@ -0,0 +1,14 @@
.buttonGroup {
display: flex;
justify-content: flex-end;
margin: 1rem 0;
}
.resultDisplay {
margin: 1em 0;
}
.withError {
border: 0.2rem solid var(--text-error);
border-radius: var(--border-radius-small);
}

View file

@ -0,0 +1,115 @@
import type { FormEventHandler } from "react";
import React, { useCallback, useState } from "react";
import clsx from "clsx";
import Dropzone from "../Dropzone";
import Codeblock from "../Codeblock";
import ErrorDisplay from "../ErrorDisplay";
import useRequest, { RequestStatus } from "../util/useRequest";
import Button from "../Button";
import styles from "./Upload.module.css";
const ENDPOINT = "/";
const ACCEPT = {
"text/xml": [".xml", ".XML"],
"application/xml": [".xml", ".XML"],
};
function createFileName(selectedFileName: string | undefined) {
return selectedFileName
? `${selectedFileName.replace(/\.xml$/i, "")}-report.xml`
: "report.xml";
}
function Upload(): JSX.Element {
const [selectedFile, setSelectedFile] = useState<File | null>(null);
const [rejected, setRejected] = useState<File[]>([]);
const { data, error, request, status } = useRequest();
const handleDrop = useCallback(
(acceptedFiles: File[], rejectedFiles: File[]) => {
if (acceptedFiles.length) {
setSelectedFile(acceptedFiles[0]);
setRejected([]);
} else {
setRejected(rejectedFiles);
}
},
[],
);
const handleSubmit: FormEventHandler<HTMLFormElement> = (e) => {
e.preventDefault();
if (!selectedFile) return;
request(ENDPOINT, {
method: "POST",
headers: { "Content-Type": "application/xml" },
body: selectedFile,
redirect: "follow",
});
};
const meaningfulErrorResponse = !!error && [406, 422].includes(error.code);
return (
<>
<form onSubmit={handleSubmit}>
{status === RequestStatus.Failure && error && !meaningfulErrorResponse && (
<ErrorDisplay title="An error occurred while validating the file">
<Codeblock enableCopy>{error.message}</Codeblock>
</ErrorDisplay>
)}
{rejected.length > 1 && (
<ErrorDisplay title="Please select a single file only" />
)}
{rejected.length === 1 && (
<ErrorDisplay title="Only XML files are supported">
<Codeblock>{`Invalid file found: ${rejected[0].name}`}</Codeblock>
</ErrorDisplay>
)}
<Dropzone
onDrop={handleDrop}
accept={ACCEPT}
multiple={false}
hasSelectedFiles={!!selectedFile}
>
{selectedFile ? (
selectedFile.name
) : (
<>Drag &amp; drop files here or click to select a file</>
)}
</Dropzone>
<div className={styles.buttonGroup}>
<Button
type="submit"
disabled={!selectedFile}
loading={status === RequestStatus.Loading}
>
Validate
</Button>
</div>
</form>
{((data && status === RequestStatus.Success) ||
meaningfulErrorResponse) && (
<div
className={clsx(
styles.resultDisplay,
meaningfulErrorResponse && styles.withError,
)}
>
<Codeblock
download={{
fileName: createFileName(selectedFile?.name),
mime: "application/xml",
}}
enableCopy
>
{data || error?.message || ""}
</Codeblock>
</div>
)}
</>
);
}
export default Upload;

View file

@ -0,0 +1,3 @@
import Upload from "./Upload";
export default Upload;

View file

@ -0,0 +1,35 @@
import React, { useEffect } from "react";
import Codeblock from "../Codeblock";
import ErrorDisplay from "../ErrorDisplay";
import useRequest, { RequestStatus } from "../util/useRequest";
function XmlView({
endpoint,
fileName,
}: {
endpoint: string;
fileName: string;
}): JSX.Element {
const { request, data, error, status } = useRequest();
useEffect(() => {
request(endpoint, { headers: { "Content-Type": "application/xml" } });
}, [endpoint, request]);
return (
<>
{status === RequestStatus.Failure && error && (
<ErrorDisplay title="An error occurred while fetching">
<Codeblock>{error.message}</Codeblock>
</ErrorDisplay>
)}
{status === RequestStatus.Success && data && (
<Codeblock download={{ fileName, mime: "application/xml" }} enableCopy>
{data}
</Codeblock>
)}
</>
);
}
export default XmlView;

View file

@ -0,0 +1,3 @@
import XmlView from "./XmlView";
export default XmlView;

View file

@ -0,0 +1,6 @@
export type SharedKeys<A, B> = Extract<keyof A, keyof B>;
export type ExtendProps<Base, Extension> = Omit<
Base,
SharedKeys<Base, Extension>
> &
Extension;

View file

@ -0,0 +1,93 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
export enum RequestStatus {
Idle = "idle",
Loading = "loading",
Success = "success",
Failure = "failure",
}
export interface RequestState {
status: RequestStatus;
data: null | string;
error: null | { code: number; message: string };
}
export interface UseRequest extends RequestState {
request: (endpoint: string, init?: RequestInit) => void;
}
const EMPTY_REQUEST: RequestState = {
status: RequestStatus.Idle,
data: null,
error: null,
};
function createEndpoint(endpoint: string, apiBase: string): string {
const segments = apiBase
.split("/")
.concat(endpoint.split("/"))
.filter(Boolean);
return `/${segments.join("/")}`;
}
function useRequest(): UseRequest {
const [requestState, setRequest] = useState(EMPTY_REQUEST);
const { siteConfig } = useDocusaurusContext();
const apiBase = siteConfig.customFields?.apiBase as string;
const isMountedRef = useRef(true);
useEffect(() => {
return () => {
isMountedRef.current = false;
};
}, []);
const request = useCallback(
(endpoint: string, init?: RequestInit) => {
setRequest((prev) => ({ ...prev, status: RequestStatus.Loading }));
fetch(createEndpoint(endpoint, apiBase), init)
.then((response) => {
return response.text().then((text) => ({
data: text,
ok: response.ok,
code: response.status,
}));
})
.then(({ data, ok, code }) => {
if (!isMountedRef.current) return;
if (ok) {
setRequest({
status: RequestStatus.Success,
data,
error: null,
});
} else {
setRequest((prev) => ({
...prev,
status: RequestStatus.Failure,
error: { code, message: data },
}));
}
})
.catch((error) => {
if (!isMountedRef.current) return;
setRequest((prev) => ({
...prev,
status: RequestStatus.Failure,
error: {
code: 0,
message: error?.toString?.() || "An unknown error occurred",
},
}));
});
},
[apiBase],
);
return useMemo(() => ({ ...requestState, request }), [request, requestState]);
}
export default useRequest;

View file

@ -0,0 +1,172 @@
/**
* Any CSS included here will be global. The classic template
* bundles Infima by default. Infima is a CSS framework designed to
* work well for content-centric websites.
*/
/* You can override the default Infima variables here. */
:root {
--ifm-color-primary: var(--blue-3);
--ifm-color-primary-dark: var(--blue-4);
--ifm-color-primary-darker: var(--blue-5);
--ifm-color-primary-darkest: var(--blue-6);
--ifm-color-primary-light: var(--blue-2);
--ifm-color-primary-lighter: var(--blue-1);
--ifm-color-primary-lightest: var(--blue-0);
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
--ifm-global-radius: var(--border-radius-small);
--ifm-font-family-base: var(--font-sans);
--ifm-font-family-monospace: var(--font-mono);
}
/* For readability concerns, you should choose a lighter palette in dark mode. */
[data-theme="dark"]:root {
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
--ifm-background-color: var(--surface-6);
}
[data-theme] .footer {
--ifm-footer-background-color: var(--surface-accent-4);
--ifm-footer-color: var(--text-accent-bg-main);
--ifm-footer-link-color: var(--text-accent-bg-main);
--ifm-footer-link-hover-color: var(--text-accent-bg-main);
--ifm-footer-title-color: var(--text-accent-bg-main);
}
[data-theme="dark"] .footer {
--ifm-footer-background-color: var(--surface-6);
border-top: 1px solid var(--ifm-table-border-color);
}
[data-theme] .navbar {
--ifm-navbar-background-color: var(--blue-4);
}
/* XÖV Theme */
:where(html) {
--blue-0: hsl(206 100% 95%);
--blue-1: hsl(206 100% 80%);
--blue-2: hsl(206 100% 65%);
--blue-3: hsl(206 100% 47%);
--blue-4: hsl(220 41% 30%);
--blue-5: hsl(220 41% 24%);
--blue-6: hsl(220 41% 18%);
--gray-0: hsl(216 33% 100%);
--gray-1: hsl(216 33% 97%);
--gray-2: hsl(220 21% 95%);
--gray-3: hsl(220 21% 92%);
--gray-4: hsl(212 10% 73%);
--gray-5: hsl(212 10% 45%);
--gray-6: hsl(212 15% 13%);
--red-0: hsl(357 80% 96%);
--red-1: hsl(357 80% 89%);
--red-2: hsl(357 80% 75%);
--red-3: hsl(357 80% 60%);
--red-4: hsl(357 80% 40%);
--red-5: hsl(357 60% 22%);
--orange-0: hsl(46 80% 90%);
--orange-1: hsl(46 80% 80%);
--orange-2: hsl(46 80% 68%);
--orange-3: hsl(46 80% 40%);
--orange-4: hsl(46 80% 25%);
--orange-5: hsl(46 80% 10%);
--green-0: hsl(162 100% 93%);
--green-1: hsl(162 100% 74%);
--green-2: hsl(162 100% 45%);
--green-3: hsl(162 100% 30%);
--green-4: hsl(162 100% 20%);
--green-5: hsl(162 100% 10%);
/* Surface colors */
--surface-0: var(--gray-0);
--surface-1: var(--gray-1);
--surface-2: var(--gray-2);
--surface-3: var(--gray-3);
--surface-4: var(--gray-4);
--surface-5: var(--gray-5);
--surface-6: var(--gray-6);
--surface-accent-0: var(--blue-0);
--surface-accent-1: var(--blue-1);
--surface-accent-2: var(--blue-2);
--surface-accent-3: var(--blue-3);
--surface-accent-4: var(--blue-4);
--surface-accent-5: var(--blue-5);
/* Text colors */
--text-0: var(--gray-4);
--text-1: var(--gray-5);
--text-2: var(--gray-6);
--text-main: var(--text-2);
--text-faded: var(--text-1);
--text-accent-0: var(--blue-3);
--text-accent-1: var(--blue-4);
--text-accent-2: var(--blue-5);
--text-accent: var(--text-accent-2);
--text-accent-bg-0: var(--gray-0);
--text-accent-bg-1: var(--gray-1);
--text-accent-bg-2: var(--gray-4);
--text-accent-bg-3: var(--blue-4);
--text-accent-bg-main: var(--text-accent-bg-0);
--text-negative: var(--red-3);
--text-error: var(--red-3);
--text-warning: var(--orange-3);
--text-info: var(--blue-3);
--text-success: var(--green-3);
/* Misc elements */
--divider: var(--gray-4);
--scrollthumb: var(--gray-4);
--input-background: var(--surface-0);
--input-background-disabled: var(--surface-2);
/* Border Radius */
--border-radius-small: 2px;
--border-radius-medium: 0.2rem;
--border-radius-large: 1rem;
--color-border: var(--gray-4);
--color-border-hover: var(--gray-4);
--color-border-accent: var(--blue-2);
--color-border-accent-hover: var(--blue-2);
/* Fonts */
--font-sans: "Open Sans", system-ui, -apple-system, "Segoe UI", "Roboto",
"Ubuntu", "Cantarell", "Noto Sans", sans-serif, "Apple Color Emoji",
"Segoe UI Emoji", "Segoe UI Symbol";
--font-serif: ui-serif, serif, "Apple Color Emoji", "Segoe UI Emoji",
"Segoe UI Symbol";
--font-mono: "Cascadia Code", "Dank Mono", "Operator Mono", "Inconsolata",
"Fira Mono", ui-monospace, "SF Mono", "Monaco", "Droid Sans Mono",
"Source Code Pro", monospace, "Apple Color Emoji", "Segoe UI Emoji",
"Segoe UI Symbol";
}
/* Scrollbars: */
/* Firefox */
* {
scrollbar-width: thin;
scrollbar-color: var(--scrollthumb) transparent;
}
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: min(8px, 0.5rem);
height: min(8px, 0.5rem);
}
*::-webkit-scrollbar-track {
background: transparent;
}
*::-webkit-scrollbar-thumb {
background-color: var(--scrollthumb);
border-radius: 999rem;
}

View file

@ -0,0 +1,18 @@
import React, { JSX } from "react";
import PageLayout from "@site/src/components/PageLayout";
import XmlView from "@site/src/components/XmlView";
function ConfigPage(): JSX.Element {
return (
<PageLayout
title="Validator configuration"
layoutDescription="The currently loaded validator configuration"
headline="Validator configuration"
description="View the currently loaded validator configuration."
>
<XmlView endpoint="/server/config" fileName="config.xml" />
</PageLayout>
);
}
export default ConfigPage;

View file

@ -0,0 +1,3 @@
import ConfigPage from "./ConfigPage";
export default ConfigPage;

View file

@ -0,0 +1,18 @@
import React, { JSX } from "react";
import PageLayout from "@site/src/components/PageLayout";
import XmlView from "@site/src/components/XmlView";
function HealthPage(): JSX.Element {
return (
<PageLayout
title="Health information"
layoutDescription="Health and status information about the system"
headline="Server health information"
description="Information about health and status of the running system."
>
<XmlView endpoint="/server/health" fileName="health.xml" />
</PageLayout>
);
}
export default HealthPage;

View file

@ -0,0 +1,3 @@
import HealthPage from "./HealthPage";
export default HealthPage;

View file

@ -0,0 +1,15 @@
import React, { JSX } from "react";
import Upload from "../components/Upload";
import PageLayout from "../components/PageLayout";
export default function Home(): JSX.Element {
return (
<PageLayout
layoutDescription="KoSIT Validator Daemon"
headline="Try the validator!"
description="Upload an XML file here to validate its contents. Note: this is just a demo implementation, not meant for production usage. If you need a production ready implementation you are welcome to contribute to the open source project."
>
<Upload />
</PageLayout>
);
}

View file

@ -0,0 +1,7 @@
---
title: Markdown page example
---
# Markdown page example
You don't need React to write simple standalone pages.

View file

Binary file not shown.

View file

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 24 24">
<path fill="hsl(220, 41%, 30%)" d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm-3.06 16L7.4 14.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L10.94 18zM13 9V3.5L18.5 9H13z"></path>
</svg>

After

Width:  |  Height:  |  Size: 306 B

View file

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 24 24">
<path fill="#fff" d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm-3.06 16L7.4 14.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L10.94 18zM13 9V3.5L18.5 9H13z"></path>
</svg>

After

Width:  |  Height:  |  Size: 292 B

9
server/ui/tsconfig.json Normal file
View file

@ -0,0 +1,9 @@
{
// This file is not used in compilation. It is here just for a nice editor experience.
"extends": "@tsconfig/docusaurus/tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"resolveJsonModule": true,
"strict": true
}
}

View file

@ -1,22 +1,5 @@
<!--
~ Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>full</id> <id>full</id>
<formats> <formats>
<format>zip</format> <format>zip</format>
@ -35,8 +18,12 @@
<directory>${project.build.directory}</directory> <directory>${project.build.directory}</directory>
<outputDirectory/> <outputDirectory/>
<includes> <includes>
<include>validationtool-*.jar</include> <include>validator-*.jar</include>
</includes> </includes>
<!-- excludes always win over includes if both patterns match -->
<excludes>
<exclude>*standalone.jar</exclude>
</excludes>
</fileSet> </fileSet>
</fileSets> </fileSets>
@ -45,7 +32,6 @@
<outputDirectory>libs</outputDirectory> <outputDirectory>libs</outputDirectory>
<useProjectArtifact>false</useProjectArtifact> <useProjectArtifact>false</useProjectArtifact>
<scope>runtime</scope> <scope>runtime</scope>
<outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension}</outputFileNameMapping>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,12 +27,13 @@ import lombok.extern.slf4j.Slf4j;
import de.kosit.validationtool.impl.ContentRepository; import de.kosit.validationtool.impl.ContentRepository;
import de.kosit.validationtool.impl.Scenario; import de.kosit.validationtool.impl.Scenario;
import de.kosit.validationtool.impl.xml.ProcessorProvider;
/** /**
* Zentrale Konfigration einer Prüf-Instanz. * Zentrale Konfigration einer Prüf-Instanz.
* *
* @author Andreas Penski * @author Andreas Penski
* @deprecated since 1.3.0 use {@link Configuration} instead * @deprecated since 1.3.0 use {@link Configuration} instead. Will be removed in 2.0
*/ */
@Getter @Getter
@Setter @Setter
@ -55,7 +56,7 @@ public class CheckConfiguration implements Configuration {
private Configuration getDelegate() { private Configuration getDelegate() {
if (this.delegate == null) { if (this.delegate == null) {
this.delegate = Configuration.load(this.scenarioDefinition, this.scenarioRepository).build(); this.delegate = Configuration.load(this.scenarioDefinition, this.scenarioRepository).build(ProcessorProvider.getProcessor());
} }
return this.delegate; return this.delegate;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -81,7 +81,7 @@ public interface Configuration {
* Add some additional parameters to the validator configuration. Parameter usage depends on actual implementation * Add some additional parameters to the validator configuration. Parameter usage depends on actual implementation
* of {@link Check} * of {@link Check}
* *
* @return * @return A Map containing the additional Parameters to be added.
*/ */
Map<String, Object> getAdditionalParameters(); Map<String, Object> getAdditionalParameters();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -45,7 +45,7 @@ public interface Input {
/** /**
* The digest algorithm used for computing the {@link #getHashCode()} * The digest algorithm used for computing the {@link #getHashCode()}
* *
* @return the name of the digest algorith * @return the name of the digest algorithm
*/ */
String getDigestAlgorithm(); String getDigestAlgorithm();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator; import javax.xml.validation.Validator;
import net.sf.saxon.lib.UnparsedTextURIResolver; import net.sf.saxon.lib.UnparsedTextURIResolver;
import net.sf.saxon.s9api.Processor;
/** /**
* Centralized construction and configuration of XML related infrastructure components. This interface allows to use * Centralized construction and configuration of XML related infrastructure components. This interface allows to use
@ -50,17 +49,6 @@ public interface ResolvingConfigurationStrategy {
*/ */
SchemaFactory createSchemaFactory(); SchemaFactory createSchemaFactory();
/**
* Returns a preconfigured {@link Processor Saxon Processor} for various tasks within the Validator. The validator
* leverages the saxon s9api for internal processing e.g. xml reading and writing. So this is the main object to
* secure for reading, transforming and writing xml files.
*
* Note: you need exactly one instance for all validator related processing.
*
* @return a preconfigured {@link Processor}
*/
Processor getProcessor();
/** /**
* Creates a specific implementation for resolving referenced objects in XML files. The URIResolver is used for * Creates a specific implementation for resolving referenced objects in XML files. The URIResolver is used for
* dereferencing an absolute URI (after resolution) to return a {@link javax.xml.transform.Source}. It <b>can</b> be * dereferencing an absolute URI (after resolution) to return a {@link javax.xml.transform.Source}. It <b>can</b> be

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,6 +22,7 @@ import org.oclc.purl.dsdl.svrl.FailedAssert;
import org.oclc.purl.dsdl.svrl.SchematronOutput; import org.oclc.purl.dsdl.svrl.SchematronOutput;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import de.kosit.validationtool.impl.model.CustomFailedAssert;
import net.sf.saxon.s9api.XdmNode; import net.sf.saxon.s9api.XdmNode;
/** /**
@ -69,23 +70,31 @@ public interface Result {
/** /**
* Schnellzugriff auf die Empfehlung zur Weiterverarbeitung des Dokuments. * Schnellzugriff auf die Empfehlung zur Weiterverarbeitung des Dokuments.
* *
* @return true wenn {@link AcceptRecommendation#ACCEPTABLE} * @return <code>true</code> wenn {@link AcceptRecommendation#ACCEPTABLE}
*/ */
boolean isAcceptable(); boolean isAcceptable();
/** /**
* Gibt eine Liste mit gefundenen Schema-Validation-Fehler zurück. Diese Liste ist leer, wenn keine Fehler gefunden * Gibt eine Liste mit gefundenen Schema-Validation-Fehler zurück. Diese Liste ist leer, wenn keine Fehler gefunden
* wurden. * wurden.
*
* @return List of schema validation errors.
*/ */
List<XmlError> getSchemaViolations(); List<XmlError> getSchemaViolations();
/** /**
* Liefert die Ergebnisse der Schematron-Prüfungen, in der Reihenfolge der Szenario-Konfiguration. * Liefert die Ergebnisse der Schematron-Prüfungen, in der Reihenfolge der Szenario-Konfiguration.
* *
* @return Liste mit Schematron-Ergebnissen * @return List with Schematron results
*/ */
List<SchematronOutput> getSchematronResult(); List<SchematronOutput> getSchematronResult();
/**
* @return List of custom failed asserts per Schematron level. Only failed assertions with a custom level are
* contained. Never <code>null</code> but maybe empty.
*/
List<CustomFailedAssert> getCustomFailedAsserts();
/** /**
* Returns {@link org.oclc.purl.dsdl.svrl.FailedAssert FailedAsserts} of a schematron evaluation. * Returns {@link org.oclc.purl.dsdl.svrl.FailedAssert FailedAsserts} of a schematron evaluation.
* *
@ -96,14 +105,14 @@ public interface Result {
/** /**
* Liefert ein true, wenn keine Schema-Violations vorhanden sind. * Liefert ein true, wenn keine Schema-Violations vorhanden sind.
* *
* @return true wenn Schema-valide * @return <code>true</code> if XML Schema compliant
*/ */
boolean isSchemaValid(); boolean isSchemaValid();
/** /**
* Liefert ein true, wenn der Prüfling eine well-formed XML-Datei ist. * Liefert ein true, wenn der Prüfling eine well-formed XML-Datei ist.
* *
* @return true wenn well-formed * @return <code>true</code> if wellformed
*/ */
boolean isWellformed(); boolean isWellformed();
@ -111,7 +120,7 @@ public interface Result {
* Returns true, if schematron has been checked and the result does not contain any {@link FailedAssert * Returns true, if schematron has been checked and the result does not contain any {@link FailedAssert
* FailedAsserts}. * FailedAsserts}.
* *
* @return true, if valid * @return <code>true</code>, if valid
*/ */
boolean isSchematronValid(); boolean isSchematronValid();
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,16 +23,14 @@ import java.util.Map;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import de.kosit.validationtool.cmd.assertions.AssertionType; import de.kosit.validationtool.cmd.assertions.AssertionType;
import de.kosit.validationtool.cmd.assertions.Assertions; import de.kosit.validationtool.cmd.assertions.Assertions;
import de.kosit.validationtool.impl.model.Result; import de.kosit.validationtool.impl.model.Result;
import de.kosit.validationtool.impl.tasks.CheckAction; import de.kosit.validationtool.impl.tasks.CheckAction;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.saxon.s9api.Processor; import net.sf.saxon.s9api.Processor;
import net.sf.saxon.s9api.SaxonApiException; import net.sf.saxon.s9api.SaxonApiException;
import net.sf.saxon.s9api.XPathCompiler; import net.sf.saxon.s9api.XPathCompiler;
@ -56,12 +54,12 @@ class CheckAssertionAction implements CheckAction {
private Map<String, List<AssertionType>> mappedAssertions; private Map<String, List<AssertionType>> mappedAssertions;
private static boolean matches(String key, String name) { private static boolean matches(final String key, final String name) {
return key.startsWith(name) || (name + ".xml").endsWith(key); return key.startsWith(name) || (name + ".xml").endsWith(key);
} }
@Override @Override
public void check(Bag results) { public void check(final Bag results) {
log.info("Checking assertions for {}", results.getInput().getName()); log.info("Checking assertions for {}", results.getInput().getName());
final List<AssertionType> toCheck = findAssertions(results.getName()); final List<AssertionType> toCheck = findAssertions(results.getName());
final List<String> errors = new ArrayList<>(); final List<String> errors = new ArrayList<>();
@ -84,28 +82,28 @@ class CheckAssertionAction implements CheckAction {
} }
} }
private List<AssertionType> findAssertions(String name) { private List<AssertionType> findAssertions(final String name) {
return getMapped().entrySet().stream().filter(e -> matches(e.getKey(), name)).map(Map.Entry::getValue).findFirst().orElse(null); return getMapped().entrySet().stream().filter(e -> matches(e.getKey(), name)).map(Map.Entry::getValue).findFirst().orElse(null);
} }
private boolean check(XdmNode document, AssertionType assertion) { private boolean check(final XdmNode document, final AssertionType assertion) {
try { try {
final XPathSelector selector = createSelector(assertion); final XPathSelector selector = createSelector(assertion);
selector.setContextItem(document); selector.setContextItem(document);
return selector.effectiveBooleanValue(); return selector.effectiveBooleanValue();
} catch (SaxonApiException e) { } catch (final SaxonApiException e) {
log.error("Error evaluating assertion {} for {}", assertion.getTest(), assertion.getReportDoc(), e); log.error("Error evaluating assertion {} for {}", assertion.getTest(), assertion.getReportDoc(), e);
} }
return false; return false;
} }
private XPathSelector createSelector(AssertionType assertion) throws SaxonApiException { private XPathSelector createSelector(final AssertionType assertion) {
try { try {
final XPathCompiler compiler = getProcessor().newXPathCompiler(); final XPathCompiler compiler = getProcessor().newXPathCompiler();
assertions.getNamespace().forEach(ns -> compiler.declareNamespace(ns.getPrefix(), ns.getValue())); assertions.getNamespace().forEach(ns -> compiler.declareNamespace(ns.getPrefix(), ns.getValue()));
return compiler.compile(assertion.getTest()).load(); return compiler.compile(assertion.getTest()).load();
} catch (SaxonApiException e) { } catch (final SaxonApiException e) {
throw new IllegalStateException(String.format("Can not compile xpath match expression '%s'", throw new IllegalStateException(String.format("Can not compile xpath match expression '%s'",
StringUtils.isNotBlank(assertion.getTest()) ? assertion.getTest() : "EMPTY EXPRESSION"), e); StringUtils.isNotBlank(assertion.getTest()) ? assertion.getTest() : "EMPTY EXPRESSION"), e);
} }
@ -114,8 +112,8 @@ class CheckAssertionAction implements CheckAction {
private Map<String, List<AssertionType>> getMapped() { private Map<String, List<AssertionType>> getMapped() {
if (mappedAssertions == null) { if (mappedAssertions == null) {
mappedAssertions = new HashMap<>(); mappedAssertions = new HashMap<>();
for (AssertionType assertionType : assertions.getAssertion()) { for (final AssertionType assertionType : assertions.getAssertion()) {
List<AssertionType> list = mappedAssertions.computeIfAbsent(assertionType.getReportDoc(), k -> new ArrayList<>()); final List<AssertionType> list = mappedAssertions.computeIfAbsent(assertionType.getReportDoc(), k -> new ArrayList<>());
list.add(assertionType); list.add(assertionType);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,24 +16,17 @@
package de.kosit.validationtool.cmd; package de.kosit.validationtool.cmd;
import static de.kosit.validationtool.cmd.CommandLineOptions.HELP;
import static de.kosit.validationtool.cmd.CommandLineOptions.createHelpOptions;
import static de.kosit.validationtool.cmd.CommandLineOptions.createOptions;
import static de.kosit.validationtool.cmd.CommandLineOptions.printHelp;
import static de.kosit.validationtool.impl.Printer.writeErr; import static de.kosit.validationtool.impl.Printer.writeErr;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import java.util.Arrays; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.fusesource.jansi.AnsiConsole; import org.fusesource.jansi.AnsiConsole;
import org.fusesource.jansi.AnsiRenderer.Code; import org.fusesource.jansi.AnsiRenderer.Code;
import de.kosit.validationtool.cmd.report.Line; import de.kosit.validationtool.cmd.report.Line;
import de.kosit.validationtool.impl.Printer; import de.kosit.validationtool.impl.Printer;
import picocli.CommandLine;
import picocli.CommandLine.ParseResult;
/** /**
* Commandline interface of the validator. It parses the commandline args and hands over actual execution to * Commandline interface of the validator. It parses the commandline args and hands over actual execution to
@ -59,7 +52,9 @@ public class CommandLineApplication {
AnsiConsole.systemInstall(); AnsiConsole.systemInstall();
final ReturnValue resultStatus = mainProgram(args); final ReturnValue resultStatus = mainProgram(args);
if (!resultStatus.equals(ReturnValue.DAEMON_MODE)) { if (!resultStatus.equals(ReturnValue.DAEMON_MODE)) {
if (!resultStatus.equals(ReturnValue.HELP_REQUEST) && resultStatus.getCode() >= 0) {
sayGoodby(resultStatus); sayGoodby(resultStatus);
}
System.exit(resultStatus.getCode()); System.exit(resultStatus.getCode());
} else { } else {
Runtime.getRuntime().addShutdownHook(new Thread(() -> Printer.writeOut("Shutting down daemon ..."))); Runtime.getRuntime().addShutdownHook(new Thread(() -> Printer.writeOut("Shutting down daemon ...")));
@ -79,60 +74,39 @@ public class CommandLineApplication {
// for testing purposes. Unless jvm is terminated during tests. See above // for testing purposes. Unless jvm is terminated during tests. See above
static ReturnValue mainProgram(final String[] args) { static ReturnValue mainProgram(final String[] args) {
final Options options = createOptions();
ReturnValue resultStatus; ReturnValue resultStatus;
final CommandLine commandLine = new CommandLine(new CommandLineOptions());
try { try {
if (isHelpRequested(args)) { commandLine.setExecutionExceptionHandler(CommandLineApplication::logExecutionException);
printHelp(options); final int cmdlineRetVal = commandLine.execute(args);
resultStatus = ReturnValue.SUCCESS; if (commandLine.isUsageHelpRequested() || cmdlineRetVal == CommandLine.ExitCode.USAGE) {
resultStatus = ReturnValue.HELP_REQUEST;
} else { } else {
final CommandLineParser parser = new DefaultParser(); resultStatus = ObjectUtils.getIfNull(commandLine.getExecutionResult(), ReturnValue.PARSING_ERROR);
final CommandLine cmd = parser.parse(options, args); if (resultStatus.isError()) {
configureLogging(cmd); commandLine.usage(System.out);
resultStatus = Validator.mainProgram(cmd);
} }
} catch (final ParseException e) { }
} catch (final Exception e) {
writeErr("Error processing command line arguments: {0}", e.getMessage(), e); writeErr("Error processing command line arguments: {0}", e.getMessage(), e);
printHelp(options);
resultStatus = ReturnValue.PARSING_ERROR; resultStatus = ReturnValue.PARSING_ERROR;
} }
return resultStatus; return resultStatus;
} }
private static boolean isHelpRequested(final String[] args) { // The signature is required, because the method is used a lambda
final Options helpOptions = createHelpOptions(); @SuppressWarnings("unused")
try { private static int logExecutionException(final Exception ex, final CommandLine cli, final ParseResult parseResult) {
final CommandLineParser parser = new DefaultParser(); final String message = isNotEmpty(ex.getMessage()) ? ex.getMessage() : "Es ist eine Fehler aufgetreten";
final CommandLine cmd = parser.parse(helpOptions, args, true); Printer.writeErr(ex, message);
if (cmd.hasOption(HELP.getOpt()) || args.length == 0) { return 1;
return true;
}
} catch (final ParseException e) {
// we can ignore that, we just look for the help parameters
}
return false;
} }
private static void configureLogging(final CommandLine cmd) throws ParseException { enum Level {
if (cmd.hasOption(CommandLineOptions.DEBUG_LOG.getOpt())) {
System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
} else if (cmd.hasOption(CommandLineOptions.LOG_LEVEL.getOpt())) {
final String level = Level.resolve(cmd.getOptionValue(CommandLineOptions.LOG_LEVEL.getOpt()));
System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, level);
} else {
System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "OFF");
}
}
private enum Level {
INFO, WARN, DEBUG, TRACE, ERROR, OFF; INFO, WARN, DEBUG, TRACE, ERROR, OFF;
static String resolve(final String optionValue) throws ParseException {
return Arrays.stream(values()).filter(e -> e.name().equalsIgnoreCase(optionValue)).map(Enum::name).findFirst()
.orElseThrow(() -> new ParseException("Either specify trace,debug,info,warn,error as log level"));
}
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,100 +16,176 @@
package de.kosit.validationtool.cmd; package de.kosit.validationtool.cmd;
import org.apache.commons.cli.HelpFormatter; import java.nio.file.Path;
import org.apache.commons.cli.Option; import java.util.List;
import java.util.concurrent.Callable;
import de.kosit.validationtool.cmd.CommandLineApplication.Level;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import picocli.CommandLine.ArgGroup;
import picocli.CommandLine.Command;
import picocli.CommandLine.Help.Visibility;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
/** /**
* Commandline Interface definition.
*
* @author Andreas Penski * @author Andreas Penski
*/ */
public class CommandLineOptions { @Command(description = "Structural and semantic validation of xml files", name = "KoSIT Validator", mixinStandardHelpOptions = false,
separator = " ", synopsisHeading = CommandLineOptions.SYNOSIS_HEADING)
@Getter
public class CommandLineOptions implements Callable<ReturnValue> {
static final Option HELP = Option.builder("?").longOpt("help").argName("Help").desc("Displays this help").build(); static final String SYNOSIS_HEADING = "Usage: ";
static final Option SCENARIOS = Option.builder("s").required().longOpt("scenarios").hasArg().desc("Location of scenarios.xml e.g.") /**
.build(); * @author Andreas Penski
*/
@Getter
@NoArgsConstructor
static class DaemonOptions {
static final Option REPOSITORY = Option.builder("r").longOpt("repository").hasArg().desc("Directory containing scenario content") @Option(names = { "-D", "--daemon" }, description = "Starts a daemon listing for validation requests", defaultValue = "false",
.build(); required = true)
private boolean daemonMode;
static final Option PRINT = Option.builder("p").longOpt("print").desc("Prints the check result to stdout").build(); @Option(names = { "-H", "--host" }, description = "The hostname / IP address to bind the daemon.", defaultValue = "localhost",
showDefaultValue = Visibility.ALWAYS)
private String host;
static final Option OUTPUT = Option.builder("o").longOpt("output-directory") @Option(names = { "-P", "--port" }, description = "The port to bind the daemon.", defaultValue = "8080",
.desc("Defines the out directory for results. Defaults to cwd").hasArg().build(); showDefaultValue = Visibility.ALWAYS)
private int port;
static final Option EXTRACT_HTML = Option.builder("h").longOpt("html") @Option(names = { "-T", "--threads" },
.desc("Extract and save any html content within result as a separate file ").build(); description = "Number of threads processing validation requests. Default depends on processor count", defaultValue = "-1",
showDefaultValue = Visibility.NEVER)
private int workerCount;
static final Option DEBUG = Option.builder("d").longOpt("debug").desc("Prints some more debug information").build(); @Option(names = { "-G", "--disable-gui" }, description = "Disables the GUI of the daemon mode")
private boolean disableGUI;
static final Option SERIALIZE_REPORT_INPUT = Option.builder("c").longOpt("serialize-report-input")
.desc("Serializes the report input to the cwd").build();
static final Option CHECK_ASSERTIONS = Option.builder("c").longOpt("check-assertions").hasArg()
.desc("Check the result using defined assertions").argName("assertions-file").build();
static final Option SERVER = Option.builder("D").longOpt("daemon").desc("Starts a daemon listing for validation requests").build();
static final Option HOST = Option.builder("H").longOpt("host").hasArg()
.desc("The hostname / IP address to bind the daemon. Default is localhost").build();
static final Option PORT = Option.builder("P").longOpt("port").hasArg().desc("The port to bind the daemon. Default is 8080").build();
static final Option WORKER_COUNT = Option.builder("T").longOpt("threads").hasArg()
.desc("Number of threads processing validation requests").build();
static final Option DISABLE_GUI = Option.builder("G").longOpt("disable-gui").desc("Disables the GUI of the daemon mode").build();
static final Option REPORT_POSTFIX = Option.builder(null).longOpt("report-postfix").hasArg()
.desc("Postfix of the generated report name").build();
static final Option REPORT_PREFIX = Option.builder(null).longOpt("report-prefix").hasArg().desc("Prefix of the generated report name")
.build();
static final Option DEBUG_LOG = Option.builder("X").longOpt("debug-logging").desc("Enables full debug log. Alias for -l debug").build();
static final Option LOG_LEVEL = Option.builder("l").longOpt("log-level").hasArg()
.desc("Enables a certain log level for debugging " + "purposes").build();
static final Option PRINT_MEM_STATS = Option.builder("m").longOpt("memory-stats").desc("Prints some memory stats").build();
private CommandLineOptions() {
// hide
} }
static org.apache.commons.cli.Options createOptions() { /**
final org.apache.commons.cli.Options options = new org.apache.commons.cli.Options(); * @author Andreas Penski
options.addOption(HELP); */
options.addOption(SERVER); @Getter
options.addOption(HOST); @NoArgsConstructor
options.addOption(PORT); static class CliOptions {
options.addOption(SCENARIOS);
options.addOption(REPOSITORY); @Option(names = { "-o", "--output-directory" }, description = "Defines the out directory for results.", defaultValue = ".",
options.addOption(PRINT); required = true)
options.addOption(OUTPUT); private Path outputPath;
options.addOption(EXTRACT_HTML);
options.addOption(DEBUG); @Option(names = { "-h", "--html", "--extract-html" },
options.addOption(CHECK_ASSERTIONS); description = "Extract and save any html content within result as a separate file")
options.addOption(PRINT_MEM_STATS); private boolean extractHtml;
options.addOption(WORKER_COUNT);
options.addOption(DISABLE_GUI); @Option(names = { "--serialize-report-input" }, description = "Serializes the report input to the cwd", defaultValue = "false")
options.addOption(REPORT_POSTFIX); private boolean serializeInput;
options.addOption(REPORT_PREFIX);
options.addOption(LOG_LEVEL); @Option(names = { "-c", "--check-assertions" }, paramLabel = "assertions-file",
options.addOption(DEBUG_LOG); description = "Check the result using defined assertions")
return options; private Path assertions;
@Option(names = { "--report-postfix" }, description = "Postfix of the generated report name")
private String reportPostfix;
@Option(names = { "--report-prefix" }, description = "Prefix of the generated report name")
private String reportPrefix;
@Option(names = { "-m", "--memory-stats" }, description = "Prints some memory stats")
private boolean printMemoryStats;
@Option(names = { "-p", "--print" }, description = "Prints the check result to stdout")
private boolean printReport;
@Parameters(arity = "1..*", description = "Files to validate")
private List<Path> files;
} }
static void printHelp(final org.apache.commons.cli.Options options) { /**
// automatically generate the help statement * Definition of logical name and a path for a configuration artifact.
final HelpFormatter formatter = new HelpFormatter(); *
formatter.printHelp("check-tool -s <scenario-config-file> [OPTIONS] [FILE]... ", options, false); * @author Andreas Penski
*/
@Getter
@Setter
public abstract static class Definition {
String name;
Path path;
} }
static org.apache.commons.cli.Options createHelpOptions() { /**
final org.apache.commons.cli.Options options = new org.apache.commons.cli.Options(); * Definition of logical name and a path for a repository.
options.addOption(HELP); *
return options; * @author Andreas Penski
*/
public static class RepositoryDefinition extends Definition {
// just for type safety
} }
/**
* Definition of logical name and a path for a scenario configuration file.
*
* @author Andreas Penski
*/
public static class ScenarioDefinition extends Definition {
// just for type safety
}
@ArgGroup(exclusive = false, heading = "Daemon options\n")
private DaemonOptions daemonOptions;
@ArgGroup(exclusive = false, heading = "CLI usage options\n")
private CliOptions cliOptions;
@Option(names = { "-d", "--debug" }, description = "Prints some more debug information")
private boolean debugOutput;
@Option(names = { "-?", "--help" }, usageHelp = true, description = "display this help message")
boolean usageHelpRequested;
@Option(names = { "-X", "--debug-logging" }, description = "Enables full debug log. Alias for -l debug")
private boolean debugLog;
@Option(names = { "-l", "--log-level" }, description = "Enables a certain log level for debugging purposes", defaultValue = "OFF")
private Level logLevel;
@Option(names = { "-r", "--repository" }, paramLabel = "repository-path", description = "Directory containing scenario content",
converter = TypeConverter.RepositoryConverter.class)
private List<RepositoryDefinition> repositories;
@Option(names = { "-s", "--scenarios" }, description = "Location of scenarios.xml", paramLabel = "scenario.xml", required = true,
converter = TypeConverter.ScenarioConverter.class)
private List<ScenarioDefinition> scenarios;
@Override
public ReturnValue call() throws Exception {
configureLogging(this);
return Validator.mainProgram(this);
}
private static void configureLogging(final CommandLineOptions cmd) {
if (cmd.isDebugLog()) {
System.setProperty(org.slf4j.simple.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
} else {
System.setProperty(org.slf4j.simple.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, cmd.getLogLevel().name());
}
}
public boolean isDaemonModeEnabled() {
return getDaemonOptions() != null;
}
public boolean isCliModeEnabled() {
return getCliOptions() != null;
}
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -37,6 +37,8 @@ import de.kosit.validationtool.cmd.report.Line;
import de.kosit.validationtool.impl.DefaultCheck; import de.kosit.validationtool.impl.DefaultCheck;
import de.kosit.validationtool.impl.tasks.CheckAction; import de.kosit.validationtool.impl.tasks.CheckAction;
import net.sf.saxon.s9api.Processor;
/** /**
* Simple Erweiterung der Klasse {@link DefaultCheck} um das Ergebnis der Assertion-Prüfung auszuwerten und auszugeben. * Simple Erweiterung der Klasse {@link DefaultCheck} um das Ergebnis der Assertion-Prüfung auszuwerten und auszugeben.
* Diese Klasse stellt keine fachliche Erweiterung des eigentlichen Prüfvorganges dar! * Diese Klasse stellt keine fachliche Erweiterung des eigentlichen Prüfvorganges dar!
@ -55,8 +57,58 @@ class InternalCheck extends DefaultCheck {
* *
* @param configuration die Konfiguration * @param configuration die Konfiguration
*/ */
InternalCheck(final Configuration configuration) { InternalCheck(final Processor processor, final Configuration... configuration) {
super(configuration); super(processor, configuration);
}
private static String createStatusLine(final Map<String, Result> results) {
final long acceptable = results.entrySet().stream().filter(e -> e.getValue().isAcceptable()).count();
final long rejected = results.entrySet().stream().filter(e -> !e.getValue().isAcceptable()).count();
final long errors = results.entrySet().stream().filter(e -> !e.getValue().isProcessingSuccessful()).count();
final Line line = new Line();
line.add("Acceptable: ").add(acceptable, Code.GREEN);
line.add(" Rejected: ").add(rejected, Code.RED);
if (errors > 0) {
line.add(" Processing errors: ").add(errors, Code.RED);
}
return line.render(true, false);
}
private static Grid createResultGrid(final Map<String, Result> results) {
final Grid grid = new Grid(
//@formatter:off
new ColumnDefinition("File", 60, 10, 1),
new ColumnDefinition("Schema", 7).justify(Justify.CENTER),
new ColumnDefinition("Schematron", 10).justify(Justify.CENTER),
new ColumnDefinition("Acceptance", 10, 5).justify(Justify.CENTER),
new ColumnDefinition("Error/Description", 60,20,3)
);
//@formatter:on
results.entrySet().stream().sorted(Entry.comparingByKey()).forEach(e -> {
final Result value = e.getValue();
final Code textcolor = value.isAcceptable() ? Code.GREEN : Code.RED;
grid.addCell(e.getKey(), textcolor);
grid.addCell(value.isSchemaValid() ? "Y" : "N", textcolor);
grid.addCell(value.isSchematronValid() ? "Y" : "N", textcolor);
grid.addCell(value.getAcceptRecommendation(), textcolor);
grid.addCell(joinErrors(value));
});
return grid;
}
private static String joinErrors(final Result value) {
final StringBuilder b = new StringBuilder();
b.append(String.join(";", value.getProcessingErrors()));
if (value.getSchemaViolations() != null && !value.getSchemaViolations().isEmpty()) {
b.append(b.length() > 0 ? ";" : "");
b.append(value.getSchemaViolations().stream().map(XmlError::getMessage).collect(Collectors.joining(";")));
}
if (value.getSchematronResult() != null && !value.getSchematronResult().isEmpty()) {
b.append(b.length() > 0 ? ";" : "");
b.append(value.getSchematronResult().stream().flatMap(e -> e.getMessages().stream()).collect(Collectors.joining(";")));
}
return b.toString();
} }
/** /**
@ -112,54 +164,4 @@ class InternalCheck extends DefaultCheck {
return (int) (this.failedAssertions + results.values().stream().filter(e -> !e.isAcceptable()).count()); return (int) (this.failedAssertions + results.values().stream().filter(e -> !e.isAcceptable()).count());
} }
private static String createStatusLine(final Map<String, Result> results) {
final long acceptable = results.entrySet().stream().filter(e -> e.getValue().isAcceptable()).count();
final long rejected = results.entrySet().stream().filter(e -> !e.getValue().isAcceptable()).count();
final long errors = results.entrySet().stream().filter(e -> !e.getValue().isProcessingSuccessful()).count();
final Line line = new Line();
line.add("Acceptable: ").add(acceptable, Code.GREEN);
line.add(" Rejected: ").add(rejected, Code.RED);
if (errors > 0) {
line.add(" Processing errors: ").add(errors, Code.RED);
}
return line.render(true, false);
}
private static Grid createResultGrid(final Map<String, Result> results) {
final Grid grid = new Grid(
//@formatter:off
new ColumnDefinition("filename", 60, 10, 1),
new ColumnDefinition("Schema", 7).justify(Justify.CENTER),
new ColumnDefinition("Schematron", 10).justify(Justify.CENTER),
new ColumnDefinition("Acceptance", 10, 5).justify(Justify.CENTER),
new ColumnDefinition("Error/Description", 60,20,3)
);
//@formatter:on
results.entrySet().stream().sorted(Entry.comparingByKey()).forEach(e -> {
final Result value = e.getValue();
final Code textcolor = value.isAcceptable() ? Code.GREEN : Code.RED;
grid.addCell(e.getKey(), textcolor);
grid.addCell(value.isSchemaValid() ? "Y" : "N", textcolor);
grid.addCell(value.isSchematronValid() ? "Y" : "N", textcolor);
grid.addCell(value.getAcceptRecommendation(), textcolor);
grid.addCell(joinErrors(value));
});
return grid;
}
private static String joinErrors(final Result value) {
final StringBuilder b = new StringBuilder();
b.append(String.join(";", value.getProcessingErrors()));
if (value.getSchemaViolations() != null && !value.getSchemaViolations().isEmpty()) {
b.append(b.length() > 0 ? ";" : "");
b.append(value.getSchemaViolations().stream().map(XmlError::getMessage).collect(Collectors.joining(";")));
}
if (value.getSchematronResult() != null && !value.getSchematronResult().isEmpty()) {
b.append(b.length() > 0 ? ";" : "");
b.append(value.getSchematronResult().stream().flatMap(e -> e.getMessages().stream()).collect(Collectors.joining(";")));
}
return b.toString();
}
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2021 Koordinierungsstelle für IT-Standards (KoSIT) * Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,7 +20,8 @@ import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
/** /**
* CLI return codes. * CLI return codes. Codes &gt; 0 indicate a processing error. Codes &lt; 0 indicates a configuration error. Code 0
* indicates a successful processing.
* *
* @author Andreas Penski * @author Andreas Penski
*/ */
@ -30,15 +31,21 @@ public class ReturnValue {
public static final ReturnValue SUCCESS = new ReturnValue(0); public static final ReturnValue SUCCESS = new ReturnValue(0);
public static final ReturnValue HELP_REQUEST = new ReturnValue(0);
public static final ReturnValue CONFIGURATION_ERROR = new ReturnValue(-2); public static final ReturnValue CONFIGURATION_ERROR = new ReturnValue(-2);
public static final ReturnValue DAEMON_MODE = new ReturnValue(-100); public static final ReturnValue DAEMON_MODE = new ReturnValue(-100);
public static final ReturnValue PARSING_ERROR = new ReturnValue(-1);; public static final ReturnValue PARSING_ERROR = new ReturnValue(-1);
private final int code; private final int code;
public static ReturnValue createFailed(final int count) { public static ReturnValue createFailed(final int count) {
return new ReturnValue(count); return new ReturnValue(count);
} }
public boolean isError() {
return this.code < 0 && this.code != DAEMON_MODE.code;
}
} }

Some files were not shown because too many files have changed in this diff Show more