diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/CityGmlParser.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/CityGmlParser.java index 660370bbf9bb20680351379bca64449603a1ff68..025db84c691316bc396eda06793f0dbc4d00b6ab 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/CityGmlParser.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/CityGmlParser.java @@ -292,6 +292,11 @@ public class CityGmlParser { } + public static void streamCityGml(CityGmlZipInputStream cgis, ParserConfiguration config, CityGmlConsumer cityObjectConsumer, + String outputFile) throws CityGmlParseException { + return; + } + public static void streamCityGml(String file, ParserConfiguration config, CityGmlConsumer cityObjectConsumer, String outputFile) throws CityGmlParseException { Path f = Paths.get(file); diff --git a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java index 2e33ed82d319293fbc67ffcd3472e71b41311d33..f1823ed8f080f775364b5a85bc74ef8c4cfa3353 100644 --- a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java +++ b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java @@ -48,6 +48,8 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamSource; +import de.hft.stuttgart.citydoctor2.zip.CityGmlZipEntry; +import de.hft.stuttgart.citydoctor2.zip.CityGmlZipInputStream; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -740,6 +742,35 @@ public class Checker { return hasUnusedDependency; } + public static void streamCheck (CityGmlZipEntry entry, String xmlOutput, String pdfOutput, ValidationConfiguration config, + String outputFile) throws IOException, CityGmlParseException{ + try (BufferedOutputStream xmlBos = getXmlOutputMaybe(xmlOutput); + BufferedOutputStream pdfBos = getPdfOutputMaybe(pdfOutput)) { + Checker c = new Checker(config, null); + String fileName = entry.getFileName(); + + // create reporter if available + XmlStreamReporter xmlReporter = getXmlReporter(config, xmlBos, fileName); + PdfStreamReporter pdfReporter = getPdfReporter(config, pdfBos, fileName); + + // execute schematron first + try (CityGmlZipInputStream cgis = new CityGmlZipInputStream(entry)) { + SvrlContentHandler handler = executeSchematronValidationIfAvailable(config, cgis.getInputStream()); + + CityGmlConsumer con = new StreamCityGmlConsumer(c, xmlReporter, pdfReporter, handler, config, null); + // parse and validate + CityGmlParser.streamCityGml(cgis, config.getParserConfiguration(), con, outputFile); + + // write reports if available + writeReport(xmlReporter); + writeReport(pdfReporter); + } + } catch (CheckReportWriteException e) { + logger.error(Localization.getText("Checker.failReports"), e); + } + } + + public static void streamCheck(File inputFile, String xmlOutput, String pdfOutput, ValidationConfiguration config, String outputFile) throws IOException, CityGmlParseException { streamCheck(inputFile, xmlOutput, pdfOutput, config, null, outputFile);