> On Fri, 21 Jun 2002, Jens Lorenz wrote: > > > ----- Original Message ----- > > From: "Stephan Michels" <[EMAIL PROTECTED]> > > To: "cocoon-dev" <[EMAIL PROTECTED]> > > Sent: Friday, June 21, 2002 3:54 PM > > Subject: RE: [PROPOSAL] Sources, the next generation RE: Speedup > > *DirectoryGenerator > > > > <snip/> > > > > > > > > I think it should work like this: > > > > > > Source source = resolver.resolveURI("dav://mydir/mydir2/"); > > > if (source instanceof TraversableSource) { > > > TraversableSource tsource = (TraversableSource) source; > > > > > > Source parent = resolver.resolveURI(tsource.getParentSource()); > > > Source child = resolver.resolveURI(tsource.getChildSource(0)); > > > } > > > > > > > Just wanted to mention, that there document stores, where one > > TraversableSource can have multiple ParentSources. For example > > unix hardlinks > > I think a link, and the document, which the link points to, has only one > parent. > > > /dir/link -> /file > parent: /dir > > /file > parent: / >
yep, I agree, the traversing goes top-down... in this sense the parent is the one that contains you/produces you. after all, the focus we have is producing an XML output that reflects how each collection thinks about the children it has, not vice versa. > > > document managment systems with some sort of collections. > > and one document being in more than one collection. > > That can be. in which case the document will show up twice in the output > > > Document > > having meaning of a single file and Collection having the > > meaning of folder which has files. > > Thats the reason for: > TranverableSource: > boolean isCollection() > > > (Yes, this really sets your mind twisting, if you have to deal with > > stuff like this) > > > > So there should be a convenience method named getParentSource() > > (or similar) which just returns the first parent (most of the > > times there will be only one) and another way of accessing the > > other parents. > > I would you agree, if there wasn't the problem of meaning of > 'traversable'. If a source has more than one parent, how would > you tranverse such a trajectory? > > Difficult ;-) so let's keep it simple :-) > > Thanks for your comment, Stephan Michels. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]