net.sf.statcvs.model
Class CvsContent

java.lang.Object
  extended bynet.sf.statcvs.model.CvsContent

public class CvsContent
extends java.lang.Object

Representation of a CVS Repository. The content is stored in a HashMap. The keys are the filenames and the values a reference to a CvsFile object.

Version:
$Id: CvsContent.java,v 1.38 2003/03/18 10:33:55 lukasz Exp $
Author:
Manuel Schulze
See Also:
CvsFile

Field Summary
static int DEFAULT_FILES
          The default number of files a repository module has.
 
Constructor Summary
CvsContent(java.lang.String name)
          The CvsContent constructor.
 
Method Summary
 java.util.Vector getChangesPerUser(java.lang.String user)
          Returns a list of files, the user commited in repository.
 java.util.Collection getDirectories()
          Returns all directories of this repository
 java.util.Collection getDirectories(java.lang.String user)
          Returns a Collection of directories for the specified user
 CvsFile getFile(java.lang.String file)
          Returns the information for this file without deleting it.
 int getFileCount()
          Returns the number of files in the repository.
 java.util.List getFilesByPrefix(java.lang.String prefix)
          Returns a list of CvsFile objects which share a given filename prefix, for example "dir/small_file.txt" and "dir/subdir/file.txt" would be returned for prefix "dir/s".
 java.util.List getFilesInModule(java.lang.String module)
          Returns a list of CvsFile objects which are in a given directory.
 java.util.Iterator getFilesIterator()
          Returns an iterator on the files in this repository.
 java.util.Date getFirstDate()
          Returns the first Date when there were changes on the repository.
 java.util.Date getLastDate()
          Returns the latest Date when there were changes on the repository.
 java.lang.String getModuleName()
          Returns the name of currnet module.
 RevisionIterator getRevisionIterator()
          Returns a RevisionIterator on all revisions in the repository.
 RevisionIterator getRevisionIteratorByFilePrefix(java.lang.String prefix)
          Returns a RevisionIterator which is filtered by filename.
 RevisionIterator getRevisionIteratorByModule(java.lang.String module)
          Returns a RevisionIterator which is filtered by filename.
 java.util.HashSet getUserNames()
          Returns the list of users, working on the repository.
 void insertFile(CvsFile entry)
          Inserts the information about one file into the set of existing fileinformation.
 CvsFile removeFile(java.lang.String file)
          Returns and deletes the information about the file.
 java.lang.String toString()
          Returns a string representation of all files in the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_FILES

public static final int DEFAULT_FILES
The default number of files a repository module has. There could of course more or less than DEFAULT_FILES in a module.

See Also:
Constant Field Values
Constructor Detail

CvsContent

public CvsContent(java.lang.String name)
The CvsContent constructor.

Parameters:
name - The name of the module
Method Detail

getModuleName

public java.lang.String getModuleName()
Returns the name of currnet module.

Returns:
The module name

insertFile

public void insertFile(CvsFile entry)
Inserts the information about one file into the set of existing fileinformation.

Parameters:
entry - The representation of the fileinformation.

getLastDate

public java.util.Date getLastDate()
Returns the latest Date when there were changes on the repository.

Returns:
The latest Date

getFirstDate

public java.util.Date getFirstDate()
Returns the first Date when there were changes on the repository.

Returns:
The first Date

getFile

public CvsFile getFile(java.lang.String file)
Returns the information for this file without deleting it.

Parameters:
file - The name of the file to get information from.
Returns:
The information of the file or null if the file not exists.

removeFile

public CvsFile removeFile(java.lang.String file)
Returns and deletes the information about the file.

Parameters:
file - The name of the file to delete and to get information from.
Returns:
The information about that file or null if the file not exists.

getChangesPerUser

public java.util.Vector getChangesPerUser(java.lang.String user)
Returns a list of files, the user commited in repository.

Parameters:
user - The user.
Returns:
The list of files.

getFilesInModule

public java.util.List getFilesInModule(java.lang.String module)
Returns a list of CvsFile objects which are in a given directory. Files in subdirectories are not included.

Parameters:
module - A directory name to search for files
Returns:
The list of files

getFilesByPrefix

public java.util.List getFilesByPrefix(java.lang.String prefix)
Returns a list of CvsFile objects which share a given filename prefix, for example "dir/small_file.txt" and "dir/subdir/file.txt" would be returned for prefix "dir/s".

Parameters:
prefix - a filename prefix to search for
Returns:
The list of files

getFileCount

public int getFileCount()
Returns the number of files in the repository.

Returns:
The number of files

getFilesIterator

public java.util.Iterator getFilesIterator()
Returns an iterator on the files in this repository.

Returns:
An iterator on the repository files

getRevisionIterator

public RevisionIterator getRevisionIterator()
Returns a RevisionIterator on all revisions in the repository. The revisions are in no particular order.

Returns:
an iterator on all revisions in the repository.

getRevisionIteratorByFilePrefix

public RevisionIterator getRevisionIteratorByFilePrefix(java.lang.String prefix)
Returns a RevisionIterator which is filtered by filename. It contains only files that have a filename starting with or equal to prefix.

Parameters:
prefix - a filename prefix
Returns:
an iterator on revisions matching prefix

getRevisionIteratorByModule

public RevisionIterator getRevisionIteratorByModule(java.lang.String module)
Returns a RevisionIterator which is filtered by filename. It contains only files that have a filename starting with or equal to prefix.

Parameters:
module - name of the module to use
Returns:
a RevisionIterator which is filtered by filename. It contains only files that have a filename starting with or equal to prefix.

getDirectories

public java.util.Collection getDirectories(java.lang.String user)
Returns a Collection of directories for the specified user

Parameters:
user - to use as filter
Returns:
Collection directories; type: String

getDirectories

public java.util.Collection getDirectories()
Returns all directories of this repository

Returns:
Collection all directories of this repository; type: String

toString

public java.lang.String toString()
Returns a string representation of all files in the repository.

Returns:
A string representation of all files in the repository

getUserNames

public java.util.HashSet getUserNames()
Returns the list of users, working on the repository.

Returns:
The user list