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.txt 9.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. From: "Adam Murdoch" <adammurdoch_ml@yahoo.com>
  16. Subject: RE: Virtual FileSystem Layer
  17. Date: Sat, 22 Dec 2001 12:06:37 +1000
  18. Hi,
  19. I've also been doing a bit of work on the VFS. No code yet - instead, I've
  20. done a survey of the Ant 1 code, to help get a better idea of what we need
  21. the VFS to actually do.
  22. I've put together a rough list of the sort of features the current tasks
  23. require from the file system. This list is entirely from the task writer's
  24. POV. I've ignored the build file writer completely - though, the action
  25. list is a good summary of the build file writer's concerns. I've tried to
  26. steer clear of assumptions about what is actually going to provide each
  27. feature to the tasks, or what the API will look like to the tasks.
  28. The goal for doing up this list, was to help identify the features we want
  29. to support, and the API that the tasks will use to get at them. This should
  30. be largely independent of how we decide to represent the file system in the
  31. build files. In addition, it doesn't matter too much whether the list below
  32. is complete (I'm sure it isn't), or that the VFS provide every single one of
  33. the features. Whatever it doesn't provide, can stay up in the tasks, and be
  34. refactored down later.
  35. The assumption here is that we do actually want to put together a file
  36. system API. I think it's a good idea to at least put together some
  37. interfaces, even if the implementation is stolen from somewhere else.
  38. Without a doubt, the file system is the most widely used "service" in the
  39. current crop of tasks. The API that we choose has to have a good semantic
  40. match with what the tasks need to do, so that writing the tasks is easy.
  41. The API also has to be general enough to deal with stuff we haven't thought
  42. of yet. On that note, I personally think that JNDI might be a touch too
  43. general for what we need.
  44. So, the features. Note that many of these will be optional - not every
  45. feature will be available for every node in the file system. I've used the
  46. term "node" to mean both directories and files. I'm not suggesting we
  47. actually call them "nodes" in the API. I've used the term "root node" to
  48. mean the root of a file system.
  49. * Naming
  50. - Locate a node by absolute name.
  51. - Get the absolute name for a node.
  52. - Resolve a name to a node, relative to some base node - like
  53. FileUtils.resolveFile().
  54. - Get the relative name of a node, relative to some base node.
  55. - Determine the base name (with and without the extension), and extension of
  56. the node.
  57. - Deal with file systems that are case sensitive, and case insentitive.
  58. * Properties
  59. - Determine what properties are available on the node.
  60. - Determine if the node exists.
  61. - Determine the type of node (file vs. directory, could be "has-content" vs
  62. "has-children").
  63. - Determine if the node is readable.
  64. - Determine if the node is writeable.
  65. - Get/set the permissions on the node. This covers things like chmod &
  66. chown, making read-only, making executable, etc.
  67. * Content
  68. - Determine if the node can/does have content.
  69. - Get the size of the node.
  70. - Get/set the last-modified time of the node.
  71. - Get/set the mime-type of the node.
  72. - Get/set the encoding of the node.
  73. - Get a checksum of the node.
  74. - Get content as InputStream.
  75. - Get content as Reader.
  76. - Set content as an OutputStream.
  77. - Set content as a Writer.
  78. - Implicit creation of node and its ancestors when content is written.
  79. - Compare nodes for equality (last modified timestamp, checksum, bytewise
  80. compare).
  81. * Hierarchy
  82. - Get the parent node of a node.
  83. - Get the child nodes of a node.
  84. - Iterate over (or visit) the descendants of a node.
  85. - With or without a selector.
  86. - In various orders - depthwise, etc.
  87. - Be able to modify the nodes during traversal.
  88. * Modification
  89. - Create a new node of a particular type. Create all missing ancestors.
  90. - Move, copy, delete a node.
  91. - All descendants.
  92. - Optional selector. E.g. ignore empty dirs, ignore default excludes, etc.
  93. - Optional filter.
  94. * Conversion
  95. - Convert the node to a java.net.URL.
  96. - Make the node content available as a local file (to hand off to external
  97. commands).
  98. - Get the OS specific *filename* for a node.
  99. - Resolve an OS specific *filename* to a node.
  100. * File System Types
  101. - Local file.
  102. - HTTP.
  103. - FTP.
  104. - Classloader, uses Classloader.getResource().
  105. - Temporary files.
  106. - etc ...
  107. - Compound file system. Made up of a bunch of mount points. The VFS
  108. itself.
  109. - Layered file systems (that sit on top of another file system or node):
  110. - zip, bzip, jar, tar
  111. - filtering - token replacement, etc
  112. - Factories for creating and configuring file system root nodes.
  113. - Ability to easily add new file system implementations.
  114. * Task Container
  115. - A mechanism for a task to get hold of the project's root node.
  116. - A mechanism that allows a task to create its own private root nodes,
  117. without letting it mess with the project's file system, or the file systems
  118. of other tasks.
  119. - A mechanism for cleaning up all the node InputStream, OutputStream, Reader
  120. and Writers opened by a task during its execute() method. Cleaning up files
  121. is one thing the current tasks don't do very well at all. Something like
  122. this would take care of anything the task did not explictly close. Would
  123. include root nodes it created.
  124. * Other things
  125. - Maybe some way to explicitly close a node and release all resources used
  126. by it.
  127. - Maybe detection of concurrent updates, in the case of parallel tasks.
  128. - Netbeans has an event model in its VFS. Something like this might be
  129. useful in dependency management.
  130. - nodesets. The replacement for, or generalisation of, FileSet, Path,
  131. FileList, etc
  132. - A nodeset that contains the descendents of a node that match a selector
  133. (like the current FileSet implementation).
  134. - A nodeset that contains arbitrary nodes.
  135. - An aggregating nodeset.
  136. - Custom nodeset implementations.
  137. - Reimplement the Ant 1 Fileset, Path and Filelist as adaptors sitting on
  138. top of the VFS.
  139. - A classloader that can load classes from a node.
  140. - etc ..
  141. What's missing? What shouldn't be on the list?
  142. Adam
  143. > -----Original Message-----
  144. > From: Magesh Umasankar
  145. > Sent: Saturday, 22 December 2001 10:44 AM
  146. > To: ant-dev@jakarta.apache.org
  147. > Subject: Virtual FileSystem Layer
  148. >
  149. >
  150. > I have been spending some time now on the VFS
  151. > layer... Nothing major to report yet, but I just wanted
  152. > to sound off so that if I am going down the wrong
  153. > route, I correct it right away.
  154. >
  155. > I evaluated at WebNFS, NetBeansFS (NBFS) and
  156. > JNDI.
  157. >
  158. > 1. WebNFS seems to be going nowhere. It has
  159. > been dormant for quite sometime now. Licensing
  160. > is rigid. Technically, it doesn't look so bad as it
  161. > closely replicates java.io.File's API. But then,
  162. > that really gives us very little.
  163. >
  164. > 2. NBFS looks OK. It has got a few filesystems
  165. > already built. There may be some licensing issues,
  166. > I don't know, but that shouldn't concern us too
  167. > much as, according to Peter, it is Mozilla (I haven't
  168. > really check the license out, sorry). But, as far as I
  169. > can see, it seems to lack in sophisticated API features
  170. > like searching based on attributes, etc., which
  171. > we will definitely be needing for the Selector APIs.
  172. >
  173. > 3. JNDI, by far, beats the above to, in my
  174. > evaluation. It is generic enough. We don't have
  175. > any licensing issues. It has also become part of
  176. > the core JRE (1.4 onwards). Technically, it fits to a T
  177. > what we are looking for - virtual file system that
  178. > provides search controls, access attributes,
  179. > url mounting, etc. Furthermore, there's been
  180. > some ground work already done for us at Jakarta/Apache
  181. > (Catalina). I have written a SPI for a FTPFileSystem
  182. > - though it is in a real crude stage right now. I believe
  183. > this is the way to go because Ant's code would be
  184. > operating at the (Dir)Context level and we can keep
  185. > adding SPIs as we need them. Furthermore,
  186. > JNDI has been stable for quite sometime now and
  187. > we can depend on a widely used API.
  188. >
  189. > I don't think JNDI is a heavyweight API for our needs.
  190. > It seems to be the only one, so far, which encompasses
  191. > at the APIP level, all the new functionalities that we
  192. > desire to introduce.
  193. >
  194. > Let me know if my approach, so far, to go the JNDI
  195. > route seems reasonable.
  196. >
  197. > Cheers,
  198. > Magesh
  199. >
  200. >
  201. >
  202. >
  203. > --
  204. > To unsubscribe, e-mail: <mailto:ant-dev-unsubscribe@jakarta.apache.org>
  205. > For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>
  206. --
  207. To unsubscribe, e-mail: <mailto:ant-dev-unsubscribe@jakarta.apache.org>
  208. For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>