ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen McConnell" <mcconn...@dpml.net>
Subject RE: Resource.getURL()
Date Tue, 26 Sep 2006 07:17:53 GMT
 

> -----Original Message-----
> From: Matt Benson [mailto:gudnabrsam@yahoo.com] 
> Sent: Tuesday, 26 September 2006 6:28 AM
> To: Ant Developers List
> Subject: RE: Resource.getURL()

[snip]

> > Matt:
> > 
> > Can you expand on what you mean by "a string representation of a 
> > Resource"?
> > Are your implying something equivalent to the way a URL can be 
> > externalized to a string (which could be done if all resources are 
> > associated with dedicated url handlers).  Some concrete 
> > usage examples would be handy.
> > 
> > /Steve.
> 
> Exactly.  Take for example the echo task.  It defines a 
> method like public void setFile(File).
> Ant knows how to resolve file="somefile" to a File object.  
> Resources' OutputStream is hardly used at present; the 
> concept behind its (OutputStream's) addition to the API is:
> 
> <echo to="property:foo">bar</echo>
> 
> I used "to" here; maybe the right name is "toresource"
> or simply "resource" as is "file".  The implementation of 
> setFile(File f) would be:
> 
> setTo(new FileResource(f));
> 
> This is the exact use case driving this, from my perspective 
> anyway.  It should be solvable, as you mention, using either 
> application-level pseudo-protocols or custom protocol 
> handlers.  But without this functionality I will consider any 
> solution incomplete.

OK - now things are making more sense.  In effect the 'property:foo' is a
resource identifier in that the resource protocol is 'property' and the
resource name is 'foo'.  

For the other resource types:
                       
    tar:[name]         TarResource        in memory tar archive
    zip:[name]         ZipArchive         in memory zip archive
    bzip:[name]        BZipResource       in memory compressed archive
    gzip:[name]        GZipArchive        in memory compressed archive
    file:[name]        FileResource       named reference to file or
directory
    property:[name]    PropertyResource   in memory property binding
    string:[name]      StringResource     in memory string value
    uri:[name]         URLResource        named reference to a streamable
source
                                          defined by a URL

I have not included CompressedResource or JavaResource resource in the above
list because my impression is that these two are both abstract resource
definitions.  For example, something like 'class:[name]' could map to a
resource class derived from JavaResource.  E.g:

    class:[name]       ClassResource      named reference to classname and
path
    handler:[name]     HandlerResource    named reference to a protocol
handler

Also important to note is that:

  * all of the above return URLs that are in fact URIs identifiy 
    the resource instance

Does that sound correct?

/Steve.

--------------------------
Stephen McConnell
mailto:mcconnell@dpml.net
http://www.dpml.net
 




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


Mime
View raw message