Hi all, I'm currently looking at the SPI-Fly component again and rationalizing the SPI-Provider header. Currently the SPI-Provider header in the code base has two required attributes: provider-name and service-ids.
In the code I found the following comment: // Format of each path element: // api1Name;provider-name="myimpl2";service-ids="myserviceId" // An example below. // Please note: // 1. The service-ids attribute holds a list of ids that will be // used when searching META-INF/services/. In other words // this will be the name of the class that will be passed to // ServiceLoader.load(). // 2. A single bundle can provide implementations for many APIs // - there might be many api names in a single SPI-Provider // header. // Sample: // jaxb;provider-name="xerces123";service-ids="javax.xml.bind.JAXBContext" I'm a little puzzled by this. I can see that provider-name could be useful in that it would be an additional service property. In the sample above, what would the relation between service-ids and the initial 'jaxb' piece? Should it not be something like SPI-Provider: javax.xml.bind.JAXBContext;provider-name="xerces123" ? besides, JAXB is probably a bad example because JAXB doesn't follow the common pattern in that the files in META-INF/services/javax.xml.bind.JAXBContext don't list subclasses/implementations of JAXBContext. So anyway. I don't understand the function of 'service-ids' and I think that provider-name should be an optional attribute. So you could have the following headers (examples): SPI-Provider: javax.xml.parsers.DocumentBuilderFactory SPI-Provider: javax.xml.parsers.DocumentBuilderFactory;provider-name="Xerces 2.10" SPI-Provider: javax.xml.parsers.DocumentBuilderFactory,org.apache.xerces.jaxp.SAXParserFactory We could even go for a more generic approach that allows arbitrary service properties to be specified: SPI-Provider: javax.xml.parsers.DocumentBuilderFactory;properties="provider-name:Xerces 2.10;my-other-prop:foobar" I think we could also consider having a simple header: SPI-Provider: true which would inspect the META-INF/services directory and register services for all providers it finds there... Thoughts anyone? David
