Browse Source

Major refactoring of Starteam tasks.

This is based on the original submission from the CruiseControl project.
Original <starteam> task has been deprecated
Starteam tasks now resides in the starteam package rather than scm.
Submitted by: stevec@ignitesports.com (Steve Cohen)


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270254 13f79535-47bb-0310-9956-ffa450edef68
master
Stephane Bailliez 23 years ago
parent
commit
63b2c1c40a
8 changed files with 1335 additions and 17 deletions
  1. +283
    -15
      docs/manual/OptionalTasks/starteam.html
  2. +1
    -1
      docs/manual/optionaltasklist.html
  3. +3
    -1
      src/main/org/apache/tools/ant/taskdefs/defaults.properties
  4. +3
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java
  5. +264
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamCheckout.java
  6. +143
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamLabel.java
  7. +297
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamTask.java
  8. +341
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/starteam/TreeBasedTask.java

+ 283
- 15
docs/manual/OptionalTasks/starteam.html View File

@@ -4,8 +4,25 @@
<title>Apache Ant User Manual</title> <title>Apache Ant User Manual</title>
</head> </head>
<body> <body>
<h1>StarTeam Support</h1>
<ul>
<!-- <li><a href="#stcheckin">STCheckin</a></li>-->
<li><a href="#stcheckout">STCheckout</a></li>
<li><a href="#stlabel">STLabel</a></li>
<li><a href="#starteam"><i>StarTeam (deprecated) </i></a></li>
</ul>


<h2>Starteam</h2>
<p>
These tasks make use of functions from the StarTeam API. As a result
they are only available to licensed users of StarTeam. You must have
<CODE>starteam-sdk.jar</CODE> in your classpath to run these tasks.
For more information about the StarTeam API and how to license it, see
the <a href="http://www.starbase.com">StarBase</a> web site.</p>

<hr></hr>

<a name="stcheckout">
<h2>STCheckout</h2></a>


<h3>Description</h3> <h3>Description</h3>


@@ -13,43 +30,273 @@ Checks out files from a StarTeam project.


<p> <p>
The <i>includes</i> and <i>excludes</i> attributes function differently from The <i>includes</i> and <i>excludes</i> attributes function differently from
other tasks in Ant. Multiple patterns must be separated by spaces, not
commas. See the examples for more information.</p>

<p>
This program makes use of functions from the StarTeam API. As a result
this task is only available to licensed users of StarTeam. You must have
<CODE>starteam-sdk.jar</CODE> in your classpath to run this task.
For more information about the StarTeam API and how to license it, see
the <a href="http://www.starbase.com">StarBase</a> web site.</p>
other tasks in Ant. Inclusion/exclusion by folder is NOT supported.
</p>


<h3>Parameters</h3> <h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0"> <table border="1" cellpadding="2" cellspacing="0">
<tr> <tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
<td valign="top">username</td>
<td valign="top">The username of the account used to log in to the StarTeam server.</td>
<td align="center" valign="top">yes</td>
</tr>
<tr>
<td valign="top">password</td>
<td valign="top">The password of the account used to log in to the StarTeam server.</td>
<td align="center" valign="top">yes</td>
</tr> </tr>

<tr> <tr>
<td valign="top">URL</td>
<td valign="top">A string of the form <code>"servername:portnum/project/view</code>
which enables user to set all of these elements in one string. </td>
<td align="center" valign="top">yes*</td>
</tr> <tr>
<td valign="top">servername</td> <td valign="top">servername</td>
<td valign="top">The name of the StarTeam server.</td> <td valign="top">The name of the StarTeam server.</td>
<td align="center" valign="top">yes</td>
<td align="center" valign="top">yes*</td>
</tr> </tr>
<tr> <tr>
<td valign="top">serverport</td> <td valign="top">serverport</td>
<td valign="top">The port number of the StarTeam server.</td> <td valign="top">The port number of the StarTeam server.</td>
<td align="center" valign="top">yes</td>
<td align="center" valign="top">yes*</td>
</tr> </tr>
<tr> <tr>
<td valign="top">projectname</td> <td valign="top">projectname</td>
<td valign="top">The name of the StarTeam project.</td> <td valign="top">The name of the StarTeam project.</td>
<td align="center" valign="top">yes*</td>
</tr>
<tr>
<td valign="top">viewname</td>
<td valign="top">The name of the view in the StarTeam project.</td>
<td align="center" valign="top">yes*</td>
</tr>

