package journal.action; import java.util.ArrayList; import java.util.List; import jargs.gnu.CmdLineParser; import journal.schema.TableVersion; public class FilepathRenamer extends BaseRenamerAction { public FilepathRenamer() { super("FilepathRenamer"); } @Override public void start() throws Exception { super.start(); } @Override public void help() { System.err.println("\t--action journal.action.FilepathRenamer -- <options>"); System.err.println("\t\tOptions are\n"); super.help(); } @Override public void finish() throws Exception { super.finish(); } @Override void addArgs(CmdLineParser parser) { // no args at the moment } @Override void processArgs(CmdLineParser parser) { // therefore nothing to process } @Override RenameAction getAction(TableVersion version) { if( !actionMap.containsKey(version)) { RenameAction action = EmptyAction.instance; List<RenameAction> list = new ArrayList<RenameAction>(); if( version.getAttributeByName("dfile") != null ) { list.add( new FileRenameAction("dfile") ); } if( version.getAttributeByName("tfile") != null ) { list.add( new FileRenameAction("tfile") ); } if( version.getAttributeByName("ffile") != null ) { list.add( new FileRenameAction("ffile") ); } if( version.getAttributeByName("afile") != null ) { list.add( new FileRenameAction("afile") ); } // need to add traits for P4Bucket // need to test archive ! if( list.size() == 1 ) { action = list.get(0); } else if ( list.size() > 1 ) { action = new CompoundActions(list); } actionMap.put(version, action); } return actionMap.get(version); } }
# | 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/FilepathRenamer.java | |||||
#3 | 8027 | Sven Erik Knop |
Moved exceptions to their own package. Enabled new Action FilepathRenamer (not fully tested yet). |
||
#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 | 8022 | Sven Erik Knop |
Beginnings of a FilepathRenamer. Not done yet or even tested. |