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

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