<tr>
<td valign="top">rootstarteamfolder</td>
<td valign="top">The root of the subtree in the StarTeam repository from which to
check out files. Defaults to the root folder of the view ('/'). </td>
<td align="center" valign="top">no</td>
</tr>
<tr>
<td valign="top">rootlocalfolder</td>
<td valign="top">The local folder which will be the root of the tree to which files are checked out. If this is not supplied, then the StarTeam "default folder" associated with <i>rootstarteamfolder</i> is used.</td>
<td align="center" valign="top">no</td>
</tr>
<tr>
<td valign="top">createworkingdirs</td>
<td valign="top">creates local folders even when the corresponding StarTeam folder is empty. Defaults to "true".</td>
<td align="center" valign="top">no</td>
</tr>
<tr>
<td valign="top">deleteuncontrolled</td>
<td valign="top">if true, any files NOT in StarTeam will be deleted. Defaults to "true".</td>
<td align="center" valign="top">no</td>
</tr>
<tr>
<td valign="top">includes</td>
<td valign="top">Only check out files that match at least one of the patterns in this list. Patterns must be separated by <i>commas</i>. Patterns in <i>excludes</i> take precedence over patterns in <i>includes</i>.</td>
<td align="center" valign="top">no</td>
</tr>
<tr>
<td valign="top">excludes</td>
<td valign="top">Do not check out files that match at least one of the patterns in this list. Patterns must be separated by <i>commas</i>. Patterns in <i>excludes</i> take precedence over patterns in <i>includes</i>.</td>
<td align="center" valign="top">no</td>
</tr>
</table>

* Either the URL attribute or <b>all four</b> of the servername, serverport, projectname and viewname attributes must be defined. <br/>

<h3>Examples</h3>

<pre>
&lt;stcheckout servername="STARTEAM"
serverport="49201"
projectname="AProject"
viewname="AView"
username="auser"
password="secret"
rootlocalfolder="C:\dev\buildtest\co"
/&gt;
</pre>

The minimum necessary to check out files out from a StarTeam server. This will
check out all files in the <i>AView</i> view of the <i>AProject</i> project to
<code>C:\dev\buildtest\co</code>. Empty folders in StarTeam will have local folders
created for them and any non-StarTeam files found in the tree will be deleted.

Or more simply:
<pre>
&lt;stcheckout URL="STARTEAM:49201/Aproject/AView"
username="auser"
password="secret"
rootlocalfolder="C:\dev\buildtest\co"
/&gt;
</pre>
<br></br>
<pre>
&lt;stcheckout URL="STARTEAM:49201/Aproject/AView"
username="auser"
password="secret"
rootlocalfolder="C:\dev\buildtest\co"
rootstarteamfolder="\Dev"
excludes="*.bak *.old"
/&gt;
</pre>

This will checkout all files from the <i>Dev</i> folder and below that do not
end in <i>.bak</i> or <i>.old</i>.

<pre>
&lt;stcheckout URL="STARTEAM:49201/Aproject/AView"
username="auser"
password="secret"
rootlocalfolder="C:\dev\buildtest\co"
includes="*.htm,*.html"
excludes="index.*"
/&gt;
</pre>


This is an example of overlapping <i>includes</i> and <i>excludes</i> attributes. Because
<i>excludes</i> takes precedence over <i>includes</i>, files named <code>index.html</code> will
not be checked out by this command.


<pre>
&lt;stcheckout URL="STARTEAM:49201/Aproject/AView"
username="auser"
password="secret"
rootstarteamfolder="src/java"
rootlocalfolder="C:\dev\buildtest\co"
/&gt;
</pre>
<br></br>
<pre>
&lt;stcheckout URL="STARTEAM:49201/Aproject/AView"
username="auser"
password="secret"
rootstarteamfolder="src/java"
/&gt;
</pre>
<br></br>
<pre>
&lt;stcheckout URL="STARTEAM:49201/Aproject/AView"
username="auser"
password="secret"
rootstarteamfolder="src/java"
rootlocalfolder="C:\dev\buildtest\co\src\java"
/&gt;
</pre>

In the preceding three examples, assuming that the AProject project has a default folder of
"AProject", the first example will check the files located in starteam under src/java out to a tree rooted at C:\dev\buildtest\co,
the second to a tree rooted at C:\dev\buildtest\co\AProject\src\java and the third to a tree rooted at C:\dev\buildtest\co\src\java.

<a name="stlabel">
<h2>STLabel</h2></a>

<h3>Description</h3>

Creates a view label in StarTeam at the specified view. The label will be classified by StarTeam as a "build label". This task will fail if there already exexists in <i>viewname</i> a label with the same name as the <i>label</i> parameter.

<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top">username</td>
<td valign="top">The username of the account used to log in to the StarTeam server.</td>
<td align="center" valign="top">yes</td> <td align="center" valign="top">yes</td>
</tr> </tr>
<tr>
<td valign="top">password</td>
<td valign="top">The password of the account used to log in to the StarTeam server.</td>
<td align="center" valign="top">yes</td>
</tr>

