org.apache.maven.scm.provider.perforce.command.changelog
Class PerforceChangeLogConsumer

java.lang.Object
  extended byorg.apache.maven.scm.provider.perforce.command.changelog.PerforceChangeLogConsumer
All Implemented Interfaces:
org.codehaus.plexus.util.cli.StreamConsumer

public class PerforceChangeLogConsumer
extends java.lang.Object
implements org.codehaus.plexus.util.cli.StreamConsumer

Version:
$Id: PerforceChangeLogConsumer.java 189558 2005-06-08 08:37:34Z evenisse $
Author:
Emmanuel Venisse

Field Summary
private static java.lang.String COMMENT_DELIMITER
          The comment section ends with a blank line
private  org.apache.maven.scm.ChangeSet currentChange
          The current log entry being processed by the parser
private  java.lang.String currentFile
          the current file being processed by the parser
private  java.util.Date endDate
           
private  java.util.List entries
           
private static java.lang.String FILE_BEGIN_TOKEN
          A file line begins with two slashes
private static int GET_COMMENT
          State machine constant: expecting comments
private static int GET_COMMENT_BEGIN
          State machine constant: eat the first blank line
private static int GET_REVISION
          State machine constant: expecting revision and/or file information
private static java.lang.String pattern
           
private static java.text.SimpleDateFormat PERFORCE_TIMESTAMP
          Date formatter for perforce timestamp
private  org.apache.regexp.RE revisionRegexp
          The regular expression used to match header lines
private  java.util.Date startDate
           
private  int status
          Current status of the parser
 
Constructor Summary
PerforceChangeLogConsumer(java.util.Date startDate, java.util.Date endDate)
           
 
Method Summary
private  void addEntry(org.apache.maven.scm.ChangeSet entry, org.apache.maven.scm.ChangeFile file)
          Add a change log entry to the list (if it's not already there) with the given file.
 void consumeLine(java.lang.String line)
           
 java.util.List getModifications()
           
private  java.util.Date parseDate(java.lang.String date)
          Converts the date timestamp from the perforce output into a date object.
private  void processGetComment(java.lang.String line)
          Process the current input line in the GET_COMMENT state.
private  void processGetRevision(java.lang.String line)
          Most of the relevant info is on the revision line matching the 'pattern' string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERFORCE_TIMESTAMP

private static final java.text.SimpleDateFormat PERFORCE_TIMESTAMP
Date formatter for perforce timestamp


entries

private java.util.List entries

GET_REVISION

private static final int GET_REVISION
State machine constant: expecting revision and/or file information

See Also:
Constant Field Values

GET_COMMENT_BEGIN

private static final int GET_COMMENT_BEGIN
State machine constant: eat the first blank line

See Also:
Constant Field Values

GET_COMMENT

private static final int GET_COMMENT
State machine constant: expecting comments

See Also:
Constant Field Values

COMMENT_DELIMITER

private static final java.lang.String COMMENT_DELIMITER
The comment section ends with a blank line

See Also:
Constant Field Values

FILE_BEGIN_TOKEN

private static final java.lang.String FILE_BEGIN_TOKEN
A file line begins with two slashes

See Also:
Constant Field Values

status

private int status
Current status of the parser


currentChange

private org.apache.maven.scm.ChangeSet currentChange
The current log entry being processed by the parser


currentFile

private java.lang.String currentFile
the current file being processed by the parser


revisionRegexp

private org.apache.regexp.RE revisionRegexp
The regular expression used to match header lines


startDate

private java.util.Date startDate

endDate

private java.util.Date endDate

pattern

private static final java.lang.String pattern
See Also:
Constant Field Values
Constructor Detail

PerforceChangeLogConsumer

public PerforceChangeLogConsumer(java.util.Date startDate,
                                 java.util.Date endDate)
Method Detail

getModifications

public java.util.List getModifications()

consumeLine

public void consumeLine(java.lang.String line)
Specified by:
consumeLine in interface org.codehaus.plexus.util.cli.StreamConsumer

addEntry

private void addEntry(org.apache.maven.scm.ChangeSet entry,
                      org.apache.maven.scm.ChangeFile file)
Add a change log entry to the list (if it's not already there) with the given file.

Parameters:
entry - a ChangeLogEntry to be added to the list if another with the same key (p4 change number) doesn't exist already.
file - a ChangeLogFile to be added to the entry

processGetRevision

private void processGetRevision(java.lang.String line)
Most of the relevant info is on the revision line matching the 'pattern' string.

Parameters:
line - A line of text from the perforce log output

processGetComment

private void processGetComment(java.lang.String line)
Process the current input line in the GET_COMMENT state. This state gathers all of the comments that are part of a log entry.

Parameters:
line - a line of text from the perforce log output

parseDate

private java.util.Date parseDate(java.lang.String date)
Converts the date timestamp from the perforce output into a date object.

Returns:
A date representing the timestamp of the log entry.