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

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