You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Sylvain Wallez <sy...@anyware-tech.com> on 2002/12/14 23:44:17 UTC
SourceFactory considered harmful (Bug #15279)
Hi team,
Bug #15279 (WriteableSource doesn't work with "context:" URLs) reveals
what seems to me a design flaw in the SourceResolver.
The SourceResolver uses two kinds of classes can to do its job :
SourceFactories and URLFactories. When an URL has to be resolved, it
first checks if any SourceFactory handles the URL's protocol, and if
there's none, it falls back to searching an URLFactory then creates an
URLSource.
Now let's consider "file:" and "context:" :
- "file:" is handled by FileSourceFactory, which creates a _FileSource_
(implements WriteableSource)
- "context:" translates the URL to a "file:" which is then used to
create an _URLSource_
This means that resolving "foo.xml" or "context://foo.xml", even if
pointing to the same content, don't give the same Source implementation,
hence the bug reported by Jeff Turner. I also ran into the same problem
last week with some application-specific protocol meant to hide the
physical location of some application data.
So I consider URLFactories are bad, since they come after
SourceFactories, even if they may produce an URL that's resolved by a
SourceFactory.
So I propose to strongly deprecate URLFactories (means @deprecate the
source and issue a warning in the logs if some are declared), and
rewrite existing implementations as SourceFactories.
Thoughts ?
--
Sylvain Wallez Anyware Technologies
http://www.apache.org/~sylvain http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: SourceFactory considered harmful (Bug #15279)
Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Carsten Ziegeler wrote:
>Sylvain Wallez wrote:
>
>>Hi team,
>>
>>Bug #15279 (WriteableSource doesn't work with "context:" URLs) reveals
>>what seems to me a design flaw in the SourceResolver.
>>
>>The SourceResolver uses two kinds of classes can to do its job :
>>SourceFactories and URLFactories. When an URL has to be resolved, it
>>first checks if any SourceFactory handles the URL's protocol, and if
>>there's none, it falls back to searching an URLFactory then creates an
>>URLSource.
>>
>>
>
>This is true for 2.0.x, but not for 2.1 where the new source resolver
>package from excalibur is used.
>URLFactories are deprecated (starting with 2.1)
>
>With this source resolving, the same implementation, URLSource I think,
>is used. I guess the problem is that the current implementation of
>the context: protocol does not use the WriteableSource implementation.
>
>
I checked ContextSourceFactory, which calls resolver.resolveURI() with
the translated URL. If that URL is a "file:", then we should get a
(writeable) FileSource.
It's been a long time since I wanted to dig in the source resolution in
2.1. Time to do it ;-)
Sylvain
--
Sylvain Wallez Anyware Technologies
http://www.apache.org/~sylvain http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
RE: SourceFactory considered harmful (Bug #15279)
Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Sylvain Wallez wrote:
> Hi team,
>
> Bug #15279 (WriteableSource doesn't work with "context:" URLs) reveals
> what seems to me a design flaw in the SourceResolver.
>
> The SourceResolver uses two kinds of classes can to do its job :
> SourceFactories and URLFactories. When an URL has to be resolved, it
> first checks if any SourceFactory handles the URL's protocol, and if
> there's none, it falls back to searching an URLFactory then creates an
> URLSource.
This is true for 2.0.x, but not for 2.1 where the new source resolver
package from excalibur is used.
URLFactories are deprecated (starting with 2.1)
With this source resolving, the same implementation, URLSource I think,
is used. I guess the problem is that the current implementation of
the context: protocol does not use the WriteableSource implementation.
Carsten
Carsten Ziegeler
Open Source Group, S&N AG
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: SourceFactory considered harmful (Bug #15279)
Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Jeremy Quinn wrote:
>
> On Saturday, Dec 14, 2002, at 22:44 Europe/London, Sylvain Wallez wrote:
>
>> So I propose to strongly deprecate URLFactories (means @deprecate the
>> source and issue a warning in the logs if some are declared), and
>> rewrite existing implementations as SourceFactories.
>>
>> Thoughts ?
>
>
> You could well be right Sylvain .... but please keep in mind, when I
> re-factored SourceWritingTransformer (in 2.1) after Carsten's
> additions, this particular aspect (resolving the different Sources)
> was the bit I really did not understand very well! Are we sure that is
> is implemented correctly in SWT in the first place? (!!)
Well, this is not SWT-specific, since SWT just uses the SourceResolver
to get a Source. That's what happens inside the SourceResolver that
causes problems !
Sylvain
--
Sylvain Wallez Anyware Technologies
http://www.apache.org/~sylvain http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: SourceFactory considered harmful (Bug #15279)
Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On Saturday, Dec 14, 2002, at 22:44 Europe/London, Sylvain Wallez wrote:
> So I propose to strongly deprecate URLFactories (means @deprecate the
> source and issue a warning in the logs if some are declared), and
> rewrite existing implementations as SourceFactories.
>
> Thoughts ?
>
You could well be right Sylvain .... but please keep in mind, when I
re-factored SourceWritingTransformer (in 2.1) after Carsten's
additions, this particular aspect (resolving the different Sources) was
the bit I really did not understand very well! Are we sure that is is
implemented correctly in SWT in the first place? (!!)
regards Jeremy
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org