jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Archana C <carchan...@yahoo.co.uk>
Subject Re: Extending RegionScopedSwiftBlobStore
Date Tue, 14 Feb 2017 09:55:16 GMT
Adding .add(SwiftBlobStoreContextModule.class) as mentioned in [1] always return RegionScopedSwiftBlobstore,
even if have SwiftBlobStore (SwiftBlobStore extends RegionScopedSwiftBlobStore)
Is there a way to remove SwiftBlobStoreContextModule from the default module and add a custom
module instead.
We are facing lot of issues in extending RegionScopedSwiftBlobStore.

[1] https://github.com/jclouds/jclouds/blob/ac2f746e64821878f157ba4b1c12675286ccc8e1/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/SwiftApiMetadata.java

RegardsArchana
 


    On Tuesday, 14 February 2017, 7:09, Archana C <carchana36@yahoo.co.uk> wrote:
 

 Making the bind as singleton made my class visible instead of RegionScopedSwiftBlobStore
Again the problem comes is this

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 jclouds20.SwiftBlobStore.<init>(SwiftBlobStore.java:43)
  at jclouds20.Module1.configure(Module1.java:11)


public class App 
{
    private static final String CONTAINER_NAME = "arctestMP";
    private static final String OBJECT_NAME = "arc";
    static byte[][] etagMap = null;

    public static void main( String[] args ) throws IOException 
    {
         Iterable<? extends Module> modules = ImmutableSet.<Module> builder()     

                 .add(new Module1())
                 .build();
        Properties overrides = new Properties();
        RegionScopedBlobStoreContext context = ContextBuilder.newBuilder("openstack-swift")
                .endpoint("http://x.xx.xx.xx:5000/v2.0")
                .credentials("xxx:xxx", "xxx")
                .overrides(overrides)
                .modules(modules)
                .buildView(RegionScopedBlobStoreContext.class);
        BlobStore blobStore = context.getBlobStore("mcstore");

        blobStore.createContainerInLocation(null, CONTAINER_NAME);
        Path path = Paths.get("/home/archupsg03/test_dir/sample2");
        File f = new File("/home/archupsg03/Downloads/sample2");
        byte []byteArray =  Files.readAllBytes(path);
        Payload payload = newByteSourcePayload(wrap(byteArray));
        PutOptions opt = new PutOptions();
        opt.multipart();

        ExecutorService customExecutor = Executors.newFixedThreadPool(1);
        ListeningExecutorService listeningExecutor = MoreExecutors.listeningDecorator(customExecutor);
        opt.setCustomExecutor(listeningExecutor);
        
        Blob blob = blobStore.blobBuilder(OBJECT_NAME)
                .payload(payload).contentLength(f.length())
                .build();
        String etag =  blobStore.putBlob(CONTAINER_NAME, blob, opt);
        System.out.println(etag);}}
public class Module1 extends AbstractModule{
    @Override
    protected void configure() {
        bind(RegionScopedSwiftBlobStore.class).to(SwiftBlobStore.class).in(Scopes.SINGLETON);
    }
}
public class SwiftBlobStore extends RegionScopedSwiftBlobStore {

    @Inject
    protected SwiftBlobStore(Injector baseGraph, BlobStoreContext context, SwiftApi api,
            @Memoized Supplier<Set<? extends Location>> locations, @Assisted
String regionId, PayloadSlicer slicer,
            @Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor)
{
        super(baseGraph, context, api, locations, regionId, slicer, userExecutor);
        
        // TODO Auto-generated constructor stub
    }}
Call to the super constructor is throwing the error > I kindly request you consider the
above issue.


RegardsArchana
 

    On Monday, 13 February 2017, 22:18, Archana C <carchana36@yahoo.co.uk> wrote:
 

 Here is the complete source code of very simple usage of API's

public class App 
{
    private static final String CONTAINER_NAME = "arctestMP1";
    private static final String OBJECT_NAME = "arc";


