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

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