<tr>
<td valign="top">URL</td>
<td valign="top">A string of the form <code>"servername:portnum/project/view"</code>
which enables user to set all of these elements in one string. </td>
<td align="center" valign="top">yes*</td>
</tr> <tr>
<td valign="top">servername</td>
<td valign="top">The name of the StarTeam server.</td>
<td align="center" valign="top">yes*</td>
</tr>
<tr>
<td valign="top">serverport</td>
<td valign="top">The port number of the StarTeam server.</td>
<td align="center" valign="top">yes*</td>
</tr>
<tr>
<td valign="top">projectname</td>
<td valign="top">The name of the StarTeam project.</td>
<td align="center" valign="top">yes*</td>
</tr>
<tr> <tr>
<td valign="top">viewname</td> <td valign="top">viewname</td>
<td valign="top">The name of the view in the StarTeam project.</td> <td valign="top">The name of the view in the StarTeam project.</td>
<td align="center" valign="top">yes*</td>
</tr>
<tr>
<td valign="top">label</td>
<td valign="top">The name to be given to the label</td>
<td align="center" valign="top">yes</td>
</tr>
<tr>
<td valign="top">lastbuild</td>
<td valign="top">The timestamp of the build that will be stored with the label. Must be formatted <code>yyyyMMddHHmmss</code></td>
<td align="center" valign="top">yes</td> <td align="center" valign="top">yes</td>
</tr> </tr>
<tr>
<td valign="top">description</td>
<td valign="top">A description of the view to be stored in the StarTeam project.</td>
<td align="center" valign="top">no</td>
</tr>
</table>
* Either the URL attribute or <b>all four</b> of the servername, serverport, projectname and viewname attributes must be defined. <br/>

<h3>Examples</h3>

This example shows the use of this tag. It will create a label named <i>Version 6.2</i> with
<i>"Thorough description"</i> as its description.
<pre>
&lt;tstamp&gt;
&lt;format property="nowstamp" pattern="yyyyMMddHHmmss" locale="en"/&gt;
&lt;/tstamp&gt;
&lt;starteamlabel URL="STARTEAM:49201/Aproject/AView"
username="auser"
password="secret"
label="Version 6.2"
lastbuild="${nowstamp}"
description-"Thorough description"
/&gt;
</pre>

<hr></hr>

<a name="starteam">
<h2>Starteam</h2></a>
<h3><i>Deprecated</i></h3>
<p><i>This task has been deprecated. Use the <a href=#stcheckout">STCheckout</a> task instead.</i></p>
<h3>Description</h3>

Checks out files from a StarTeam project.

<p>
The <i>includes</i> and <i>excludes</i> attributes function differently from
other tasks in Ant. Multiple patterns must be separated by spaces, not
commas. See the examples for more information.</p>

<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr> <tr>
<td valign="top">username</td> <td valign="top">username</td>
<td valign="top">The username of the account used to log in to the StarTeam server.</td> <td valign="top">The username of the account used to log in to the StarTeam server.</td>
@@ -59,7 +306,28 @@ the <a href="http://www.starbase.com">StarBase</a> web site.</p>
<td valign="top">password</td> <td valign="top">password</td>
<td valign="top">The password of the account used to log in to the StarTeam server.</td> <td valign="top">The password of the account used to log in to the StarTeam server.</td>
<td align="center" valign="top">yes</td> <td align="center" valign="top">yes</td>
</tr>
<tr>
<td valign="top">servername</td>
<td valign="top">The name of the StarTeam server.</td>
<td align="center" valign="top">yes</td>
</tr> </tr>
<tr>
<td valign="top">serverport</td>
<td valign="top">The port number of the StarTeam server.</td>
<td align="center" valign="top">yes</td>
</tr>
<tr>
<td valign="top">projectname</td>
<td valign="top">The name of the StarTeam project.</td>
<td align="center" valign="top">yes</td>
</tr>
<tr>
<td valign="top">viewname</td>
<td valign="top">The name of the view in the StarTeam project.</td>
<td align="center" valign="top">yes</td>
</tr>

<tr> <tr>
<td valign="top">targetfolder</td> <td valign="top">targetfolder</td>
<td valign="top">The folder to which files are checked out. What this precisely means is determined by the <i>targetFolderAbsolute</i> param.</td> <td valign="top">The folder to which files are checked out. What this precisely means is determined by the <i>targetFolderAbsolute</i> param.</td>


+ 1
- 1
docs/manual/optionaltasklist.html View File

@@ -43,7 +43,7 @@
<a href="OptionalTasks/rpm.html">Rpm</a><br> <a href="OptionalTasks/rpm.html">Rpm</a><br>
<a href="OptionalTasks/script.html">Script</a><br> <a href="OptionalTasks/script.html">Script</a><br>
<a href="OptionalTasks/sound.html">Sound</a><br> <a href="OptionalTasks/sound.html">Sound</a><br>
<a href="OptionalTasks/starteam.html">Starteam</a><br>
<a href="OptionalTasks/starteam.html">Starteam Tasks</a><br>
<a href="OptionalTasks/stylebook.html">Stylebook</a><br> <a href="OptionalTasks/stylebook.html">Stylebook</a><br>
<a href="OptionalTasks/telnet.html">Telnet</a><br> <a href="OptionalTasks/telnet.html">Telnet</a><br>
<a href="OptionalTasks/test.html">Test</a><br> <a href="OptionalTasks/test.html">Test</a><br>


