With the described approach you'll need two contexts, one to use each version (as the ServiceLoader will create one instance of the service for each).
Depending on the complexity of the differences, perhaps it can be configured with a single ApiMetadata and let Guice *provide* the right classes depending on the *apiVersion* (it can be configured when creating the context). jclouds-chef already does this to handle the deserialization of objects in different versions of the api [1] (see the peoviders at the end of the file). [1] https://github.com/jclouds/jclouds-chef/blob/master/core/src/main/java/org/jclouds/chef/config/ChefParserModule.java El 21/01/2014 19:13, "Andrew Phillips" <[email protected]> escribió: > If we start going down the path of breaking it out into glance-v1, >> glance-v2, and glance-common, we're going to see an explosion of >> OpenStack modules in jclouds as new versions of APIs are released in >> OpenStack land. >> > > I wasn't very clear in my original answer: I was under the impression that > the two versions cannot coexist simultaneously in the same context. If > there's no problem to have both of these loaded at the same time, then > let's definitely try to do that in one dependency! > > ap >
