I'm trying to replace some of Tuscany's service provider files, or in some cases remove them. I've been struggling with this for a while and thought I'd toss it out for discussion. Here are examples.
1) I want to replace the RequestContextFactory provider. Tuscany finds a provider file using ServiceDiscoverer.getServiceDeclaration(). As far as I can tell, when there are multiple provider files, both EquinoxServiceDiscoverer and ContextClassLoaderServiceDiscoverer pick the first one found and there's no way to control which one that will be. I think there needs to be some way to control order. Perhaps the service declaration should have a weight attribute and getServiceDeclaration() should pick the one with the highest weight. 2) I want to replace an implementation type in one of Tuscany's definitions file. Tuscany finds Definitions providers using ServiceDiscoverer.getServiceDeclarations(). Again, there's no way to control order, so here too a weight attribute might be useful. (PullTransformer already uses a "weight" attribute for a different purpose so it might have to be called something else.) The other problem is that Tuscany issues a warning when there are duplicate definitions. I think there would need to be some way to suppress that but I'm not sure how. I wouldn't want to lose the warning altogether because in some cases it might be useful. Also I wouldn't want application definitions to be able to replace system definitions, which could happen if we're not careful about this. 3) I want to eliminate certain Tuscany policy providers, for example JaasAuthenticationPolicyProviderFactory and JMSTokenAuthenticationPolicyProviderFactory, either because I have alternative providers or I don't want to support the function. However these providers are bundled with other classes I do need. I think in this case the simplest thing to do is to separate the policy functionality into another Tuscany bundle. Greg