ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Levy-Lambert" <levylamb...@tiscali-dsl.de>
Subject Re: API changes introduced while fixing bug 10755
Date Wed, 12 Feb 2003 10:28:14 GMT
Stefan, Bruce,

1) logging in Scanners

Stefan Bodewig wrote :

> True.  I could as well pass in an org.apache.tools.ant.util.TaskLogger
> instance.
>

What is the benefit of TaskLogger in terms of design, compared to the
current situation of having a reference to the current task in ZipScanner ?

Don't we need a static method or a "factory" somewhere that all types could
use to find the official logger for the current task ?

2) exceptions

Bruce Atherton wrote :

>As someone who hates checked exceptions, I'm probably the wrong person to
>talk to this point. I'll just point out that BuildExceptions already
>percolate throughout the code without necessarily being declared.

I agree that it would be better to throw BuildExceptions rather than log
errors or print them on System.err. I did not know that BuildException(s)
did not have to be declared in the method signatures.

3) ResourceScanner interface

re removing the ResourceScanner interface
>
>I'm not convinced that this is really needed (at this point).

Fine with me. It looks like ResourceScanner will be then defacto replaced by
DirectoryScanner. Or do you have something else in mind ?

4) for the future

I think we should change a number of method signatures to use Resource
instead of File.

I have the following in mind :
    - adding new properties to the Resource class
          size to record file sizes for selectors
          symlink to record whether a Resource is a simlink because there
simlinks are scanned with a special treatment in DirectoryScanner
          an object or several properties to know the "base URL" of the
resource,
              ie for a zip entry the path of the zip file,
                 for a file in a fileset the basedir,

    - changing the BaseSelector API so that isSelected only takes as
argument

      we would have :

      public boolean isSelected(Resource someresource)

      instead of

      public boolean isSelected(File basedir, String filename, File file)

    - create a new routine in DirectoryScanner called Resource []
ListDir(Resource base)
    this routine would be also implemented (but differently) in all
subclasses of DirectoryScanner
    it would give the list of all entries which are directly under base,
without recursion.

    and would be called from DirectoryScanner#scan

    then ideally, subclasses of DirectoryScanner would not need their own
implementation of scan, but would just rely on ListDir

This is probably a lot of work and a revolution in some areas of the ant
APIs, but it might disentangle a number of routines and pave the way for
doing new things, like using a ZipFileSet as a source in the <copy> task,
....

Comments ?

Antoine


Mime
View raw message