org.acmsl.antmake.cvslib
Class CvsUtils

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

public class CvsUtils
extends java.lang.Object

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

Version:
$Revision: 1.5 $
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.
static int MARGIN
          The margin.
 
Constructor Summary
protected CvsUtils()
          Protected constructor to avoid accidental instantiation.
 
Method Summary
 void generateChangeLog(java.io.File workingDirectory, java.lang.String output, 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 write(java.io.PrintWriter printWriter, java.lang.String content)
          Writes the CVS log message.
 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.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

MARGIN

public static final int MARGIN
The margin.

See Also:
Constant Field Values

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,
                              org.apache.tools.ant.Task task)
                       throws AntMakeException
Generates a GNU-formatted ChangeLog file.

Parameters:
workingDirectory - the working directory.
output - the output file.
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.

write

public void write(java.io.PrintWriter printWriter,
                  java.lang.String content)
           throws java.io.IOException
Writes the CVS log message.

Parameters:
printWriter - the print writer.
content - the content to write.
Throws:
java.io.IOException - if the write operation fails.


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