org.jclouds.rest.internal
Class RestContextImpl<S,A>

java.lang.Object
  extended by org.jclouds.rest.internal.RestContextImpl<S,A>
All Implemented Interfaces:
Location, RestContext<S,A>

public class RestContextImpl<S,A>
extends Object
implements RestContext<S,A>

Author:
Adrian Cole

Constructor Summary
protected RestContextImpl(Closer closer, Map<String,Credentials> credentialStore, Utils utils, com.google.inject.Injector injector, com.google.inject.TypeLiteral<S> syncApi, com.google.inject.TypeLiteral<A> asyncApi, com.google.common.base.Supplier<URI> endpoint, String provider, String identity, String apiVersion, String buildVersion, Set<String> iso3166Codes)
           
 
Method Summary
 void close()
          Closes all connections to Cloud Files.
 Map<String,Credentials> credentialStore()
           
 boolean equals(Object obj)
           
 S getApi()
          reflects a tuned connection to the cloud which calls RestContext.getAsyncApi() with predetermined timeouts.
 String getApiVersion()
           
 A getAsyncApi()
          low-level api to the cloud.
 String getBuildVersion()
           
 Map<String,Credentials> getCredentialStore()
          retrieves a list of credentials for resources created within this context, keyed on id of the resource.
 String getDescription()
          Description of the location
 URI getEndpoint()
           
 String getId()
          Unique ID provided by the provider (us-standard, miami, etc)
 String getIdentity()
           
 Set<String> getIso3166Codes()
           
 Map<String,Object> getMetadata()
           
 Location getParent()
          The parent, or null, if top-level
 LocationScope getScope()
          Scope of the location, ex.
 Utils getUtils()
           
 int hashCode()
           
 String toString()
           
 Utils utils()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RestContextImpl

@Inject
protected RestContextImpl(Closer closer,
                                 Map<String,Credentials> credentialStore,
                                 Utils utils,
                                 com.google.inject.Injector injector,
                                 com.google.inject.TypeLiteral<S> syncApi,
                                 com.google.inject.TypeLiteral<A> asyncApi,
                                 com.google.common.base.Supplier<URI> endpoint,
                                 String provider,
                                 String identity,
                                 String apiVersion,
                                 String buildVersion,
                                 Set<String> iso3166Codes)
Method Detail

close

public void close()
Closes all connections to Cloud Files.

Specified by:
close in interface RestContext<S,A>
See Also:
Closer

getIdentity

public String getIdentity()
Specified by:
getIdentity in interface RestContext<S,A>

getAsyncApi

public A getAsyncApi()
Description copied from interface: RestContext
low-level api to the cloud. Threadsafe implementations will return a singleton.

Specified by:
getAsyncApi in interface RestContext<S,A>
Returns:
a connection to the cloud where all methods return Futures

getApi

public S getApi()
Description copied from interface: RestContext
reflects a tuned connection to the cloud which calls RestContext.getAsyncApi() with predetermined timeouts.

Specified by:
getApi in interface RestContext<S,A>
Returns:
a connection to the cloud where all methods block

getEndpoint

public URI getEndpoint()
Specified by:
getEndpoint in interface RestContext<S,A>

getUtils

public Utils getUtils()
Specified by:
getUtils in interface RestContext<S,A>

utils

public Utils utils()
Specified by:
utils in interface RestContext<S,A>
See Also:
RestContext.getUtils()

getApiVersion

public String getApiVersion()
Specified by:
getApiVersion in interface RestContext<S,A>
Returns:
version of the api presented by this service
See Also:
Constants.PROPERTY_API_VERSION

getBuildVersion

public String getBuildVersion()
Specified by:
getBuildVersion in interface RestContext<S,A>
Returns:
version of software this service is running
See Also:
Constants.PROPERTY_BUILD_VERSION

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

getCredentialStore

public Map<String,Credentials> getCredentialStore()
Description copied from interface: RestContext
retrieves a list of credentials for resources created within this context, keyed on id of the resource. We are testing this approach for resources such as compute nodes, where you could access this externally.

Specified by:
getCredentialStore in interface RestContext<S,A>

credentialStore

public Map<String,Credentials> credentialStore()
Specified by:
credentialStore in interface RestContext<S,A>

getDescription

public String getDescription()
Description copied from interface: Location
Description of the location

Specified by:
getDescription in interface Location

getId

public String getId()
Description copied from interface: Location
Unique ID provided by the provider (us-standard, miami, etc)

Specified by:
getId in interface Location

getIso3166Codes

public Set<String> getIso3166Codes()
Specified by:
getIso3166Codes in interface Location
Returns:
if known, the IS0 3166 or 3166-2 divisions where this service may run. ex. a set of strings like "US" or "US-CA"; otherwise returns an empty list.
See Also:
3166

getMetadata

public Map<String,Object> getMetadata()
Specified by:
getMetadata in interface Location
Returns:
immutable set of metadata relating to this location

getParent

public Location getParent()
Description copied from interface: Location
The parent, or null, if top-level

Specified by:
getParent in interface Location

getScope

public LocationScope getScope()
Description copied from interface: Location
Scope of the location, ex. region, zone, host

Specified by:
getScope in interface Location


Copyright © 2009-2012 jclouds. All Rights Reserved.