org.jclouds.s3.config
Class S3RestClientModule<S extends S3Client,A extends S3AsyncClient>

java.lang.Object
  extended by com.google.inject.AbstractModule
      extended by org.jclouds.rest.config.RestModule
          extended by org.jclouds.rest.config.RestClientModule<S,A>
              extended by org.jclouds.aws.config.AWSRestClientModule<S,A>
                  extended by org.jclouds.s3.config.S3RestClientModule<S,A>
All Implemented Interfaces:
com.google.inject.Module
Direct Known Subclasses:
AWSS3RestClientModule, WalrusRestClientModule

public class S3RestClientModule<S extends S3Client,A extends S3AsyncClient>
extends AWSRestClientModule<S,A>

Configures the S3 connection, including logging and http transport.

Author:
Adrian Cole

Field Summary
 
Fields inherited from class org.jclouds.rest.config.RestClientModule
asyncClientType, syncClientType
 
Fields inherited from class org.jclouds.rest.config.RestModule
authException, sync2Async, URI_SUPPLIER_TYPE
 
Constructor Summary
  S3RestClientModule()
           
protected S3RestClientModule(com.google.common.reflect.TypeToken<S> syncClientType, com.google.common.reflect.TypeToken<A> asyncClientType)
           
 
Method Summary
protected  void bindErrorHandlers()
          overrides this to change the default error handlers for the http engine ex.
protected  void bindRetryHandlers()
          overrides this to change the default retry handlers for the http engine ex.
protected  com.google.common.cache.LoadingCache<String,com.google.common.base.Optional<String>> bucketToRegion(com.google.common.cache.CacheLoader<String,com.google.common.base.Optional<String>> loader)
           
protected  com.google.common.cache.CacheLoader<String,com.google.common.base.Optional<String>> bucketToRegion(com.google.common.base.Supplier<Set<String>> regionSupplier, S3Client client)
           
protected  void configure()
           
protected  com.google.common.base.Supplier<String> defaultRegionForBucket(com.google.common.base.Supplier<String> defaultRegion)
           
protected  com.google.common.base.Supplier<URI> provideBucketURI(com.google.common.base.Supplier<String> defaultRegion, RegionToEndpointOrProviderIfNull regionToEndpoint)
           
protected  RequestSigner provideRequestSigner(RequestAuthorizeSignature in)
           
protected  String provideTimeStamp(com.google.common.base.Supplier<String> cache)
           
protected  com.google.common.base.Supplier<String> provideTimeStampCache(long seconds, DateService dateService)
          borrowing concurrency code to ensure that caching takes place properly
 
Methods inherited from class org.jclouds.rest.config.RestClientModule
bindAsyncClient, bindClient
 
Methods inherited from class org.jclouds.rest.config.RestModule
installLocations, seedAnnotationCache, timeouts
 
Methods inherited from class com.google.inject.AbstractModule
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

S3RestClientModule

public S3RestClientModule()

S3RestClientModule

protected S3RestClientModule(com.google.common.reflect.TypeToken<S> syncClientType,
                             com.google.common.reflect.TypeToken<A> asyncClientType)
Method Detail

bucketToRegion

@Provides
@Singleton
protected com.google.common.cache.CacheLoader<String,com.google.common.base.Optional<String>> bucketToRegion(com.google.common.base.Supplier<Set<String>> regionSupplier,
                                                                                                                                S3Client client)

bucketToRegion

@Provides
@Singleton
protected com.google.common.cache.LoadingCache<String,com.google.common.base.Optional<String>> bucketToRegion(com.google.common.cache.CacheLoader<String,com.google.common.base.Optional<String>> loader)

defaultRegionForBucket

@Provides
@Singleton
protected com.google.common.base.Supplier<String> defaultRegionForBucket(com.google.common.base.Supplier<String> defaultRegion)

provideBucketURI

@Provides
@Singleton
protected com.google.common.base.Supplier<URI> provideBucketURI(com.google.common.base.Supplier<String> defaultRegion,
                                                                                   RegionToEndpointOrProviderIfNull regionToEndpoint)

configure

protected void configure()
Overrides:
configure in class RestClientModule<S extends S3Client,A extends S3AsyncClient>

bindErrorHandlers

protected void bindErrorHandlers()
Description copied from class: RestClientModule
overrides this to change the default error handlers for the http engine ex.
 bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseAWSErrorFromXmlContent.class);
 bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseAWSErrorFromXmlContent.class);
 bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseAWSErrorFromXmlContent.class);
 

Overrides:
bindErrorHandlers in class AWSRestClientModule<S extends S3Client,A extends S3AsyncClient>

provideRequestSigner

@Provides
@Singleton
protected RequestSigner provideRequestSigner(RequestAuthorizeSignature in)

bindRetryHandlers

protected void bindRetryHandlers()
Description copied from class: RestClientModule
overrides this to change the default retry handlers for the http engine ex.
 bind(HttpRetryHandler.class).annotatedWith(Redirection.class).to(AWSRedirectionRetryHandler.class);
 bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(AWSClientErrorRetryHandler.class);
 

Overrides:
bindRetryHandlers in class AWSRestClientModule<S extends S3Client,A extends S3AsyncClient>

provideTimeStamp

@Provides
protected String provideTimeStamp(com.google.common.base.Supplier<String> cache)

provideTimeStampCache

@Provides
@Singleton
protected com.google.common.base.Supplier<String> provideTimeStampCache(@Named(value="jclouds.session-interval")
                                                                                           long seconds,
                                                                                           DateService dateService)
borrowing concurrency code to ensure that caching takes place properly



Copyright © 2009-2012 jclouds. All Rights Reserved.