version 1.7, 2005/04/11 13:27:12
|
version 1.8, 2005/04/12 10:58:54
|
Line 31 import java.sql.Statement;
|
Line 31 import java.sql.Statement;
|
import java.sql.Types; |
import java.sql.Types; |
import java.text.ParseException; |
import java.text.ParseException; |
import java.util.ArrayList; |
import java.util.ArrayList; |
|
import java.util.Enumeration; |
import java.util.Hashtable; |
import java.util.Hashtable; |
import java.util.Iterator; |
import java.util.Iterator; |
import java.util.List; |
import java.util.List; |
|
import java.util.Properties; |
import java.util.StringTokenizer; |
import java.util.StringTokenizer; |
import java.util.TreeSet; |
import java.util.TreeSet; |
import java.util.Vector; |
import java.util.Vector; |
Line 119 class Convert
|
Line 121 class Convert
|
|
|
final static int numIntervalls = 4; |
final static int numIntervalls = 4; |
|
|
static boolean debug =! false; |
static boolean debug = false; |
|
|
static boolean isGUI = true; |
static boolean isGUI = true; |
|
|
Line 144 class Convert
|
Line 146 class Convert
|
* //System.out.println(new String(b,"UTF-8")); } catch |
* //System.out.println(new String(b,"UTF-8")); } catch |
* (UnsupportedEncodingException e) { e.printStackTrace(); } |
* (UnsupportedEncodingException e) { e.printStackTrace(); } |
*/ |
*/ |
|
File tmpPath = new File(System.getProperty("java.io.tmpdir")); |
isGUI = false; |
isGUI = false; |
FileOutputStream file = null; |
FileOutputStream file = null; |
if (args.length != 1) |
if (args.length != 1) |
{ |
{ |
System.out.println(versionID); |
System.out.println(versionID); |
System.out.println("Usage: java Convert <xml config file>"); |
System.out.println("Usage: java Convert <xml config file>"); |
|
System.out.println("Log file will be written in "+tmpPath.getCanonicalPath()+" folder "); |
System.exit(-1); |
System.exit(-1); |
} |
} |
|
File temp = null; |
try |
try |
{ |
{ |
File temp = File.createTempFile("fm2sql", ".txt"); |
temp = new File(tmpPath, "fm2sql.txt"); |
|
int count = 1; |
|
while (temp.exists()) |
|
{ |
|
temp = new File(tmpPath, "fm2sql" + generateSuffix(count++) + ".txt"); |
|
} |
file = new FileOutputStream(temp); |
file = new FileOutputStream(temp); |
} catch (FileNotFoundException e1) |
} catch (FileNotFoundException e1) |
{ |
{ |
e1.printStackTrace(); |
e1.printStackTrace(); |
} |
} |
PrintStream stream = new PrintStream(file, true); |
PrintStream stream = new PrintStream(file, true); |
|
// write info for user to stdout |
|
System.out.println(versionID); |
|
System.out.println("Loading "+args[0]+"...."); |
|
System.out.println("Log will be written to "+temp.getCanonicalPath()); |
|
|
if (!debug) |
if (!debug) |
{ |
{ |
System.setOut(stream); |
System.setOut(stream); |
System.setErr(stream); |
System.setErr(stream); |
} |
} |
System.out.println(versionID); |
System.out.println(versionID); |
|
System.out.println("Using config file : "+args[0]+"...."); |
|
|
StringBuffer sb = readXMLFile(args[0]); |
StringBuffer sb = readXMLFile(args[0]); |
parseXMLConfig(sb); |
parseXMLConfig(sb); |
if (!(new File(args[0]).exists())) |
if (!(new File(args[0]).exists())) |
Line 3866 class Convert
|
Line 3883 class Convert
|
// ****** end Test ****** |
// ****** end Test ****** |
|
|
} |
} |
|
|
|
public final static String generateSuffix(final int step) |
|
{ |
|
String fileString = null; |
|
if (step < 10) |
|
fileString = "00" + step; |
|
else if (step < 100) |
|
fileString = "0" + step; |
|
else |
|
fileString = step + ""; |
|
return fileString; |
|
} |
|
|
} |
} |
|
|