Search in sources :

Example 1 with InternalUrlModule

use of org.jclouds.openstack.v2_0.config.InternalUrlModule in project druid by druid-io.

the class CloudFilesStorageDruidModule method getCloudFilesApi.

@Provides
@LazySingleton
public CloudFilesApi getCloudFilesApi(final CloudFilesAccountConfig config) {
    log.info("Building Cloud Files Api...");
    Iterable<com.google.inject.Module> modules = null;
    if (config.getUseServiceNet()) {
        log.info("Configuring Cloud Files Api to use the internal service network...");
        modules = ImmutableSet.<com.google.inject.Module>of(new SLF4JLoggingModule(), new InternalUrlModule());
    } else {
        log.info("Configuring Cloud Files Api to use the public network...");
        modules = ImmutableSet.<com.google.inject.Module>of(new SLF4JLoggingModule());
    }
    ProviderRegistry.registerProvider(CloudFilesUSProviderMetadata.builder().build());
    ProviderRegistry.registerProvider(CloudFilesUKProviderMetadata.builder().build());
    ContextBuilder cb = ContextBuilder.newBuilder(config.getProvider()).credentials(config.getUserName(), config.getApiKey()).modules(modules);
    CloudFilesApi cfa = cb.buildApi(CloudFilesApi.class);
    log.info("Cloud Files Api built.");
    return cfa;
}
Also used : InternalUrlModule(org.jclouds.openstack.v2_0.config.InternalUrlModule) SLF4JLoggingModule(org.jclouds.logging.slf4j.config.SLF4JLoggingModule) ContextBuilder(org.jclouds.ContextBuilder) CloudFilesApi(org.jclouds.rackspace.cloudfiles.v1.CloudFilesApi) Module(com.fasterxml.jackson.databind.Module) SLF4JLoggingModule(org.jclouds.logging.slf4j.config.SLF4JLoggingModule) InternalUrlModule(org.jclouds.openstack.v2_0.config.InternalUrlModule) DruidModule(io.druid.initialization.DruidModule) LazySingleton(io.druid.guice.LazySingleton) Provides(com.google.inject.Provides)

Aggregations

Module (com.fasterxml.jackson.databind.Module)1 Provides (com.google.inject.Provides)1 LazySingleton (io.druid.guice.LazySingleton)1 DruidModule (io.druid.initialization.DruidModule)1 ContextBuilder (org.jclouds.ContextBuilder)1 SLF4JLoggingModule (org.jclouds.logging.slf4j.config.SLF4JLoggingModule)1 InternalUrlModule (org.jclouds.openstack.v2_0.config.InternalUrlModule)1 CloudFilesApi (org.jclouds.rackspace.cloudfiles.v1.CloudFilesApi)1