Hi Stefan this is definitely an interesting approach. I can see the potential, but so far I haven't really seen use cases (which doesn't mean there are non).
If I understand correctly, you do the matching based on the path which avoids the need of introducing an explicit concept of a tenant. On the other it requires you to have a corresponding resource or request. I assume for most of the use cases this works as they are request bound anyway. And even for background tasks you should have at least some resource. I guess this should be sufficient. I'm a little bit worried about the reliability, for example if a bundle providing a specifc SPI interface is currently not active, you get (temporarily) a different result. This might be fine as well. In general, I'm unsure :) this sounds useful, but of course complicates things and the general execution. Regards Carsten Stefan Seifert wrote > consider the following use case: > - an OSGi/Sling-based library provides a SPI interface > - applications of multiple tenants are deployed on the same instance > - each tenant uses a different content tree, e.g. /content/tenant1 and > /content/tenant2 > - each tenant's application wants to register a different implementation of > the SPI, to be applied on resource requests on the tenant's content subtree > - this affects not only one SPI but multiple SPIs > - we do not want to implement a > detect-the-matching-SPI-implementation-for-a-given resource for each library > again > - we want to have a configuration of the mapping tenant's resource path -> > SPI implementation in a central place and to be applied to all SPI > implementation of a tenant's application > > i've implemented a solution for this some months ago, it's currently part of > a wcm.io library. > documentation [1], source code [2] > > questions: > 1. do you have these use cases as well? (we had a lot of enterprise projects > where we needed exactly this in the last years) > 2. does it make sense to contribute it to sling? > 3. do you have better ideas for configuring the mapping or the implementation? > > stefan > > [1] http://wcm.io/sling/commons/context-aware-services.html > [2] > https://github.com/wcm-io/wcm-io-sling/tree/develop/commons/src/main/java/io/wcm/sling/commons/caservice > > > -- Carsten Ziegeler Adobe Research Switzerland cziege...@apache.org