Pier Fumagalli wrote:
Ah, this is in a sub interface of Source (TraversableSource or somethingOnly "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.
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 }
