You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@locus.apache.org on 2000/11/25 02:10:11 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/scm AntStarTeamCheckOut.java
donaldp 00/11/24 17:10:11
Modified: src/main/org/apache/tools/ant/taskdefs Copydir.java
Copyfile.java Exec.java GenerateKey.java Get.java
Replace.java SignJar.java
src/main/org/apache/tools/ant/taskdefs/optional
NetRexxC.java RenameExtensions.java
src/main/org/apache/tools/ant/taskdefs/optional/scm
AntStarTeamCheckOut.java
Log:
Removed Project.toBoolean method where appropriate and removed a number of tabs.
Revision Changes Path
1.17 +5 -6 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java
Index: Copydir.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Copydir.java 2000/10/04 09:18:48 1.16
+++ Copydir.java 2000/11/25 01:10:05 1.17
@@ -54,10 +54,9 @@
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.*;
-
import java.io.*;
import java.util.*;
+import org.apache.tools.ant.*;
/**
* Copies a directory.
@@ -84,16 +83,16 @@
destDir = dest;
}
- public void setFiltering(String filter) {
- filtering = Project.toBoolean(filter);
+ public void setFiltering(boolean filter) {
+ filtering = filter;
}
public void setFlatten(boolean flatten) {
this.flatten = flatten;
}
- public void setForceoverwrite(String force) {
- forceOverwrite = Project.toBoolean(force);
+ public void setForceoverwrite(boolean force) {
+ forceOverwrite = force;
}
public void execute() throws BuildException {
1.9 +3 -4 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copyfile.java
Index: Copyfile.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copyfile.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Copyfile.java 2000/10/04 09:18:48 1.8
+++ Copyfile.java 2000/11/25 01:10:05 1.9
@@ -54,10 +54,9 @@
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.*;
-
import java.io.*;
import java.util.*;
+import org.apache.tools.ant.*;
/**
* Copies a file.
@@ -78,8 +77,8 @@
srcFile = src;
}
- public void setForceoverwrite(String force) {
- forceOverwrite = Project.toBoolean(force);
+ public void setForceoverwrite(boolean force) {
+ forceOverwrite = force;
}
public void setDest(File dest) {
1.17 +2 -2 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java
Index: Exec.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exec.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Exec.java 2000/08/03 10:29:20 1.16
+++ Exec.java 2000/11/25 01:10:06 1.17
@@ -182,8 +182,8 @@
this.out = out;
}
- public void setFailonerror(String fail) {
- failOnError = Project.toBoolean(fail);
+ public void setFailonerror(boolean fail) {
+ failOnError = fail;
}
protected void outputLog(String line, int messageLevel) {
1.3 +82 -79 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
Index: GenerateKey.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GenerateKey.java 2000/08/10 06:51:51 1.2
+++ GenerateKey.java 2000/11/25 01:10:06 1.3
@@ -53,15 +53,15 @@
*/
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.*;
-import org.apache.tools.ant.types.Commandline;
import java.util.Enumeration;
import java.util.Vector;
+import org.apache.tools.ant.*;
+import org.apache.tools.ant.types.Commandline;
/**
* Generates a key.
*
- * @author Peter Donald <a href="mailto:donaldp@mad.scientist.com">donaldp@mad.scientist.com</a>
+ * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
*/
public class GenerateKey extends Task {
@@ -104,46 +104,46 @@
}
public String toString() {
- final int size = params.size();
- final StringBuffer sb = new StringBuffer();
- boolean firstPass = true;
-
- for( int i = 0; i < size; i++ ) {
- if( !firstPass ) {
- sb.append(" ,");
- }
- firstPass = false;
-
- final DnameParam param = (DnameParam)params.elementAt( i );
- sb.append( encode( param.getName() ) );
- sb.append( '=' );
- sb.append( encode( param.getValue() ) );
- }
-
- return sb.toString();
- }
-
- public String encode( final String string ) {
- int end = string.indexOf(',');
-
- if( -1 == end ) return string;
-
- final StringBuffer sb = new StringBuffer();
-
- int start = 0;
-
- while( -1 != end )
- {
- sb.append( string.substring( start, end ) );
- sb.append( "\\," );
- start = end + 1;
- end = string.indexOf( ',', start );
- }
-
- sb.append( string.substring( start ) );
-
- return sb.toString();
- }
+ final int size = params.size();
+ final StringBuffer sb = new StringBuffer();
+ boolean firstPass = true;
+
+ for( int i = 0; i < size; i++ ) {
+ if( !firstPass ) {
+ sb.append(" ,");
+ }
+ firstPass = false;
+
+ final DnameParam param = (DnameParam)params.elementAt( i );
+ sb.append( encode( param.getName() ) );
+ sb.append( '=' );
+ sb.append( encode( param.getValue() ) );
+ }
+
+ return sb.toString();
+ }
+
+ public String encode( final String string ) {
+ int end = string.indexOf(',');
+
+ if( -1 == end ) return string;
+
+ final StringBuffer sb = new StringBuffer();
+
+ int start = 0;
+
+ while( -1 != end )
+ {
+ sb.append( string.substring( start, end ) );
+ sb.append( "\\," );
+ start = end + 1;
+ end = string.indexOf( ',', start );
+ }
+
+ sb.append( string.substring( start ) );
+
+ return sb.toString();
+ }
}
/**
@@ -168,20 +168,22 @@
protected boolean verbose;
public DistinguishedName createDname() throws BuildException {
- if( null != expandedDname ) {
- throw new BuildException("DName sub-element can only be specified once.");
- }
- if( null != dname ) {
- throw new BuildException("It is not possible to specify dname both as attribute and element.");
- }
- expandedDname = new DistinguishedName();
- return expandedDname;
+ if( null != expandedDname ) {
+ throw new BuildException( "DName sub-element can only be specified once." );
+ }
+ if( null != dname ) {
+ throw new BuildException( "It is not possible to specify dname both " +
+ "as attribute and element." );
+ }
+ expandedDname = new DistinguishedName();
+ return expandedDname;
}
public void setDname(final String dname) {
- if( null != expandedDname ) {
- throw new BuildException("It is not possible to specify dname both as attribute and element.");
- }
+ if( null != expandedDname ) {
+ throw new BuildException( "It is not possible to specify dname both " +
+ "as attribute and element." );
+ }
this.dname = dname;
}
@@ -214,40 +216,41 @@
}
public void setKeysize(final String keysize) throws BuildException {
- try { this.keysize = Integer.parseInt(keysize); }
- catch(final NumberFormatException nfe)
- {
- throw new BuildException( "KeySize attribute should be a integer" );
- }
+ try { this.keysize = Integer.parseInt(keysize); }
+ catch(final NumberFormatException nfe)
+ {
+ throw new BuildException( "KeySize attribute should be a integer" );
+ }
}
public void setValidity(final String validity) throws BuildException {
- try { this.validity = Integer.parseInt(validity); }
- catch(final NumberFormatException nfe)
- {
- throw new BuildException( "Validity attribute should be a integer" );
- }
+ try { this.validity = Integer.parseInt(validity); }
+ catch(final NumberFormatException nfe)
+ {
+ throw new BuildException( "Validity attribute should be a integer" );
+ }
}
- public void setVerbose(final String verbose) {
- this.verbose = project.toBoolean(verbose);
+ public void setVerbose(final boolean verbose) {
+ this.verbose = verbose;
}
public void execute() throws BuildException {
if (project.getJavaVersion().equals(Project.JAVA_1_1)) {
- throw new BuildException("The genkey task is only available on JDK versions 1.2 or greater");
+ throw new BuildException( "The genkey task is only available on JDK" +
+ " versions 1.2 or greater" );
}
if (null == alias) {
- throw new BuildException("alias attribute must be set");
+ throw new BuildException( "alias attribute must be set" );
}
if (null == storepass) {
- throw new BuildException("storepass attribute must be set");
+ throw new BuildException( "storepass attribute must be set" );
}
if (null == dname && null == expandedDname) {
- throw new BuildException("dname must be set");
+ throw new BuildException( "dname must be set" );
}
final StringBuffer sb = new StringBuffer();
@@ -258,9 +261,9 @@
sb.append("-v ");
}
- sb.append("-alias \"");
- sb.append(alias);
- sb.append("\" ");
+ sb.append("-alias \"");
+ sb.append(alias);
+ sb.append("\" ");
if (null != dname) {
sb.append("-dname \"");
@@ -275,9 +278,9 @@
}
if (null != keystore) {
- sb.append("-keystore \"");
+ sb.append("-keystore \"");
sb.append(keystore);
- sb.append("\" ");
+ sb.append("\" ");
}
if (null != storepass) {
@@ -292,14 +295,14 @@
sb.append("\" ");
}
- sb.append("-keypass \"");
+ sb.append("-keypass \"");
if (null != keypass) {
sb.append(keypass);
}
- else {
+ else {
sb.append(storepass);
- }
- sb.append("\" ");
+ }
+ sb.append("\" ");
if (null != sigalg) {
sb.append("-sigalg \"");
1.7 +47 -47 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Get.java
Index: Get.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Get.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Get.java 2000/09/18 07:55:00 1.6
+++ Get.java 2000/11/25 01:10:07 1.7
@@ -54,10 +54,10 @@
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.*;
import java.io.*;
import java.net.*;
import java.util.*;
+import org.apache.tools.ant.*;
/**
* Get a particular file from a URL source.
@@ -100,14 +100,14 @@
try {
- log("Getting: " + source);
+ log("Getting: " + source);
- //set the timestamp to the file date.
- long timestamp=0;
+ //set the timestamp to the file date.
+ long timestamp=0;
boolean hasTimestamp=false;
- if(useTimestamp && dest.exists()) {
- timestamp=dest.lastModified();
+ if(useTimestamp && dest.exists()) {
+ timestamp=dest.lastModified();
if (verbose) {
Date t=new Date(timestamp);
log("local file date : "+t.toString());
@@ -115,7 +115,7 @@
hasTimestamp=true;
}
-
+
//set up the URL connection
URLConnection connection=source.openConnection();
//modify the headers
@@ -128,7 +128,7 @@
connection.connect();
//next test for a 304 result (HTTP only)
if(connection instanceof HttpURLConnection) {
- HttpURLConnection httpConnection=(HttpURLConnection)connection;
+ HttpURLConnection httpConnection=(HttpURLConnection)connection;
if(httpConnection.getResponseCode()==HttpURLConnection.HTTP_NOT_MODIFIED) {
//not modified so no file download. just return instead
//and trace out something so the user doesn't think that the
@@ -141,45 +141,45 @@
//REVISIT: at this point even non HTTP connections may support the if-modified-since
//behaviour -we just check the date of the content and skip the write if it is not
//newer. Some protocols (FTP) dont include dates, of course.
-
- FileOutputStream fos = new FileOutputStream(dest);
+
+ FileOutputStream fos = new FileOutputStream(dest);
- InputStream is=null;
- for( int i=0; i< 3 ; i++ ) {
- try {
- is = connection.getInputStream();
- break;
- } catch( IOException ex ) {
- log( "Error opening connection " + ex );
- }
- }
- if( is==null ) {
- log( "Can't get " + source + " to " + dest);
- if(ignoreErrors)
+ InputStream is=null;
+ for( int i=0; i< 3 ; i++ ) {
+ try {
+ is = connection.getInputStream();
+ break;
+ } catch( IOException ex ) {
+ log( "Error opening connection " + ex );
+ }
+ }
+ if( is==null ) {
+ log( "Can't get " + source + " to " + dest);
+ if(ignoreErrors)
return;
- throw new BuildException( "Can't get " + source + " to " + dest,
+ throw new BuildException( "Can't get " + source + " to " + dest,
location);
- }
-
- byte[] buffer = new byte[100 * 1024];
- int length;
-
- while ((length = is.read(buffer)) >= 0) {
- fos.write(buffer, 0, length);
- if (verbose) System.out.print(".");
- }
- if(verbose) System.out.println();
- fos.close();
- is.close();
+ }
+
+ byte[] buffer = new byte[100 * 1024];
+ int length;
+
+ while ((length = is.read(buffer)) >= 0) {
+ fos.write(buffer, 0, length);
+ if (verbose) System.out.print(".");
+ }
+ if(verbose) System.out.println();
+ fos.close();
+ is.close();
//if (and only if) the use file time option is set, then the
//saved file now has its timestamp set to that of the downloaded file
if(useTimestamp) {
- long remoteTimestamp=connection.getLastModified();
+ long remoteTimestamp=connection.getLastModified();
if (verbose) {
Date t=new Date(remoteTimestamp);
log("last modified = "+t.toString()
- +((remoteTimestamp==0)?" - using current time instead":""));
+ +((remoteTimestamp==0)?" - using current time instead":""));
}
if(remoteTimestamp!=0)
touchFile(dest,remoteTimestamp);
@@ -187,12 +187,12 @@
- } catch (IOException ioe) {
- log("Error getting " + source + " to " + dest );
- if(ignoreErrors)
+ } catch (IOException ioe) {
+ log("Error getting " + source + " to " + dest );
+ if(ignoreErrors)
return;
- throw new BuildException(ioe, location);
- }
+ throw new BuildException(ioe, location);
+ }
}
/**
@@ -221,7 +221,7 @@
} else {
return false;
}
- }
+ }
/**
* Set the URL.
@@ -229,7 +229,7 @@
* @param u URL for the file.
*/
public void setSrc(URL u) {
- this.source = u;
+ this.source = u;
}
/**
@@ -238,7 +238,7 @@
* @param dest Path to file.
*/
public void setDest(File dest) {
- this.dest = dest;
+ this.dest = dest;
}
/**
@@ -247,7 +247,7 @@
* @param v if "true" then be verbose
*/
public void setVerbose(boolean v) {
- verbose = v;
+ verbose = v;
}
/**
@@ -256,7 +256,7 @@
* @param v if "true" then don't report download errors up to ant
*/
public void setIgnoreErrors(boolean v) {
- ignoreErrors = v;
+ ignoreErrors = v;
}
/**
1.7 +1 -1 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Replace.java
Index: Replace.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Replace.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Replace.java 2000/09/18 07:55:01 1.6
+++ Replace.java 2000/11/25 01:10:07 1.7
@@ -110,7 +110,7 @@
}
if (dir != null) {
- DirectoryScanner ds = super.getDirectoryScanner(dir);
+ DirectoryScanner ds = super.getDirectoryScanner(dir);
String[] srcs = ds.getIncludedFiles();
for(int i=0; i<srcs.length; i++) {
1.5 +7 -7 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SignJar.java
Index: SignJar.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SignJar.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SignJar.java 2000/10/27 14:59:27 1.4
+++ SignJar.java 2000/11/25 01:10:07 1.5
@@ -53,9 +53,9 @@
*/
package org.apache.tools.ant.taskdefs;
+import java.io.File;
import org.apache.tools.ant.*;
import org.apache.tools.ant.types.Commandline;
-import java.io.File;
/**
* Sign a archive.
@@ -119,16 +119,16 @@
this.signedjar = signedjar;
}
- public void setVerbose(final String verbose) {
- this.verbose = project.toBoolean(verbose);
+ public void setVerbose(final boolean verbose) {
+ this.verbose = verbose;
}
- public void setInternalsf(final String internalsf) {
- this.internalsf = project.toBoolean(internalsf);
+ public void setInternalsf(final boolean internalsf) {
+ this.internalsf = internalsf;
}
- public void setSectionsonly(final String sectionsonly) {
- this.sectionsonly = project.toBoolean(sectionsonly);
+ public void setSectionsonly(final boolean sectionsonly) {
+ this.sectionsonly = sectionsonly;
}
public void execute() throws BuildException {
1.6 +67 -66 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
Index: NetRexxC.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NetRexxC.java 2000/09/21 07:42:48 1.5
+++ NetRexxC.java 2000/11/25 01:10:08 1.6
@@ -54,14 +54,12 @@
package org.apache.tools.ant.taskdefs.optional;
-import org.apache.tools.ant.*;
-import org.apache.tools.ant.taskdefs.*;
-
-import netrexx.lang.Rexx;
-
import java.io.*;
import java.lang.reflect.*;
import java.util.*;
+import netrexx.lang.Rexx;
+import org.apache.tools.ant.*;
+import org.apache.tools.ant.taskdefs.*;
/**
* Task to compile NetRexx source files. This task can take the following
@@ -154,8 +152,8 @@
/**
* Set whether literals are treated as binary, rather than NetRexx types
*/
- public void setBinary(String binary) {
- this.binary = Project.toBoolean(binary);
+ public void setBinary(boolean binary) {
+ this.binary = binary;
}
/**
@@ -170,17 +168,17 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false
*/
- public void setComments(String comments) {
- this.comments = Project.toBoolean(comments);
+ public void setComments(boolean comments) {
+ this.comments = comments;
}
- /**
+ /**
* Set whether error messages come out in compact or verbose format.
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false
*/
- public void setCompact(String compact) {
- this.compact = Project.toBoolean(compact);
+ public void setCompact(boolean compact) {
+ this.compact = compact;
}
/**
@@ -189,8 +187,8 @@
* The default value is true.
* Setting this flag to false, will automatically set the keep flag to true.
*/
- public void setCompile(String compile) {
- this.compile = Project.toBoolean(compile);
+ public void setCompile(boolean compile) {
+ this.compile = compile;
if (!this.compile && !this.keep) this.keep = true;
}
@@ -199,15 +197,15 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is true.
*/
- public void setConsole(String console) {
- this.console = Project.toBoolean(console);
+ public void setConsole(boolean console) {
+ this.console = console;
}
/**
* Whether variable cross references are generated
*/
- public void setCrossref(String crossref) {
- this.crossref = Project.toBoolean(crossref);
+ public void setCrossref(boolean crossref) {
+ this.crossref = crossref;
}
/**
@@ -216,8 +214,8 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is true.
*/
- public void setDecimal(String decimal) {
- this.decimal = Project.toBoolean(decimal);
+ public void setDecimal(boolean decimal) {
+ this.decimal = decimal;
}
/**
@@ -231,8 +229,8 @@
/**
* Whether diagnostic information about the compile is generated
*/
- public void setDiag(String diag) {
- this.diag = Project.toBoolean(diag);
+ public void setDiag(boolean diag) {
+ this.diag = diag;
}
/**
@@ -240,16 +238,16 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
- public void setExplicit(String explicit) {
- this.explicit = Project.toBoolean(explicit);
+ public void setExplicit(boolean explicit) {
+ this.explicit = explicit;
}
/**
* Whether the generated java code is formatted nicely or left to match NetRexx
* line numbers for call stack debugging
*/
- public void setFormat(String format) {
- this.format = Project.toBoolean(format);
+ public void setFormat(boolean format) {
+ this.format = format;
}
/**
@@ -257,8 +255,8 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
- public void setJava(String java) {
- this.java = Project.toBoolean(java);
+ public void setJava(boolean java) {
+ this.java = java;
}
@@ -268,24 +266,24 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
- public void setKeep(String keep) {
- this.keep = Project.toBoolean(keep);
+ public void setKeep(boolean keep) {
+ this.keep = keep;
}
/**
* Whether the compiler text logo is displayed when compiling
*/
- public void setLogo(String logo) {
- this.logo = Project.toBoolean(logo);
+ public void setLogo(boolean logo) {
+ this.logo = logo;
}
- /**
+ /**
* Whether the generated .java file should be replaced when compiling
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
- public void setReplace(String replace) {
- this.replace = Project.toBoolean(replace);
+ public void setReplace(boolean replace) {
+ this.replace = replace;
}
/**
@@ -294,8 +292,8 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
- public void setSavelog(String savelog) {
- this.savelog = Project.toBoolean(savelog);
+ public void setSavelog(boolean savelog) {
+ this.savelog = savelog;
}
/**
@@ -304,8 +302,8 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is true.
*/
- public void setSourcedir(String sourcedir) {
- this.sourcedir = Project.toBoolean(sourcedir);
+ public void setSourcedir(boolean sourcedir) {
+ this.sourcedir = sourcedir;
}
/**
@@ -322,22 +320,22 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
- public void setStrictargs(String strictargs) {
- this.strictargs = Project.toBoolean(strictargs);
+ public void setStrictargs(boolean strictargs) {
+ this.strictargs = strictargs;
}
/**
* Tells the NetRexx compile that assignments must match exactly on type
*/
- public void setStrictassign(String strictassign) {
- this.strictassign = Project.toBoolean(strictassign);
+ public void setStrictassign(boolean strictassign) {
+ this.strictassign = strictassign;
}
/**
* Specifies whether the NetRexx compiler should be case sensitive or not
*/
- public void setStrictcase(String strictcase) {
- this.strictcase = Project.toBoolean(strictcase);
+ public void setStrictcase(boolean strictcase) {
+ this.strictcase = strictcase;
}
/**
@@ -347,8 +345,8 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
- public void setStrictimport(String strictimport) {
- this.strictimport = Project.toBoolean(strictimport);
+ public void setStrictimport(boolean strictimport) {
+ this.strictimport = strictimport;
}
/**
@@ -356,16 +354,16 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
- public void setStrictprops(String strictprops) {
- this.strictprops = Project.toBoolean(strictprops);
+ public void setStrictprops(boolean strictprops) {
+ this.strictprops = strictprops;
}
/**
* Whether the compiler should force catching of exceptions by explicitly named types
*/
- public void setStrictsignal(String strictsignal) {
- this.strictsignal = Project.toBoolean(strictsignal);
+ public void setStrictsignal(boolean strictsignal) {
+ this.strictsignal = strictsignal;
}
/**
@@ -373,8 +371,8 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
- public void setSymbols(String symbols) {
- this.symbols = Project.toBoolean(symbols);
+ public void setSymbols(boolean symbols) {
+ this.symbols = symbols;
}
/**
@@ -382,8 +380,8 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
- public void setTime(String time) {
- this.time = Project.toBoolean(time);
+ public void setTime(boolean time) {
+ this.time = time;
}
/**
@@ -393,9 +391,9 @@
*/
public void setTrace(String trace) {
if (trace.equalsIgnoreCase("trace")
- || trace.equalsIgnoreCase("trace1")
- || trace.equalsIgnoreCase("trace2")
- || trace.equalsIgnoreCase("notrace")) {
+ || trace.equalsIgnoreCase("trace1")
+ || trace.equalsIgnoreCase("trace2")
+ || trace.equalsIgnoreCase("notrace")) {
this.trace = trace;
} else {
throw new BuildException("Unknown trace value specified: '" + trace + "'");
@@ -407,8 +405,8 @@
* Valid true values are "on" or "true". Anything else sets the flag to false.
* The default value is false.
*/
- public void setUtf8(String utf8) {
- this.utf8 = Project.toBoolean(utf8);
+ public void setUtf8(boolean utf8) {
+ this.utf8 = utf8;
}
/**
@@ -463,7 +461,10 @@
// if it's a source file, see if the destination class file
// needs to be recreated via compilation
if (filename.toLowerCase().endsWith(".nrx")) {
- File classFile = new File(destDir, filename.substring(0, filename.lastIndexOf('.')) + ".class");
+ File classFile =
+ new File(destDir,
+ filename.substring(0, filename.lastIndexOf('.')) + ".class");
+
if (!compile || srcFile.lastModified() > classFile.lastModified()) {
filecopyList.put(srcFile.getAbsolutePath(), destFile.getAbsolutePath());
compileList.addElement(destFile.getAbsolutePath());
@@ -492,7 +493,7 @@
project.copyFile(fromFile, toFile);
} catch (IOException ioe) {
String msg = "Failed to copy " + fromFile + " to " + toFile
- + " due to " + ioe.getMessage();
+ + " due to " + ioe.getMessage();
throw new BuildException(msg, ioe);
}
}
@@ -554,8 +555,8 @@
try {
StringWriter out = new StringWriter();
- int rc = COM.ibm.netrexx.process.NetRexxC.main(
- new Rexx(compileArgs), new PrintWriter(out));
+ int rc = COM.ibm.netrexx.process.NetRexxC.
+ main(new Rexx(compileArgs), new PrintWriter(out));
if (rc > 1) { // 1 is warnings from real NetRexxC
log(out.toString(), Project.MSG_ERR);
@@ -644,7 +645,7 @@
*/
private void addExistingToClasspath(StringBuffer target,String source) {
StringTokenizer tok = new StringTokenizer(source,
- System.getProperty("path.separator"), false);
+ System.getProperty("path.separator"), false);
while (tok.hasMoreTokens()) {
File f = project.resolveFile(tok.nextToken());
@@ -653,7 +654,7 @@
target.append(f.getAbsolutePath());
} else {
log("Dropping from classpath: "+
- f.getAbsolutePath(), Project.MSG_VERBOSE);
+ f.getAbsolutePath(), Project.MSG_VERBOSE);
}
}
1.5 +17 -8 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java
Index: RenameExtensions.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RenameExtensions.java 2000/07/06 16:48:27 1.4
+++ RenameExtensions.java 2000/11/25 01:10:09 1.5
@@ -101,8 +101,8 @@
* store replace attribute - this determines whether the target file
* should be overwritten if present
*/
- public void setReplace(String replaceString) {
- replace = Project.toBoolean(replaceString);
+ public void setReplace(boolean replace) {
+ this.replace = replace;
}
/**
@@ -119,7 +119,8 @@
// first off, make sure that we've got a from and to extension
if (fromExtension == null || toExtension == null || srcDir == null) {
- throw new BuildException("srcDir, fromExtension and toExtension attributes must be set!");
+ throw new BuildException( "srcDir, fromExtension and toExtension " +
+ "attributes must be set!" );
}
// scan source and dest dirs to build up rename list
@@ -136,7 +137,10 @@
fromFile = (File)e.nextElement();
toFile = (File)renameList.get(fromFile);
if (toFile.exists() && replace) toFile.delete();
- if (!fromFile.renameTo(toFile)) throw new BuildException("Rename from: '" + fromFile + "' to '" + toFile + "' failed.");
+ if (!fromFile.renameTo(toFile)) {
+ throw new BuildException( "Rename from: '" + fromFile + "' to '" +
+ toFile + "' failed." );
+ }
}
}
@@ -147,17 +151,22 @@
String filename = files[i];
// if it's a file that ends in the fromExtension, copy to the rename list
if (filename.toLowerCase().endsWith(fromExtension)) {
- File destFile = new File(srcDir, filename.substring(0, filename.lastIndexOf(fromExtension)) + toExtension);
+ File destFile =
+ new File( srcDir,
+ filename.substring(0, filename.lastIndexOf(fromExtension)) +
+ toExtension );
+
if (replace || !destFile.exists()) {
list.put(srcFile, destFile);
} else {
- log("Rejecting file: '" + srcFile + "' for rename as replace is false and file exists", Project.MSG_VERBOSE);
+ log( "Rejecting file: '" + srcFile + "' for rename as " +
+ "replace is false and file exists", Project.MSG_VERBOSE );
}
} else {
- log("File '"+ filename + "' doesn't match fromExtension: '" + fromExtension + "'", Project.MSG_VERBOSE);
+ log( "File '"+ filename + "' doesn't match fromExtension: '" +
+ fromExtension + "'", Project.MSG_VERBOSE );
}
}
return list;
}
-
}
1.3 +1311 -1301jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java
Index: AntStarTeamCheckOut.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AntStarTeamCheckOut.java 2000/08/22 15:54:16 1.2
+++ AntStarTeamCheckOut.java 2000/11/25 01:10:09 1.3
@@ -55,11 +55,11 @@
*/
package org.apache.tools.ant.taskdefs.optional.scm;
-import org.apache.tools.ant.*;
-import java.io.*;
-import java.util.*;
import com.starbase.starteam.*;
import com.starbase.util.Platform;
+import java.io.*;
+import java.util.*;
+import org.apache.tools.ant.*;
/**
* Checks out files from a specific StarTeam server, project, view, and
@@ -105,1307 +105,1317 @@
*/
public class AntStarTeamCheckOut extends org.apache.tools.ant.Task
{
+ /**
+ * By default, <CODE>force</CODE> is set to "false" through this field.
+ * If you set <CODE>force</CODE> to "true," AntStarTeamCheckOut will
+ * overwrite files in the target directory. If the target directory does
+ * not exist, the <CODE>force</CODE> setting does nothing. Note that
+ * <CODE>DEFAULT_FORCESETTING</CODE> and <CODE>force</CODE> are strings,
+ * not boolean values. See the links below for more information.
+ *
+ * @see #getForce()
+ * @see #getForceAsBoolean()
+ * @see #setForce(String force)
+ */
+ static public final String DEFAULT_FORCESETTING = "false";
+
+ /**
+ * This field is used in setting <CODE>verbose</CODE> to "false", the
+ * default. If <CODE>verbose</CODE> is true, AntStarTeamCheckOut will
+ * display file and directory names as it checks files out. The default
+ * setting displays only a total. Note that
+ * <CODE>DEFAULT_VERBOSESETTING</CODE> and <CODE>verbose</CODE> are
+ * strings, not boolean values. See the links below for more
+ * information.
+ *
+ * @see #getVerbose()
+ * @see #getVerboseAsBoolean()
+ * @see #setVerbose(String verbose)
+ */
+ static public final String DEFAULT_VERBOSESETTING = "false";
+
+ /**
+ * <CODE>DEFAULT_RECURSIONSETTING</CODE> contains the normal setting --
+ * true -- for recursion. Thus, if you do not
+ * <CODE>setRecursion("false")</CODE> somewhere in your program,
+ * AntStarTeamCheckOut will check files out from all subfolders as well
+ * as from the given folder.
+ *
+ * @see #getRecursion()
+ * @see #setRecursion(String recursion)
+ */
+ static public final String DEFAULT_RECURSIONSETTING = "true";
+
+ /**
+ * 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)
+ */
+ static public final 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)
+ */
+ static public final String DEFAULT_EXCLUDESETTING = null;
+
+ /**
+ * The default folder to search; the root folder. Since
+ * AntStarTeamCheckOut searches subfolders, by default it processes an
+ * entire view.
+ *
+ * @see #getFolderName()
+ * @see #setFolderName(String folderName)
+ */
+ static public final String DEFAULT_FOLDERSETTING = null;
+
+ /**
+ * This is used when formatting the output. The directory name is
+ * displayed only when it changes.
+ */
+ private Folder prevFolder = null;
+
+ /**
+ * This field keeps count of the number of files checked out.
+ */
+ private int checkedOut;
+
+ // Change these through their GET and SET methods.
+
+ /**
+ * The name of the server you wish to connect to.
+ */
+ private String serverName = null;
+
+ /**
+ * The port on the server used for StarTeam.
+ */
+ private String serverPort = null;
+
+ /**
+ * The name of your project.
+ */
+ private String projectName = null;
+
+ /**
+ * The name of the folder you want to check out files from. All
+ * subfolders will be searched, as well.
+ */
+ private String folderName = DEFAULT_FOLDERSETTING;
+
+ /**
+ * The view that the files you want are in.
+ */
+ private String viewName = null;
+
+ /**
+ * Your username on the StarTeam server.
+ */
+ private String username = null;
+
+ /**
+ * Your StarTeam password.
+ */
+ private String password = null;
+
+ /**
+ * The path to the root folder you want to check out to. This is a local
+ * directory.
+ */
+ private String targetFolder = null;
+
+ /**
+ * If force set to true, AntStarTeamCheckOut will overwrite files in the
+ * target directory.
+ */
+ private String force = DEFAULT_FORCESETTING;
+
+ /**
+ * When verbose is true, the program will display all files and
+ * directories as they are checked out.
+ */
+ private String verbose = DEFAULT_VERBOSESETTING;
+
+ /**
+ * Set recursion to false to check out files in only the given folder
+ * and not in its subfolders.
+ */
+ private String recursion = DEFAULT_RECURSIONSETTING;
+
+ // These fields deal with includes and excludes
+
+ /**
+ * 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;
+
+ /**
+ * The file delimitor on the user's system.
+ */
+ private String delim = Platform.getFilePathDelim();
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException
+ */
+ public void execute() throws BuildException
+ {
+ // Check all of the properties that are required.
+ if ( getServerName() == null )
+ {
+ project.log("ServerName must not be null.");
+ return;
+ }
+ if ( getServerPort() == null )
+ {
+ project.log("ServerPort must not be null.");
+ return;
+ }
+ if ( getProjectName() == null )
+ {
+ project.log("ProjectName must not be null.");
+ return;
+ }
+ if ( getViewName() == null )
+ {
+ project.log("ViewName must not be null.");
+ return;
+ }
+ if ( getUsername() == null )
+ {
+ project.log("Username must not be null.");
+ return;
+ }
+ if ( getPassword() == null )
+ {
+ project.log("Password must not be null.");
+ return;
+ }
+ if ( getTargetFolder() == null )
+ {
+ project.log("TargetFolder must not be null.");
+ return;
+ }
+
+ // Because of the way I create the full target path, there
+ // must be NO slash at the end of targetFolder and folderName
+ // However, if the slash or backslash is the only character, leave it alone
+ if (null != getTargetFolder())
+ {
+ if ((getTargetFolder().endsWith("/") ||
+ getTargetFolder().endsWith("\\")) && getTargetFolder().length() > 1)
+ {
+ setTargetFolder(getTargetFolder().substring(0, getTargetFolder().length() - 1));
+ }
+ }
+
+ if ( null != getFolderName() )
+ {
+ if ((getFolderName().endsWith("/") ||
+ getFolderName().endsWith("\\")) && getFolderName().length() > 1)
+ {
+ setFolderName(getFolderName().substring(0, getFolderName().length() - 1));
+ }
+ }
+
+ // Check to see if the target directory exists.
+ java.io.File dirExist = new java.io.File(getTargetFolder());
+ if (dirExist.isDirectory() && !getForceAsBoolean())
+ {
+ project.log( "Target directory exists. Set \"force\" to \"true\" " +
+ "to continue anyway." );
+ return;
+ }
+
+ try
+ {
+ // Connect to the StarTeam server, and log on.
+ Server s = getServer();
+
+ // Search the items on this server.
+ runServer(s);
+
+ // Disconnect from the server.
+ s.disconnect();
+
+ // after you are all of the properties are ok, do your thing
+ // with StarTeam. If there are any kind of exceptions then
+ // send the message to the project log.
+
+ // Tell how many files were checked out.
+ project.log(checkedOut + " files checked out.");
+ }
+ catch (Throwable e)
+ {
+ project.log(" " + e.getMessage());
+ }
+ }
+
+ /**
+ * Creates and logs in to a StarTeam server.
+ *
+ * @return A StarTeam server.
+ */
+ protected Server getServer()
+ {
+ // Simplest constructor, uses default encryption algorithm and compression level.
+ Server s = new Server(getServerName(), getServerPortAsInt());
+
+ // Optional; logOn() connects if necessary.
+ s.connect();
+
+ // Logon using specified user name and password.
+ s.logOn(getUsername(), getPassword());
+
+ return s;
+ }
+
+ /**
+ * Searches for the specified project on the server.
+ *
+ * @param s A StarTeam server.
+ */
+ protected void runServer(Server s)
+ {
+ com.starbase.starteam.Project[] projects = s.getProjects();
+ for (int i = 0; i < projects.length; i++)
+ {
+ com.starbase.starteam.Project p = projects[i];
+
+ if (p.getName().equals(getProjectName()))
+ {
+ if (getVerboseAsBoolean())
+ {
+ project.log("Found " + getProjectName() + delim);
+ }
+ runProject(s, p);
+ break;
+ }
+ }
+ }
+
+ /**
+ * Searches for the given view in the project.
+ *
+ * @param s A StarTeam server.
+ * @param p A valid project on the given server.
+ */
+ protected void runProject(Server s, com.starbase.starteam.Project p)
+ {
+ View[] views = p.getViews();
+ for (int i = 0; i < views.length; i++)
+ {
+ View v = views[i];
+ if (v.getName().equals(getViewName()))
+ {
+ if (getVerboseAsBoolean())
+ {
+ project.log("Found " + getProjectName() + delim + getViewName() + delim);
+ }
+ runType(s, p, v, s.typeForName((String)s.getTypeNames().FILE));
+ break;
+ }
+ }
+ }
+
+ /**
+ * Searches for folders in the given view.
+ *
+ * @param s A StarTeam server.
+ * @param p A valid project on the server.
+ * @param v A view name from the specified project.
+ * @param t An item type which is currently always "file".
+ */
+ protected void runType(Server s, com.starbase.starteam.Project p, View v, Type t)
+ {
+ // This is ugly; checking for the root folder.
+ Folder f = v.getRootFolder();
+ if (!(getFolderName()==null))
+ {
+ if (getFolderName().equals("\\") || getFolderName().equals("/"))
+ {
+ setFolderName(null);
+ }
+ else
+ {
+ f = StarTeamFinder.findFolder(v.getRootFolder(), getFolderName());
+ }
+ }
+
+ if (getVerboseAsBoolean() && !(getFolderName()==null))
+ {
+ project.log( "Found " + getProjectName() + delim + getViewName() +
+ delim + getFolderName() + delim + "\n" );
+ }
+
+ // For performance reasons, it is important to pre-fetch all the
+ // properties we'll need for all the items we'll be searching.
+
+ // We always display the ItemID (OBJECT_ID) and primary descriptor.
+ int nProperties = 2;
+
+ // We'll need this item type's primary descriptor.
+ Property p1 = getPrimaryDescriptor(t);
+
+ // Does this item type have a secondary descriptor?
+ // If so, we'll need it.
+ Property p2 = getSecondaryDescriptor(t);
+ if (p2 != null)
+ {
+ nProperties++;
+ }
+
+ // Now, build an array of the property names.
+ String[] strNames = new String[nProperties];
+ int iProperty = 0;
+ strNames[iProperty++] = s.getPropertyNames().OBJECT_ID;
+ strNames[iProperty++] = p1.getName();
+ if (p2 != null)
+ {
+ strNames[iProperty++] = p2.getName();
+ }
+
+ // Pre-fetch the item properties and cache them.
+ f.populateNow(t.getName(), strNames, -1);
+
+ // Now, search for items in the selected folder.
+ runFolder(s, p, v, t, f);
+
+ // Free up the memory used by the cached items.
+ f.discardItems(t.getName(), -1);
+ }
+
+ /**
+ * Searches for files in the given folder. This method is recursive and
+ * thus searches all subfolders.
+ *
+ * @param s A StarTeam server.
+ * @param p A valid project on the server.
+ * @param v A view name from the specified project.
+ * @param t An item type which is currently always "file".
+ * @param f The folder to search.
+ */
+ protected void runFolder( Server s,
+ com.starbase.starteam.Project p,
+ View v,
+ Type t,
+ Folder f )
+ {
+ // Process all items in this folder.
+ Item[] items = f.getItems(t.getName());
+ for (int i = 0; i < items.length; i++)
+ {
+ runItem(s, p, v, t, f, items[i]);
+ }
+
+ // Process all subfolders recursively if recursion is on.
+ if (getRecursionAsBoolean())
+ {
+ Folder[] subfolders = f.getSubFolders();
+ for (int i = 0; i < subfolders.length; i++)
+ {
+ runFolder(s, p, v, t, subfolders[i]);
+ }
+ }
+ }
+
+ /**
+ * Check out one file if it matches the include filter but not the
+ * exclude filter.
+ *
+ * @param s A StarTeam server.
+ * @param p A valid project on the server.
+ * @param v A view name from the specified project.
+ * @param t An item type which is currently always "file".
+ * @param f The folder the file is localed in.
+ * @param item The file to check out.
+ */
+ protected void runItem( Server s,
+ com.starbase.starteam.Project p,
+ View v,
+ Type t,
+ Folder f,
+ Item item )
+ {
+ // Get descriptors for this item type.
+ Property p1 = getPrimaryDescriptor(t);
+ Property p2 = getSecondaryDescriptor(t);
+
+ // Time to filter...
+ String pName = (String)item.get(p1.getName());
+ boolean includeIt = false;
+ boolean excludeIt = false;
+
+ // See if it fits any includes.
+ if (getIncludes()!=null)
+ {
+ StringTokenizer inStr = new StringTokenizer(getIncludes(), " ");
+ while (inStr.hasMoreTokens())
+ {
+ if (match(inStr.nextToken(), pName))
+ {
+ includeIt = true;
+ }
+ }
+ }
+
+ // See if it fits any excludes.
+ if (getExcludes()!=null)
+ {
+ StringTokenizer exStr = new StringTokenizer(getExcludes(), " ");
+ while (exStr.hasMoreTokens())
+ {
+ if (match(exStr.nextToken(), pName))
+ {
+ excludeIt = true;
+ }
+ }
+ }
- /**
- * By default, <CODE>force</CODE> is set to "false" through this field.
- * If you set <CODE>force</CODE> to "true," AntStarTeamCheckOut will
- * overwrite files in the target directory. If the target directory does
- * not exist, the <CODE>force</CODE> setting does nothing. Note that
- * <CODE>DEFAULT_FORCESETTING</CODE> and <CODE>force</CODE> are strings,
- * not boolean values. See the links below for more information.
- *
- * @see #getForce()
- * @see #getForceAsBoolean()
- * @see #setForce(String force)
- */
- static public final String DEFAULT_FORCESETTING = "false";
-
- /**
- * This field is used in setting <CODE>verbose</CODE> to "false", the
- * default. If <CODE>verbose</CODE> is true, AntStarTeamCheckOut will
- * display file and directory names as it checks files out. The default
- * setting displays only a total. Note that
- * <CODE>DEFAULT_VERBOSESETTING</CODE> and <CODE>verbose</CODE> are
- * strings, not boolean values. See the links below for more
- * information.
- *
- * @see #getVerbose()
- * @see #getVerboseAsBoolean()
- * @see #setVerbose(String verbose)
- */
- static public final String DEFAULT_VERBOSESETTING = "false";
-
- /**
- * <CODE>DEFAULT_RECURSIONSETTING</CODE> contains the normal setting --
- * true -- for recursion. Thus, if you do not
- * <CODE>setRecursion("false")</CODE> somewhere in your program,
- * AntStarTeamCheckOut will check files out from all subfolders as well
- * as from the given folder.
- *
- * @see #getRecursion()
- * @see #setRecursion(String recursion)
- */
- static public final String DEFAULT_RECURSIONSETTING = "true";
-
- /**
- * 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)
- */
- static public final 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)
- */
- static public final String DEFAULT_EXCLUDESETTING = null;
-
- /**
- * The default folder to search; the root folder. Since
- * AntStarTeamCheckOut searches subfolders, by default it processes an
- * entire view.
- *
- * @see #getFolderName()
- * @see #setFolderName(String folderName)
- */
- static public final String DEFAULT_FOLDERSETTING = null;
-
-
- /**
- * This is used when formatting the output. The directory name is
- * displayed only when it changes.
- */
- private Folder prevFolder = null;
-
- /**
- * This field keeps count of the number of files checked out.
- */
- private int checkedOut;
-
- // Change these through their GET and SET methods.
-
- /**
- * The name of the server you wish to connect to.
- */
- private String serverName = null;
-
- /**
- * The port on the server used for StarTeam.
- */
- private String serverPort = null;
-
- /**
- * The name of your project.
- */
- private String projectName = null;
-
- /**
- * The name of the folder you want to check out files from. All
- * subfolders will be searched, as well.
- */
- private String folderName = DEFAULT_FOLDERSETTING;
-
- /**
- * The view that the files you want are in.
- */
- private String viewName = null;
-
- /**
- * Your username on the StarTeam server.
- */
- private String username = null;
-
- /**
- * Your StarTeam password.
- */
- private String password = null;
-
- /**
- * The path to the root folder you want to check out to. This is a local
- * directory.
- */
- private String targetFolder = null;
-
- /**
- * If force set to true, AntStarTeamCheckOut will overwrite files in the
- * target directory.
- */
- private String force = DEFAULT_FORCESETTING;
-
- /**
- * When verbose is true, the program will display all files and
- * directories as they are checked out.
- */
- private String verbose = DEFAULT_VERBOSESETTING;
-
- /**
- * Set recursion to false to check out files in only the given folder
- * and not in its subfolders.
- */
- private String recursion = DEFAULT_RECURSIONSETTING;
-
- // These fields deal with includes and excludes
-
- /**
- * 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;
-
- /**
- * The file delimitor on the user's system.
- */
- private String delim = Platform.getFilePathDelim();
-
- /**
- * Do the execution.
- *
- * @exception BuildException
- */
- public void execute() throws BuildException
- {
-
- // Check all of the properties that are required.
- if ( getServerName() == null )
- {
- project.log("ServerName must not be null.");
- return;
- }
- if ( getServerPort() == null )
- {
- project.log("ServerPort must not be null.");
- return;
- }
- if ( getProjectName() == null )
- {
- project.log("ProjectName must not be null.");
- return;
- }
- if ( getViewName() == null )
- {
- project.log("ViewName must not be null.");
- return;
- }
- if ( getUsername() == null )
- {
- project.log("Username must not be null.");
- return;
- }
- if ( getPassword() == null )
- {
- project.log("Password must not be null.");
- return;
- }
- if ( getTargetFolder() == null )
- {
- project.log("TargetFolder must not be null.");
- return;
- }
-
- // Because of the way I create the full target path, there must be NO slash at the end of targetFolder and folderName
- // However, if the slash or backslash is the only character, leave it alone
- if (!(getTargetFolder()==null))
- {
- if ((getTargetFolder().endsWith("/") || getTargetFolder().endsWith("\\")) && getTargetFolder().length() > 1)
- {
- setTargetFolder(getTargetFolder().substring(0, getTargetFolder().length() - 1));
- }
- }
-
- if (!(getFolderName()==null))
- {
- if ((getFolderName().endsWith("/") || getFolderName().endsWith("\\")) && getFolderName().length() > 1)
- {
- setFolderName(getFolderName().substring(0, getFolderName().length() - 1));
- }
- }
-
- // Check to see if the target directory exists.
- java.io.File dirExist = new java.io.File(getTargetFolder());
- if (dirExist.isDirectory() && !getForceAsBoolean())
- {
- project.log("Target directory exists. Set \"force\" to \"true\" to continue anyway.");
- return;
- }
-
- try
- {
- // Connect to the StarTeam server, and log on.
- Server s = getServer();
-
- // Search the items on this server.
- runServer(s);
-
- // Disconnect from the server.
- s.disconnect();
-
- // after you are all of the properties are ok, do your thing
- // with StarTeam. If there are any kind of exceptions then
- // send the message to the project log.
-
- // Tell how many files were checked out.
- project.log(checkedOut + " files checked out.");
- }
- catch (Throwable e)
- {
- project.log(" " + e.getMessage());
- }
- }
-
- /**
- * Creates and logs in to a StarTeam server.
- *
- * @return A StarTeam server.
- */
- protected Server getServer()
- {
- // Simplest constructor, uses default encryption algorithm and compression level.
- Server s = new Server(getServerName(), getServerPortAsInt());
-
- // Optional; logOn() connects if necessary.
- s.connect();
-
- // Logon using specified user name and password.
- s.logOn(getUsername(), getPassword());
-
- return s;
- }
-
- /**
- * Searches for the specified project on the server.
- *
- * @param s A StarTeam server.
- */
- protected void runServer(Server s)
- {
-
- com.starbase.starteam.Project[] projects = s.getProjects();
- for (int i = 0; i < projects.length; i++)
- {
- com.starbase.starteam.Project p = projects[i];
-
- if (p.getName().equals(getProjectName()))
- {
- if (getVerboseAsBoolean())
- {
- project.log("Found " + getProjectName() + delim);
- }
- runProject(s, p);
- break;
- }
- }
- }
-
- /**
- * Searches for the given view in the project.
- *
- * @param s A StarTeam server.
- * @param p A valid project on the given server.
- */
- protected void runProject(Server s, com.starbase.starteam.Project p)
- {
- View[] views = p.getViews();
- for (int i = 0; i < views.length; i++)
- {
- View v = views[i];
- if (v.getName().equals(getViewName()))
- {
- if (getVerboseAsBoolean())
- {
- project.log("Found " + getProjectName() + delim + getViewName() + delim);
- }
- runType(s, p, v, s.typeForName((String)s.getTypeNames().FILE));
- break;
- }
- }
- }
-
- /**
- * Searches for folders in the given view.
- *
- * @param s A StarTeam server.
- * @param p A valid project on the server.
- * @param v A view name from the specified project.
- * @param t An item type which is currently always "file".
- */
- protected void runType(Server s, com.starbase.starteam.Project p, View v, Type t)
- {
-
- // This is ugly; checking for the root folder.
- Folder f = v.getRootFolder();
- if (!(getFolderName()==null))
- {
- if (getFolderName().equals("\\") || getFolderName().equals("/"))
- {
- setFolderName(null);
- }
- else
- {
- f = StarTeamFinder.findFolder(v.getRootFolder(), getFolderName());
- }
- }
-
- if (getVerboseAsBoolean() && !(getFolderName()==null))
- {
- project.log("Found " + getProjectName() + delim + getViewName() + delim + getFolderName() + delim + "\n");
- }
-
- // For performance reasons, it is important to pre-fetch all the
- // properties we'll need for all the items we'll be searching.
-
- // We always display the ItemID (OBJECT_ID) and primary descriptor.
- int nProperties = 2;
-
- // We'll need this item type's primary descriptor.
- Property p1 = getPrimaryDescriptor(t);
-
- // Does this item type have a secondary descriptor?
- // If so, we'll need it.
- Property p2 = getSecondaryDescriptor(t);
- if (p2 != null)
- {
- nProperties++;
- }
-
- // Now, build an array of the property names.
- String[] strNames = new String[nProperties];
- int iProperty = 0;
- strNames[iProperty++] = s.getPropertyNames().OBJECT_ID;
- strNames[iProperty++] = p1.getName();
- if (p2 != null)
- {
- strNames[iProperty++] = p2.getName();
- }
-
- // Pre-fetch the item properties and cache them.
- f.populateNow(t.getName(), strNames, -1);
-
- // Now, search for items in the selected folder.
- runFolder(s, p, v, t, f);
-
- // Free up the memory used by the cached items.
- f.discardItems(t.getName(), -1);
- }
-
- /**
- * Searches for files in the given folder. This method is recursive and
- * thus searches all subfolders.
- *
- * @param s A StarTeam server.
- * @param p A valid project on the server.
- * @param v A view name from the specified project.
- * @param t An item type which is currently always "file".
- * @param f The folder to search.
- */
- protected void runFolder(Server s, com.starbase.starteam.Project p, View v, Type t, Folder f)
- {
-
- // Process all items in this folder.
- Item[] items = f.getItems(t.getName());
- for (int i = 0; i < items.length; i++)
- {
- runItem(s, p, v, t, f, items[i]);
- }
-
- // Process all subfolders recursively if recursion is on.
- if (getRecursionAsBoolean())
- {
- Folder[] subfolders = f.getSubFolders();
- for (int i = 0; i < subfolders.length; i++)
- {
- runFolder(s, p, v, t, subfolders[i]);
- }
- }
- }
-
- /**
- * Check out one file if it matches the include filter but not the
- * exclude filter.
- *
- * @param s A StarTeam server.
- * @param p A valid project on the server.
- * @param v A view name from the specified project.
- * @param t An item type which is currently always "file".
- * @param f The folder the file is localed in.
- * @param item The file to check out.
- */
- protected void runItem(Server s, com.starbase.starteam.Project p, View v, Type t, Folder f, Item item)
- {
-
- // Get descriptors for this item type.
- Property p1 = getPrimaryDescriptor(t);
- Property p2 = getSecondaryDescriptor(t);
-
- // Time to filter...
- String pName = (String)item.get(p1.getName());
- boolean includeIt = false;
- boolean excludeIt = false;
-
- // See if it fits any includes.
- if (getIncludes()!=null)
- {
- StringTokenizer inStr = new StringTokenizer(getIncludes(), " ");
- while (inStr.hasMoreTokens())
- {
- if (match(inStr.nextToken(), pName))
- {
- includeIt = true;
- }
- }
- }
-
- // See if it fits any excludes.
- if (getExcludes()!=null)
- {
- StringTokenizer exStr = new StringTokenizer(getExcludes(), " ");
- while (exStr.hasMoreTokens())
- {
- if (match(exStr.nextToken(), pName))
- {
- excludeIt = true;
- }
- }
- }
-
- // Don't check it out if
- // (a) It fits no include filters
- // (b) It fits an exclude filter
- if (!includeIt | excludeIt)
- {
- return;
- }
-
- // VERBOSE MODE ONLY
- if (getVerboseAsBoolean())
- {
- // Show folder only if changed.
- boolean bShowHeader = true;
- if (f != prevFolder)
- {
- // We want to display the folder the same way you would
- // enter it on the command line ... so we remove the
- // View name (which is also the name of the root folder,
- // and therefore shows up at the start of the path).
- String strFolder = f.getFolderHierarchy();
- int i = strFolder.indexOf(delim);
- if (i >= 0)
- {
- strFolder = strFolder.substring(i+1);
- }
- System.out.println(" Folder: \"" + strFolder + "\"");
- prevFolder = f;
- }
- else
- bShowHeader = false;
-
- // If we displayed the project, view, item type, or folder,
- // then show the list of relevant item properties.
- if (bShowHeader)
- {
- System.out.print(" Item");
- System.out.print(",\t" + p1.getDisplayName());
- if (p2 != null)
- {
- System.out.print(",\t" + p2.getDisplayName());
- }
- System.out.println("");
- }
-
- // Finally, show the Item properties ...
-
- // Always show the ItemID.
- System.out.print(" " + item.getItemID());
-
- // Show the primary descriptor.
- // There should always be one.
- System.out.print(",\t" + formatForDisplay(p1, item.get(p1.getName())));
-
- // Show the secondary descriptor, if there is one.
- // Some item types have one, some don't.
- if (p2 != null)
- {
- System.out.print(",\t" + formatForDisplay(p2, item.get(p2.getName())));
- }
-
- // Show if the file is locked.
- int locker = item.getLocker();
- if (locker>-1)
- {
- System.out.println(",\tLocked by " + locker);
- }
- else
- {
- System.out.println(",\tNot locked");
- }
- }
- // END VERBOSE ONLY
-
- // Check it out; also ugly.
-
- // Change the item to be checked out to a StarTeam File.
- com.starbase.starteam.File remote = (com.starbase.starteam.File)item;
-
- // Create a variable dirName that contains the name of the StarTeam folder that is the root folder in this view.
- // Get the default path to the current view.
- String dirName = v.getDefaultPath();
- // Settle on "/" as the default path separator for this purpose only.
- dirName = dirName.replace('\\', '/');
- // Take the StarTeam folder name furthest down in the hierarchy.
- int endDirIndex = dirName.length();
- // If it ends with separator then strip it off
- if (dirName.endsWith("/"))
+ // Don't check it out if
+ // (a) It fits no include filters
+ // (b) It fits an exclude filter
+ if (!includeIt | excludeIt)
+ {
+ return;
+ }
+
+ // VERBOSE MODE ONLY
+ if (getVerboseAsBoolean())
+ {
+ // Show folder only if changed.
+ boolean bShowHeader = true;
+ if (f != prevFolder)
+ {
+ // We want to display the folder the same way you would
+ // enter it on the command line ... so we remove the
+ // View name (which is also the name of the root folder,
+ // and therefore shows up at the start of the path).
+ String strFolder = f.getFolderHierarchy();
+ int i = strFolder.indexOf(delim);
+ if (i >= 0)
{
- // This should be the SunOS and Linux case
- endDirIndex--;
+ strFolder = strFolder.substring(i+1);
}
- dirName = dirName.substring(dirName.lastIndexOf("/", dirName.length() - 2) + 1, endDirIndex);
+ System.out.println(" Folder: \"" + strFolder + "\"");
+ prevFolder = f;
+ }
+ else
+ bShowHeader = false;
+
+ // If we displayed the project, view, item type, or folder,
+ // then show the list of relevant item properties.
+ if (bShowHeader)
+ {
+ System.out.print(" Item");
+ System.out.print(",\t" + p1.getDisplayName());
+ if (p2 != null)
+ {
+ System.out.print(",\t" + p2.getDisplayName());
+ }
+ System.out.println("");
+ }
+
+ // Finally, show the Item properties ...
+
+ // Always show the ItemID.
+ System.out.print(" " + item.getItemID());
+
+ // Show the primary descriptor.
+ // There should always be one.
+ System.out.print(",\t" + formatForDisplay(p1, item.get(p1.getName())));
+
+ // Show the secondary descriptor, if there is one.
+ // Some item types have one, some don't.
+ if (p2 != null)
+ {
+ System.out.print(",\t" + formatForDisplay(p2, item.get(p2.getName())));
+ }
+
+ // Show if the file is locked.
+ int locker = item.getLocker();
+ if (locker>-1)
+ {
+ System.out.println(",\tLocked by " + locker);
+ }
+ else
+ {
+ System.out.println(",\tNot locked");
+ }
+ }
+ // END VERBOSE ONLY
+
+ // Check it out; also ugly.
+
+ // Change the item to be checked out to a StarTeam File.
+ com.starbase.starteam.File remote = (com.starbase.starteam.File)item;
+
+ // Create a variable dirName that contains the name of
+ //the StarTeam folder that is the root folder in this view.
+ // Get the default path to the current view.
+ String dirName = v.getDefaultPath();
+ // Settle on "/" as the default path separator for this purpose only.
+ dirName = dirName.replace('\\', '/');
+ // Take the StarTeam folder name furthest down in the hierarchy.
+ int endDirIndex = dirName.length();
+ // If it ends with separator then strip it off
+ if (dirName.endsWith("/"))
+ {
+ // This should be the SunOS and Linux case
+ endDirIndex--;
+ }
+ dirName =
+ dirName.substring(dirName.lastIndexOf("/", dirName.length() - 2) + 1, endDirIndex);
- // Replace the projectName in the file's absolute path to the viewName.
- // This eventually makes the target of a checkout operation equal to:
- // targetFolder + dirName + [subfolders] + itemName
- StringTokenizer pathTokenizer = new StringTokenizer(item.getParentFolder().getFolderHierarchy(), delim);
- String localName = delim;
- String currentToken = null;
- while (pathTokenizer.hasMoreTokens())
- {
- currentToken = pathTokenizer.nextToken();
- if (currentToken.equals(getProjectName()))
- {
- currentToken = dirName;
- }
- localName += currentToken + delim;
- }
- // Create a reference to the local target file using the format listed above.
- java.io.File local = new java.io.File(getTargetFolder() + localName + item.get(p1.getName()));
- try
- {
- remote.checkoutTo(local, Item.LockType.UNCHANGED, false, true, true);
- }
- catch (Throwable e)
- {
- project.log(" " + e.getMessage());
- }
- checkedOut++;
- }
-
- /**
- * Get the primary descriptor of the given item type.
- * Returns null if there isn't one.
- * In practice, all item types have a primary descriptor.
- *
- * @param t An item type. At this point it will always be "file".
- * @return The specified item's primary descriptor.
- */
- protected Property getPrimaryDescriptor(Type t)
- {
- Property[] properties = t.getProperties();
- for (int i = 0; i < properties.length; i++)
- {
- Property p = properties[i];
- if (p.isPrimaryDescriptor())
- {
- return p;
- }
- }
- return null;
- }
-
- /**
- * Get the secondary descriptor of the given item type.
- * Returns null if there isn't one.
- *
- * @param t An item type. At this point it will always be "file".
- * @return The specified item's secondary descriptor. There may not be
- * one for every file.
- */
- protected Property getSecondaryDescriptor(Type t)
- {
- Property[] properties = t.getProperties();
- for (int i = 0; i < properties.length; i++)
- {
- Property p = properties[i];
- if (p.isDescriptor() && !p.isPrimaryDescriptor())
- {
- return p;
- }
- }
- return null;
- }
-
- /**
- * Formats a property value for display to the user.
- *
- * @param p An item property to format.
- * @param value
- * @return A string containing the property, which is truncated to 35
- * characters for display.
- */
- protected String formatForDisplay(Property p, Object value)
- {
- if (p.getTypeCode() == Property.Types.TEXT)
- {
- String str = value.toString();
- if (str.length() > 35)
- {
- str = str.substring(0, 32) + "...";
- }
- return "\"" + str + "\"";
- }
- else
- {
- if (p.getTypeCode() == Property.Types.ENUMERATED)
- {
- return "\"" + p.getEnumDisplayName(((Integer)value).intValue()) + "\"";
- }
- else
- {
- return value.toString();
- }
- }
- }
-
- // TORN STRAIGHT FROM ANT.DIRECTORYSCANNER
-
- /**
- * <B>TORN STRAIGHT FROM ANT.DIRECTORYSCANNER</B>
- *
- * 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.
- *
- * @param pattern the (non-null) pattern to match against
- * @param str the (non-null) string that must be matched against the
- * pattern
- * @return <code>true</code> when the string matches against the
- * pattern, <code>false</code> otherwise.
- */
- private static boolean match(String pattern, String str)
- {
- char[] patArr = pattern.toCharArray();
- char[] strArr = str.toCharArray();
- int patIdxStart = 0;
- int patIdxEnd = patArr.length-1;
- int strIdxStart = 0;
- int strIdxEnd = strArr.length-1;
- char ch;
-
- boolean containsStar = false;
- for (int i = 0; i < patArr.length; i++)
- {
- if (patArr[i] == '*')
- {
- containsStar = true;
- break;
- }
- }
-
- if (!containsStar)
- {
- // No '*'s, so we make a shortcut
- if (patIdxEnd != strIdxEnd)
- {
- return false; // Pattern and string do not have the same size
- }
- for (int i = 0; i <= patIdxEnd; i++)
- {
- ch = patArr[i];
- if (ch != '?' && ch != strArr[i])
- {
- return false; // Character mismatch
- }
- }
- return true; // String matches against pattern
- }
-
- if (patIdxEnd == 0)
- {
- return true; // Pattern contains only '*', which matches anything
- }
-
- // Process characters before first star
- while ((ch = patArr[patIdxStart]) != '*' && strIdxStart <= strIdxEnd)
- {
- if (ch != '?' && ch != strArr[strIdxStart])
- {
- return false;
- }
- patIdxStart++;
- strIdxStart++;
- }
- if (strIdxStart > strIdxEnd)
- {
- // All characters in the string are used. Check if only '*'s are
- // left in the pattern. If so, we succeeded. Otherwise failure.
- for (int i = patIdxStart; i <= patIdxEnd; i++)
- {
- if (patArr[i] != '*')
- {
- return false;
- }
- }
- return true;
- }
-
- // Process characters after last star
- while ((ch = patArr[patIdxEnd]) != '*' && strIdxStart <= strIdxEnd)
- {
- if (ch != '?' && ch != strArr[strIdxEnd])
- {
- return false;
- }
- patIdxEnd--;
- strIdxEnd--;
- }
- if (strIdxStart > strIdxEnd)
- {
- // All characters in the string are used. Check if only '*'s are
- // left in the pattern. If so, we succeeded. Otherwise failure.
- for (int i = patIdxStart; i <= patIdxEnd; i++)
- {
- if (patArr[i] != '*')
- {
- return false;
- }
- }
- return true;
- }
-
- // process pattern between stars. padIdxStart and patIdxEnd point
- // always to a '*'.
- while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd)
- {
- int patIdxTmp = -1;
- for (int i = patIdxStart+1; i <= patIdxEnd; i++)
- {
- if (patArr[i] == '*')
- {
- patIdxTmp = i;
- break;
- }
- }
- if (patIdxTmp == patIdxStart+1)
- {
- // Two stars next to each other, skip the first one.
- patIdxStart++;
- continue;
- }
- // Find the pattern between padIdxStart & padIdxTmp in str between
- // strIdxStart & strIdxEnd
- int patLength = (patIdxTmp-patIdxStart-1);
- int strLength = (strIdxEnd-strIdxStart+1);
- int foundIdx = -1;
- strLoop:
- for (int i = 0; i <= strLength - patLength; i++)
- {
- for (int j = 0; j < patLength; j++)
- {
- ch = patArr[patIdxStart+j+1];
- if (ch != '?' && ch != strArr[strIdxStart+i+j])
- {
- continue strLoop;
- }
- }
-
- foundIdx = strIdxStart+i;
- break;
- }
-
- if (foundIdx == -1)
- {
- return false;
- }
-
- patIdxStart = patIdxTmp;
- strIdxStart = foundIdx+patLength;
- }
-
- // All characters in the string are used. Check if only '*'s are left
- // in the pattern. If so, we succeeded. Otherwise failure.
- for (int i = patIdxStart; i <= patIdxEnd; i++)
- {
- if (patArr[i] != '*')
- {
- return false;
- }
- }
- return true;
- }
-
- // Begin SET and GET methods
-
- /**
- * Sets the <CODE>serverName</CODE> attribute to the given value.
- *
- * @param serverName The name of the server you wish to connect to.
- * @see #getServerName()
- */
- public void setServerName(String serverName)
- {
- this.serverName = serverName;
- }
-
- /**
- * Gets the <CODE>serverName</CODE> attribute.
- *
- * @return The StarTeam server to log in to.
- * @see #setServerName(String serverName)
- */
- public String getServerName()
- {
- return serverName;
- }
-
- /**
- * Sets the <CODE>serverPort</CODE> attribute to the given value. The
- * given value must be a valid integer, but it must be a string object.
- *
- * @param serverPort A string containing the port on the StarTeam server
- * to use.
- * @see #getServerPort()
- */
- public void setServerPort(String serverPort)
- {
- this.serverPort = serverPort;
- }
-
- /**
- * Gets the <CODE>serverPort</CODE> attribute.
- *
- * @return A string containing the port on the StarTeam server to use.
- * @see #getServerPortAsInt()
- * @see #setServerPort(String serverPort)
- */
- public String getServerPort()
- {
- return serverPort;
- }
-
- /**
- * Gets the <CODE>serverPort</CODE> attribute as an integer.
- *
- * @return An integer value for the port on the StarTeam server to use.
- * @see #getServerPort()
- * @see #setServerPort(String serverPort)
- */
- public int getServerPortAsInt()
- {
- return Integer.parseInt(serverPort);
- }
-
- /**
- * Sets the <CODE>projectName</CODE> attribute to the given value.
- *
- * @param projectName
- * The StarTeam project to search.
- * @see #getProjectName()
- */
- public void setProjectName(String projectName)
- {
- this.projectName = projectName;
- }
-
- /**
- * Gets the <CODE>projectName</CODE> attribute.
- *
- * @return The StarTeam project to search.
- * @see #setProjectName(String projectName)
- */
- public String getProjectName()
- {
- return projectName;
- }
-
- /**
- * Sets the <CODE>viewName</CODE> attribute to the given value.
- *
- * @param viewName The view to find the specified folder in.
- * @see #getViewName()
- */
- public void setViewName(String viewName)
- {
- this.viewName = viewName;
- }
-
- /**
- * Gets the <CODE>viewName</CODE> attribute.
- *
- * @return The view to find the specified folder in.
- * @see #setViewName(String viewName)
- */
- public String getViewName()
- {
- return viewName;
- }
-
- /**
- * Sets the <CODE>folderName</CODE> attribute to the given value. To
- * search the root folder, use a slash or backslash, or simply don't set
- * a folder at all.
- *
- * @param folderName The subfolder from which to check out files.
- * @see #getFolderName()
- */
- public void setFolderName(String folderName)
- {
- this.folderName = folderName;
- }
-
- /**
- * Gets the <CODE>folderName</CODE> attribute.
- *
- * @return The subfolder from which to check out files. All subfolders
- * will be searched, as well.
- * @see #setFolderName(String folderName)
- */
- public String getFolderName()
- {
- return folderName;
- }
-
- /**
- * Sets the <CODE>username</CODE> attribute to the given value.
- *
- * @param username Your username for the specified StarTeam server.
- * @see #getUsername()
- */
- public void setUsername(String username)
- {
- this.username = username;
- }
-
- /**
- * Gets the <CODE>username</CODE> attribute.
- *
- * @return The username given by the user.
- * @see #setUsername(String username)
- */
- public String getUsername()
- {
- return username;
- }
-
- /**
- * Sets the <CODE>password</CODE> attribute to the given value.
- *
- * @param password Your password for the specified StarTeam server.
- * @see #getPassword()
- */
- public void setPassword(String password)
- {
- this.password = password;
- }
-
- /**
- * Gets the <CODE>password</CODE> attribute.
- *
- * @return The password given by the user.
- * @see #setPassword(String password)
- */
- public String getPassword()
- {
- return password;
- }
-
- /**
- * Sets the <CODE>targetFolder</CODE> attribute to the given value.
- *
- * @param target The target path on the local machine to check out to.
- * @see #getTargetFolder()
- */
- public void setTargetFolder(String targetFolder)
- {
- this.targetFolder = targetFolder;
- }
-
- /**
- * Gets the <CODE>targetFolder</CODE> attribute.
- *
- * @return The target path on the local machine to check out to.
- *
- * @see #setTargetFolder(String targetFolder)
- */
- public String getTargetFolder()
- {
- return targetFolder;
- }
-
- /**
- * Sets the <CODE>force</CODE> attribute to the given value.
- *
- * @param force A string containing "true" or "false" that tells the
- * application whether to continue if the target directory
- * exists. If <CODE>force</CODE> is true,
- * AntStarTeamCheckOut will overwrite files in the target
- * directory. By default it set to false as a safeguard.
- * Note that if the target directory does not exist, this
- * setting has no effect.
- * @see #DEFAULT_FORCESETTING
- * @see #getForce()
- * @see #getForceAsBoolean()
- */
- public void setForce(String force)
- {
- this.force = force;
- }
-
- /**
- * Gets the <CODE>force</CODE> attribute.
- *
- * @return A string containing "true" or "false" telling the application
- * whether to continue if the target directory exists. If
- * <CODE>force</CODE> is true, AntStarTeamCheckOut will
- * overwrite files in the target directory. If it is false and
- * the target directory exists, AntStarTeamCheckOut will exit
- * with a warning. If the target directory does not exist, this
- * setting has no effect. The default setting is false.
- * @see #DEFAULT_FORCESETTING
- * @see #getForceAsBoolean()
- * @see #setForce(String force)
- */
- public String getForce()
- {
- return force;
- }
-
- /**
- * Gets the <CODE>force</CODE> attribute as a boolean value.
- *
- * @return A boolean value telling whether to continue if the target
- * directory exists.
- * @see #DEFAULT_FORCESETTING
- * @see #getForce()
- * @see #setForce(String force)
- */
- public boolean getForceAsBoolean()
- {
- return project.toBoolean(force);
- }
-
- /**
- * Turns recursion on or off.
- *
- * @param verbose A string containing "true" or "false." If it is true,
- * the default, subfolders are searched recursively for
- * files to check out. Otherwise, only files specified
- * by <CODE>folderName</CODE> are scanned.
- * @see #DEFAULT_RECURSIONSETTING
- * @see #getRecursion()
- * @see #getRecursionAsBoolean()
- */
- public void setRecursion(String recursion)
- {
- this.recursion = recursion;
- }
-
- /**
- * Gets the <CODE>recursion</CODE> attribute, which tells
- * AntStarTeamCheckOut whether to search subfolders when checking out
- * files.
- *
- * @return A string telling whether <CODE>recursion</CODE> is "true" or
- * "false."
- *
- * @see #DEFAULT_RECURSIONSETTING
- * @see #getRecursionAsBoolean()
- * @see #setRecursion(String recursion)
- */
- public String getRecursion()
- {
- return recursion;
- }
-
- /**
- * Gets the <CODE>recursion</CODE> attribute as a boolean value.
- *
- * @return A boolean value telling whether subfolders of
- * <CODE>folderName</CODE> will be scanned for files to check out.
- *
- * @see #DEFAULT_RECURSIONSETTING
- * @see #getRecursion()
- * @see #setRecursion(String recursion)
- */
- public boolean getRecursionAsBoolean()
- {
- return project.toBoolean(recursion);
- }
-
- /**
- * Sets the <CODE>verbose</CODE> attribute to the given value.
- *
- * @param verbose A string containing "true" or "false" to tell
- * AntStarTeamCheckOut whether to display files as they
- * are checked out. By default it is false, so the
- * program only displays the total number of files unless
- * you override this default.
- * @see #DEFAULT_FORCESETTING
- * @see #getForce()
- * @see #getForceAsBoolean()
- */
- public void setVerbose(String verbose)
- {
- this.verbose = verbose;
- }
-
- /**
- * Gets the <CODE>verbose</CODE> attribute.
- *
- * @return A string containing "true" or "false" telling the application
- * to display all files as it checks them out. By default it is
- * false, so the program only displays the total number of
- * files.
- * @see #DEFAULT_VERBOSESETTING
- * @see #getVerboseAsBoolean()
- * @see #setVerbose(String verbose)
- */
- public String getVerbose()
- {
- return verbose;
- }
-
- /**
- * Gets the <CODE>verbose</CODE> attribute as a boolean value.
- *
- * @return A boolean value telling whether to display all files as they
- * are checked out.
- * @see #DEFAULT_VERBOSESETTING
- * @see #getVerbose()
- * @see #setVerbose(String verbose)
- */
- public boolean getVerboseAsBoolean()
- {
- return project.toBoolean(verbose);
- }
-
- // Begin filter getters and setters
-
- /**
- * Sets the include 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>
- * I would have used the Ant method directly from its class, but
- * <CODE>match</CODE> is a private member, so I cannot access it from
- * this program.
- * <BR><BR>
- * Separate multiple inlcude filters by <I>spaces</I>, not commas as Ant
- * uses. For example, if you want to check out all .java and .class\
- * files, you would put the following line in your program:
- * <CODE>setIncludes("*.java *.class");</CODE>
- * Finally, note that filters have no effect on the <B>directories</B>
- * that are scanned; you could not check out files from directories with
- * names beginning only with "build," for instance. Of course, you
- * could limit AntStarTeamCheckOut to a particular folder and its
- * subfolders with the <CODE>setFolderName(String folderName)</CODE>
- * command.
- * <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 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>
- * I would have used the Ant method directly from its class, but
- * <CODE>match</CODE> is a private member, so I cannot access it from
- * this program.
- * <BR><BR>
- * Separate multiple exlcude filters by <I>spaces</I>, not commas as Ant
- * uses. 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;
- }
+ // Replace the projectName in the file's absolute path to the viewName.
+ // This eventually makes the target of a checkout operation equal to:
+ // targetFolder + dirName + [subfolders] + itemName
+ StringTokenizer pathTokenizer =
+ new StringTokenizer(item.getParentFolder().getFolderHierarchy(), delim);
+ String localName = delim;
+ String currentToken = null;
+ while (pathTokenizer.hasMoreTokens())
+ {
+ currentToken = pathTokenizer.nextToken();
+ if (currentToken.equals(getProjectName()))
+ {
+ currentToken = dirName;
+ }
+ localName += currentToken + delim;
+ }
+ // Create a reference to the local target file using the format listed above.
+ java.io.File local = new java.io.File( getTargetFolder() + localName +
+ item.get(p1.getName()) );
+ try
+ {
+ remote.checkoutTo(local, Item.LockType.UNCHANGED, false, true, true);
+ }
+ catch (Throwable e)
+ {
+ project.log(" " + e.getMessage());
+ }
+ checkedOut++;
+ }
+
+ /**
+ * Get the primary descriptor of the given item type.
+ * Returns null if there isn't one.
+ * In practice, all item types have a primary descriptor.
+ *
+ * @param t An item type. At this point it will always be "file".
+ * @return The specified item's primary descriptor.
+ */
+ protected Property getPrimaryDescriptor(Type t)
+ {
+ Property[] properties = t.getProperties();
+ for (int i = 0; i < properties.length; i++)
+ {
+ Property p = properties[i];
+ if (p.isPrimaryDescriptor())
+ {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the secondary descriptor of the given item type.
+ * Returns null if there isn't one.
+ *
+ * @param t An item type. At this point it will always be "file".
+ * @return The specified item's secondary descriptor. There may not be
+ * one for every file.
+ */
+ protected Property getSecondaryDescriptor(Type t)
+ {
+ Property[] properties = t.getProperties();
+ for (int i = 0; i < properties.length; i++)
+ {
+ Property p = properties[i];
+ if (p.isDescriptor() && !p.isPrimaryDescriptor())
+ {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Formats a property value for display to the user.
+ *
+ * @param p An item property to format.
+ * @param value
+ * @return A string containing the property, which is truncated to 35
+ * characters for display.
+ */
+ protected String formatForDisplay(Property p, Object value)
+ {
+ if (p.getTypeCode() == Property.Types.TEXT)
+ {
+ String str = value.toString();
+ if (str.length() > 35)
+ {
+ str = str.substring(0, 32) + "...";
+ }
+ return "\"" + str + "\"";
+ }
+ else
+ {
+ if (p.getTypeCode() == Property.Types.ENUMERATED)
+ {
+ return "\"" + p.getEnumDisplayName(((Integer)value).intValue()) + "\"";
+ }
+ else
+ {
+ return value.toString();
+ }
+ }
+ }
+
+ // TORN STRAIGHT FROM ANT.DIRECTORYSCANNER
+
+ /**
+ * <B>TORN STRAIGHT FROM ANT.DIRECTORYSCANNER</B>
+ *
+ * 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.
+ *
+ * @param pattern the (non-null) pattern to match against
+ * @param str the (non-null) string that must be matched against the
+ * pattern
+ * @return <code>true</code> when the string matches against the
+ * pattern, <code>false</code> otherwise.
+ */
+ private static boolean match(String pattern, String str)
+ {
+ char[] patArr = pattern.toCharArray();
+ char[] strArr = str.toCharArray();
+ int patIdxStart = 0;
+ int patIdxEnd = patArr.length-1;
+ int strIdxStart = 0;
+ int strIdxEnd = strArr.length-1;
+ char ch;
+
+ boolean containsStar = false;
+ for (int i = 0; i < patArr.length; i++)
+ {
+ if (patArr[i] == '*')
+ {
+ containsStar = true;
+ break;
+ }
+ }
+
+ if (!containsStar)
+ {
+ // No '*'s, so we make a shortcut
+ if (patIdxEnd != strIdxEnd)
+ {
+ return false; // Pattern and string do not have the same size
+ }
+ for (int i = 0; i <= patIdxEnd; i++)
+ {
+ ch = patArr[i];
+ if (ch != '?' && ch != strArr[i])
+ {
+ return false; // Character mismatch
+ }
+ }
+ return true; // String matches against pattern
+ }
+
+ if (patIdxEnd == 0)
+ {
+ return true; // Pattern contains only '*', which matches anything
+ }
+
+ // Process characters before first star
+ while ((ch = patArr[patIdxStart]) != '*' && strIdxStart <= strIdxEnd)
+ {
+ if (ch != '?' && ch != strArr[strIdxStart])
+ {
+ return false;
+ }
+ patIdxStart++;
+ strIdxStart++;
+ }
+ if (strIdxStart > strIdxEnd)
+ {
+ // All characters in the string are used. Check if only '*'s are
+ // left in the pattern. If so, we succeeded. Otherwise failure.
+ for (int i = patIdxStart; i <= patIdxEnd; i++)
+ {
+ if (patArr[i] != '*')
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // Process characters after last star
+ while ((ch = patArr[patIdxEnd]) != '*' && strIdxStart <= strIdxEnd)
+ {
+ if (ch != '?' && ch != strArr[strIdxEnd])
+ {
+ return false;
+ }
+ patIdxEnd--;
+ strIdxEnd--;
+ }
+ if (strIdxStart > strIdxEnd)
+ {
+ // All characters in the string are used. Check if only '*'s are
+ // left in the pattern. If so, we succeeded. Otherwise failure.
+ for (int i = patIdxStart; i <= patIdxEnd; i++)
+ {
+ if (patArr[i] != '*')
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // process pattern between stars. padIdxStart and patIdxEnd point
+ // always to a '*'.
+ while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd)
+ {
+ int patIdxTmp = -1;
+ for (int i = patIdxStart+1; i <= patIdxEnd; i++)
+ {
+ if (patArr[i] == '*')
+ {
+ patIdxTmp = i;
+ break;
+ }
+ }
+ if (patIdxTmp == patIdxStart+1)
+ {
+ // Two stars next to each other, skip the first one.
+ patIdxStart++;
+ continue;
+ }
+ // Find the pattern between padIdxStart & padIdxTmp in str between
+ // strIdxStart & strIdxEnd
+ int patLength = (patIdxTmp-patIdxStart-1);
+ int strLength = (strIdxEnd-strIdxStart+1);
+ int foundIdx = -1;
+ strLoop:
+ for (int i = 0; i <= strLength - patLength; i++)
+ {
+ for (int j = 0; j < patLength; j++)
+ {
+ ch = patArr[patIdxStart+j+1];
+ if (ch != '?' && ch != strArr[strIdxStart+i+j])
+ {
+ continue strLoop;
+ }
+ }
+ foundIdx = strIdxStart+i;
+ break;
+ }
+
+ if (foundIdx == -1)
+ {
+ return false;
+ }
+
+ patIdxStart = patIdxTmp;
+ strIdxStart = foundIdx+patLength;
+ }
+
+ // All characters in the string are used. Check if only '*'s are left
+ // in the pattern. If so, we succeeded. Otherwise failure.
+ for (int i = patIdxStart; i <= patIdxEnd; i++)
+ {
+ if (patArr[i] != '*')
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // Begin SET and GET methods
+
+ /**
+ * Sets the <CODE>serverName</CODE> attribute to the given value.
+ *
+ * @param serverName The name of the server you wish to connect to.
+ * @see #getServerName()
+ */
+ public void setServerName(String serverName)
+ {
+ this.serverName = serverName;
+ }
+
+ /**
+ * Gets the <CODE>serverName</CODE> attribute.
+ *
+ * @return The StarTeam server to log in to.
+ * @see #setServerName(String serverName)
+ */
+ public String getServerName()
+ {
+ return serverName;
+ }
+
+ /**
+ * Sets the <CODE>serverPort</CODE> attribute to the given value. The
+ * given value must be a valid integer, but it must be a string object.
+ *
+ * @param serverPort A string containing the port on the StarTeam server
+ * to use.
+ * @see #getServerPort()
+ */
+ public void setServerPort(String serverPort)
+ {
+ this.serverPort = serverPort;
+ }
+
+ /**
+ * Gets the <CODE>serverPort</CODE> attribute.
+ *
+ * @return A string containing the port on the StarTeam server to use.
+ * @see #getServerPortAsInt()
+ * @see #setServerPort(String serverPort)
+ */
+ public String getServerPort()
+ {
+ return serverPort;
+ }
+
+ /**
+ * Gets the <CODE>serverPort</CODE> attribute as an integer.
+ *
+ * @return An integer value for the port on the StarTeam server to use.
+ * @see #getServerPort()
+ * @see #setServerPort(String serverPort)
+ */
+ public int getServerPortAsInt()
+ {
+ return Integer.parseInt(serverPort);
+ }
+
+ /**
+ * Sets the <CODE>projectName</CODE> attribute to the given value.
+ *
+ * @param projectName
+ * The StarTeam project to search.
+ * @see #getProjectName()
+ */
+ public void setProjectName(String projectName)
+ {
+ this.projectName = projectName;
+ }
+
+ /**
+ * Gets the <CODE>projectName</CODE> attribute.
+ *
+ * @return The StarTeam project to search.
+ * @see #setProjectName(String projectName)
+ */
+ public String getProjectName()
+ {
+ return projectName;
+ }
+
+ /**
+ * Sets the <CODE>viewName</CODE> attribute to the given value.
+ *
+ * @param viewName The view to find the specified folder in.
+ * @see #getViewName()
+ */
+ public void setViewName(String viewName)
+ {
+ this.viewName = viewName;
+ }
+
+ /**
+ * Gets the <CODE>viewName</CODE> attribute.
+ *
+ * @return The view to find the specified folder in.
+ * @see #setViewName(String viewName)
+ */
+ public String getViewName()
+ {
+ return viewName;
+ }
+
+ /**
+ * Sets the <CODE>folderName</CODE> attribute to the given value. To
+ * search the root folder, use a slash or backslash, or simply don't set
+ * a folder at all.
+ *
+ * @param folderName The subfolder from which to check out files.
+ * @see #getFolderName()
+ */
+ public void setFolderName(String folderName)
+ {
+ this.folderName = folderName;
+ }
+
+ /**
+ * Gets the <CODE>folderName</CODE> attribute.
+ *
+ * @return The subfolder from which to check out files. All subfolders
+ * will be searched, as well.
+ * @see #setFolderName(String folderName)
+ */
+ public String getFolderName()
+ {
+ return folderName;
+ }
+
+ /**
+ * Sets the <CODE>username</CODE> attribute to the given value.
+ *
+ * @param username Your username for the specified StarTeam server.
+ * @see #getUsername()
+ */
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ /**
+ * Gets the <CODE>username</CODE> attribute.
+ *
+ * @return The username given by the user.
+ * @see #setUsername(String username)
+ */
+ public String getUsername()
+ {
+ return username;
+ }
+
+ /**
+ * Sets the <CODE>password</CODE> attribute to the given value.
+ *
+ * @param password Your password for the specified StarTeam server.
+ * @see #getPassword()
+ */
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ /**
+ * Gets the <CODE>password</CODE> attribute.
+ *
+ * @return The password given by the user.
+ * @see #setPassword(String password)
+ */
+ public String getPassword()
+ {
+ return password;
+ }
+
+ /**
+ * Sets the <CODE>targetFolder</CODE> attribute to the given value.
+ *
+ * @param target The target path on the local machine to check out to.
+ * @see #getTargetFolder()
+ */
+ public void setTargetFolder(String targetFolder)
+ {
+ this.targetFolder = targetFolder;
+ }
+
+ /**
+ * Gets the <CODE>targetFolder</CODE> attribute.
+ *
+ * @return The target path on the local machine to check out to.
+ *
+ * @see #setTargetFolder(String targetFolder)
+ */
+ public String getTargetFolder()
+ {
+ return targetFolder;
+ }
+
+ /**
+ * Sets the <CODE>force</CODE> attribute to the given value.
+ *
+ * @param force A string containing "true" or "false" that tells the
+ * application whether to continue if the target directory
+ * exists. If <CODE>force</CODE> is true,
+ * AntStarTeamCheckOut will overwrite files in the target
+ * directory. By default it set to false as a safeguard.
+ * Note that if the target directory does not exist, this
+ * setting has no effect.
+ * @see #DEFAULT_FORCESETTING
+ * @see #getForce()
+ * @see #getForceAsBoolean()
+ */
+ public void setForce(String force)
+ {
+ this.force = force;
+ }
+
+ /**
+ * Gets the <CODE>force</CODE> attribute.
+ *
+ * @return A string containing "true" or "false" telling the application
+ * whether to continue if the target directory exists. If
+ * <CODE>force</CODE> is true, AntStarTeamCheckOut will
+ * overwrite files in the target directory. If it is false and
+ * the target directory exists, AntStarTeamCheckOut will exit
+ * with a warning. If the target directory does not exist, this
+ * setting has no effect. The default setting is false.
+ * @see #DEFAULT_FORCESETTING
+ * @see #getForceAsBoolean()
+ * @see #setForce(String force)
+ */
+ public String getForce()
+ {
+ return force;
+ }
+
+ /**
+ * Gets the <CODE>force</CODE> attribute as a boolean value.
+ *
+ * @return A boolean value telling whether to continue if the target
+ * directory exists.
+ * @see #DEFAULT_FORCESETTING
+ * @see #getForce()
+ * @see #setForce(String force)
+ */
+ public boolean getForceAsBoolean()
+ {
+ return project.toBoolean(force);
+ }
+
+ /**
+ * Turns recursion on or off.
+ *
+ * @param verbose A string containing "true" or "false." If it is true,
+ * the default, subfolders are searched recursively for
+ * files to check out. Otherwise, only files specified
+ * by <CODE>folderName</CODE> are scanned.
+ * @see #DEFAULT_RECURSIONSETTING
+ * @see #getRecursion()
+ * @see #getRecursionAsBoolean()
+ */
+ public void setRecursion(String recursion)
+ {
+ this.recursion = recursion;
+ }
+
+ /**
+ * Gets the <CODE>recursion</CODE> attribute, which tells
+ * AntStarTeamCheckOut whether to search subfolders when checking out
+ * files.
+ *
+ * @return A string telling whether <CODE>recursion</CODE> is "true" or
+ * "false."
+ *
+ * @see #DEFAULT_RECURSIONSETTING
+ * @see #getRecursionAsBoolean()
+ * @see #setRecursion(String recursion)
+ */
+ public String getRecursion()
+ {
+ return recursion;
+ }
+
+ /**
+ * Gets the <CODE>recursion</CODE> attribute as a boolean value.
+ *
+ * @return A boolean value telling whether subfolders of
+ * <CODE>folderName</CODE> will be scanned for files to check out.
+ *
+ * @see #DEFAULT_RECURSIONSETTING
+ * @see #getRecursion()
+ * @see #setRecursion(String recursion)
+ */
+ public boolean getRecursionAsBoolean()
+ {
+ return project.toBoolean(recursion);
+ }
+
+ /**
+ * Sets the <CODE>verbose</CODE> attribute to the given value.
+ *
+ * @param verbose A string containing "true" or "false" to tell
+ * AntStarTeamCheckOut whether to display files as they
+ * are checked out. By default it is false, so the
+ * program only displays the total number of files unless
+ * you override this default.
+ * @see #DEFAULT_FORCESETTING
+ * @see #getForce()
+ * @see #getForceAsBoolean()
+ */
+ public void setVerbose(String verbose)
+ {
+ this.verbose = verbose;
+ }
+
+ /**
+ * Gets the <CODE>verbose</CODE> attribute.
+ *
+ * @return A string containing "true" or "false" telling the application
+ * to display all files as it checks them out. By default it is
+ * false, so the program only displays the total number of
+ * files.
+ * @see #DEFAULT_VERBOSESETTING
+ * @see #getVerboseAsBoolean()
+ * @see #setVerbose(String verbose)
+ */
+ public String getVerbose()
+ {
+ return verbose;
+ }
+
+ /**
+ * Gets the <CODE>verbose</CODE> attribute as a boolean value.
+ *
+ * @return A boolean value telling whether to display all files as they
+ * are checked out.
+ * @see #DEFAULT_VERBOSESETTING
+ * @see #getVerbose()
+ * @see #setVerbose(String verbose)
+ */
+ public boolean getVerboseAsBoolean()
+ {
+ return project.toBoolean(verbose);
+ }
+
+ // Begin filter getters and setters
+
+ /**
+ * Sets the include 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>
+ * I would have used the Ant method directly from its class, but
+ * <CODE>match</CODE> is a private member, so I cannot access it from
+ * this program.
+ * <BR><BR>
+ * Separate multiple inlcude filters by <I>spaces</I>, not commas as Ant
+ * uses. For example, if you want to check out all .java and .class\
+ * files, you would put the following line in your program:
+ * <CODE>setIncludes("*.java *.class");</CODE>
+ * Finally, note that filters have no effect on the <B>directories</B>
+ * that are scanned; you could not check out files from directories with
+ * names beginning only with "build," for instance. Of course, you
+ * could limit AntStarTeamCheckOut to a particular folder and its
+ * subfolders with the <CODE>setFolderName(String folderName)</CODE>
+ * command.
+ * <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 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>
+ * I would have used the Ant method directly from its class, but
+ * <CODE>match</CODE> is a private member, so I cannot access it from
+ * this program.
+ * <BR><BR>
+ * Separate multiple exlcude filters by <I>spaces</I>, not commas as Ant
+ * uses. 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;
+ }
}