package journal.action; import java.io.FileOutputStream; import java.io.PrintStream; import journal.reader.DataJournalEntry; import journal.reader.DeleteJournalEntry; import journal.reader.NoteJournalEntry; import journal.reader.Options; import journal.reader.TransactionJournalEntry; public abstract class BaseAction implements Action { @Override public void start() throws Exception { } @Override public void setDefaultOptions(Options options) { this.options = options; this.out = options.getOutputStream(); options.setOptionName(this.getClass().getName(), "outputFile", "", new Options.OptionSetter() { public void set(String key, String value) { if( outputFile != "" ) { out.close(); } outputFile = value; try { out = new PrintStream(new FileOutputStream(outputFile)); } catch (Exception e) { System.err.println("Cannot open file : " + outputFile); e.printStackTrace(System.err); System.exit(1); } } } ); } @Override public void help() { } @Override public void finish() throws Exception { if( outputFile != "" ) { out.close(); } } @Override public String[] parseArgs(String[] args) { return args; } @Override public void putValue(DataJournalEntry entry) throws Exception { // empty implementation } @Override public void replaceValue(DataJournalEntry entry) throws Exception { // empty implementation } @Override public void deleteValue(DataJournalEntry entry) throws Exception { // empty implementation } @Override public void verifyValue(DataJournalEntry entry) throws Exception { // empty implementation } @Override public void commitMarker(TransactionJournalEntry entry) throws Exception { // empty implementation } @Override public void flushMarker(TransactionJournalEntry entry) throws Exception { // empty implementation } @Override public void journalMarker(NoteJournalEntry entry) throws Exception { // empty implementation } @Override public void deleteMarker(DeleteJournalEntry entry) throws Exception { // empty implementation } protected String outputFile = ""; protected PrintStream out; protected Options options; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 24773 | Norman Morse |
Moving journalReader from sven's private branch to perforce_software. This is because journalReader is used in the perfsplit test harness, and should be updated over time. Merging //guest/sven_erik_knop/java/JournalReader/... to //guest/perforce_software/journalReader/... |
||
//guest/sven_erik_knop/java/JournalReader/src/journal/action/BaseAction.java | |||||
#7 | 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. |
||
#6 | 8200 | Sven Erik Knop |
JournalReader can now process delete records (@dl@). Also fixed processing of type 12 note records = journaldbchecksum |
||
#5 | 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. |
||
#4 | 8020 | Sven Erik Knop | Replace public Option attributes with setters and getters. | ||
#3 | 8016 | Sven Erik Knop | In the middle of refactoring the Renamer classes into the BaseRenamer. | ||
#2 | 7874 | Sven Erik Knop | Upgrade to 2010.2 including new JournalNotes. | ||
#1 | 7527 | Sven Erik Knop |
JournalReader, now in its proper place. Documentation to follow. |