package journal.reader; import java.io.FileReader; import java.io.IOException; import java.io.PrintStream; import java.io.Reader; import java.util.Properties; /* * Simple helper class to transport all options together in one block */ public class Options { public enum Names { COMPRESSED("reader.compressed", Boolean.FALSE.toString()), VERBOSE("reader.verbose", Boolean.FALSE.toString()), CASE_INSENSITIVE("reader.caseinsensitive", Boolean.FALSE.toString()), ACTION("reader.action","journal.action.JournalAction"), FILTER("reader.filter", ""), OUTPUT_FILE("reader.outputfile", ""), SQL_CLASSPATH("sql.classpath", ""), SQL_CLASSNAME("sql.classname", ""), SQL_CONNECTION("sql.connection", ""); final String option; final String defaultValue; private Names(String option, String defaultValue) { this.option = option; this.defaultValue = defaultValue; } public String option() { return option; } public String defaultValue() { return defaultValue; } } private Properties defineDefaultProperties() { Properties prop = new Properties(); for (Options.Names o : Options.Names.values()) { prop.setProperty(o.option, o.defaultValue); } return prop; } public void loadProperties(String fileName) throws IOException { Reader reader = new FileReader(fileName); properties.load(reader); } public String getProperty(String propertyName) { return properties.getProperty(propertyName); } public String getProperty(Options.Names opt) { return properties.getProperty(opt.option); } public Options() { } public boolean compressed; public boolean verbose; public boolean caseInsensitive; public PrintStream outputStream; public PrintStream errorStream; public Properties properties = new Properties(defineDefaultProperties()); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 7529 | Sven Erik Knop |
Deleted the whole JournalReader. It has actually moved to //guest/sven_erik_knop/java/JournalReader/. |
||
#2 | 7427 | Sven Erik Knop |
Major update of the JournalReader: - New help (usage) system, which explains all options - Config file that allows storing of parameters in a file. These are necessary for the SQLLoader and Updater, because classpath, classname and connection parameters need to be set. (see the example *.cfg files provided) - Now tested with MySQL, SQLite and Oracle 10 XE |
||
#1 | 7375 | Sven Erik Knop |
Major update of the JournalReader. Complete rewrite of the command line parsing Change in the options parsing within the journal reader New SQLLoader action. Currently only against MySQL (needs MySQL JDBC driver) with fixed database and user name. This will be replaced by a config file at some stage. |