Bug 47720 - Find Catalogs using Service Provider Interface
Summary: Find Catalogs using Service Provider Interface
Status: NEW
Alias: None
Product: XmlCommons - Now in JIRA
Classification: Unclassified
Component: Resolver (show other bugs)
Version: 1.x
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Commons Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-21 03:00 UTC by Martin von Gagern
Modified: 2009-08-21 03:00 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2009-08-21 03:00:04 UTC
Developing apps would be greatly simplified if you could simply add some JAR to the classpath, and a Catalog as generated by the default CatalogManager would find the catalog within that JAR as well as the documents it references.

To achieve this, I believe a slightly modified version of the Service Provider Interface would be most suitable.
http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider describes that a file under META-INF/services/package.interface.Name should list qualified names of classes providing said interface.

To work with XML catalogs, you would specify a class name, but instead the name of a resource. So I think that you should have a file called "META-INF/services/org.apache.xml.resolver.catalog" which would contain lines like "my/company/catalog.xml". That catalog could then be located as a resource, auto-appended to the list of catalogs and parsed along with the system catalogs.

One could consider placing the catalog itself in the META-INF directory. That, however, would probably prevent it from being uniquely identified by its name alone, which might be useful if you want to deal with the catalog yourself, without using the full CatalogManager framework.