Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.statsvn.input
Class CacheBuilder

    java.lang.Object
      net.sf.statsvn.input.CacheBuilder

public class CacheBuilder
extends 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).

Version:
  $Id: CacheBuilder.java 351 2008-03-28 18:46:26Z benoitx $
Author:
  Gunter Mussbacher

Constructor Summary
`CacheBuilder(SvnLogBuilder builder, RepositoryFileManager repositoryFileManager)` Constructs the LineCountsBuilder by giving it a reference to the builder currently in use.

Method Summary
`void` | `buildPath(String name, String revision, String binaryStatus)` Initializes the builder for subsequent invocations of (@link #buildRevision(String, String, String)).
`void` | `buildRevision(String number, String added, String removed, 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.
`Document` | `getDocument()` Returns the DOM object when building is complete.
`boolean` | `isBinary(String fileName, String revisionNumber)` Checks the path's cached binary status.
`void` | `newRevision(String name, String number, String added, String removed, boolean binaryStatus)` Adds a revision to the DOM.
`void` | `updateBinaryStatus(Collection fileBuilders, String revisionNumber)` Updates all paths in the DOM structure with the latest binary status information from the working folder.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CacheBuilder

    public CacheBuilder(SvnLogBuilder builder,
                        RepositoryFileManager repositoryFileManager)

  Constructs the LineCountsBuilder by giving it a reference to the builder currently in use.

Parameters:
  `builder` - the SvnLogBuilder which contains all the FileBuilders.

Method Detail

### buildPath

    public void buildPath(String name,
                          String revision,
                          String binaryStatus)

  Initializes the builder for subsequent invocations of (@link #buildRevision(String, String, String)).

  Parameters:
    `name` - the filename

### buildRevision

    public void buildRevision(String number,
                              String added,
                              String removed,
                              String binaryStatus)

  Given the file specified by the preceeding invocation to (@link #buildPath(String)), set the line counts for the given revision. If the path given in the preceeding invocation to (@link #buildPath(String)) is not used by the (@link SvnLogBuilder), this call does nothing.

  Parameters:
    `number` - the revision number
    `added` - the number of lines added
    `removed` - the number of lines removed.

### buildRoot

    public void buildRoot()
                   throws ParserConfigurationException

  Builds the DOM root.

  Throws:
    `ParserConfigurationException`

### getDocument

    public Document getDocument()

  Returns the DOM object when building is complete.

  Returns:
    the DOM document.

### newRevision

    public void newRevision(String name,
                            String number,
                            String added,
                            String removed,
                            boolean binaryStatus)

  Adds a revision to the DOM. Encapsulates calls to (@link #buildRoot()), (@link #buildPath(String)), and (@link #buildRevision(String, String, String)) into one easy to use interface.

  Parameters:
    `name` - the filename
    `number` - the revision number
    `added` - the number of lines added
    `removed` - the number of lines removed

### updateBinaryStatus

    public void updateBinaryStatus(Collection fileBuilders,
                                   String revisionNumber)

  Updates all paths in the DOM structure with the latest binary status information from the working folder.

### isBinary

    public boolean isBinary(String fileName,
                            String revisionNumber)

  Checks the path's cached binary status.

  Parameters:
    `fileName` - the path to be checked
    `revisionNumber` - the revision of the path to be checked
  Returns:
    true if the path's BINARY_STATUS is true and the revisionNumber is lower or equal to the path's LATEST_REVISION

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD