Skip to content

Commit

Permalink
Changing File Separator
Browse files Browse the repository at this point in the history
=======================
For testing with Linux
  • Loading branch information
Chlara committed Nov 28, 2014
1 parent 167ac4b commit a487f15
Show file tree
Hide file tree
Showing 14 changed files with 215 additions and 127 deletions.
62 changes: 36 additions & 26 deletions KOST-Val/src/main/java/ch/kostceco/tools/kostval/KOSTVal.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ public static void main( String[] args ) throws IOException
System.out.println( "KOST-Val" );
System.out.println( "" );

File xslOrig = new File( "resources\\kost-val.xsl" );
File xslOrig = new File( "resources" + File.separator + "kost-val.xsl" );
File xslCopy = new File( directoryOfLogfile.getAbsolutePath()
+ "\\kost-val.xsl" );
+ File.separator + "kost-val.xsl" );
if ( !xslCopy.exists() ) {
Util.copyFile( xslOrig, xslCopy );
}
Expand All @@ -193,7 +193,7 @@ public static void main( String[] args ) throws IOException
String tiffValidation = kostval.getConfigurationService()
.tiffValidation();
String jp2Validation = kostval.getConfigurationService()
.jp2Validation();
.jp2Validation();

File tmpDir = new File( pathToWorkDir );

Expand Down Expand Up @@ -298,14 +298,17 @@ public static void main( String[] args ) throws IOException
System.exit( 1 );
}

File xmlDiaOrig = new File( "resources\\KaD-Diagnosedaten.kost-val.xml" );
File xmlDiaCopy = new File( diaPath
+ "\\KaD-Diagnosedaten.kost-val.xml" );
File xmlDiaOrig = new File( "resources" + File.separator
+ "KaD-Diagnosedaten.kost-val.xml" );
File xmlDiaCopy = new File( diaPath + File.separator
+ "KaD-Diagnosedaten.kost-val.xml" );
if ( !xmlDiaCopy.exists() ) {
Util.copyFile( xmlDiaOrig, xmlDiaCopy );
}
File xslDiaOrig = new File( "resources\\kost-val_KaDdia.xsl" );
File xslDiaCopy = new File( diaPath + "\\kost-val_KaDdia.xsl" );
File xslDiaOrig = new File( "resources" + File.separator
+ "kost-val_KaDdia.xsl" );
File xslDiaCopy = new File( diaPath + File.separator
+ "kost-val_KaDdia.xsl" );
if ( !xslDiaCopy.exists() ) {
Util.copyFile( xslDiaOrig, xslDiaCopy );
}
Expand Down Expand Up @@ -603,7 +606,8 @@ public static void main( String[] args ) throws IOException
Util.valEnd( ausgabeEnd, logFile );
Util.amp( logFile );

countSummaryNio = pdfaCountNio + siardCountNio + tiffCountNio + jp2CountNio;
countSummaryNio = pdfaCountNio + siardCountNio + tiffCountNio
+ jp2CountNio;

if ( countNio.equals( count ) ) {
// keine Dateien Validiert
Expand Down Expand Up @@ -777,7 +781,8 @@ public static void main( String[] args ) throws IOException
String toplevelDir = valDatei.getName();
int lastDotIdx = toplevelDir.lastIndexOf( "." );
toplevelDir = toplevelDir.substring( 0, lastDotIdx );
tmpDirZip = new File( tmpDir.getAbsolutePath() + "\\ZIP\\"
tmpDirZip = new File( tmpDir.getAbsolutePath()
+ File.separator + "ZIP" + File.separator
+ toplevelDir );
try {
Zip64Archiver.unzip( valDatei.getAbsolutePath(),
Expand Down Expand Up @@ -851,7 +856,7 @@ public static void main( String[] args ) throws IOException
valDatei = tmpDirZip;

File toplevelfolder = new File( valDatei.getAbsolutePath()
+ "\\" + valDatei.getName() );
+ File.separator + valDatei.getName() );
if ( toplevelfolder.exists() ) {
valDatei = toplevelfolder;
}
Expand Down Expand Up @@ -895,7 +900,8 @@ public static void main( String[] args ) throws IOException
File newFile = fileMap.get( entryName );

if ( !newFile.isDirectory()
&& newFile.getAbsolutePath().contains( "\\content\\" ) ) {
&& newFile.getAbsolutePath().contains(
File.separator + "content" + File.separator ) ) {
valDatei = newFile;
count = count + 1;

Expand Down Expand Up @@ -975,7 +981,7 @@ public static void main( String[] args ) throws IOException
}

if ( ((valDatei.getAbsolutePath().toLowerCase()
.endsWith( ".jp2" ) ))
.endsWith( ".jp2" )))
&& jp2Validation.equals( "yes" ) ) {

boolean valFile = valFile( valDatei, logFileName,
Expand Down Expand Up @@ -1010,7 +1016,7 @@ public static void main( String[] args ) throws IOException
String pathToWorkDirSiard = kostval
.getConfigurationService().getPathToWorkDir();
File tmpDirSiard = new File( pathToWorkDirSiard
+ "\\SIARD" );
+ File.separator + "SIARD" );
if ( tmpDirSiard.exists() ) {
Util.deleteDir( tmpDirSiard );
}
Expand Down Expand Up @@ -1047,8 +1053,10 @@ public static void main( String[] args ) throws IOException
}
}