    public static void main( String[] args ) throws IOException 
    {
        Iterable<Module> modules = ImmutableSet.<Module>of(
                new Module1());
        Properties overrides = new Properties();
        BlobStoreContext context = ContextBuilder.newBuilder("openstack-swift")
                .endpoint("http://x.xx.xx.xx:5000/v2.0")
                .credentials("xxx:xxx", "xxx")
                .overrides(overrides)
                .modules(modules)
                .buildView(BlobStoreContext.class);
        BlobStore blobStore = context.getBlobStore();
        blobStore.createContainerInLocation(null, CONTAINER_NAME);
        Path path = Paths.get("/home/archu/test_dir/test2");
        File f = new File("/home/archu/Downloads/test2");
        byte []byteArray =  Files.readAllBytes(path);
        Payload payload = newByteSourcePayload(wrap(byteArray));
        PutOptions opt = new PutOptions();
        opt.multipart();
        Blob blob = blobStore.blobBuilder(OBJECT_NAME)
                .payload(payload).contentLength(f.length())
                .build();
        String etag =  blobStore.putBlob(CONTAINER_NAME, blob, opt);
        System.out.println(etag);}}
Custom Module
import org.jclouds.openstack.swift.v1.blobstore.RegionScopedSwiftBlobStore;

import com.google.inject.AbstractModule;

public class Module1 extends AbstractModule{
    protected void configure() {
        bind(RegionScopedSwiftBlobStore.class).to(SwiftBlobStore.class);
    }
}
Custom BlobStore

import java.util.Set;

import javax.inject.Inject;

import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.domain.Location;
import org.jclouds.io.PayloadSlicer;
import org.jclouds.openstack.swift.v1.SwiftApi;
import org.jclouds.openstack.swift.v1.blobstore.RegionScopedSwiftBlobStore;

import com.google.common.base.Supplier;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.inject.Injector;

public class SwiftBlobStore extends RegionScopedSwiftBlobStore {

    @Inject
    protected SwiftBlobStore(Injector baseGraph, BlobStoreContext context, SwiftApi api,
            @Memoized Supplier<Set<? extends Location>> locations, String
regionId, PayloadSlicer slicer,
            @Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor)
{
        super(baseGraph, context, api, locations, regionId, slicer, userExecutor);
        System.out.println("Hi");
        // TODO Auto-generated constructor stub
    }
    
     @Override
       public MultipartUpload initiateMultipartUpload(String container, BlobMetadata
blobMetadata, PutOptions options) {
          if (options.getBlobAccess() != BlobAccess.PRIVATE) {
             throw new UnsupportedOperationException("blob ACLs not supported in
swift");
          }
          return initiateMultipartUpload(container, blobMetadata, 0, options);
       }

       private MultipartUpload initiateMultipartUpload(String container, BlobMetadata
blobMetadata, long partSize, PutOptions options) {
          Long contentLength = blobMetadata.getContentMetadata().getContentLength();
          String uploadId = String.format("%s/slo/%.6f/%s/%s", blobMetadata.getName(),
                  System.currentTimeMillis() / 1000.0, contentLength == null
? Long.valueOf(0) : contentLength,
                  partSize);
          return MultipartUpload.create(container, blobMetadata.getName(), uploadId,
blobMetadata, options);
       }
    
    protected String putMultipartBlob(String container, Blob blob, PutOptions overrides,
ListeningExecutorService executor) {
          ArrayList<ListenableFuture<MultipartPart>> parts = new ArrayList<ListenableFuture<MultipartPart>>();

          long contentLength = checkNotNull(blob.getMetadata().getContentMetadata().getContentLength(),
                "must provide content-length to use multi-part upload");
          MultipartUploadSlicingAlgorithm algorithm = new MultipartUploadSlicingAlgorithm(
                getMinimumMultipartPartSize(), getMaximumMultipartPartSize(),
getMaximumNumberOfParts());
          long partSize = algorithm.calculateChunkSize(contentLength);
          MultipartUpload mpu = initiateMultipartUpload(container, blob.getMetadata(),
partSize, overrides);
          int partNumber = 0;

          for (Payload payload : slicer.slice(blob.getPayload(), partSize)) {
             BlobUploader b =
                   new BlobUploader(mpu, partNumber++, payload);
             parts.add(executor.submit(b));
          }

          return completeMultipartUpload(mpu, Futures.getUnchecked(Futures.allAsList(parts)));
       }
    
    @Override
       public long getMinimumMultipartPartSize() {
          return 5242880L ;
       }

       @Override
       public long getMaximumMultipartPartSize() {
          return 33554432L;
       }

       @Override
       public int getMaximumNumberOfParts() {
          return Integer.MAX_VALUE;
       }
       
       private final class BlobUploader implements Callable<MultipartPart> {
              private final MultipartUpload mpu;
              private final int partNumber;
              private final Payload payload;

              BlobUploader(MultipartUpload mpu, int partNumber, Payload payload)
{
                 this.mpu = mpu;
                 this.partNumber = partNumber;
                 this.payload = payload;
              }

              
              public MultipartPart call() {
                 return uploadMultipartPart(mpu, partNumber, payload);
              }
           }

}
The above code compiles without any error. But binding to custom class is not happening 



RegardsArchana 

