package journal.schema; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; public class TableVersion implements Iterable<Attribute> { private int version; private Table table; private List<Attribute> attributes = new ArrayList<Attribute>(); public TableVersion(final Table table, final int version) { this.table = table; this.version = version; table.addVersion(this); } public TableVersion(final TableVersion previous, final int version) { this.table = previous.table; this.version = version; attributes.addAll(previous.attributes); table.addVersion(this); } public int getVersion() { return version; } public Table getTable() { return table; } public List<Attribute> getAttributes() { return Collections.unmodifiableList(attributes); } public void addAttributes(TableVersion otherVersion) { attributes.addAll(otherVersion.attributes); } public void addAttribute(String name, Domain domain) { attributes.add(new Attribute(name, domain)); } public void addAttribute(String name, Domain domain, int index) { attributes.add(index, new Attribute(name, domain)); } public Attribute getAttribute(int index) { return attributes.get(index); } public Attribute getAttributeByName(String attrName) { for (Attribute attr : attributes) { if (attr.getName().equals(attrName)) { return attr; } } return null; } public void removeAttribute(String attrName) { Attribute attr = getAttributeByName(attrName); if (attr != null) { attributes.remove(attr); } else { throw new IllegalArgumentException("Remove Attribute " + attrName + ". Not found"); } } public String toString() { StringBuffer buf = new StringBuffer("Version : " + version + "\n"); for (Attribute attr : attributes) { buf.append("\t"); buf.append(attr); buf.append("\n"); } return buf.toString(); } public Object toJournalString() { StringBuffer buf = new StringBuffer(); buf.append(version); buf.append(" @"); buf.append(table.getName()); buf.append("@"); return buf.toString(); } public Iterator<Attribute> iterator() { return attributes.iterator(); } }
# | 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/schema/TableVersion.java | |||||
#2 | 8025 | Sven Erik Knop | Removed a couple of warnings. | ||
#1 | 7589 | Sven Erik Knop | Rescue attempt to recover missing files from the JournalReader | ||
//guest/sven_erik_knop/JournalReader/src/journal/schema/TableVersion.java | |||||
#2 | 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. |
||
#1 | 7374 | Sven Erik Knop | Rename/move file(s) - correct location for Eclipse project | ||
//guest/sven_erik_knop/JournalReader/journal/schema/TableVersion.java | |||||
#2 | 7117 | Sven Erik Knop |
Added HighAsciiFinderAction, an action that displays all journal/checkpoint entries that contain high ascii characters in any of their text fields. Small adjustment in journal.schema.TableVersion to provide an iterator for all attributes: for (Attribute attr : tableVersion) |
||
#1 | 6467 | Sven Erik Knop |
Added JournalReader, a Java library of useful tools to read and process checkpoints and journals. Added are a readme.txt to explain some details, and a jar file that contains the compiled class files. The programs will need Java 1.6 to run. |