cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: [Kernel2.2] Source Resolving
Date Wed, 31 Mar 2004 21:26:39 GMT
Gianugo Rabellino wrote:

> 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.


Yep. The basic Source interface is just a read-only access point to a 
stream (bytes or XML) of data, which represents the vast majority of 
uses. This is a minimal common denominator. Later came TraversableSource 
(parent/child relationship), ModifiableSource (can be written to) an 
some other things in the "repository" block (versioned, inspectable, etc).

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Mime
View raw message