This is a general ticket for using servics allowing to access entities from multiple repositories in Wikibase client. Tickets for more specific implementations related tasks should be created as subtasks.
- ClientStore implementation is not changed,
- existing ClientStore implementation, ie. DirectSqlStore should be using dispatching versions of services instead of single-repo ones it uses now
- A new factory, ServiceMapFactory, should be created for providing maps of service instances for each service name. DirectSqlStore will for now use these service maps to create the dispatching service instance for each service name. [TBD: ServiceMapFactory could have the knowledge/wiring for constructing the dispatchign services from the maps!]
- This factory would have a public interface partly reminding the one of ServiceContainer, ie. it would have a generic method getServiceMap (name is subject to change) returning a map in form [ repoName => service ] of services configured for particular repository.
- It could also have convenience getters for particular services [probably not needed, since this class is used only from inside DirectSqlStore].
- This factory has access to configuration of each foreign repository (what repos are configured, what are DB names, URLs etc).
- ServiceMapFactory will know one ServiceContainer for each repo. When asked for the service map for service "foo", it will construct the map by asking each service container for the service "foo".
- The ServiceContainer container will use a wiring file for instantiating the per-repo services. The instantiator functions in the wiring file need access to the configuration setting describing the target repository.
- services that return entities coming from a foreign repo, in particular implementations of EntityRevisionLookup, must apply the correct ID mapping for that repo during deserialization.
- for managing a set of service instances for a given repo, consider using a ServiceContainer. We should consider changing WikibaseClient to use core's new ServiceContainer mechanism alltogether.
- the ability to load e.g. labels for entities on another repo will be needed by repo code, not just client code. We will have to re-consider the relationship between repo and client once more.
- in the long run, WikibaseClient should also become a ServiceContainer but this is something which out of scope of this task