ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject zip update problem - API ideas
Date Fri, 10 Jan 2003 12:04:37 GMT
This is a rough sketch of my current ideas, as I won't have the time
to work on this this week and I know Antoine wants to get his feet
wet.

Stefan

I'm trying to combine Antoine's and my ideas a little here:

* introduce Resource with name, exists and lastmodified as attributes.

  more can be added later, if needed.

  should probably go into the types package.

* introduce ResourceFactory interface with one method:

  Resource getResource(String name)

  types package (or util?).

* make ZipScanner return the names of the ZipEntries instead of the
  name of the archive in getIncludedFiles and so on.

* introduce SourceSelector with a method

  Resource[] selectOutOfDateSources(Resource[] source,
                                    FileNameMapper mapper,
                                    ResourceFactory targets)

  that would basically do what SourceFileScanner#restrict does today,
  but worked on the lastmodfied properties of the Resources.

  util package.

* in Zip 

  - use Resources wrapped around Files for "normal" <fileset>s
    and wrapped around ZipEntrys for <zipfilesets> that use the src
    attribute.

  - use a ResourceFactory that wraps resources around ZipEntrys of the
    existing archive.

  - short-circuit, if the archive doesn't exis, off course.

  we'll probably want to cache the Resources of the existing archive
  so that we don't re-read the archive for each fileset.

* make SourceFileScanner delegate to SourceSelector using a built-in
  ResourceFactory that wraps Resources around "new File(srcDir, files[i])"
  and "new File(destDir, name)" respectively.

  this is here for backwards compatibilty.


Optional, not really necessary to fix the bug.

* make DirectoryScanner implement ResourceFactory

  will return a Resource that wraps "new File(dir, name)"

* make ZipScanner override the method so that it will return a wrapper
  around the correct ZipEntry.

* something similar needs to be done to FTPDirectoryScanner in
  oata.taskdefs.optional.net.FTP.

* add getIncludedResources() and so on to DirectoryScanner that return
  Resource instances instead of names.

  use these methods in all tasks and use SourceSelector instead of
  SourceFileScanner.

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message