net.sf.statsvn.input
public class CacheBuilder extends java.lang.Object
CVS log files include lines modified for each commit and binary status of a file while SVN log files do not offer this additional information.
StatSVN must query the Subversion repository for line counts using svn diff. However, this is very costly, performance-wise. Therefore, the decision was taken to persist this information in an XML file. This class receives information from (@link net.sf.statsvn.input.SvnXmlLineCountsFileHandler) to build a DOM-based xml structure. It also forwards line counts to the appropriate (@link net.sf.statsvn.input.FileBuilder).
Constructor and Description |
---|
CacheBuilder(SvnLogBuilder builder,
RepositoryFileManager repositoryFileManager)
Constructs the LineCountsBuilder by giving it a reference to the builder
currently in use.
|
Modifier and Type | Method and Description |
---|---|
void |
buildPath(java.lang.String name,
java.lang.String revision,
java.lang.String binaryStatus)
Initializes the builder for subsequent invocations of (@link
#buildRevision(String, String, String)).
|
void |
buildRevision(java.lang.String number,
java.lang.String added,
java.lang.String removed,
java.lang.String binaryStatus)
Given the file specified by the preceeding invocation to (@link
#buildPath(String)), set the line counts for the given revision.
|
void |
buildRoot()
Builds the DOM root.
|
org.w3c.dom.Document |
getDocument()
Returns the DOM object when building is complete.
|
boolean |
isBinary(java.lang.String fileName,
java.lang.String revisionNumber)
Checks the path's cached binary status.
|
void |
newRevision(java.lang.String name,
java.lang.String number,
java.lang.String added,
java.lang.String removed,
boolean binaryStatus)
Adds a revision to the DOM.
|
void |
updateBinaryStatus(java.util.Collection fileBuilders,
java.lang.String revisionNumber)
Updates all paths in the DOM structure with the latest binary status
information from the working folder.
|
public CacheBuilder(SvnLogBuilder builder, RepositoryFileManager repositoryFileManager)
builder
- the SvnLogBuilder which contains all the FileBuilders.public void buildPath(java.lang.String name, java.lang.String revision, java.lang.String binaryStatus)
name
- the filenamepublic void buildRevision(java.lang.String number, java.lang.String added, java.lang.String removed, java.lang.String binaryStatus)
number
- the revision numberadded
- the number of lines addedremoved
- the number of lines removed.public void buildRoot() throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
public org.w3c.dom.Document getDocument()
public void newRevision(java.lang.String name, java.lang.String number, java.lang.String added, java.lang.String removed, boolean binaryStatus)
name
- the filenamenumber
- the revision numberadded
- the number of lines addedremoved
- the number of lines removedpublic void updateBinaryStatus(java.util.Collection fileBuilders, java.lang.String revisionNumber)
name
- the filenamenumber
- the revision numberadded
- the number of lines addedremoved
- the number of lines removedpublic boolean isBinary(java.lang.String fileName, java.lang.String revisionNumber)
fileName
- the path to be checkedrevisionNumber
- the revision of the path to be checked