diff --git a/build.gradle b/build.gradle index dc491b0..a5ae6ad 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ allprojects { compileJava.options.encoding = 'US-ASCII' } -version '1.14.0'+System.getProperty('release','-SNAPSHOT') +version '1.14.1'+System.getProperty('release','-SNAPSHOT') configurations { deployerJars @@ -24,9 +24,9 @@ configurations { dependencies { compile group: 'ch.ehi', name: 'ehibasics', version: '1.4.1' compile group: 'ch.interlis', name: 'iox-api', version: '1.0.4' - compile group: 'ch.interlis', name: 'iox-ili', version: '1.22.0' - compile group: 'ch.interlis', name: 'ili2c-tool', version: "5.4.0" - compile group: 'ch.interlis', name: 'ili2c-core', version: "5.4.0" + compile group: 'ch.interlis', name: 'iox-ili', version: '1.22.1' + compile group: 'ch.interlis', name: 'ili2c-tool', version: "5.4.1" + compile group: 'ch.interlis', name: 'ili2c-core', version: "5.4.1" testCompile group: 'junit', name: 'junit', version: '4.12' deployerJars "org.apache.maven.wagon:wagon-ftp:3.3.3" deployerJars "org.apache.maven.wagon:wagon-ssh:3.3.3" diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index f58c420..8d234a7 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -1,3 +1,13 @@ +ilivalidator 1.14.1 (2023-12-29) +-------------------------------- +- implement Math_V2, Text_V2 (#375) +- fix evaluation of multiple constraints on associations (#390) +- GUI: skip logging errors to log window if to many errors (#259) +- add --csvlog (#403) +- iox-ili-1.22.1 +- ili2c-5.4.1 + + ilivalidator 1.14.0 (2023-12-06) -------------------------------- - ILI2.4 Constraints zu Domains (#378) diff --git a/docs/ilivalidator.rst b/docs/ilivalidator.rst index f9b031a..d001374 100644 --- a/docs/ilivalidator.rst +++ b/docs/ilivalidator.rst @@ -322,6 +322,8 @@ Optionen: +---------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``--xtflog filename`` | Schreibt die log-Meldungen in eine INTERLIS 2-Datei. Die Datei result.xtf entspricht dem Modell IliVErrors. | +---------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| ``--csvlog filename`` | Schreibt die log-Meldungen in eine CSV-Datei. Die Spalten in der CSV-Datei entsprechen dem Modell IliVErrors. | ++---------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``--plugins folder`` | Verzeichnis mit JAR-Dateien, die Zusatzfunktionen enthalten. Die Zusatzfunktionen müssen das Java-Interface ``ch.interlis.iox_j.validator.InterlisFunction`` implementieren, und der Name der Java-Klasse muss mit ``IoxPlugin`` enden. | +---------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``--proxy host`` | Proxy Server für den Zugriff auf Modell Repositories | diff --git a/src/org/interlis2/validator/Main.java b/src/org/interlis2/validator/Main.java index a5a253c..07524d8 100644 --- a/src/org/interlis2/validator/Main.java +++ b/src/org/interlis2/validator/Main.java @@ -134,6 +134,9 @@ static public void main(String args[]){ }else if(arg.equals("--xtflog")) { argi++; settings.setValue(Validator.SETTING_XTFLOG, args[argi]); + }else if(arg.equals("--csvlog")) { + argi++; + settings.setValue(Validator.SETTING_CSVLOG, args[argi]); }else if(arg.equals("--plugins")) { argi++; settings.setValue(Validator.SETTING_PLUGINFOLDER, args[argi]); @@ -175,6 +178,7 @@ static public void main(String args[]){ System.err.println("--log file text file, that receives validation results."); System.err.println("--logtime include timestamps in logfile."); System.err.println("--xtflog file INTERLIS transfer file, that receives validation results."); + System.err.println("--csvlog file CSV file, that receives validation results."); System.err.println("--models model user sets certain models, separated by a semicolon."); System.err.println("--modeldir "+Validator.SETTING_DEFAULT_ILIDIRS+" list of directories/repositories with ili-files."); System.err.println("--plugins folder directory with jar files that contain user defined functions."); diff --git a/src/org/interlis2/validator/Validator.java b/src/org/interlis2/validator/Validator.java index b6ea820..7d565b7 100644 --- a/src/org/interlis2/validator/Validator.java +++ b/src/org/interlis2/validator/Validator.java @@ -42,6 +42,7 @@ import ch.interlis.iox_j.StartTransferEvent; import ch.interlis.iox_j.inifile.IniFileReader; import ch.interlis.iox_j.inifile.MetaConfig; +import ch.interlis.iox_j.logging.CsvErrorsLogger; import ch.interlis.iox_j.logging.FileLogger; import ch.interlis.iox_j.logging.LogEventFactory; import ch.interlis.iox_j.logging.StdLogger; @@ -91,6 +92,7 @@ public static boolean runValidation( * @see #SETTING_META_CONFIGFILE * @see #SETTING_LOGFILE * @see #SETTING_XTFLOG + * @see #SETTING_CSVLOG * @see #SETTING_PLUGINDIR */ public boolean validate( @@ -106,9 +108,11 @@ public boolean validate( } String logFilename=settings.getValue(Validator.SETTING_LOGFILE); String xtflogFilename=settings.getValue(Validator.SETTING_XTFLOG); + String csvlogFilename=settings.getValue(Validator.SETTING_CSVLOG); boolean doTimestamp=TRUE.equals(settings.getValue(Validator.SETTING_LOGFILE_TIMESTAMP)); FileLogger logfile=null; XtfErrorsLogger xtflog=null; + CsvErrorsLogger csvlog=null; AbstractStdListener logStderr=null; boolean ret=false; try{ @@ -143,6 +147,21 @@ public boolean validate( return false; } } + if(csvlogFilename!=null){ + File f=new java.io.File(csvlogFilename); + try { + if(isWriteable(f)) { + csvlog=new CsvErrorsLogger(f); + EhiLogger.getInstance().addListener(csvlog); + }else { + EhiLogger.logError("failed to write to logfile <"+f.getPath()+">"); + return false; + } + } catch (IOException e) { + EhiLogger.logError("failed to write to logfile <"+f.getPath()+">",e); + return false; + } + } if(!TRUE.equals(settings.getValue(SETTING_DISABLE_STD_LOGGER))) { logStderr=new StdLogger(logFilename); EhiLogger.getInstance().addListener(logStderr); @@ -477,6 +496,11 @@ public boolean validate( EhiLogger.getInstance().removeListener(xtflog); xtflog=null; } + if(csvlog!=null){ + csvlog.close(); + EhiLogger.getInstance().removeListener(csvlog); + csvlog=null; + } if(logfile!=null){ logfile.close(); EhiLogger.getInstance().removeListener(logfile); @@ -806,6 +830,9 @@ public static boolean isItfFilename(String filename) /** Name of the data file (XTF format) that receives the validation results. */ public static final String SETTING_XTFLOG = "org.interlis2.validator.xtflog"; + /** Name of the data file (CSV format) that receives the validation results. + */ + public static final String SETTING_CSVLOG = "org.interlis2.validator.csvlog"; /** Name of the folder that contains jar files with plugins. */ public static final String SETTING_PLUGINFOLDER = "org.interlis2.validator.pluginfolder"; diff --git a/src/org/interlis2/validator/gui/MainFrame.java b/src/org/interlis2/validator/gui/MainFrame.java index b74b360..a88ce04 100644 --- a/src/org/interlis2/validator/gui/MainFrame.java +++ b/src/org/interlis2/validator/gui/MainFrame.java @@ -612,7 +612,7 @@ public Settings getSettings() { // get values from UI String logFile=getLogFile(); - String xtflogFile=getXtfLogFile(); + String datalogFile=getXtfLogFile(); String configFile=getConfigFile(); String metaConfigFile=getMetaConfigFile(); String modelNames=getModelNames(); @@ -638,7 +638,11 @@ public Settings getSettings() newSettings.setValue(ch.interlis.ili2c.gui.UserSettings.WORKING_DIRECTORY,workingDir); newSettings.setValue(Validator.SETTING_LOGFILE,logFile); - newSettings.setValue(Validator.SETTING_XTFLOG,xtflogFile); + if(datalogFile!=null && GenericFileFilter.createCsvFilter().getExtension().equals(GenericFileFilter.getFileExtension(datalogFile))){ + newSettings.setValue(Validator.SETTING_CSVLOG,datalogFile); + }else { + newSettings.setValue(Validator.SETTING_XTFLOG,datalogFile); + } newSettings.setValue(Validator.SETTING_MODELNAMES,modelNames); newSettings.setValue(Validator.SETTING_CONFIGFILE,configFile); newSettings.setValue(Validator.SETTING_META_CONFIGFILE,metaConfigFile); @@ -708,7 +712,7 @@ public static void main(String[] xtfFile,Settings settings) { frame.setSettings(settings); String logFile=settings.getValue(Validator.SETTING_LOGFILE); frame.setLogFile(logFile); - EhiLogger.getInstance().addListener(new LogListener(frame,logFile)); + resetLogListener(frame,logFile); frame.setXtfFile(xtfFile); String modelList=settings.getValue(Validator.SETTING_MODELNAMES); frame.setModelNames(modelList); @@ -722,6 +726,14 @@ public static void main(String[] xtfFile,Settings settings) { restoreWindowSizeAndLocation(frame, settings); frame.show(); } + private LogListener logListener=null; + private static void resetLogListener(MainFrame frame,String logFile) { + if(frame.logListener!=null) { + EhiLogger.getInstance().removeListener(frame.logListener); + } + frame.logListener=new LogListener(frame,logFile); + EhiLogger.getInstance().addListener(frame.logListener); + } private static void restoreWindowSizeAndLocation(JFrame frame, Settings settings) { try { int width = Integer.parseInt(settings.getValue(WINDOW_WIDTH)); @@ -756,6 +768,7 @@ public void actionPerformed(java.awt.event.ActionEvent e) { public Object construct() { try { boolean ret=Validator.runValidation(getXtfFile(),getSettings()); + resetLogListener(MainFrame.this, getLogFile()); getLogUi().setCaretPosition(getLogUi().getDocument().getLength()); Toolkit.getDefaultToolkit().beep(); JOptionPane.showMessageDialog(MainFrame.this, ret?Validator.MSG_VALIDATION_DONE:Validator.MSG_VALIDATION_FAILED); @@ -834,7 +847,8 @@ public void actionPerformed(java.awt.event.ActionEvent e) { FileChooser fileDialog = new FileChooser(file); fileDialog.setCurrentDirectory(new File(getWorkingDirectory())); fileDialog.setDialogTitle(rsrc.getString("MainFrame.xtflogFileChooserTitle")); - fileDialog.setFileFilter(new GenericFileFilter(rsrc.getString("MainFrame.xtfFileFilter"),"xtf")); + fileDialog.addChoosableFileFilter(new GenericFileFilter(rsrc.getString("MainFrame.xtfFileFilter"),"xtf")); + fileDialog.setFileFilter(GenericFileFilter.createCsvFilter()); if (fileDialog.showSaveDialog(MainFrame.this) == FileChooser.APPROVE_OPTION) { setWorkingDirectory(fileDialog.getCurrentDirectory().getAbsolutePath());