You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@apache.org> on 2003/01/10 13:04:37 UTC
zip update problem - API ideas
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: zip update problem - API ideas
Posted by Antoine Levy-Lambert <le...@tiscali-dsl.de>.
+8 for everything that Stefan wrote
DirectoryScanner and ZipScanner need a list method
new method suggested by myself in DirectoryScanner and ZipScanner
>> > Resource [ ] list(String path)
>>
>>
> this function would be used in the scandir method of Directory.java,
> instead of java.io.File.list instead of String []
> newfiles=dir.list();
Would we need to expose this method outside DirectoryScanner?
Right, this method can be private in both DirectoryScanner and ZipScanner,
it should only be called from
DirectoryScanner#scandir
True Stefan, if we are creating new methods returning Resource[] then we do
not need the long getModificationTime(String path)
in DirectoryScanner
----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Friday, January 10, 2003 1:04 PM
Subject: zip update problem - API ideas
> 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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>