+ 3
- 1
src/main/org/apache/tools/ant/taskdefs/defaults.properties View File

@@ -79,7 +79,8 @@ ftp=org.apache.tools.ant.taskdefs.optional.net.FTP
icontract=org.apache.tools.ant.taskdefs.optional.IContract icontract=org.apache.tools.ant.taskdefs.optional.IContract
javacc=org.apache.tools.ant.taskdefs.optional.javacc.JavaCC javacc=org.apache.tools.ant.taskdefs.optional.javacc.JavaCC
jjtree=org.apache.tools.ant.taskdefs.optional.javacc.JJTree jjtree=org.apache.tools.ant.taskdefs.optional.javacc.JJTree
starteam=org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut
stcheckout=org.apache.tools.ant.taskdefs.optional.starteam.StartTeamCheckout
stlabel=org.apache.tools.ant.taskdefs.optional.starteam.StartTeamLabel
wljspc=org.apache.tools.ant.taskdefs.optional.jsp.WLJspc wljspc=org.apache.tools.ant.taskdefs.optional.jsp.WLJspc
jlink=org.apache.tools.ant.taskdefs.optional.jlink.JlinkTask jlink=org.apache.tools.ant.taskdefs.optional.jlink.JlinkTask
native2ascii=org.apache.tools.ant.taskdefs.optional.Native2Ascii native2ascii=org.apache.tools.ant.taskdefs.optional.Native2Ascii
@@ -133,6 +134,7 @@ replaceregexp=org.apache.tools.ant.taskdefs.optional.ReplaceRegExp
translate=org.apache.tools.ant.taskdefs.optional.i18n.Translate translate=org.apache.tools.ant.taskdefs.optional.i18n.Translate


# deprecated ant tasks (kept for back compatibility) # deprecated ant tasks (kept for back compatibility)
starteam=org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut
javadoc2=org.apache.tools.ant.taskdefs.Javadoc javadoc2=org.apache.tools.ant.taskdefs.Javadoc
#compileTask=org.apache.tools.ant.taskdefs.CompileTask #compileTask=org.apache.tools.ant.taskdefs.CompileTask
copydir=org.apache.tools.ant.taskdefs.Copydir copydir=org.apache.tools.ant.taskdefs.Copydir


+ 3
- 0
src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java View File

