cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Michels <step...@apache.org>
Subject RE: Defining Source Interfaces
Date Mon, 06 Jan 2003 16:14:31 GMT


On Mon, 6 Jan 2003, Carsten Ziegeler wrote:

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

getLocalId() ??? because of getSystemId()?

> >     /** Return the parent source. Returns null if the source hasn't a
> > parent. */
> >     public Source getParentSource() throws ProcessingException,
> > IOException;
> > }

I don't return Sources, because Sources can be Components, which
must be resolved/released by the SourceResolver.
So I think returning the URI instead of the Sources is a must-have.

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

I like Avalon because of the separation of the contracts. If you implement
a component, you don't have to implement all lifecycle methods like
EJBs. If you implement a source you only need to implement the IFs that
you need.

My 2cents, Stephan Michels.


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


Mime
View raw message