cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: Defining Source Interfaces
Date Mon, 06 Jan 2003 15:49:57 GMT

Sylvain Wallez wrote:
> 
> Carsten Ziegeler wrote:
> 
> >I think it's time to define the WriteableSource etc. interfaces
> >for the excalibur source package and move them out of Cocoon.
> >
> >What do you think about this? This would move the responsibility
> >to excalibur :)
> >
> 
> I guess you're joking, but is this good or bad ? Who else beside Cocoon 
> is using the source package in Excalibur ?
> 
Oh, believe me - a lot of projects and companies are using it! I get
several support questions for that package every month from various
places.
So, to be true: no, it's not a joke.

> >I added before christmas the possibility to retrieve children
> >of a source to the Source interface in excalibur and started
> >with the ModifiableSource interface (= WriteableSource).
> >
> >What else do we need? I think we have a buch of extensions
> >to the Source interface.
> >
> 
> Well, look in the 2.1 scratchpad where there's a lot of yummy stuff : 
> TraversableSource, VersionableSource, LockableSource, etc.
> 
> While working on sources recently (the CVSSource I'm about to publish), 
> I found the current definition of TraversableSource not intuitive, and 
> modified it so it's more like to java.io.File :
> 
> public interface TraversableSource extends Source {
> 
>     /** Is the source a directory or a collection ? */
>     public boolean isSourceCollection() throws ProcessingException, 
> IOException;
> 
>     /** Returns the collection of child sources. */
>     public Collection getChildren() throws ProcessingException, 
> IOException;
>      
>     /** Returns the local name of this source */
>     public String getName() throws ProcessingException, IOException;
> 
>     /** Return the parent source. Returns null if the source hasn't a 
> parent. */
>     public Source getParentSource() throws ProcessingException, 
> IOException;
> }
> 
> Stephan, others, what about these changes ?
> 
> Carsten, I also some remarks/questions about your changes in Excalibur :
> - should parent/child traversal be defined on Source. IMO, a Source 
> should be kept very simple and basic as not all sources are traversable,
Yes, that is true. But always doing an instanceof is not the best advice
for doing OOP. So, I thought of adding the most common methods to the base
interface and only use extending interfaces if required.

> - why does getChildrenLocation return an Iterator (and not a Collection) 
> of URIs (and Sources) ?
Hmm, why not Iterator? Why is Collection better?

Carsten

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message