@@ -285,6 +285,9 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task
*/ */
public void execute() throws BuildException public void execute() throws BuildException
{ {
log("DEPRECATED - The starteam task is deprecated. Use stcheckout instead.",
Project.MSG_WARN);

// Connect to the StarTeam server, and log on. // Connect to the StarTeam server, and log on.
Server s = getServer(); Server s = getServer();




+ 264
- 0
src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamCheckout.java View File

@@ -0,0 +1,264 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.tools.ant.taskdefs.optional.starteam;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;

import com.starbase.starteam.File;
import com.starbase.starteam.Folder;
import com.starbase.starteam.Item;
import com.starbase.starteam.Status;

import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;

/**
* This class logs into StarTeam checks out any changes that have occurred since
* the last successful build. It also creates all working directories on the
* local directory if appropriate. Ant Usage: <taskdef name="starteamcheckout"
* classname="org.apache.tools.ant.taskdefs.StarTeamCheckout"/>
* <starteamcheckout username="BuildMaster" password="ant" starteamFolder="Source"
* starteamurl="servername:portnum/project/view"
* createworkingdirectories="true"/>
*
* @author Christopher Charlier, ThoughtWorks, Inc. 2001
* @author <a href="mailto:jcyip@thoughtworks.com">Jason Yip</a>
* @author Jason Pettiss
* @version 1.1
* @author <a href="mailto:stevec@ignitesports.com">Steve Cohen</a>
* @see <A HREF="http://www.starbase.com/">StarBase Web Site</A>
*/
public class StarTeamCheckout extends TreeBasedTask {

private boolean createDirs = true;
private boolean deleteUncontrolled = true;
/**
* Set the attribute that tells ant if we want to create all directories
* that are in the Starteam repository regardless if they are empty.
*/
public void setCreateWorkingDirs(boolean value) {
this.createDirs = value;
}

/**
* Sets the attribute that tells ant whether or not to remove local files
* that are NOT found in the Starteam repository.
*/
public void setDeleteUncontrolled(boolean value) {
this.deleteUncontrolled = value;
}


/**
* Implements base-class abstract function to perform the checkout operation
* on the files in each folder of the tree.
*
* @param starteamFolder the StarTeam folder from which files to be
* checked out
* @param targetFolder the local mapping of rootStarteamFolder
*/
protected void visit(Folder starteamFolder, java.io.File targetFolder )
throws BuildException
{
try {
Hashtable localFiles = getLocalFiles(targetFolder);

// If we have been told to create the working folders
if (createDirs) {
// Create if it doesn't exist
if (!targetFolder.exists()) {
targetFolder.mkdir();
}
}
// For all Files in this folder, we need to check
// if there have been modifications.

Item[] files = starteamFolder.getItems("File");
for (int i = 0; i < files.length; i++) {
File eachFile = (File) files[i];
String filename = eachFile.getName();
java.io.File localFile = new java.io.File(targetFolder, filename);
localFiles.remove(localFile.toString());
int fileStatus = (eachFile.getStatus());

// We try to update the status once to give StarTeam another chance.
if (fileStatus == Status.MERGE || fileStatus == Status.UNKNOWN) {
eachFile.updateStatus(true, true);
}

// If the file is current then skip it.
// If the file doesn't pass the include/exclude tests, skip it.
if (fileStatus == Status.CURRENT || !shouldProcess(filename)) {
continue;
}

// Check out anything else.
// Just a note: StarTeam has a status for NEW which implies that there
// is an item on your local machine that is not in the repository.
// These are the items that show up as NOT IN VIEW in the Starteam GUI.
// One would think that we would want to perhaps checkin the NEW items
// (not in all cases! - Steve Cohen 15 Dec 2001)
// Unfortunately, the sdk doesn't really work, and we can't actually see
// anything with a status of NEW. That is why we can just check out
// everything here without worrying about losing anything.

log("Checking Out: " + (localFile.toString()), Project.MSG_INFO);
eachFile.checkoutTo(localFile, Item.LockType.
UNCHANGED, true, true, true);
}

// Now we recursively call this method on all sub folders in this folder.
Folder[] subFolders = starteamFolder.getSubFolders();
for (int i = 0; i < subFolders.length; i++) {
localFiles.remove(subFolders[i].getPath());
visit(subFolders[i],
new java.io.File(targetFolder, subFolders[i].getName()));
}

// Delete all folders or files that are not in Starteam.
if (this.deleteUncontrolled && !localFiles.isEmpty()) {
delete(localFiles);
}
} catch (IOException e) {
throw new BuildException(e);
}
}

/**
* Deletes everything on the local machine that is not in Starteam.
*
* @param files
*/
/**
* Deletes everything on the local machine that is not in Starteam.
*
* @param files an "identity" <code>Hashtable</code> which we use only because
* of ant's requirement to be JDK 1.1 compatible. Otherwise, we
* could use a set. We are only interested in the keys,
* not the associated values in this Hashtable. Each of its keys
* represents the name of a local file to be deleted.
*/
private void delete(Hashtable files) {
try {

Enumeration e = files.keys();
while (e.hasMoreElements()) {
java.io.File file = new java.io.File(e.nextElement().toString());
delete(file);
}

} catch (SecurityException e) {
log("Error deleting file: " + e, Project.MSG_ERR);
}
}

/**
* Deletes the file from the local drive.
* @param file the file or directory to delete.
* @return true if the file was successfully deleted otherwise false.
*/
private boolean delete(java.io.File file) {
// If the current file is a Directory, we need to delete all its children as well.
if (file.isDirectory()) {
java.io.File[] children = file.listFiles();
for (int i = 0; i < children.length; i++) {
delete(children[i]);
}
}

log("Deleting: " + file.getAbsolutePath(), Project.MSG_INFO);
return file.delete();
}

/**
* Gets the collection of the local file names in the current directory We
* need to check this collection against what we find in Starteam to
* understand what we need to delete in order to synch with the repos.
*
* @param folder
* @return
*/
private static Hashtable getLocalFiles(java.io.File localFolder) {

// we can't use java 2 collections so we will use an identity Hashtable to
// hold the file names. We only care about the keys, not the values
// (which will all be "").

Hashtable results = new Hashtable();

if (localFolder.exists()) {
String[] localFiles = localFolder.list();
for (int i = 0; i < localFiles.length; i++) {
results.put( localFolder.toString() +
java.io.File.separatorChar + localFiles[i], "");
}
}
return results;
}
}











+ 143
- 0
src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamLabel.java View File

@@ -0,0 +1,143 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.tools.ant.taskdefs.optional.starteam;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.starbase.starteam.Label;
import com.starbase.starteam.ServerException;
import com.starbase.starteam.StarTeamFinder;
import com.starbase.starteam.View;
import com.starbase.starteam.ViewConfiguration;
import com.starbase.starteam.vts.comm.CommandException;
import com.starbase.util.OLEDate;

import org.apache.tools.ant.BuildException;

/**
* This class logs into StarTeam and creates a label for the repository at the
* time of the last successful build.
* 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"/>
*
* @author Christopher Charlier, ThoughtWorks, Inc. 2001
* @author <a href="mailto:jcyip@thoughtworks.com">Jason Yip</a>
* @see <A HREF="http://www.starbase.com/">StarBase Web Site</A>
*/
public class StarTeamLabel extends StarTeamTask {

/**
* The name of the label to be set in Starteam.
*/
private String labelName;

/**
* The label description to be set in Starteam.
*/
private String description;

/**
* 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 Date lastBuildTime;

private static final SimpleDateFormat DATE_FORMAT =
new SimpleDateFormat("yyyyMMddHHmmss");


public void setLabel(String label) {
this.labelName = label;
}

public void setDescription(String description) {
this.description = description;
}

public void setLastBuild(String lastbuild) throws BuildException {
try {
lastBuildTime = DATE_FORMAT.parse(lastbuild);
} catch (ParseException e) {
throw new BuildException("Unable to parse the date '" + lastbuild + "'", e);
}
}

/**
* This method does the work of creating the new view and checking it into
* Starteam.
*
*/
public void execute() throws BuildException {
OLEDate buildDate = new OLEDate(lastBuildTime);

// Get view as of the last successful build time.
View view = StarTeamFinder.openView(getUserName() + ":" + getPassword()
+ "@" + getURL());
View snapshot = new View(view, ViewConfiguration.createFromTime(buildDate));

// Create the new label and update the repository
new Label(snapshot, labelName, description, buildDate, true).update();
log("Created Label " + labelName);
}

}


+ 297
- 0
src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamTask.java View File

@@ -0,0 +1,297 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.tools.ant.taskdefs.optional.starteam;

import com.starbase.starteam.ServerException;
import com.starbase.starteam.vts.comm.CommandException;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;

import java.io.FileNotFoundException;
import java.util.StringTokenizer;

/**
* Common super class for all StarTeam tasks.
* At this level of the hierarchy we are concerned only with obtaining a
* connection to the StarTeam server. The subclass <code>TreeBasedTask</code>,
* also abstract defines the tree-walking behavior common to many subtasks.
*
* @see TreeBasedTask
* @author <a href="mailto:jcyip@thoughtworks.com">Jason Yip</a>
* @version 1.1
* @author <a href="mailto:stevec@ignitesports.com">Steve Cohen</a>
*/

public abstract class StarTeamTask extends Task {

// ATTRIBUTES

/**
* The username of the connection
*/
private String userName;

/**
* The username of the connection
*/
private String password;

/**
* name of Starteam server to connect to
*/
private String servername;

/**
* port of Starteam server to connect to
*/
private String serverport;

/**
* name of Starteam project to connect to
*/
private String projectname;

/**
* name of Starteam view to connect to
*/
private String viewname;

/////////////////////////////////////////////////////////
// GET/SET methods.
// Setters, of course are where ant user passes in values.
/////////////////////////////////////////////////////////

/**
* Set the name of StarTeamServer
*
* @param servername a <code>String</code> value
* @see setURL()
*/
public void setServername(String servername) {
this.servername = servername;
}

/**
* returns the name of the StarTeamServer
*
* @return the name of the StarTeam server
* @see getURL()
*/
public String getServername() {
return this.servername;
}
/**
* set the port number of the StarTeam connection
*
* @param serverport port number to be set
* @see setURL()
*/
public void setServerport(String serverport) {
this.serverport = serverport;
}

/**
* returns the port number of the StarTeam connection
*
* @return the port number of the StarTeam connection
* @see getURL()
*/
public String getServerport() {
return this.serverport;
}
/**
* set the name of the StarTeam project to be acted on
*
* @param projectname the name of the StarTeam project to be acted on
* @see setURL()
*/
public void setProjectname(String projectname) {
this.projectname = projectname;
}

/**
* returns the name of the StarTeam project to be acted on
*
* @return the name of the StarTeam project to be acted on
* @see getURL()
*/
public String getProjectname() {
return this.projectname;
}
/**
* set the name of the StarTeam view to be acted on
*
* @param projectname the name of the StarTeam view to be acted on
* @see setURL()
*/
public void setViewname(String viewname) {
this.viewname = viewname;
}

/**
* returns the name of the StarTeam view to be acted on
*
* @return the name of the StarTeam view to be acted on
* @see getURL()
*/ public String getViewname() {
return this.viewname;
}

/**
* This is a convenience method for setting the server name, server port,
* project name and project folder at one shot.
*
* @param url a <code>String</code> of the form
* "servername:portnum/project/view"
* @see setServerame()
* @see setServerport()
* @see setProjectname()
* @see setViewname()
*/
public void setURL(String url) {
StringTokenizer t = new StringTokenizer(url,"/");
if (t.hasMoreTokens()) {
String unpw = t.nextToken();
int pos = unpw.indexOf(":");
if (pos > 0) {
this.servername = unpw.substring(0,pos);
this.serverport = unpw.substring(pos+1);
if (t.hasMoreTokens()) {
this.projectname=t.nextToken();
if (t.hasMoreTokens()) {
this.viewname = t.nextToken();
}
}
}
}
}

/**
* convenience method returns whole URL at once
* returns
* as a single string
*/
/**
* a convenience method which returns the whole StarTeam
* connection information as a single URL string of
*
* @return a <code>String</code> of the form
* "servername:portnum/project/view"
* @see getServername()
* @see getServerport()
* @see getProjectname()
* @see getViewname()
*/
public String getURL() {
return
this.servername + ":" +
this.serverport + "/" +
this.projectname + "/" +
((null==this.viewname)?"":this.viewname);
}
/**
* set the name of the StarTeam user, needed for the connection
*
* @param userName name of the user to be logged in
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* returns the name of the StarTeam user
*
* @return the name of the StarTeam user
*/
public String getUserName() {
return this.userName;
}

/**
* set the password to be used for login.
*
* @param password the password to be used for login
*/
public void setPassword(String password) {
this.password = password;
}
/**
* returns the password used for login
*
* @return the password used for login
*/
public String getPassword() {
return this.password;
}
}













+ 341
- 0
src/main/org/apache/tools/ant/taskdefs/optional/starteam/TreeBasedTask.java View File

@@ -0,0 +1,341 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.tools.ant.taskdefs.optional.starteam;

import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.BuildException;

import java.util.StringTokenizer;
import java.io.IOException;

import com.starbase.starteam.File;
import com.starbase.starteam.Folder;
import com.starbase.starteam.View;
import com.starbase.starteam.ViewConfiguration;
import com.starbase.util.OLEDate;
import com.starbase.starteam.StarTeamFinder;

/**
* FileBasedTask.java
* This abstract class is the base for any tasks that are tree-based, that
* is, for tasks which iterate over a tree of folders in StarTeam which
* is reflected in a tree of folder the local machine.
*
* This class provides the tree-iteration functionality. Derived classes
* will implement their specific task functionality by the visitor pattern,
* specifically by implementing the method
* <code>visit(Folder rootStarteamFolder, java.io.File rootLocalFolder)</code>
*
* Created: Sat Dec 15 16:55:19 2001
*
* @author <a href="mailto:stevec@ignitesports.com">Steve Cohen</a>
* @version 1.0
* @see <A HREF="http://www.starbase.com/">StarBase Web Site</A>
*/

public abstract class TreeBasedTask extends StarTeamTask {


///////////////////////////////////////////////////////////////
// default values for attributes.
///////////////////////////////////////////////////////////////
/**
* This constant sets the filter to include all files. This default has
* the same result as <CODE>setIncludes("*")</CODE>.
*
* @see #getIncludes()
* @see #setIncludes(String includes)
*/
public final static String DEFAULT_INCLUDESETTING = "*";

/**
* This disables the exclude filter by default. In other words, no files
* are excluded. This setting is equivalent to
* <CODE>setExcludes(null)</CODE>.
*
* @see #getExcludes()
* @see #setExcludes(String excludes)
*/
public final static String DEFAULT_EXCLUDESETTING = null;

//ATTRIBUTES settable from ant.

/**
* The root folder of the operation in StarTeam.
*/
private String rootStarteamFolder = "/";

/**
* The local folder corresponding to starteamFolder. If not specified
* the Star Team defalt folder will be used.
*/
private String rootLocalFolder = null;

/**
* All files that fit this pattern are checked out.
*/
private String includes = DEFAULT_INCLUDESETTING;

/**
* All files fitting this pattern are ignored.
*/
private String excludes = DEFAULT_EXCLUDESETTING;

///////////////////////////////////////////////////////////////
// GET/SET methods.
// Setters, of course are where ant user passes in values.
///////////////////////////////////////////////////////////////

/**
* Set the root folder in the Starteam repository for this operation
*/
public void setRootStarteamFolder(String rootStarteamFolder) {
this.rootStarteamFolder = rootStarteamFolder;
}

/**
* returns the root folder in the Starteam repository
* used for this operation
*/
public String getRootStarteamFolder() {
return this.rootStarteamFolder;
}

/**
* Set the local folder corresponding to the
* starteam folder for this operation.
* If not specified, the StarTeam default will be used
* the default is used.
*/
public void setRootLocalFolder(String rootLocalFolder) {
this.rootLocalFolder = rootLocalFolder;
}
/**
* Returns the local folder specified by the user,
* corresponding to the starteam folder for this operation.
* or null if not specified
*/
public String getRootLocalFolder() {
return this.rootLocalFolder;
}

/**
* sets the pattern of files to be included. See setExcludes() for a
* description
* @param includes A string of filter patterns to include. Separate the
* patterns by spaces.
* @see #getIncludes()
* @see #setExcludes(String excludes)
* @see #getExcludes()
*/
public void setIncludes(String includes) {
this.includes = includes;
}

/**
* Gets the patterns from the include filter. Rather that duplicate the
* details of AntStarTeanCheckOut's filtering here, refer to these
* links:
*
* @return A string of filter patterns separated by spaces.
* @see #setIncludes(String includes)
* @see #setExcludes(String excludes)
* @see #getExcludes()
*/
public String getIncludes() {
return includes;
}

/**
* Sets the exclude filter. When filtering files, AntStarTeamCheckOut
* uses an unmodified version of <CODE>DirectoryScanner</CODE>'s
* <CODE>match</CODE> method, so here are the patterns straight from the
* Ant source code:
* <BR><BR>
* Matches a string against a pattern. The pattern contains two special
* characters:
* <BR>'*' which means zero or more characters,
* <BR>'?' which means one and only one character.
* <BR><BR>
* For example, if you want to check out all files except .XML and
* .HTML files, you would put the following line in your program:
* <CODE>setExcludes("*.XML,*.HTML");</CODE>
* Finally, note that filters have no effect on the <B>directories</B>
* that are scanned; you could not skip over all files in directories
* whose names begin with "project," for instance.
* <BR><BR>
* Treatment of overlapping inlcudes and excludes: To give a simplistic
* example suppose that you set your include filter to "*.htm *.html"
* and your exclude filter to "index.*". What happens to index.html?
* AntStarTeamCheckOut will not check out index.html, as it matches an
* exclude filter ("index.*"), even though it matches the include
* filter, as well.
* <BR><BR>
* Please also read the following sections before using filters:
*
* @param excludes A string of filter patterns to exclude. Separate the
* patterns by spaces.
* @see #setIncludes(String includes)
* @see #getIncludes()
* @see #getExcludes()
*/
public void setExcludes(String excludes) {
this.excludes = excludes;
}

/**
* Gets the patterns from the exclude filter. Rather that duplicate the
* details of AntStarTeanCheckOut's filtering here, refer to these
* links:
*
* @return A string of filter patterns separated by spaces.
* @see #setExcludes(String excludes)
* @see #setIncludes(String includes)
* @see #getIncludes()
*/
public String getExcludes() {
return excludes;
}

///////////////////////////////////////////////////////////////
// INCLUDE-EXCLUDE processing
///////////////////////////////////////////////////////////////

/**
* Look if the file should be processed by the task.
* Don't process it if it fits no include filters or if
* it fits an exclude filter.
* @param pName the item name to look for being included.
* @return whether the file should be checked out or not.
*/
protected boolean shouldProcess(String pName){
boolean includeIt = matchPatterns(getIncludes(), pName);
boolean excludeIt = matchPatterns(getExcludes(), pName);
return (includeIt && !excludeIt);
}

/**
* Convenience method to see if a string match a one pattern
* in given set of space-separated patterns.
* @param patterns the space-separated list of patterns.
* @param pName the name to look for matching.
* @return whether the name match at least one pattern.
*/
protected boolean matchPatterns(String patterns, String pName){
if (patterns == null){
return false;
}
StringTokenizer exStr = new StringTokenizer(patterns, ",");
while (exStr.hasMoreTokens())
{
if (DirectoryScanner.match(exStr.nextToken(), pName))
{
return true;
}
}
return false;
}

/**
* This method does the work of opening the supplied Starteam view and calling
* the visit method to perform the task.
*
* @exception BuildException if any error occurs in the processing
*/
public void execute() throws BuildException {
// Get view as of the current time?
View view = StarTeamFinder.openView(getUserName() + ":" + getPassword()
+ "@" + getURL());
View snapshot = new View(view, ViewConfiguration.createFromTime(
new OLEDate()));
Folder starteamrootfolder =
StarTeamFinder.findFolder(snapshot.getRootFolder(), this.rootStarteamFolder);

if ( null == starteamrootfolder) {
throw new BuildException("Unable to find root folderin repository.");
}

java.io.File localrootfolder;

if (null == this.rootLocalFolder) {
// use Star Team's default
localrootfolder = new java.io.File(starteamrootfolder.getPath());
} else {
// force StarTeam to use our folder
localrootfolder = new java.io.File(getRootLocalFolder());
log("overriding local folder to " + localrootfolder);
}

// Inspect everything in the root folder and then recursively
visit(starteamrootfolder, localrootfolder);
}

/**
* Derived classes must override this class to define the actual processing
* to performed on each folder in the tree defined for the task
*
* @param rootStarteamFolder the StarTeam folderto be visited
* @param rootLocalFolder the local mapping of rootStarteamFolder
*/
protected abstract void visit(Folder rootStarteamFolder, java.io.File rootLocalFolder)
throws BuildException;

}





Loading…
Cancel
Save