public LinkedBindingBuilder<JsonSerializer<?>> addKeySerializerBinding(Class<?> type) { requireNonNull(type, "type is null"); return keySerializerMapBinder.addBinding(type); }
public LinkedBindingBuilder<JsonSerializer<?>> addSerializerBinding(Class<?> type) { requireNonNull(type, "type is null"); return serializerMapBinder.addBinding(type); }
public LinkedBindingBuilder<JsonDeserializer<?>> addDeserializerBinding(Class<?> type) { requireNonNull(type, "type is null"); return deserializerMapBinder.addBinding(type); }
public LinkedBindingBuilder<KeyDeserializer> addKeyDeserializerBinding(Class<?> type) { requireNonNull(type, "type is null"); return keyDeserializerMapBinder.addBinding(type); }
@Override public void configure(Binder binder) { MapBinder<String, RowDecoderFactory> decoderFactoriesByName = MapBinder.newMapBinder(binder, String.class, RowDecoderFactory.class); decoderFactoriesByName.addBinding(DummyRowDecoder.NAME).to(DummyRowDecoderFactory.class).in(SINGLETON); decoderFactoriesByName.addBinding(CsvRowDecoder.NAME).to(CsvRowDecoderFactory.class).in(SINGLETON); decoderFactoriesByName.addBinding(JsonRowDecoder.NAME).to(JsonRowDecoderFactory.class).in(SINGLETON); decoderFactoriesByName.addBinding(RawRowDecoder.NAME).to(RawRowDecoderFactory.class).in(SINGLETON); decoderFactoriesByName.addBinding(AvroRowDecoder.NAME).to(AvroRowDecoderFactory.class).in(SINGLETON); binder.bind(DispatchingRowDecoderFactory.class).in(SINGLETON); } }
@Override public void configure(Binder binder) { MapBinder<String, RowDecoderFactory> decoderFactoriesByName = MapBinder.newMapBinder(binder, String.class, RowDecoderFactory.class); decoderFactoriesByName.addBinding(DummyRowDecoder.NAME).to(DummyRowDecoderFactory.class).in(SINGLETON); decoderFactoriesByName.addBinding(CsvRowDecoder.NAME).to(CsvRowDecoderFactory.class).in(SINGLETON); decoderFactoriesByName.addBinding(JsonRowDecoder.NAME).to(JsonRowDecoderFactory.class).in(SINGLETON); decoderFactoriesByName.addBinding(RawRowDecoder.NAME).to(RawRowDecoderFactory.class).in(SINGLETON); decoderFactoriesByName.addBinding(ZsetRedisRowDecoder.NAME).to(ZsetRedisRowDecoderFactory.class).in(SINGLETON); decoderFactoriesByName.addBinding(HashRedisRowDecoder.NAME).to(HashRedisRowDecoderFactory.class).in(SINGLETON); decoderFactoriesByName.addBinding(AvroRowDecoder.NAME).to(AvroRowDecoderFactory.class).in(SINGLETON); binder.bind(DispatchingRowDecoderFactory.class).in(SINGLETON); } }
@Override protected void configure() { final MapBinder<String, AuthenticatingRealm> auth = authenticationRealmBinder(); auth.addBinding(AccessTokenAuthenticator.NAME).to(AccessTokenAuthenticator.class).in(Scopes.SINGLETON); auth.addBinding(RootAccountRealm.NAME).to(RootAccountRealm.class).in(Scopes.SINGLETON); auth.addBinding(LdapUserAuthenticator.NAME).to(LdapUserAuthenticator.class).in(Scopes.SINGLETON); auth.addBinding(PasswordAuthenticator.NAME).to(PasswordAuthenticator.class).in(Scopes.SINGLETON); auth.addBinding(SessionAuthenticator.NAME).to(SessionAuthenticator.class).in(Scopes.SINGLETON); } }
@Override public void configure(Binder binder) { final MapBinder<String, Authorizer> authorizerMapBinder = PolyBind.optionBinder( binder, Key.get(Authorizer.class) ); authorizerMapBinder.addBinding(AuthConfig.ALLOW_ALL_NAME).to(AllowAllAuthorizer.class).in(LazySingleton.class); }
@Override public void configure(Binder binder) { final MapBinder<String, Authenticator> authenticatorMapBinder = PolyBind.optionBinder( binder, Key.get(Authenticator.class) ); authenticatorMapBinder.addBinding(AuthConfig.ALLOW_ALL_NAME) .to(AllowAllAuthenticator.class) .in(LazySingleton.class); }
private static <T extends Statement> void bindDataDefinitionTask( Binder binder, MapBinder<Class<? extends Statement>, QueryExecutionFactory<?>> executionBinder, Class<T> statement, Class<? extends DataDefinitionTask<T>> task) { verify(getAllQueryTypes().get(statement) == QueryType.DATA_DEFINITION); MapBinder<Class<? extends Statement>, DataDefinitionTask<?>> taskBinder = newMapBinder(binder, new TypeLiteral<Class<? extends Statement>>() {}, new TypeLiteral<DataDefinitionTask<?>>() {}); taskBinder.addBinding(statement).to(task).in(Scopes.SINGLETON); executionBinder.addBinding(statement).to(DataDefinitionExecutionFactory.class).in(Scopes.SINGLETON); }
public <T> void bindSerializer(JsonSerializer<T> jsonSerializer) { requireNonNull(jsonSerializer, "jsonSerializer is null"); Class<?> type = jsonSerializer.handledType(); requireNonNull(type, "jsonSerializer.handledType is null"); Preconditions.checkArgument(type == Object.class, "jsonSerializer.handledType can not be Object.class"); serializerMapBinder.addBinding(type).toInstance(jsonSerializer); } }
@Override public void configure(Binder binder) { PolyBind.optionBinder(binder, Key.get(DataSegmentPusher.class)) .addBinding(SCHEME) .to(CassandraDataSegmentPusher.class) .in(LazySingleton.class); JsonConfigProvider.bind(binder, "druid.storage", CassandraDataSegmentConfig.class); }
@Override public void configure(Binder binder) { JsonConfigProvider.bind(binder, "druid.azure", AzureAccountConfig.class); Binders.dataSegmentPusherBinder(binder) .addBinding(SCHEME) .to(AzureDataSegmentPusher.class).in(LazySingleton.class); Binders.dataSegmentKillerBinder(binder) .addBinding(SCHEME) .to(AzureDataSegmentKiller.class).in(LazySingleton.class); Binders.taskLogsBinder(binder).addBinding(SCHEME).to(AzureTaskLogs.class); JsonConfigProvider.bind(binder, "druid.indexer.logs", AzureTaskLogsConfig.class); binder.bind(AzureTaskLogs.class).in(LazySingleton.class); }
protected <T extends MessageOutput> void installOutput(MapBinder<String, MessageOutput.Factory<? extends MessageOutput>> outputMapBinder, Class<T> target, Class<? extends MessageOutput.Factory<T>> targetFactory) { install(new FactoryModuleBuilder().implement(MessageOutput.class, target).build(targetFactory)); outputMapBinder.addBinding(target.getCanonicalName()).to(Key.get(targetFactory)); }
protected void installWidgetStrategy(MapBinder<String, WidgetStrategy.Factory<? extends WidgetStrategy>> widgetStrategyBinder, Class<? extends WidgetStrategy> target, Class<? extends WidgetStrategy.Factory<? extends WidgetStrategy>> targetFactory) { install(new FactoryModuleBuilder().implement(WidgetStrategy.class, target).build(targetFactory)); widgetStrategyBinder.addBinding(target.getCanonicalName()).to(Key.get(targetFactory)); }
protected <T extends MessageInput> void installInput(MapBinder<String, MessageInput.Factory<? extends MessageInput>> inputMapBinder, Class<T> target, Class<? extends MessageInput.Factory<T>> targetFactory) { install(new FactoryModuleBuilder().implement(MessageInput.class, target).build(targetFactory)); inputMapBinder.addBinding(target.getCanonicalName()).to(Key.get(targetFactory)); }
protected void installAlertCondition(MapBinder<String, AlertCondition.Factory> alertConditionBinder, Class<? extends AlertCondition> alertConditionClass, Class<? extends AlertCondition.Factory> alertConditionFactoryClass) { install(new FactoryModuleBuilder().implement(AlertCondition.class, alertConditionClass).build(alertConditionFactoryClass)); alertConditionBinder.addBinding(alertConditionClass.getCanonicalName()).to(alertConditionFactoryClass); }
@Override public void configure(Binder binder) { DruidBinders.queryToolChestBinder(binder) .addBinding(MaterializedViewQuery.class) .to(MaterializedViewQueryQueryToolChest.class); LifecycleModule.register(binder, DerivativeDataSourceManager.class); binder.bind(DataSourceOptimizer.class).in(Singleton.class); MetricsModule.register(binder, DataSourceOptimizerMonitor.class); JsonConfigProvider.bind(binder, "druid.manager.derivatives", MaterializedViewConfig.class); } }
@Override public void configure(Binder binder) { log.info("Configuring CloudFilesStorageDruidModule..."); JsonConfigProvider.bind(binder, "druid.storage", CloudFilesDataSegmentPusherConfig.class); JsonConfigProvider.bind(binder, "druid.cloudfiles", CloudFilesAccountConfig.class); Binders.dataSegmentPusherBinder(binder).addBinding(SCHEME).to(CloudFilesDataSegmentPusher.class) .in(LazySingleton.class); log.info("Configured CloudFilesStorageDruidModule."); }
protected void installLookupCache(String name, Class<? extends LookupCache> cacheClass, Class<? extends LookupCache.Factory> factoryClass, Class<? extends LookupCacheConfiguration> configClass) { install(new FactoryModuleBuilder().implement(LookupCache.class, cacheClass).build(factoryClass)); lookupCacheBinder().addBinding(name).to(factoryClass); registerJacksonSubtype(configClass, name); }