You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Carsten Ziegeler <cz...@sundn.de> on 2001/09/06 11:16:12 UTC
[C2]: Possible Problems with the new Source interface
Hi Team,
I am not quiet sure, put I have some strange feelings with the
changes to the Source interface.
The source interface is now split into Source and ModifiableSource.
This is a good idea, but I am not sure if it is practicable.
The original idea behind the refresh() method which builds now the
ModifiableSource interface, was to refresh and reset the Source object.
The reason for this is, that there might be Source objects were you
can only get an InputStream once. So if you want to read more
than once from a Source object you should call getInputStream(),
refresh() and then again getInputStream().
For example, the URLSource (http connection) needs this, as you
can get only once an inputstream from a connection and calling
refresh() creates a new connection object.
Now splitting this functionality into a subinterface makes the
handling of Source objects very difficult: you have first
to call getInputStream(), test if it is a ModifiableSource, if
so call refresh() and can then call getInputStream() again.
The SitemapSource (describing a cocoon: url) needs this refresh()
call, too.
So I would propose to add a new method to the Source interface
which will make several calls to getInputStream possible.
Any idea for a name (refresh and recycle are already used)?
Carsten
Open Source Group sunShine - b:Integrated
================================================================
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
www.sundn.de mailto: cziegeler@sundn.de
================================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
AW: [C2]: Possible Problems with the new Source interface
Posted by Carsten Ziegeler <cz...@sundn.de>.
> Berin Loritsch wrote:
>
> Carsten Ziegeler wrote:
> >
> > Hi Team,
> >
> > I am not quiet sure, put I have some strange feelings with the
> > changes to the Source interface.
> >
> > The source interface is now split into Source and ModifiableSource.
> > This is a good idea, but I am not sure if it is practicable.
> > The original idea behind the refresh() method which builds now the
> > ModifiableSource interface, was to refresh and reset the Source object.
> > The reason for this is, that there might be Source objects were you
> > can only get an InputStream once. So if you want to read more
> > than once from a Source object you should call getInputStream(),
> > refresh() and then again getInputStream().
> > For example, the URLSource (http connection) needs this, as you
> > can get only once an inputstream from a connection and calling
> > refresh() creates a new connection object.
> >
> > Now splitting this functionality into a subinterface makes the
> > handling of Source objects very difficult: you have first
> > to call getInputStream(), test if it is a ModifiableSource, if
> > so call refresh() and can then call getInputStream() again.
> >
> > The SitemapSource (describing a cocoon: url) needs this refresh()
> > call, too.
> >
> > So I would propose to add a new method to the Source interface
> > which will make several calls to getInputStream possible.
> > Any idea for a name (refresh and recycle are already used)?
>
> What about the getInputStream() method checking to see if it needs
> to be refreshed, and handle that automatically. I don't think
> altering the interface should be done. I think the implementation
> needs to enforce the contract that getInputStream() always returns
> a working InputStream().
>
Yes, good idea. Sometimes one is thinking too technical. Will do that!
Carsten
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: [C2]: Possible Problems with the new Source interface
Posted by Berin Loritsch <bl...@apache.org>.
Carsten Ziegeler wrote:
>
> Hi Team,
>
> I am not quiet sure, put I have some strange feelings with the
> changes to the Source interface.
>
> The source interface is now split into Source and ModifiableSource.
> This is a good idea, but I am not sure if it is practicable.
> The original idea behind the refresh() method which builds now the
> ModifiableSource interface, was to refresh and reset the Source object.
> The reason for this is, that there might be Source objects were you
> can only get an InputStream once. So if you want to read more
> than once from a Source object you should call getInputStream(),
> refresh() and then again getInputStream().
> For example, the URLSource (http connection) needs this, as you
> can get only once an inputstream from a connection and calling
> refresh() creates a new connection object.
>
> Now splitting this functionality into a subinterface makes the
> handling of Source objects very difficult: you have first
> to call getInputStream(), test if it is a ModifiableSource, if
> so call refresh() and can then call getInputStream() again.
>
> The SitemapSource (describing a cocoon: url) needs this refresh()
> call, too.
>
> So I would propose to add a new method to the Source interface
> which will make several calls to getInputStream possible.
> Any idea for a name (refresh and recycle are already used)?
What about the getInputStream() method checking to see if it needs
to be refreshed, and handle that automatically. I don't think
altering the interface should be done. I think the implementation
needs to enforce the contract that getInputStream() always returns
a working InputStream().
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org