compatibility. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275035 13f79535-47bb-0310-9956-ffa450edef68master
@@ -150,6 +150,19 @@ the code to parse MS-DOS listings -any takers? | |||
<td valign="top" align="center">No; defaults to false.</td> | |||
</tr> | |||
</table> | |||
<h3>Parameters specified as nested elements</h3> | |||
<h4>fileset</h4> | |||
<p>The ftp task supports any number of nested <a | |||
href="../CoreTypes/fileset.html"><code><fileset></code></a> elements to specify | |||
the files to be retrieved, or deleted, or listed, or whose mode you want to change.</p> | |||
<p> | |||
<code>followsymlinks</code> defaults to <code>false</code> for remote filesets. | |||
Remote filesets are used for all actions except put. | |||
</p> | |||
<p> | |||
Remote filesets do not support selectors.<br/> | |||
</p> | |||
<h3>Sending Files</h3> | |||
<p>The easiest way to describe how to send files is with a couple of examples:</p> | |||
<pre> | |||
@@ -177,6 +177,9 @@ public class FTP | |||
* internal class allowing to read the contents of a remote file system | |||
* using the FTP protocol | |||
* used in particular for ftp get operations | |||
* differences with DirectoryScanner | |||
* "" (the root of the fileset) is never included in the included directories | |||
* followSymlinks defaults to false | |||
*/ | |||
protected class FTPDirectoryScanner extends DirectoryScanner { | |||
protected FTPClient ftp = null; | |||
@@ -189,6 +192,7 @@ public class FTP | |||
public FTPDirectoryScanner(FTPClient ftp) { | |||
super(); | |||
this.ftp = ftp; | |||
this.setFollowSymlinks(false); | |||
} | |||
@@ -215,17 +219,6 @@ public class FTP | |||
try { | |||
String cwd = ftp.printWorkingDirectory(); | |||
// register also the root directory of the fileset if it matches | |||
// include and exclude patterns | |||
if (isIncluded("")) { | |||
if (!isExcluded("")) { | |||
dirsIncluded.addElement(""); | |||
} else { | |||
dirsExcluded.addElement(""); | |||
} | |||
} else { | |||
dirsNotIncluded.addElement(""); | |||
} | |||
// always start from the current ftp working dir | |||
scandir(".", "", true); | |||
@@ -157,7 +157,7 @@ public class FTPTest extends BuildFileTest{ | |||
ds.scan(); | |||
compareFiles(ds, new String[] {"alpha/beta/beta.xml", | |||
"alpha/beta/gamma/gamma.xml"}, | |||
new String[] {"", "alpha", "alpha/beta", | |||
new String[] {"alpha", "alpha/beta", | |||
"alpha/beta/gamma"}); | |||
} | |||
} | |||
@@ -218,6 +218,7 @@ public class FTPTest extends BuildFileTest{ | |||
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||
ds.setIncludes(new String[] {"alpha/beta/gamma/"}); | |||
ds.setFollowSymlinks(true); | |||
ds.scan(); | |||
compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"}, | |||
new String[] {"alpha/beta/gamma"}); | |||
@@ -255,6 +256,7 @@ public class FTPTest extends BuildFileTest{ | |||
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||
ds.setIncludes(new String[] {"alpha/beta/gamma/"}); | |||
ds.setFollowSymlinks(true); | |||
ds.scan(); | |||
compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"}, | |||
new String[] {"alpha/beta/gamma"}); | |||
@@ -481,10 +483,9 @@ public class FTPTest extends BuildFileTest{ | |||
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||
ds.setExcludes(new String[] {"alpha/**"}); | |||
ds.setFollowSymlinks(false); | |||
ds.scan(); | |||
compareFiles(ds, new String[] {"delta/delta.xml"}, | |||
new String[] {"", "delta"}); | |||
new String[] {"delta"}); | |||
ds = myFTPTask.newScanner(ftp); | |||
if (!changeRemoteDir(remoteTmpDir)) { | |||
@@ -492,12 +493,11 @@ public class FTPTest extends BuildFileTest{ | |||
} | |||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||
ds.setExcludes(new String[] {"alpha"}); | |||
ds.setFollowSymlinks(false); | |||
ds.scan(); | |||
compareFiles(ds, new String[] {"alpha/beta/beta.xml", | |||
"alpha/beta/gamma/gamma.xml", | |||
"delta/delta.xml"}, | |||
new String[] {"", "alpha/beta", "alpha/beta/gamma", "delta"}); | |||
new String[] {"alpha/beta", "alpha/beta/gamma", "delta"}); | |||
} | |||