I just added to scratchpad a refactored implementation of DirectoryGenerator (TraversableGenerator) that doesn't work with just files but with any TraversableSource. Together with it, a refactoring was done on XPathDirectory, which is now XPathTraversable, so that even XPath queries can be done on any TraversableSource (while we were at it, we added namespace support, missing on the previous implementation).
Damn, competing implementations : I've had this same thing on my HD for several weeks now as part of the new version of the CVSSource. Shame on me, I should have committed this for a long time. "release early, release often".
Oh well... silly me for not asking. :-)
My version is cacheable, but doesn't support XPath. I'll look at yours to see how to merge them.
Ours is cacheable too, actually it was very little more than s/File/Source on the cacheable DirectoryGenerator, so a more clever implementation would be most welcome. :-) Also, the XPath stuff is on an different class (XPathTraversableGenerator), which extends TraversableGenerator, so some care should be taken in merging the two.
Also, since we're not talking about directory and files anymore, I used the more generic terms of collection and resource, changing the namespace too to "http://apache.org/cocoon/collection/1.0". I don't remember if a vote was required for new namespace additions, but I'd like to hear at least your opinion on that. :-)
I think we should keep the current namespace, which describes a hierarchy, and is not really tied to the fact that is a real filesystem or something else. But we should keep the current DirectoryGenerator (eventually deprecated) since users may have extended it (we did it for an application to add extra attributes and filtering rules).
Makes sense.
Ciao,
-- Gianugo Rabellino Pro-netics s.r.l. - http://www.pro-netics.com Orixo, the XML business alliance - http://www.orixo.com (Now blogging at: http://blogs.cocoondev.org/gianugo/)