package journal.action; import java.sql.SQLException; import journal.reader.TransactionJournalEntry; import journal.reader.Options; public class SQLLoader extends SQLUpdater { private int batchSize; public SQLLoader() { } @Override public void setDefaultOptions(Options options) { super.setDefaultOptions(options); options.setOptionName(this.getClass().getName(), "batchsize", "100", new Options.OptionSetter() { public void set(String key, String value) { batchSize = Integer.parseInt(value); } } ); } @Override public void start() throws Exception { super.start(); sf.dropTables(); sf.setBatchSize(batchSize); } @Override public void commitMarker(TransactionJournalEntry entry) throws Exception { try { sf.commitMarker(entry); } catch (SQLException ex) { handleSQLException(ex); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 8296 | Sven Erik Knop |
Clean-up: instead of casting in every action, cast only once in the dispatcher. Should make code saner and safer. No functional change. |
||
#3 | 8239 | Sven Erik Knop | Added missing super call for setDefaultOptions | ||
#2 | 8023 | Sven Erik Knop |
Complete rewrite of the configuration file, now based on an ini-file format. The ini file has a general [reader] section for settings like verbose, outputFile, case-sensitivity and so on. It also allows to set up a range of Actions and Filters. The section name here is the fully classified class name, followed by settings for the particular actions. An example will make this clearer: ================================================================ [reader] verbose=true [journal.action.UserRenamer] fileName=user.txt patch=True outputFile=user.out [journal.action.ClientRenamer] fileName=client.txt outputFile=client.out patch=true ================================================================ I will provide more example set-ups in the near future. Filters are classes implementing journal.action.Filter (soon to be journal.filter.Filter) which can be chained together and are all executed before the actions. Actions are applied in order that they are given in the config file. |
||
#1 | 7527 | Sven Erik Knop |
JournalReader, now in its proper place. Documentation to follow. |