    On Monday, 13 February 2017, 19:51, Archana C <carchana36@yahoo.co.uk> wrote:
 

 Sure I have place the entire code here
 Properties properties = new Properties();

    public static void main( String[] args ) throws IOException
    {
        //Context Creation             modules = ImmutableSet.<Module>
builder()
                            .addAll(modules)
                            .add(new SwiftContextModule())
                            .build();         RegionScopedSwiftBlobStore
blobStoreContextRegion = ContextBuilder.newBuilder("openstack-swift")
                    .overrides(properties)                   
.modules(modules). credentials("XXXX:XXXX", "XXXX")                     
.buildView(RegionScopedBlobStoreContext.class);           
BlobStore store = blobStoreContextRegion.getBlobStore("region1");store.createContainerInLocation(null,
CONTAINER_NAME);}


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(ICStoreSwiftBlobStore.class);
       }}
I have no other guice bindings
RegardsArchana 

    On Monday, 13 February 2017, 19:37, Ignasi Barrera <nacx@apache.org> wrote:
 

 There are missing pieces here. The error you get is because there are
classes that are not bound to the context, but if everything is
configured as you described it shouldn't happen.

The openstack-swift provider already defines these modules [1] that
configure the bindings that your stacktraces say are missing, so there
is something that is not properly configured.

Please, could you paste *ALL* the code you use to create the context,
including variables (just replace the credentials), modules, and
entire code of any custom guice module you have, so I can have a clear
understanding of what you are defining?


[1] https://github.com/jclouds/jclouds/blob/master/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/SwiftApiMetadata.java#L88-L94

