net.sourceforge.cruisecontrol.labelincrementers
Class SVNLabelIncrementer

java.lang.Object
  extended bynet.sourceforge.cruisecontrol.labelincrementers.SVNLabelIncrementer
All Implemented Interfaces:
LabelIncrementer, java.io.Serializable

public class SVNLabelIncrementer
extends java.lang.Object
implements LabelIncrementer

This class provides a label incrementation based on svn revision numbers. This class expects the label format to be "x<sep>y[<sep>z]", where x is any String and y is an integer and <sep> a separator, the last part z, is optional, and gets generated and later incremented in case a build is forced. The default separator is "." and can be modified using setSeparator(java.lang.String).

Author:
Ketan Padegaonkar < KetanPadegaonkar gmail >
See Also:
Serialized Form

Constructor Summary
SVNLabelIncrementer()
           
 
Method Summary
 java.lang.String getDefaultLabel()
          Called by Project when there is no previously serialized label.
 java.lang.String getLabelPrefix()
           
 java.lang.String getSeparator()
           
protected  java.lang.String getSvnRevision()
           
 java.lang.String incrementLabel(java.lang.String oldLabel, org.jdom.Element buildLog)
          Increments the label when a successful build occurs.
 boolean isPreBuildIncrementer()
          Some implementations of LabelIncrementer, such as those involving dates, are better suited to being incremented before building rather than after building.
 boolean isValidLabel(java.lang.String label)
          Check the validity of a user-supplied label, making sure that it can be incremented successfully by the appropriate implementation of LabelIncrementer
 void setLabelPrefix(java.lang.String labelPrefix)
           
 void setSeparator(java.lang.String separator)
           
 void setWorkingCopyPath(java.lang.String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVNLabelIncrementer

public SVNLabelIncrementer()
Method Detail

isPreBuildIncrementer

public boolean isPreBuildIncrementer()
Description copied from interface: LabelIncrementer
Some implementations of LabelIncrementer, such as those involving dates, are better suited to being incremented before building rather than after building. This method determines whether to increment before building or after building.

Specified by:
isPreBuildIncrementer in interface LabelIncrementer

incrementLabel

public java.lang.String incrementLabel(java.lang.String oldLabel,
                                       org.jdom.Element buildLog)
Description copied from interface: LabelIncrementer
Increments the label when a successful build occurs. The oldLabel should be transformed and returned as the new label. The build log is also passed in so that some more complex label incrementing can be handled. For example, a label incrementer could find the ant target that was called and increment based on that information.

Specified by:
incrementLabel in interface LabelIncrementer
Parameters:
buildLog - JDOM Element representation of the build.
oldLabel - Label from previous successful build.
Returns:
Label to use for most recent successful build.

getSvnRevision

protected java.lang.String getSvnRevision()
                                   throws java.io.IOException
Throws:
java.io.IOException

isValidLabel

public boolean isValidLabel(java.lang.String label)
Description copied from interface: LabelIncrementer
Check the validity of a user-supplied label, making sure that it can be incremented successfully by the appropriate implementation of LabelIncrementer

Specified by:
isValidLabel in interface LabelIncrementer
Parameters:
label - user-supplied label
Returns:
true if it is a valid label.

setWorkingCopyPath

public void setWorkingCopyPath(java.lang.String path)

getLabelPrefix

public java.lang.String getLabelPrefix()

setLabelPrefix

public void setLabelPrefix(java.lang.String labelPrefix)

getDefaultLabel

public java.lang.String getDefaultLabel()
Description copied from interface: LabelIncrementer
Called by Project when there is no previously serialized label.

Specified by:
getDefaultLabel in interface LabelIncrementer
Returns:
defaultLabel

getSeparator

public java.lang.String getSeparator()

setSeparator

public void setSeparator(java.lang.String separator)