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 19 KiB

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