Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
claeis committed Dec 29, 2023
2 parents 68a706c + c72ea0b commit 24c5f1a
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 8 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
10 changes: 10 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 2 additions & 0 deletions docs/ilivalidator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
4 changes: 4 additions & 0 deletions src/org/interlis2/validator/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -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.");
Expand Down
27 changes: 27 additions & 0 deletions src/org/interlis2/validator/Validator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand All @@ -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{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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";
Expand Down
22 changes: 18 additions & 4 deletions src/org/interlis2/validator/gui/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 24c5f1a

Please sign in to comment.