Package org.jclouds

Class ContextBuilder


  • public class ContextBuilder
    extends Object
    Creates Context or Injector configured to an api and endpoint. Alternatively, this can be used to make a portable View of that api.
    ex. to build a Api on a particular endpoint using the typed interface
     api = ContextBuilder.newBuilder(new NovaApiMetadata())
                         .endpoint("http://10.10.10.10:5000/v2.0")
                         .credentials(user, pass)
                         .buildApi(NovaApi.class);
     

    ex. to build a View of a particular backend context, looked up by key.
     context = ContextBuilder.newBuilder("aws-s3")
                             .credentials(apikey, secret)
                             .buildView(BlobStoreContext.class);
     

    Assumptions

    Threadsafe objects will be bound as singletons to the Injector or Context provided.

    If no Modules are specified, the default logging and http transports will be installed.

    See Also:
    Context, View, ApiMetadata, ProviderMetadata
    • Field Detail

      • name

        protected com.google.common.base.Optional<String> name
      • providerMetadata

        protected com.google.common.base.Optional<ProviderMetadata> providerMetadata
      • providerId

        protected final String providerId
      • endpoint

        protected com.google.common.base.Optional<String> endpoint
      • identity

        protected com.google.common.base.Optional<String> identity
      • credentialsSupplierOption

        protected com.google.common.base.Optional<com.google.common.base.Supplier<Credentials>> credentialsSupplierOption
      • apiVersion

        protected String apiVersion
      • buildVersion

        protected String buildVersion
      • overrides

        protected com.google.common.base.Optional<Properties> overrides
      • modules

        protected List<com.google.inject.Module> modules