countSummaryNio = pdfaCountNio + siardCountNio + tiffCountNio+ jp2CountNio;
countSummaryIo = pdfaCountIo + siardCountIo + tiffCountIo+ jp2CountIo;
countSummaryNio = pdfaCountNio + siardCountNio + tiffCountNio
+ jp2CountNio;
countSummaryIo = pdfaCountIo + siardCountIo + tiffCountIo
+ jp2CountIo;
int countSummaryIoP = 100 / count * countSummaryIo;
int countSummaryNioP = 100 / count * countSummaryNio;
int countNioP = 100 / count * countNio;
Expand All @@ -1067,7 +1075,8 @@ public static void main( String[] args ) throws IOException
fileName3c = "3c_Invalide.txt";
}
// outputFile3c = new File( directoryOfLogfile + fileName3c );
outputFile3c = new File( pathToWorkDir + "\\" + fileName3c );
outputFile3c = new File( pathToWorkDir + File.separator
+ fileName3c );
try {
outputFile3c.createNewFile();
} catch ( IOException e ) {
Expand Down Expand Up @@ -1405,8 +1414,8 @@ public static void main( String[] args ) throws IOException
Util.deleteDir( tmpDir );
}
if ( tmpDir.exists() ) {
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec( command.toString() );
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec( command.toString() );
}
System.exit( 0 );
} else {
Expand All @@ -1415,8 +1424,8 @@ public static void main( String[] args ) throws IOException
Util.deleteDir( tmpDir );
}
if ( tmpDir.exists() ) {
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec( command.toString() );
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec( command.toString() );
}
System.exit( 2 );
}
Expand Down Expand Up @@ -1452,7 +1461,7 @@ private static boolean valFile( File valDatei, String logFileName,
String originalValName = valDatei.getAbsolutePath();
boolean valFile = false;

if ( (valDatei.getAbsolutePath().toLowerCase().endsWith( ".jp2" ) ) ) {
if ( (valDatei.getAbsolutePath().toLowerCase().endsWith( ".jp2" )) ) {
LOGGER.logError( kostval.getTextResourceService().getText(
MESSAGE_XML_VALERGEBNIS ) );
LOGGER.logError( kostval.getTextResourceService().getText(
Expand Down Expand Up @@ -1490,8 +1499,8 @@ private static boolean valFile( File valDatei, String logFileName,

// Ausgabe der Pfade zu den Jpylyzer Reports, falls welche
// generiert wurden (-v) oder Jpylyzer Report löschen
File JpylyzerReport = new File( directoryOfLogfile, valDatei.getName()
+ ".jpylyzer-log.xml" );
File JpylyzerReport = new File( directoryOfLogfile,
valDatei.getName() + ".jpylyzer-log.xml" );

if ( JpylyzerReport.exists() ) {
if ( verbose ) {
Expand All @@ -1502,8 +1511,9 @@ private static boolean valFile( File valDatei, String logFileName,
}
}

} else if ( (valDatei.getAbsolutePath().toLowerCase().endsWith( ".tiff" ) || valDatei
.getAbsolutePath().toLowerCase().endsWith( ".tif" )) ) {
} else if ( (valDatei.getAbsolutePath().toLowerCase()
.endsWith( ".tiff" ) || valDatei.getAbsolutePath()
.toLowerCase().endsWith( ".tif" )) ) {
LOGGER.logError( kostval.getTextResourceService().getText(
MESSAGE_XML_VALERGEBNIS ) );
LOGGER.logError( kostval.getTextResourceService().getText(
Expand Down
Loading

0 comments on commit a487f15

Please sign in to comment.