FileDocCategorySizeDatePackage
StarTeamLabel.javaAPI DocApache Ant 1.706488Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.taskdefs.optional.starteam

StarTeamLabel

public class StarTeamLabel extends StarTeamTask
Creates a view label in StarTeam at the specified view. Ant Usage:
<taskdef name="stlabel"
classname="org.apache.tools.ant.taskdefs.optional.starteam.StarTeamLabel"/<
<stlabel
label="1.0" lastbuild="20011514100000" description="Successful Build"
username="BuildMaster" password="ant"
starteamurl="server:port/project/view"/>
see
borland StarTeam Web Site
ant.task
name="stlabel" category="scm"

Fields Summary
private String
labelName
The name of the label to be set in Starteam.
private String
description
The label description to be set in Starteam.
private boolean
buildlabel
If true, this will be a build label. If false, it will be a non-build label. The default is false. Has no effect if revision label is true.
private boolean
revisionlabel
If true, this will be a revision label. If false, it will be a build label. The default is false.
private com.starbase.util.OLEDate
lastBuild
The time of the last successful. The new label will be a snapshot of the repository at this time. String should be formatted as "yyyyMMddHHmmss"
private static final SimpleDateFormat
DATE_FORMAT
Constructors Summary
Methods Summary
protected com.starbase.starteam.ViewcreateSnapshotView(com.starbase.starteam.View raw)
Override of base-class abstract function creates an appropriately configured view. For labels this a view configured as of this.lastBuild.

param
raw the unconfigured View
return
the snapshot View appropriately configured.

        /*
        if (this.revisionlabel) {
            return raw;
        }
        return new View(raw, ViewConfiguration.createFromTime(this.lastBuild));
        */
        return raw;
    
public voidexecute()
This method does the work of creating the new view and checking it into Starteam.

throws
BuildException on error


        if (this.revisionlabel && this.buildlabel) {
            throw new BuildException("'revisionlabel' and 'buildlabel' "
                + "both specified.  A revision label cannot be a build label.");
        }

        try {
            View snapshot = openView();

            // Create the new label and update the repository

            if (this.revisionlabel) {
                new Label(snapshot, this.labelName, this.description).update();
                log("Created Revision Label " + this.labelName);
            } else if (null != lastBuild) {
                new Label(snapshot, this.labelName, this.description, this.lastBuild,
                          this.buildlabel).update();
                log("Created View Label ("
                    + (this.buildlabel ? "" : "non-") + "build) " + this.labelName
                    + " as of " + this.lastBuild.toString());
            } else {
                new Label(snapshot, this.labelName, this.description,
                          this.buildlabel).update();
                log("Created View Label ("
                    + (this.buildlabel ? "" : "non-") + "build) " + this.labelName);
            }
        } catch (Exception e) {
            throw new BuildException(e);
        } finally {
            disconnectFromServer();
        }

    
public voidsetBuildLabel(boolean buildlabel)
set the type of label based on the supplied value - if true, this label will be a revision label, if false, a build label.

param
buildlabel If true this will be a revision label; if false, a build label

        this.buildlabel = buildlabel;
    
public voidsetDescription(java.lang.String description)
Description of the label to be stored in the StarTeam project.

param
description the description to be used

        this.description = description;
    
public voidsetLabel(java.lang.String label)
The name to be given to the label; required.

param
label the name to be used



                         
        
        this.labelName = label;
    
public voidsetLastBuild(java.lang.String lastbuild)
The timestamp of the build that will be stored with the label; required. Must be formatted yyyyMMddHHmmss

param
lastbuild the timestamp of the last build
throws
BuildException on error

        try {
            Date lastBuildTime = DATE_FORMAT.parse(lastbuild);
            this.lastBuild = new OLEDate(lastBuildTime);
        } catch (ParseException e) {
            throw new BuildException("Unable to parse the date '"
                + lastbuild + "'", e);
        }
    
public voidsetRevisionLabel(boolean revisionlabel)
set the type of label based on the supplied value - if true, this label will be a revision label, if false, a build label.

param
revisionlabel If true this will be a revision label; if false, a build label

        this.revisionlabel = revisionlabel;