You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

vfs.html 20 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!-- Content Stylesheet for Site -->
  3. <!-- start the processing -->
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
  7. <meta name="author" value="Adam Murdoch">
  8. <meta name="email" value="adammurdoch@apache.org">
  9. <title>Apache Myrmidon - VFS User Guide</title>
  10. </head>
  11. <body bgcolor="#ffffff" text="#000000" link="#525D76">
  12. <table border="0" width="100%" cellspacing="0">
  13. <!-- TOP IMAGE -->
  14. <tr>
  15. <td> <td colspan="2">
  16. <a href="http://jakarta.apache.org"><img src="http://jakarta.apache.org/images/jakarta-logo.gif" align="left" border="0"/></a>
  17. </td>
  18. </td>
  19. <td valign="bottom"><div align="right"><b><font size="+3" color="#525D76">Apache Myrmidon</font></b></div></td>
  20. </tr>
  21. </table>
  22. <table border="0" width="100%" cellspacing="4">
  23. <tr><td colspan="2">
  24. <hr noshade="" size="1"/>
  25. </td></tr>
  26. <tr>
  27. <!-- LEFT SIDE NAVIGATION -->
  28. <td valign="top" nowrap="true">
  29. <p><strong>Myrmidon</strong></p>
  30. <ul>
  31. <li> <a href="./index.html">Introduction</a>
  32. </li>
  33. <li> <a href="./getinvolved.html">Get Involved</a>
  34. </li>
  35. <li> <a href="./user.html">Building Myrmidon</a>
  36. </li>
  37. <li> <a href="./todo.html">Todo List</a>
  38. </li>
  39. </ul>
  40. <p><strong>User Guide</strong></p>
  41. <ul>
  42. <li> <a href="./buildfile.html">Build file</a>
  43. </li>
  44. <li> <a href="./vfs.html">Virtual File System</a>
  45. </li>
  46. <li> <a href="./ant1compat.html">Ant1 Compatibility Layer</a>
  47. </li>
  48. <li> <a href="./differences.html">Differences to Ant1</a>
  49. </li>
  50. <li> <a href="./task.html">My First Task</a>
  51. </li>
  52. </ul>
  53. <p><strong>Extending Ant</strong></p>
  54. <ul>
  55. <li> <a href="./configuring.html">Configuration HOWTO</a>
  56. </li>
  57. <li> <a href="./converter.html">Converter HOWTO</a>
  58. </li>
  59. <li> <a href="./type.html">Type HOWTO</a>
  60. </li>
  61. <li> <a href="./classloader.html">ClassLoader HOWTO</a>
  62. </li>
  63. <li> <a href="./librarys.html">Library HOWTO</a>
  64. </li>
  65. </ul>
  66. <p><strong>Container Design</strong></p>
  67. <ul>
  68. </ul>
  69. </td>
  70. <td align="left" valign="top">
  71. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  72. <tr><td bgcolor="#525D76">
  73. <font color="#ffffff" face="arial,helvetica,sanserif">
  74. <a name="Handling Files"><strong>Handling Files</strong></a>
  75. </font>
  76. </td></tr>
  77. <tr><td>
  78. <blockquote>
  79. <p>Myrmidon includes a Virtual File System (VFS), which allows files from
  80. different sources to be treated identically. The VFS currently supports
  81. the following file types:</p>
  82. <table>
  83. <tr>
  84. <td bgcolor="#039acc" colspan="" rowspan=""
  85. valign="top" align="left">
  86. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  87. File System
  88. </font>
  89. </td>
  90. <td bgcolor="#039acc" colspan="" rowspan=""
  91. valign="top" align="left">
  92. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  93. Description
  94. </font>
  95. </td>
  96. <td bgcolor="#039acc" colspan="" rowspan=""
  97. valign="top" align="left">
  98. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  99. URL Format
  100. </font>
  101. </td>
  102. </tr>
  103. <tr>
  104. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  105. valign="top" align="left">
  106. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  107. Local Files
  108. </font>
  109. </td>
  110. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  111. valign="top" align="left">
  112. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  113. Files on the local file system.
  114. </font>
  115. </td>
  116. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  117. valign="top" align="left">
  118. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  119. Three different formats are currently supported for local file names:
  120. <ul>
  121. <li><code>file://</code> <i>absolute-file-name</i></li>
  122. <li>Absolute file names</li>
  123. <li>Relative file names. These are resolved relative to the
  124. project's base directory.
  125. </li>
  126. </ul>
  127. </font>
  128. </td>
  129. </tr>
  130. <tr>
  131. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  132. valign="top" align="left">
  133. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  134. Zip Files
  135. </font>
  136. </td>
  137. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  138. valign="top" align="left">
  139. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  140. The contents of Zip files (and Jar, War, and Ear files).
  141. Currently, the VFS supports read-only access to Zip file contents.
  142. </font>
  143. </td>
  144. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  145. valign="top" align="left">
  146. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  147. <code>zip:</code> <i>zip-file-uri</i> [<code>!</code><i>absolute-path</i>]
  148. </font>
  149. </td>
  150. </tr>
  151. <tr>
  152. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  153. valign="top" align="left">
  154. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  155. FTP
  156. </font>
  157. </td>
  158. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  159. valign="top" align="left">
  160. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  161. Files on an FTP server.
  162. </font>
  163. </td>
  164. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  165. valign="top" align="left">
  166. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  167. <code>ftp://</code> [[<i>password</i><code>:</code>] <i>username</i><code>@</code>] <i>hostname</i> [<code>:</code><i>port</i>] [<i>absolute-path</i>]
  168. </font>
  169. </td>
  170. </tr>
  171. <tr>
  172. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  173. valign="top" align="left">
  174. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  175. SMB
  176. </font>
  177. </td>
  178. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  179. valign="top" align="left">
  180. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  181. Files on a CFIS server, such as Samba or Windows shares.
  182. </font>
  183. </td>
  184. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  185. valign="top" align="left">
  186. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  187. <code>smb://</code> [[<i>password</i><code>:</code>] <i>username</i><code>@</code>] <i>hostname</i> [<code>:</code><i>port</i>] [<i>absolute-path</i>]
  188. </font>
  189. </td>
  190. </tr>
  191. </table>
  192. <p>Both forward or backward slashes can be used to separate the elements of
  193. a URL.</p>
  194. <p>Here are some example URLs:</p>
  195. <ul>
  196. <li><code>build/classes</code></li>
  197. <li><code>c:\program files\ant\bin</code></li>
  198. <li><code>file://C:/program files/ant</code></li>
  199. <li><code>zip:build/lib/ant.jar!/org/apache/tools</code></li>
  200. <li><code>ftp://adam@somehost/pub/downloads</code></li>
  201. <li><code>smb://password:adam@somehost/home/adam</code></li>
  202. </ul>
  203. <p>Currently, there are only a handful of VFS aware tasks. This will grow
  204. as more tasks are ported to the new API, and data types.</p>
  205. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  206. <tr><td bgcolor="#828DA6">
  207. <font color="#ffffff" face="arial,helvetica,sanserif">
  208. <a name="File Sets"><strong>File Sets</strong></a>
  209. </font>
  210. </td></tr>
  211. <tr><td>
  212. <blockquote>
  213. <p>A file set in Myrmidon is more general than Ant 1's concept of a file set.
  214. Firstly, there is more than one type of file set. Secondly, they are VFS enabled.
  215. File sets are automatically converted to a <a href="#Paths">path</a>, and so
  216. can be used anywhere that a path can.</p>
  217. <h3><code>&lt;v-fileset&gt;</code></h3>
  218. <p>This is the equivalent of Ant 1's <code>&lt;fileset&gt;</code> (The name
  219. is temporary, it will be changed to <code>&lt;fileset&gt;</code> once more
  220. porting work as been completed).</p>
  221. <p>Rather than use a set of include and exclude patterns to choose the files
  222. that make up the file set, <code>&lt;v-fileset&gt;</code> takes zero or more
  223. <a href="#File Selectors">file selectors</a>. File selectors can be used to
  224. select files based on any attribute of the file, rather than just the name.
  225. You can use <code>&lt;name&gt;</code> selectors to achieve the same result
  226. as using includes or excludes.</p>
  227. <p>A <code>&lt;v-fileset&gt;</code> element takes the following attributes:</p>
  228. <table>
  229. <tr>
  230. <td bgcolor="#039acc" colspan="" rowspan=""
  231. valign="top" align="left">
  232. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  233. Attribute
  234. </font>
  235. </td>
  236. <td bgcolor="#039acc" colspan="" rowspan=""
  237. valign="top" align="left">
  238. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  239. Description
  240. </font>
  241. </td>
  242. <td bgcolor="#039acc" colspan="" rowspan=""
  243. valign="top" align="left">
  244. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  245. Default Value
  246. </font>
  247. </td>
  248. </tr>
  249. <tr>
  250. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  251. valign="top" align="left">
  252. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  253. dir
  254. </font>
  255. </td>
  256. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  257. valign="top" align="left">
  258. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  259. The base directory for the file set. This can be any URL that the
  260. VFS supports.
  261. </font>
  262. </td>
  263. <td bgcolor="#a0ddf0" colspan="" rowspan=""
  264. valign="top" align="left">
  265. <font color="#000000" size="-1" face="arial,helvetica,sanserif">
  266. Required
  267. </font>
  268. </td>
  269. </tr>
  270. </table>
  271. <p>A <code>&lt;v-fileset&gt;</code> element takes any number of nested
  272. <a href="#File Selectors">file selector</a> elements. To be included in the
  273. file set, a file must be selected by all the file selectors. That is, the
  274. file selectors are implicitly AND-ed together. If no file selector is provided,
  275. all the files and directories are included in the set.</p>
  276. <p>An example:</p>
  277. <div align="left">
  278. <table cellspacing="4" cellpadding="0" border="0">
  279. <tr>
  280. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  281. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  282. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  283. </tr>
  284. <tr>
  285. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  286. <td bgcolor="#ffffff"><pre>
  287. &lt;v-fileset dir=&quot;src&quot;&gt;
  288. &lt;name pattern=&quot;org/apache/tools/ant/**&quot;/&gt;
  289. &lt;is-file/&gt;
  290. &lt;/v-fileset&gt;
  291. </pre></td>
  292. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  293. </tr>
  294. <tr>
  295. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  296. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  297. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  298. </tr>
  299. </table>
  300. </div>
  301. <h3><code>&lt;flat-fileset&gt;</code></h3>
  302. <p>This file set takes a set of nested file sets and paths, and flattens them
  303. into a single directory. It can be used as a way of converting a path into a
  304. file set. It can also be used as a replacement for the <code>flatten</code>
  305. attribute for the copy and move tasks.</p>
  306. <p>A <code>&lt;flat-fileset&gt;</code> element takes no attributes, and a set
  307. of nested paths or file sets.</p>
  308. <p>An example:</p>
  309. <div align="left">
  310. <table cellspacing="4" cellpadding="0" border="0">
  311. <tr>
  312. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  313. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  314. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  315. </tr>
  316. <tr>
  317. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  318. <td bgcolor="#ffffff"><pre>
  319. &lt;v-copy todir=&quot;dist/lib&quot;&gt;
  320. &lt;flat-fileset&gt;
  321. &lt;v-fileset dir=&quot;build/lib&quot;&gt;
  322. &lt;basename pattern=&quot;*.jar&quot;/&gt;
  323. &lt;v-fileset&gt;
  324. &lt;v-path path=&quot;${classpath}&quot;/&gt;
  325. &lt;/flat-fileset&gt;
  326. &lt;/v-copy&gt;
  327. </pre></td>
  328. <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  329. </tr>
  330. <tr>
  331. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  332. <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  333. <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
  334. </tr>
  335. </table>
  336. </div>
  337. <h3><code>&lt;mapped-fileset&gt;</code></h3>
  338. <p>A fileset that applies a <a href="buildfile.html#File Name Mappers">file name mapper</a>
  339. to a nested fileset.
  340. </p>
  341. </blockquote>
  342. </td></tr>
  343. </table>
  344. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  345. <tr><td bgcolor="#828DA6">
  346. <font color="#ffffff" face="arial,helvetica,sanserif">
  347. <a name="Paths"><strong>Paths</strong></a>
  348. </font>
  349. </td></tr>
  350. <tr><td>
  351. <blockquote>
  352. <p>Paths are an ordered list of files.</p>
  353. <h3><code>&lt;v-path&gt;</code></h3>
  354. <p>This is the equivalent of Ant 1's <code>&lt;path&gt;</code>.</p>
  355. <h3><code>&lt;filtered-path&gt;</code></h3>
  356. <p>A path that applies file selectors to a set of nested file sets and paths.</p>
  357. </blockquote>
  358. </td></tr>
  359. </table>
  360. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  361. <tr><td bgcolor="#828DA6">
  362. <font color="#ffffff" face="arial,helvetica,sanserif">
  363. <a name="File Selectors"><strong>File Selectors</strong></a>
  364. </font>
  365. </td></tr>
  366. <tr><td>
  367. <blockquote>
  368. <p>File selectors are used to select files from file sets and paths.</p>
  369. <h3><code>&lt;and&gt;</code></h3>
  370. <p>Combines zero or more file selectors, using AND. An empty <code>&lt;and&gt;</code>
  371. selector accepts all files.</p>
  372. <h3><code>&lt;basename&gt;</code></h3>
  373. <p>Selects files whose base name matches an Ant 1 style pattern, or a regular
  374. expression.</p>
  375. <h3><code>&lt;condition&gt;</code></h3>
  376. <p>Takes a set of <a href="buildfile.html#Conditions">conditions</a>. If
  377. the conditions evaluate to true, then select every file. Otherwise,
  378. select no files.</p>
  379. <h3><code>&lt;exists&gt;</code></h3>
  380. <p>Selects files that exist.</p>
  381. <h3><code>&lt;is-empty-folder&gt;</code></h3>
  382. <p>Selects empty folders, that is, folders that have no children.</p>
  383. <h3><code>&lt;is-folder&gt;</code></h3>
  384. <p>Selects folders, does not select regular files.</p>
  385. <h3><code>&lt;is-file&gt;</code></h3>
  386. <p>Selects regular files, does not select folders.</p>
  387. <h3><code>&lt;name&gt;</code></h3>
  388. <p>Selects files whose path in a file set matches an Ant 1 style pattern, or
  389. a regular expression.</p>
  390. <h3><code>&lt;not&gt;</code></h3>
  391. <p>Selects files that are not selected by a nested file selector.</p>
  392. <h3><code>&lt;or&gt;</code></h3>
  393. <p>Combines zero or more file selectors, using OR. An empty <code>&lt;or&gt;</code>
  394. selector accepts all files.</p>
  395. <h3><code>&lt;url&gt;</code></h3>
  396. <p>Selects files whose URL matches an Ant 1 style pattern, or a regular expression.</p>
  397. </blockquote>
  398. </td></tr>
  399. </table>
  400. </blockquote>
  401. </td></tr>
  402. </table>
  403. </td>
  404. </tr>
  405. <!-- FOOTER -->
  406. <tr><td colspan="2">
  407. <hr noshade="" size="1"/>
  408. </td></tr>
  409. <tr><td colspan="2">
  410. <div align="center"><font color="#525D76" size="-1"><em>
  411. Copyright &#169; 2000-2002, Apache Software Foundation
  412. </em></font></div>
  413. </td></tr>
  414. </table>
  415. </body>
  416. </html>
  417. <!-- end the processing -->