Hi, I would like to add getURL() to Resource before Ant 1.7 ships.
I would add it to the Resource base class, and to ZipResource, FileResource. I am not clear whether it is better to signal that a particular Resource does not provide URL by throwing UnsupportedOperationException (as Matt suggested) or by returning null. Concerning custom URLProtocolHandler (s), I am not clear how this works ? Regards, Antoine -------- Original-Nachricht -------- Datum: Thu, 21 Sep 2006 10:08:48 +0100 Von: Steve Loughran <[EMAIL PROTECTED]> An: Ant Developers List <dev@ant.apache.org> Betreff: Re: Resource.getURL() > Stefan Bodewig wrote: > > On Wed, 20 Sep 2006, Matt Benson <[EMAIL PROTECTED]> wrote: > >> --- Antoine Levy-Lambert <[EMAIL PROTECTED]> wrote: > >> > >>> Hello Matt, > >>> > >>> thanks for fixing my fixes ! > >>> > >>> did you already add getURL() to all Resource(s) ? > >>> this would be cool to be able to always set the > >>> SystemId in case of XML documents of all sorts. > >> I have been thinking it might make sense to add > >> getURL() to Resource. Did a discussion on that > >> already take place? > > > > I don't remember any. > > > > Given that Resource as a class and not an interface we are able to add > > new methods even after 1.7.0 without running the risk of breaking the > > code of people who implement their own resources. Given that there > > wouldn't be any code in Ant 1.7.0 that used getURL() we should defer > > adding the method as well, IMHO. > > maybe, but if a subclass adds its own getURL() method bad things happen. > Also, if subclasses ought to override it, then we dont give ant1.7-based > resources a warking. > > > > >> And, for example, what would we do for resources of > >> nonstandard "protocols"? Would a StringResource with > >> value "foo" return "string:foo" as its URL? Should we > >> install custom protocol handlers for built-in > >> resources and encourage the same be done for > >> third-party resource implementations? > > > > +1 for custom protocol handlers. > > Its very hard to add custom protocol handlers in java once you have a > classloader tree. and you increase the effort needed to implement a > resource. > > How about having a hasURL interface that resources can implement? That > way things like my <random> component dont need to bother.? > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]