ca.utoronto.JCVSReport
Class MetricDatabase

java.lang.Object
  extended bynet.sf.bloof.db.Database
      extended byca.utoronto.JCVSReport.MetricDatabase

public class MetricDatabase
extends Database

A McKoi database for storing metrics based on statistics gathered from CVS repositories

Author:
David James, Polina Gohshtein

Field Summary
 
Fields inherited from class net.sf.bloof.db.Database
CREATE_INDEX_FILE, CREATE_TABLE_FILE, DROP_TABLE_FILE, mConnection, mDeveloperNames, mFileNameMaxRevisionDate, mPrepAddFileDeletionStatement, mPreparedAddDeveloperStatement, mPrepFileAddStatement, mPrepRevisionAddStatement, mStatement, sLogger, SQL_ADD_DEVELOPER, SQL_ADD_FILE, SQL_ADD_FILE_DELETION, SQL_ADD_REVISION, SQL_GET_DEVELOPER, SQL_GET_FILES, SQL_GET_PROJECTDATA, SQL_GET_TIME_BOUNDARY
 
Constructor Summary
MetricDatabase(Connection connection)
          Initialize from an existing connection
 
Method Summary
protected  void addCvsOperation(History aRecord)
          Update the database by adding the cvs operation captured by the given history record.
 void close()
          Close the metric database
 String getRevisionId(String file, String version)
          Query the revision id of the file given the file pathname and version.
 boolean isDeletedFile(String filepath)
          Checks if the file with the given path has been deleted from CVS.
 void populateWithHistory(Iterator historyIter)
          Populate the database with CVS history data.
 PreparedStatement prepareStatement(String statement)
          Prepare an SQL statement for execution
 void setAutoCommit(boolean value)
          Sets auto commit to the given value.
 
Methods inherited from class net.sf.bloof.db.Database
addDeletedFile, addFile, addNewDeveloper, addRevision, executeQuery, formatResultSet, getDevelopersOrderedByName, getFilesOrderdByPath, getOnlyRowResultSet, getProjectScmAccess, getTimespanBoundaries, populateDatabase, proccessDBScript, updateDatabase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetricDatabase

public MetricDatabase(Connection connection)
               throws SQLException
Initialize from an existing connection

Parameters:
connection - An existing connection
Method Detail

close

public void close()
           throws IOException,
                  SQLException
Close the metric database

Throws:
SQLException - on error
IOException - on error

prepareStatement

public PreparedStatement prepareStatement(String statement)
                                   throws SQLException
Prepare an SQL statement for execution

Parameters:
statement - An SQL statement
Returns:
The prepared statement
Throws:
SQLException - if the statement cannot be compiled

populateWithHistory

public void populateWithHistory(Iterator historyIter)
                         throws SQLException
Populate the database with CVS history data.

Parameters:
historyIter - An iterator over CVS history records
Throws:
SQLException

getRevisionId

public String getRevisionId(String file,
                            String version)
                     throws SQLException
Query the revision id of the file given the file pathname and version.

Parameters:
file - Pathname of the file in CVS.
version - Version of the file in CVS.
Returns:
revisionId
Throws:
SQLException

isDeletedFile

public boolean isDeletedFile(String filepath)
                      throws SQLException
Checks if the file with the given path has been deleted from CVS.

Parameters:
filepath - The path to the file
Returns:
True if this file has been deleted from CVS, i.e. if it exists in the 'DeletedFile' table in our database.
Throws:
SQLException

setAutoCommit

public void setAutoCommit(boolean value)
                   throws SQLException
Sets auto commit to the given value.

Parameters:
value - Boolean value to set autocommit to.
Throws:
SQLException

addCvsOperation

protected void addCvsOperation(History aRecord)
                        throws SQLException
Update the database by adding the cvs operation captured by the given history record.

Parameters:
aRecord - The history record.
Throws:
SQLException


JCVSReport: Easy Progress Reports for CVS/Java Projects. By David James.