package journal.action; import java.util.SortedSet; import java.util.TreeSet; import journal.reader.DataJournalEntry; import journal.schema.TableVersion; public class UserLister extends BaseAction { @Override public void putValue(DataJournalEntry data) throws Exception { TableVersion version = data.getTableVersion(); String user = null; if( version.getAttributeByName("user") != null ) { user = (String) data.getValue("user"); } else if( version.getAttributeByName("owner") != null ) { user = (String) data.getValue("owner"); } if( user != null && ! user.equals("")) { if( options.isCaseInsensitive() ) { user = user.toLowerCase(); } if( ! uniqueUsers.contains(user)) { uniqueUsers.add(user); } } } @Override public void finish() throws Exception { for( String user : uniqueUsers) { out.println(user + "="); } if( outputFile != "" ) { out.close(); } } SortedSet<String> uniqueUsers = new TreeSet<String>(); }
# | 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/UserLister.java | |||||
#2 | 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. |
||
#1 | 8187 | Sven Erik Knop |
Added a simple UserLister action to list all users present and past in a checkpoint. Use like this: java -jar JournalReader -a journal.action.UserLister <checkpoint> Prints the users out to stdout (or a file if -o <filename> is specified) in the form username= This should make it easy to add the new name for a RenameAction. |