org.acmsl.antmake
Class ChangeLogParser

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

public class ChangeLogParser
extends java.lang.Object

Knows how to parse "cvs log" command output.

Version:
$Revision: 1.8 $
Author:
Jose San Leandro, based on Peter Donald's ChangeLogParser. It's package-protected, so it had to be basically copied and pasted.
See Also:
org.apache.tools.ant.taskdefs.cvslib.ChangeLogParser

Field Summary
static java.text.DateFormat CVS_LOG_DATE_FORMAT
          The date format returned by cvs log.
protected static CvsEntry[] EMPTY_CVSENTRY_ARRAY
          A cached empty CvsEntry array.
 
Constructor Summary
ChangeLogParser()
          Creates a ChangeLogParser.
 
Method Summary
protected  java.lang.Object buildEntryKey(java.lang.String date, java.lang.String author, java.lang.String comment)
          Builds a key for an entry.
protected  java.lang.String getAuthor()
          Retrieves the author of the current CVS file being processed.
protected  java.lang.String getComment()
          Retrieves the comment of the CVS file being processed.
protected  int getCurrentState()
          Retrieves the current state of the parser.
protected  java.lang.String getDate()
          Retrieves the date of the current CVS file being processed.
protected  java.util.Map getEntries()
          Retrieves the CVS entries map.
 CvsEntry[] getEntrySetAsArray()
          Retrieves the list of RCS entries as an array.
protected  java.lang.String getName()
          Retrieves the name of the current CVS file being processed.
protected  java.lang.String getPreviousRevision()
          Retrieves the previous revision of the current CVS file being processed.
protected  java.lang.String getRevision()
          Retrieves the revision of the current CVS file being processed.
protected  java.util.Date parseDate(java.lang.String date)
          Parses date out from expected format.
protected  void processComment(java.lang.String line)
          Processes a line while in GET_COMMENT state.
protected  void processDate(java.lang.String line)
          Processes a line while in DATE state.
protected  void processFile(java.lang.String line)
          Processes a line while in GET_FILE state.
protected  void processGetPreviousRevision(java.lang.String line)
          Processes a line while in GET_PREVIOUS_REVISION state.
protected  void processRevision(java.lang.String line)
          Processes a line while in REVISION state.
protected  java.lang.String removeTrailing(java.lang.String input, int suffix)
          Removes trailing substring.
protected  void reset()
          Resets all internal attributes except current state.
protected  void saveEntry()
          Saves the current entry.
protected  void setAuthor(java.lang.String author)
          Specifies the author.
protected  void setComment(java.lang.String comment)
          Specifies the comment.
protected  void setCurrentState(int state)
          Specifies the current state of the parser.
protected  void setDate(java.lang.String date)
          Specifies the date.
protected  void setEntries(java.util.Map map)
          Specifies the CVS entries map.
protected  void setName(java.lang.String name)
          Specifies the name.
protected  void setPreviousRevision(java.lang.String previousRevision)
          Specifies the previous revision.
protected  void setRevision(java.lang.String revision)
          Specifies the revision.
 void stdout(java.lang.String line)
          Receives notification about the process writing to standard output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_CVSENTRY_ARRAY

protected static final CvsEntry[] EMPTY_CVSENTRY_ARRAY
A cached empty CvsEntry array.


CVS_LOG_DATE_FORMAT

public static final java.text.DateFormat CVS_LOG_DATE_FORMAT
The date format returned by cvs log.

Constructor Detail

ChangeLogParser

public ChangeLogParser()
Creates a ChangeLogParser.

Method Detail

setName

protected void setName(java.lang.String name)
Specifies the name.

Parameters:
name - the name of the current CVS file being processed.

getName

protected java.lang.String getName()
Retrieves the name of the current CVS file being processed.

Returns:
such information.

setDate

protected void setDate(java.lang.String date)
Specifies the date.

Parameters:
date - the date of the current CVS file being processed.

getDate

protected java.lang.String getDate()
Retrieves the date of the current CVS file being processed.

Returns:
such information.

setAuthor

protected void setAuthor(java.lang.String author)
Specifies the author.

Parameters:
author - the author of the current CVS file being processed.

getAuthor

protected java.lang.String getAuthor()
Retrieves the author of the current CVS file being processed.

Returns:
such information.

setComment

protected void setComment(java.lang.String comment)
Specifies the comment.

Parameters:
comment - the comment of the CVS file being processed.

getComment

protected java.lang.String getComment()
Retrieves the comment of the CVS file being processed.

Returns:
such information.

setRevision

protected void setRevision(java.lang.String revision)
Specifies the revision.

Parameters:
revision - the revision of the current CVS file being processed.

getRevision

protected java.lang.String getRevision()
Retrieves the revision of the current CVS file being processed.

Returns:
such information.

setPreviousRevision

protected void setPreviousRevision(java.lang.String previousRevision)
Specifies the previous revision.

Parameters:
previousRevision - the previous revision of the current CVS file being processed.

getPreviousRevision

protected java.lang.String getPreviousRevision()
Retrieves the previous revision of the current CVS file being processed.

Returns:
such information.

setCurrentState

protected void setCurrentState(int state)
Specifies the current state of the parser.

Parameters:
state - the current state of the parser.

getCurrentState

protected int getCurrentState()
Retrieves the current state of the parser.

Returns:
such information.

setEntries

protected void setEntries(java.util.Map map)
Specifies the CVS entries map.

Parameters:
map - the map.

getEntries

protected java.util.Map getEntries()
Retrieves the CVS entries map.

Returns:
such map.

getEntrySetAsArray

public CvsEntry[] getEntrySetAsArray()
Retrieves the list of RCS entries as an array.

Returns:
such items.

stdout

public void stdout(java.lang.String line)
Receives notification about the process writing to standard output.

Parameters:
line - the last line read.

processComment

protected void processComment(java.lang.String line)
Processes a line while in GET_COMMENT state.

Parameters:
line - the line to process.

removeTrailing

protected java.lang.String removeTrailing(java.lang.String input,
                                          int suffix)
Removes trailing substring.

Parameters:
input - the text to process.
suffix - the length of the substring to remove at the end.
Returns:
the updated input.

processFile

protected void processFile(java.lang.String line)
Processes a line while in GET_FILE state.

Parameters:
line - the line to process.

processRevision

protected void processRevision(java.lang.String line)
Processes a line while in REVISION state.

Parameters:
line - the line to process.

processDate

protected void processDate(java.lang.String line)
Processes a line while in DATE state.

Parameters:
line - the line to process.

processGetPreviousRevision

protected void processGetPreviousRevision(java.lang.String line)
Processes a line while in GET_PREVIOUS_REVISION state.

Parameters:
line - the line to process.

saveEntry

protected void saveEntry()
Saves the current entry.


parseDate

protected java.util.Date parseDate(java.lang.String date)
Parses date out from expected format.

Parameters:
date - the string holding the date.
Returns:
the date object or null if unknown date format.

buildEntryKey

protected java.lang.Object buildEntryKey(java.lang.String date,
                                         java.lang.String author,
                                         java.lang.String comment)
Builds a key for an entry.

Parameters:
date - the entry's date.
author - the author.
comment - the comment.
Returns:
a key for such entry.

reset

protected void reset()
Resets all internal attributes except current state.



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