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: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to