I have added my modules like this
modules = ImmutableSet.<Module> builder()
.addAll(modules)
.add(new SwiftContextModule())
.build();
blobStoreContext = ContextBuilder.newBuilder(provider)
.overrides(properties)
.modules(modules)
.buildView(BlobStoreContext.class);
Since we are working on one or more providers, our context is generic
And SwiftContextModule looks somewhat like this
public class SwiftContextModule extends AbstractModule {
@Override
protected void configure() {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
bind(BlobStoreContext.class).to(RegionScopedBlobStoreContext.class);
install(new FactoryModuleBuilder().build(Factory.class));
bind(RegionScopedSwiftBlobStore.class).to(SwiftBlobStore.class);
}
interface Factory {
SwiftBlobStore create(String in);
}
@Provides
final Function<String, RegionScopedSwiftBlobStore>
blobStore(FactoryFunction in) {
return in;
}
static class FactoryFunction extends ForwardingObject implements
Function<String, RegionScopedSwiftBlobStore> {
@Inject
Factory delegate;
@Override
protected Factory delegate() {
return delegate;
}
@Override
public RegionScopedSwiftBlobStore apply(String in) {
return delegate.create(in);
}
}
}
On Monday, 13 February 2017, 15:20, Ignasi Barrera <[email protected]> wrote:
Could you share the code you use to get the blob store context? IIRC
when using the "region scoped" one you need to specify the region.
Something like:
RegionScopedBlobStoreContext ctx =
contextBuilder.buildView(RegionScopedBlobStoreContext.class); // with
your modules
BlobStore getBlobStore("regionId");
What region ids are returned if you call: ctx.getConfiguredRegions() ?
On 13 February 2017 at 10:33, Archana C <[email protected]> wrote:
> Hi
>
> We are trying to extend RegionScopedSwiftblobStore for our use case somewhat
> like
>
> public class SwiftBlobStore extends RegionScopedSwiftBlobStore{
> // Our Implementation
> }
>
> Compilation is successful, binding is not happening properly at the run time
>
> Error:
>
> 1) No implementation for java.lang.String annotated with
> @com.google.inject.assistedinject.Assisted(value=) was bound.
> while locating java.lang.String annotated with
> @com.google.inject.assistedinject.Assisted(value=)
> for parameter 4 at
> com.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>
> @Assisted is causing issue here. Is there anything that we need modify
> internally to avoid this error ?
>
> Regards
> Archana