org.jclouds.cloudstack.config
Class CloudStackRestClientModule

java.lang.Object
  extended by com.google.inject.AbstractModule
      extended by org.jclouds.rest.config.RestClientModule<CloudStackClient,CloudStackAsyncClient>
          extended by org.jclouds.cloudstack.config.CloudStackRestClientModule
All Implemented Interfaces:
com.google.inject.Module

public class CloudStackRestClientModule
extends RestClientModule<CloudStackClient,CloudStackAsyncClient>

Configures the cloudstack connection.

Author:
Adrian Cole

Field Summary
static Map<Class<?>,Class<?>> DELEGATE_MAP
           
 
Fields inherited from class org.jclouds.rest.config.RestClientModule
asyncClientType, authException, delegates, syncClientType, URI_SUPPLIER_TYPE
 
Constructor Summary
CloudStackRestClientModule()
           
 
Method Summary
protected  AuthenticationFilter authenticationFilterForCredentialType(CredentialType credentialType, AddSessionKeyAndJSessionIdToRequest addSessionKeyAndJSessionIdToRequest, QuerySigner querySigner)
          we use the type of credentials specified at login to determine which way we want to filter the request.
protected  void bindAsyncClient()
           
protected  void bindClient()
           
protected  void bindErrorHandlers()
          overrides this to change the default error handlers for the http engine ex.
protected  void configure()
           
protected  com.google.common.base.Function<Credentials,LoginResponse> makeSureFilterRetriesOnTimeout(LoginWithPasswordCredentials loginWithPasswordCredentials)
           
 com.google.common.cache.LoadingCache<Credentials,LoginResponse> provideLoginResponseCache(com.google.common.base.Function<Credentials,LoginResponse> getLoginResponse, int seconds)
           
protected  com.google.common.base.Supplier<LoginResponse> provideLoginResponseSupplier(com.google.common.cache.LoadingCache<Credentials,LoginResponse> cache, Credentials creds)
           
 
Methods inherited from class org.jclouds.rest.config.RestClientModule
bindRetryHandlers, installLocations
 
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
 

Field Detail

DELEGATE_MAP

public static final Map<Class<?>,Class<?>> DELEGATE_MAP
Constructor Detail

CloudStackRestClientModule

public CloudStackRestClientModule()
Method Detail

bindAsyncClient

protected void bindAsyncClient()
Overrides:
bindAsyncClient in class RestClientModule<CloudStackClient,CloudStackAsyncClient>

bindClient

protected void bindClient()
Overrides:
bindClient in class RestClientModule<CloudStackClient,CloudStackAsyncClient>

configure

protected void configure()
Overrides:
configure in class RestClientModule<CloudStackClient,CloudStackAsyncClient>

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 RestClientModule<CloudStackClient,CloudStackAsyncClient>

authenticationFilterForCredentialType

@Provides
protected AuthenticationFilter authenticationFilterForCredentialType(CredentialType credentialType,
                                                                              AddSessionKeyAndJSessionIdToRequest addSessionKeyAndJSessionIdToRequest,
                                                                              QuerySigner querySigner)
we use the type of credentials specified at login to determine which way we want to filter the request.
for ex, if we are getting passwords, we know we will need to login/logout. Otherwise we are signing requests.


makeSureFilterRetriesOnTimeout

@Provides
protected com.google.common.base.Function<Credentials,LoginResponse> makeSureFilterRetriesOnTimeout(LoginWithPasswordCredentials loginWithPasswordCredentials)

provideLoginResponseCache

@Provides
public com.google.common.cache.LoadingCache<Credentials,LoginResponse> provideLoginResponseCache(com.google.common.base.Function<Credentials,LoginResponse> getLoginResponse,
                                                                                                          int seconds)

provideLoginResponseSupplier

@Provides
protected com.google.common.base.Supplier<LoginResponse> provideLoginResponseSupplier(com.google.common.cache.LoadingCache<Credentials,LoginResponse> cache,
                                                                                               Credentials creds)


Copyright © 2009-2012 jclouds. All Rights Reserved.