On 13 February 2017 at 14:52, Archana C <carchana36@yahoo.co.uk> wrote:
> My current module looks like
>
> 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);
>        }
> }
>
> Error :
>
> Caused by: com.google.inject.CreationException: Guice creation errors:
>
> 1) No implementation for com.google.common.base.Supplier<java.util.Set<?
> extends org.jclouds.domain.Location>> annotated with
> @org.jclouds.collect.Memoized() was bound.
>  while locating com.google.common.base.Supplier<java.util.Set<? extends
> org.jclouds.domain.Location>> annotated with @org.jclouds.collect.Memoized()
>    for parameter 3 at
> com.modules.ICStoreSwiftBlobStore.<init>(ICStoreSwiftBlobStore.java:129)
>  at
> com.modules.SwiftContextModule.configure(ICStoreSwiftContextModule.java:33)
>
> 2) No implementation for com.google.common.reflect.TypeToken<? extends
> org.jclouds.Context> annotated with @org.jclouds.location.Provider() was
> bound.
>  while locating com.google.common.reflect.TypeToken<? extends
> org.jclouds.Context> annotated with @org.jclouds.location.Provider()
>    for parameter 1 at
> org.jclouds.blobstore.internal.BlobStoreContextImpl.<init>(BlobStoreContextImpl.java:46)
>  while locating org.jclouds.blobstore.BlobStoreContext
>    for parameter 1 at
> com.ibm.icstore.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>  at
> com.ibm.icstore.modules.ICStoreSwiftContextModule.configure(SwiftContextModule.java:33)
>
> 3) No implementation for
> com.google.common.util.concurrent.ListeningExecutorService annotated with
> @com.google.inject.name.Named(value=jclouds.user-threads) was bound.
>  while locating com.google.common.util.concurrent.ListeningExecutorService
> annotated with @com.google.inject.name.Named(value=jclouds.user-threads)
>    for parameter 6 at
> com.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>
> 4) 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)
>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>
> 5) No implementation for java.lang.String annotated with
> @com.google.inject.name.Named(value=jclouds.payloads.pretty-print) was
> bound.
>  while locating java.lang.String annotated with
> @com.google.inject.name.Named(value=jclouds.payloads.pretty-print)
>    for parameter 0 at
> org.jclouds.xml.internal.JAXBParser.<init>(JAXBParser.java:48)
>  while locating org.jclouds.xml.XMLParser
>    for parameter 2 at
> org.jclouds.rest.internal.UtilsImpl.<init>(UtilsImpl.java:52)
>  while locating org.jclouds.rest.Utils
>    for parameter 2 at
> org.jclouds.blobstore.internal.BlobStoreContextImpl.<init>(BlobStoreContextImpl.java:46)
>  while locating org.jclouds.blobstore.BlobStoreContext
>    for parameter 1 at
> com.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>
> 6) No implementation for java.util.Map<java.lang.String,
> org.jclouds.domain.Credentials> was bound.
>  while locating java.util.Map<java.lang.String,
> org.jclouds.domain.Credentials>
>    for parameter 7 at
> org.jclouds.rest.internal.UtilsImpl.<init>(UtilsImpl.java:52)
>  while locating org.jclouds.rest.Utils
>    for parameter 2 at
> org.jclouds.blobstore.internal.BlobStoreContextImpl.<init>(BlobStoreContextImpl.java:46)
>  while locating org.jclouds.blobstore.BlobStoreContext
>    for parameter 1 at
> com.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>
> 7) No implementation for org.jclouds.Context annotated with
> @org.jclouds.location.Provider() was bound.
>  while locating org.jclouds.Context annotated with
> @org.jclouds.location.Provider()
>    for parameter 0 at
> org.jclouds.blobstore.internal.BlobStoreContextImpl.<init>(BlobStoreContextImpl.java:46)
>  while locating org.jclouds.blobstore.BlobStoreContext
>    for parameter 1 at
> com.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>
> 8) No implementation for org.jclouds.blobstore.BlobStore was bound.
>  while locating org.jclouds.blobstore.BlobStore
>    for parameter 4 at
> org.jclouds.blobstore.internal.BlobStoreContextImpl.<init>(BlobStoreContextImpl.java:46)
>  while locating org.jclouds.blobstore.BlobStoreContext
>    for parameter 1 at
> com.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>
> 9) No implementation for org.jclouds.blobstore.attr.ConsistencyModel was
> bound.
>  while locating org.jclouds.blobstore.attr.ConsistencyModel
>    for parameter 3 at
> org.jclouds.blobstore.internal.BlobStoreContextImpl.<init>(BlobStoreContextImpl.java:46)
>  while locating org.jclouds.blobstore.BlobStoreContext
>    for parameter 1 at
> com.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>
> 10) No implementation for org.jclouds.json.Json was bound.
>  while locating org.jclouds.json.Json
>    for parameter 1 at
> org.jclouds.rest.internal.UtilsImpl.<init>(UtilsImpl.java:52)
>  while locating org.jclouds.rest.Utils
>    for parameter 2 at
> org.jclouds.blobstore.internal.BlobStoreContextImpl.<init>(BlobStoreContextImpl.java:46)
>  while locating org.jclouds.blobstore.BlobStoreContext
>    for parameter 1 at
> com.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>  at
> com.modules.ICStoreSwiftContextModule.configure(SwiftContextModule.java:33)
>
> 11) No implementation for org.jclouds.logging.Logger$LoggerFactory was
> bound.
>  while locating org.jclouds.logging.Logger$LoggerFactory
>    for parameter 8 at
> org.jclouds.rest.internal.UtilsImpl.<init>(UtilsImpl.java:52)
>  while locating org.jclouds.rest.Utils
>    for parameter 2 at
> org.jclouds.blobstore.internal.BlobStoreContextImpl.<init>(BlobStoreContextImpl.java:46)
>  while locating org.jclouds.blobstore.BlobStoreContext
>    for parameter 1 at
> com.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>
> 12) No implementation for org.jclouds.openstack.swift.v1.SwiftApi was bound.
>  while locating org.jclouds.openstack.swift.v1.SwiftApi
>    for parameter 2 at
> com.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>
> 13) No implementation for org.jclouds.rest.HttpClient was bound.
>  while locating org.jclouds.rest.HttpClient
>    for parameter 3 at
> org.jclouds.rest.internal.UtilsImpl.<init>(UtilsImpl.java:52)
>  while locating org.jclouds.rest.Utils
>    for parameter 2 at
> org.jclouds.blobstore.internal.BlobStoreContextImpl.<init>(BlobStoreContextImpl.java:46)
>  while locating org.jclouds.blobstore.BlobStoreContext
>    for parameter 1 at
> com.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>
>
>
> On Monday, 13 February 2017, 18:58, Ignasi Barrera <nacx@apache.org> wrote:
>
>
> Can you try changing your module to just define this binding? Remove all
> others.
>
> bind(RegionScopedSwiftBlobStore.class).to(SwiftBlobStore.class);
>
> On 13 February 2017 at 13:26, Archana C <carchana36@yahoo.co.uk> wrote:
>>
>> 'openstack-swift' is the keyword used for creating context and jClouds-2.0
>> is the version we are using
>>
>> Is this a bug or are we missing things ?
>>
>> Regards
>> Archana
>>
>>
>> On Monday, 13 February 2017, 17:09, Ignasi Barrera <nacx@apache.org>
>> wrote:
>>
>>
>> Are you using "openstack-swift" as the provider string when creating
>> the context?
>>
>> On 13 February 2017 at 12:26, Archana C <carchana36@yahoo.co.uk> wrote:
>>> Yeah, jclouds 2.0 is the version we are using
>>>
>>> Regards
>>> Archana
>>>
>>>
>>> On Monday, 13 February 2017, 16:55, Ignasi Barrera <nacx@apache.org>
>>> wrote:
>>>
>>>
>>> Which version of jclouds are you using?
>>> Are you using "openstack-swift" as the provider string when creating
>>> the context?
>>>
>>> On 13 February 2017 at 12:12, Archana C <carchana36@yahoo.co.uk> wrote:
>>>> RegionScopedBlobStoreContext blobStoreContextRegion =
>>>> ContextBuilder.newBuilder(provider)
>>>>                    .overrides(properties)
>>>>                    .modules(modules)
>>>>                    .buildView(RegionScopedBlobStoreContext.class);
>>>>
>>>> BlobStore store = blobStoreContextRegion.getBlobStore(region);
>>>>
>>>> we are using SwiftContextModule that extends Abstract module
>>>>
>>>> public class SwiftContextModule  extends AbstractModule {
>>>>
>>>>    @Override
>>>>        protected void configure() {
>>>>
>>>> bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
>>>>
>>>> bind(BlobStoreContext.class).to(RegionScopedBlobStoreContext.class);
>>>>
>>>> bind(RegionScopedSwiftBlobStore.class).to(SwiftBlobStore.class);
>>>>        }
>>>> }
>>>>
>>>> The bolded lines are causing errors saying No Implementation Found
>>>>
>>>> 1) No implementation for
>>>> com.google.common.base.Function<java.lang.String,
>>>> org.jclouds.blobstore.BlobRequestSigner> was bound.
>>>>  while locating com.google.common.base.Function<java.lang.String,
>>>> org.jclouds.blobstore.BlobRequestSigner>
>>>>    for parameter 5 at
>>>>
>>>>
>>>>
>>>> org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext.<init>(RegionScopedBlobStoreContext.java:106)
>>>>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:31)
>>>>
>>>> 2) No implementation for
>>>> com.google.common.base.Function<java.lang.String,
>>>> org.jclouds.blobstore.BlobStore> was bound.
>>>>  while locating com.google.common.base.Function<java.lang.String,
>>>> org.jclouds.blobstore.BlobStore>
>>>>    for parameter 4 at
>>>>
>>>>
>>>>
>>>> org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext.<init>(RegionScopedBlobStoreContext.java:106)
>>>>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:31)
>>>>
>>>> 3) No implementation for
>>>> com.google.common.base.Supplier<java.lang.String>
>>>> annotated with @org.jclouds.location.Region() was bound.
>>>>  while locating com.google.common.base.Supplier<java.lang.String>
>>>> annotated
>>>> with @org.jclouds.location.Region()
>>>>    for parameter 3 at
>>>>
>>>>
>>>>
>>>> org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext.<init>(RegionScopedBlobStoreContext.java:106)
>>>>  at com.modules.SwiftContextModule.configure(ContextModule.java:31)
>>>>
>>>> 4) No implementation for com.google.common.base.Supplier<java.util.Set<?
>>>> extends org.jclouds.domain.Location>> annotated with
>>>> @org.jclouds.collect.Memoized() was bound.
>>>>  while locating com.google.common.base.Supplier<java.util.Set<? extends
>>>> org.jclouds.domain.Location>> annotated with
>>>> @org.jclouds.collect.Memoized()
>>>>    for parameter 3 at
>>>> com.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>>>>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>>>>
>>>> 5) No implementation for
>>>> com.google.common.base.Supplier<java.util.Set<java.lang.String>>
>>>> annotated
>>>> with @org.jclouds.location.Region() was bound.
>>>>  while locating
>>>> com.google.common.base.Supplier<java.util.Set<java.lang.String>>
>>>> annotated
>>>> with @org.jclouds.location.Region()
>>>>    for parameter 2 at
>>>>
>>>>
>>>>
>>>> org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext.<init>(RegionScopedBlobStoreContext.java:106)
>>>>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:31)
>>>>
>>>> 6) No implementation for com.google.common.reflect.TypeToken<? extends
>>>> org.jclouds.Context> annotated with @org.jclouds.location.Provider() was
>>>> bound.
>>>>  while locating com.google.common.reflect.TypeToken<? extends
>>>> org.jclouds.Context> annotated with @org.jclouds.location.Provider()
>>>>    for parameter 1 at
>>>>
>>>>
>>>>
>>>> org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext.<init>(RegionScopedBlobStoreContext.java:106)
>>>>  at commodules.SwiftContextModule.configure(SwiftContextModule.java:31)
>>>>
>>>> 7) No implementation for
>>>> com.google.common.util.concurrent.ListeningExecutorService annotated
>>>> with
>>>> @com.google.inject.name.Named(value=jclouds.user-threads) was bound.
>>>>  while locating
>>>> com.google.common.util.concurrent.ListeningExecutorService
>>>> annotated with @com.google.inject.name.Named(value=jclouds.user-threads)
>>>>    for parameter 6 at
>>>> com.ibm.icstore.modules.SwiftBlobStore.<init>(SwiftBlobStore.java:129)
>>>>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>>>>
>>>> 8) 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.ibm.icstore.modules.ICStoreSwiftBlobStore.<init>(SwiftBlobStore.java:129)
>>>>  at
>>>>
>>>>
>>>>
>>>> com.ibm.icstore.modules.SwiftContextModule.configure(SwiftContextModule.java:33)
>>>>
>>>> 9) No implementation for java.lang.String annotated with
>>>> @com.google.inject.name.Named(value=jclouds.payloads.pretty-print) was
>>>> bound.
>>>>  while locating java.lang.String annotated with
>>>> @com.google.inject.name.Named(value=jclouds.payloads.pretty-print)
>>>>    for parameter 0 at
>>>> org.jclouds.xml.internal.JAXBParser.<init>(JAXBParser.java:48)
>>>>  while locating org.jclouds.xml.XMLParser
>>>>    for parameter 2 at
>>>> org.jclouds.rest.internal.UtilsImpl.<init>(UtilsImpl.java:52)
>>>>  while locating org.jclouds.rest.Utils
>>>>    for parameter 6 at
>>>>
>>>>
>>>>
>>>> org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext.<init>(RegionScopedBlobStoreContext.java:106)
>>>>  at com.modules.SwiftContextModule.configure(SwiftContextModule.java:31)
>>>>
>>>> 10) No implementation for java.util.Map<java.lang.String,
>>>> org.jclouds.domain.Credentials> was bound.
>>>>  while locating java.util.Map<java.lang.String,
>>>> org.jclouds.domain.Credentials>
>>>>    for parameter 7 at
>>>> org.jclouds.rest.internal.UtilsImpl.<init>(UtilsImpl.java:52)
>>>>  while locating org.jclouds.rest.Utils
>>>>    for parameter 6 at
>>>>
>>>>
>>>>
>>>> org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext.<init>(RegionScopedBlobStoreContext.java:106)
>>>>  at
>>>>
>>>>
>>>>
>>>> com.modules.ICStoreSwiftContextModule.configure(SwiftContextModule.java:31)
>>>>
>>>> 11) No implementation for org.jclouds.Context annotated with
>>>> @org.jclouds.location.Provider() was bound.
>>>>  while locating org.jclouds.Context annotated with
>>>> @org.jclouds.location.Provider()
>>>>    for parameter 0 at
>>>>
>>>>
>>>>
>>>> org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext.<init>(RegionScopedBlobStoreContext.java:106)
>>>>  at
>>>>
>>>>
>>>>
>>>> com.modules.ICStoreSwiftContextModule.configure(SwiftContextModule.java:31)
>>>>
>>>> 12) No implementation for org.jclouds.json.Json was bound.
>>>>  while locating org.jclouds.json.Json
>>>>    for parameter 1 at
>>>> org.jclouds.rest.internal.UtilsImpl.<init>(UtilsImpl.java:52)
>>>>  while locating org.jclouds.rest.Utils
>>>>    for parameter 6 at
>>>>
>>>>
>>>>
>>>> org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext.<init>(RegionScopedBlobStoreContext.java:106)
>>>>  at
>>>>
>>>>
>>>>
>>>> com.modules.ICStoreSwiftContextModule.configure(SwiftContextModule.java:31)
>>>>
>>>> 13) No implementation for org.jclouds.logging.Logger$LoggerFactory was
>>>> bound.
>>>>  while locating org.jclouds.logging.Logger$LoggerFactory
>>>>    for parameter 8 at
>>>> org.jclouds.rest.internal.UtilsImpl.<init>(UtilsImpl.java:52)
>>>>  while locating org.jclouds.rest.Utils
>>>>    for parameter 6 at
>>>>
>>>>
>>>>
>>>> org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext.<init>(RegionScopedBlobStoreContext.java:106)
>>>>  at
>>>> com.ibm.ICStoreSwiftContextModule.configure(SwiftContextModule.java:31)
>>>>
>>>> 14) No implementation for org.jclouds.openstack.swift.v1.SwiftApi was
>>>> bound.
>>>>  while locating org.jclouds.openstack.swift.v1.SwiftApi
>>>>    for parameter 2 at
>>>>
>>>>
>>>>
>>>> com.ibm.icstore.modules.ICStoreSwiftBlobStore.<init>(ICStoreSwiftBlobStore.java:129)
>>>>  at
>>>>
>>>>
>>>>
>>>> com.ibm.icstore.modules.ICStoreSwiftContextModule.configure(SwiftContextModule.java:33)
>>>>
>>>> 15) No implementation for org.jclouds.rest.HttpClient was bound.
>>>>  while locating org.jclouds.rest.HttpClient
>>>>    for parameter 3 at
>>>> org.jclouds.rest.internal.UtilsImpl.<init>(UtilsImpl.java:52)
>>>>  while locating org.jclouds.rest.Utils
>>>>    for parameter 6 at
>>>>
>>>>
>>>>
>>>> org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext.<init>(RegionScopedBlobStoreContext.java:106)
>>>>  at
>>>>
>>>>
>>>>
>>>> com.modules.ICStoreSwiftContextModule.configure(SwiftContextModule.java:31)
>>>>
>>>>
>>>> Not able to proceed further
>>>>
>>>>
>>>>
>>>> On Monday, 13 February 2017, 16:30, Ignasi Barrera <nacx@apache.org>
>>>> wrote:
>>>>
>>>>
>>>> The mode might fail when you call getBlobStore() or
>>>> getBlobStore(region).
>>>>
>>>> Could you paste the code you use to create the context *and* to get
>>>> the BlobStore?
>>>> What if you cast to your SwiftBlobStore?
>>>>
>>>> On 13 February 2017 at 11:44, Archana C <carchana36@yahoo.co.uk> wrote:
>>>>> ctx.getConfiguredRegions()  - Returns the exact region from swift
>>>>>
>>>>> Casting regionScopedBlobStore to BlobStore also works.
>>>>>
>>>>> Our requirement is to use CustomRegionScopedSwiftBlobStore instead of
>>>>> RegionScopedSwiftBlobStore
>>>>>
>>>>>
>>>>> Regards
>>>>> Archana
>>>>>
>>>>>
>>>>> On Monday, 13 February 2017, 16:04, Ignasi Barrera <nacx@apache.org>
>>>>> wrote:
>>>>>
>>>>>
>>>>> What region ids are returned if you call: ctx.getConfiguredRegions()
?
>>>>> And if you try casting the context, and pass a specific region, do you
>>>>> still get the failure?
>>>>>
>>>>> On 13 February 2017 at 11:04, Archana C <carchana36@yahoo.co.uk>
wrote:
>>>>>> 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 <nacx@apache.org>
>>>>>> 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 <carchana36@yahoo.co.uk>
>>>>>> 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
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


   

   

   

   
Mime
View raw message