org.opensolaris.opengrok.history
Class HistoryGuru

java.lang.Object
  extended by org.opensolaris.opengrok.history.HistoryGuru

public final class HistoryGuru
extends java.lang.Object

The HistoryGuru is used to implement an transparent layer to the various source control systems.


Method Summary
 void addRepositories(java.lang.String dir)
          Search through the all of the directories and add all of the source repositories found.
 Annotation annotate(java.io.File file, java.lang.String rev)
          Annotate the specified revision of a file.
 void createCache()
          Create the history cache for all of the repositories
 void createCache(java.util.List<java.lang.String> repositories)
           
 HistoryReader getHistoryReader(java.io.File file)
          Get the appropriate history reader for the file specified by parent and basename.
static HistoryGuru getInstance()
          Get the one and only instance of the HistoryGuru
 java.io.InputStream getRevision(java.lang.String parent, java.lang.String basename, java.lang.String rev)
          Get a named revision of the specified file.
 boolean hasAnnotation(java.io.File file)
          Check if we can annotate the specified file.
 boolean hasHistory(java.io.File file)
          Does this directory contain files with source control information?
 void updateRepositories()
          Update the source the contents in the source repositories.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static HistoryGuru getInstance()
Get the one and only instance of the HistoryGuru

Returns:
the one and only HistoryGuru instance

annotate

public Annotation annotate(java.io.File file,
                           java.lang.String rev)
                    throws java.io.IOException
Annotate the specified revision of a file.

Parameters:
file - the file to annotate
rev - the revision to annotate (null means BASE)
Returns:
file annotation, or null if the HistoryParser does not support annotation
Throws:
java.io.IOException

getHistoryReader

public HistoryReader getHistoryReader(java.io.File file)
                               throws HistoryException
Get the appropriate history reader for the file specified by parent and basename.

Parameters:
file - The file to get the history reader for
Returns:
A HistorReader that may be used to read out history data for a named file
Throws:
HistoryException - If an error occurs while getting the history

getRevision

public java.io.InputStream getRevision(java.lang.String parent,
                                       java.lang.String basename,
                                       java.lang.String rev)
                                throws java.io.IOException
Get a named revision of the specified file.

Parameters:
parent - The directory containing the file
basename - The name of the file
rev - The revision to get
Returns:
An InputStream containing the named revision of the file.
Throws:
java.io.IOException - If an error occurs while reading out the version

hasHistory

public boolean hasHistory(java.io.File file)
Does this directory contain files with source control information?

Parameters:
file - The name of the directory
Returns:
true if the files in this directory have associated revision history

hasAnnotation

public boolean hasAnnotation(java.io.File file)
Check if we can annotate the specified file.

Parameters:
file - the file to check
Returns:
true if the file is under version control and the version control system supports annotation

addRepositories

public void addRepositories(java.lang.String dir)
Search through the all of the directories and add all of the source repositories found.

Parameters:
dir - the root directory to start the search in.

updateRepositories

public void updateRepositories()
Update the source the contents in the source repositories.


createCache

public void createCache()
Create the history cache for all of the repositories


createCache

public void createCache(java.util.List<java.lang.String> repositories)