use of com.google.inject.Provides in project druid by druid-io.
the class JettyServerModule method getServer.
@Provides
@LazySingleton
public Server getServer(final Injector injector, final Lifecycle lifecycle, @Self final DruidNode node, final ServerConfig config) {
final Server server = makeJettyServer(node, config);
initializeServer(injector, lifecycle, server);
return server;
}
use of com.google.inject.Provides in project druid by druid-io.
the class GoogleStorageDruidModule method getGoogleStorage.
@Provides
@LazySingleton
public GoogleStorage getGoogleStorage(final GoogleAccountConfig config) throws IOException, GeneralSecurityException {
LOG.info("Building Cloud Storage Client...");
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
GoogleCredential credential = GoogleCredential.getApplicationDefault(httpTransport, jsonFactory);
if (credential.createScopedRequired()) {
credential = credential.createScoped(StorageScopes.all());
}
Storage storage = new Storage.Builder(httpTransport, jsonFactory, credential).setApplicationName(APPLICATION_NAME).build();
return new GoogleStorage(storage);
}
use of com.google.inject.Provides in project druid by druid-io.
the class JacksonModule method smileMapper.
@Provides
@LazySingleton
@Smile
public ObjectMapper smileMapper() {
final SmileFactory smileFactory = new SmileFactory();
smileFactory.configure(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT, false);
smileFactory.delegateToTextual(true);
final ObjectMapper retVal = new DefaultObjectMapper(smileFactory);
retVal.getFactory().setCodec(retVal);
return retVal;
}
use of com.google.inject.Provides in project druid by druid-io.
the class CuratorModule method makeEnsembleProvider.
@Provides
@LazySingleton
public EnsembleProvider makeEnsembleProvider(CuratorConfig config, ExhibitorConfig exConfig) {
if (exConfig.getHosts().isEmpty()) {
return new FixedEnsembleProvider(config.getZkHosts());
}
return new ExhibitorEnsembleProvider(new Exhibitors(exConfig.getHosts(), exConfig.getRestPort(), newBackupProvider(config.getZkHosts())), new DefaultExhibitorRestClient(exConfig.getUseSsl()), exConfig.getRestUriPath(), exConfig.getPollingMs(), new BoundedExponentialBackoffRetry(BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES)) {
@Override
public void start() throws Exception {
log.info("Poll the list of zookeeper servers for initial ensemble");
this.pollForInitialEnsemble();
super.start();
}
};
}
use of com.google.inject.Provides in project hudson-2.x by hudson.
the class HudsonModule method getHudson.
@Provides
private Hudson getHudson() {
Hudson hudson = Hudson.getInstance();
checkState(hudson != null);
return hudson;
}
Aggregations