cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gianugo Rabellino <gian...@apache.org>
Subject Re: [Kernel2.2] Source Resolving
Date Wed, 31 Mar 2004 13:29:13 GMT
Pier Fumagalli wrote:

>>> Only "issue" I might see with that is that Excalibur's Source
>>> doesn't have the "isDirectory()" and "children()" methods,
>>> so, well, I don't absolutely like it because it's prone to hacks.
>>>
>> Ah, this is in a sub interface of Source (TraversableSource or something
>> like that).
> 
> 
> On 31 Mar 2004, at 13:09, Gianugo Rabellino wrote:
> 
>> Uh? It's in TraversableSource, a subinterface, yes, but it's there...
> 
> 
> I still prefer something like:
> 
> if (!source.isDirectory()) throw Exception("I need a directory");
> 
> rather than
> 
> if (!(source instanceof TraversableSource)) throw Exception("I need a 
> directory");
> 
> I don't see the point of two interfaces (and as I did, it's easy to miss).

Well, I think that this is due to historical reasons, but in any case I 
can also see a point in having the subinterface concept: for quite a bit 
of sources the concept of traversal just doesn't apply (oh, by the way, 
please drop "file" and "directory" for "resource" and "collection"... 
pretty please :-)), so it makes quite some sense to use plain 
polymorphism in this specific case.

-- 
Gianugo Rabellino
Pro-netics s.r.l. -  http://www.pro-netics.com
Orixo, the XML business alliance - http://www.orixo.com
     (Blogging at: http://www.rabellino.it/blog/)

Mime
View raw message