org.acmsl.antmake
Class CvsUtils

java.lang.Object
  |
  +--org.acmsl.antmake.CvsUtils

public class CvsUtils
extends java.lang.Object

Provides helpful methods for interacting with CVS servers through its command-line client.

Version:
$Revision: 1.8 $
Author:
Jose San Leandro, based on Jeff Martin and Peter Donald's CvsChangeLogTask.

Nested Class Summary
static class CvsUtils.DateComparator
          Sorts CVS entries by date.
 
Field Summary
static java.util.Comparator DATE_COMPARATOR
          The date comparator to sort the CVS entries.
static java.text.DateFormat DATE_FORMAT
          The date format.
 
Constructor Summary
protected CvsUtils()
          Protected constructor to avoid accidental instantiation.
 
Method Summary
 void generateChangeLog(java.io.File workingDirectory, java.lang.String output, java.lang.String[] files, org.apache.tools.ant.Task task)
          Generates a GNU-formatted ChangeLog file.
static CvsUtils getInstance()
          Retrieves a CvsUtils instance.
protected static java.lang.ref.WeakReference getReference()
          Retrieves the weak reference.
protected static void setReference(CvsUtils utils)
          Specifies a new weak reference.
 CvsEntry[] sortByDate(CvsEntry[] cvsEntries)
          Sorts given CVS entries by date.
 void writeChangeLog(java.io.PrintWriter printWriter, CvsEntry cvsEntry)
          Writes a changelog entry.
 void writeChangeLog(java.io.PrintWriter printWriter, CvsEntry[] cvsEntries)
          Writes the changelog.
 void writeChangeLog(java.io.PrintWriter printWriter, RcsFile rcsFile)
          Writes the CVS log message for given RCS file.
 void writeChangeLog(java.lang.String output, CvsEntry[] cvsEntries, AntMakeUtils antMakeUtils, org.apache.tools.ant.Task task)
          Prints changelog to given output file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_COMPARATOR

public static final java.util.Comparator DATE_COMPARATOR
The date comparator to sort the CVS entries.


DATE_FORMAT

public static final java.text.DateFormat DATE_FORMAT
The date format.

Constructor Detail

CvsUtils

protected CvsUtils()
Protected constructor to avoid accidental instantiation.

Method Detail

setReference

protected static void setReference(CvsUtils utils)
Specifies a new weak reference.

Parameters:
utils - the utils instance to use.

getReference

protected static java.lang.ref.WeakReference getReference()
Retrieves the weak reference.

Returns:
such reference.

getInstance

public static CvsUtils getInstance()
Retrieves a CvsUtils instance.

Returns:
such instance.

generateChangeLog

public void generateChangeLog(java.io.File workingDirectory,
                              java.lang.String output,
                              java.lang.String[] files,
                              org.apache.tools.ant.Task task)
                       throws AntMakeException
Generates a GNU-formatted ChangeLog file.

Parameters:
workingDirectory - the working directory.
output - the output file.
files - the files to record changes for.
task - an Ant task (for logging, and required by Execute).
Throws:
AntMakeException - if something goes wrong while executing the cvs command.

writeChangeLog

public void writeChangeLog(java.lang.String output,
                           CvsEntry[] cvsEntries,
                           AntMakeUtils antMakeUtils,
                           org.apache.tools.ant.Task task)
                    throws AntMakeException
Prints changelog to given output file.

Parameters:
output - the output file.
cvsEntries - the entry set to write.
Throws:
AntMakeException - if theres an error writing changelog.

sortByDate

public CvsEntry[] sortByDate(CvsEntry[] cvsEntries)
Sorts given CVS entries by date.

Parameters:
cvsEntries - the CVS entries to sort.
Returns:
the sorted collection.

writeChangeLog

public void writeChangeLog(java.io.PrintWriter printWriter,
                           CvsEntry[] cvsEntries)
                    throws java.io.IOException
Writes the changelog.

Parameters:
printWriter - the printWriter.
cvsEntries - the CVS entries.
Throws:
java.io.IOException - if the write operation fails.

writeChangeLog

public void writeChangeLog(java.io.PrintWriter printWriter,
                           CvsEntry cvsEntry)
                    throws java.io.IOException
Writes a changelog entry.

Parameters:
printWriter - the printWriter.
cvsEntry - the CVS entry.
Throws:
java.io.IOException - if the write operation fails.

writeChangeLog

public void writeChangeLog(java.io.PrintWriter printWriter,
                           RcsFile rcsFile)
                    throws java.io.IOException
Writes the CVS log message for given RCS file.

Parameters:
printWriter - the print writer.
rcsFile - the RCS file.
Throws:
java.io.IOException - if the write operation fails.


Copyright © 2004 ACM S.L.. All Rights Reserved.