@Override public void configure(Binder binder) { binder.bind(Validator.class).toInstance(Validation.buildDefaultValidatorFactory().getValidator()); binder.bind(JsonConfigurator.class).in(LazySingleton.class); }
@Override public void configure(Binder binder) { JsonConfigProvider.bind(binder, "druid.monitoring", DruidMonitorSchedulerConfig.class); JsonConfigProvider.bind(binder, "druid.monitoring", MonitorsConfig.class); DruidBinders.metricMonitorBinder(binder); // get the binder so that it will inject the empty set at a minimum. binder.bind(DataSourceTaskIdHolder.class).in(LazySingleton.class); binder.bind(EventReceiverFirehoseRegister.class).in(LazySingleton.class); binder.bind(ExecutorServiceMonitor.class).in(LazySingleton.class); // Instantiate eagerly so that we get everything registered and put into the Lifecycle binder.bind(Key.get(MonitorScheduler.class, Names.named("ForTheEagerness"))) .to(MonitorScheduler.class) .asEagerSingleton(); }
@Override public void configure(Binder binder) { binder.bind(Configuration.class).toInstance(configuration); binder.bind(BaseConfiguration.class).toInstance(configuration); } }
@Override public void configure(Binder binder) { binder.install(new DruidGuiceExtensions()); binder.bind(Properties.class).toInstance(properties); binder.bind(ConfigurationObjectFactory.class).toInstance(factory); binder.bind(ObjectMapper.class).to(Key.get(ObjectMapper.class, Json.class)); binder.bind(Validator.class).toInstance(validator); binder.bind(JsonConfigurator.class); }
@Override public void configure(Binder binder) { Properties props = new Properties(); props.put("druid.emitter.composing.emitters", "[\"" + testEmitterType + "\"]"); binder.bind(Properties.class).toInstance(props); binder.bind(Validator.class).toInstance(Validation.buildDefaultValidatorFactory().getValidator()); binder.bind(Emitter.class).annotatedWith(Names.named(testEmitterType)).toInstance(emitter); } },
@Override public void configure(Binder binder) { binder.bindConstant().annotatedWith(Names.named("serviceName")).to("druid/test/memcached"); binder.bindConstant().annotatedWith(Names.named("servicePort")).to(0); binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(-1); binder.bind(MemcachedCacheConfig.class).toInstance(config); binder.bind(Cache.class).toProvider(MemcachedProviderWithConfig.class).in(ManageLifecycle.class); } }
@Override public void configure(Binder binder) { createBindingChoices(binder, TYPE); super.configure(binder); binder.bind(MetadataStorage.class).toProvider(NoopMetadataStorageProvider.class); PolyBind.optionBinder(binder, Key.get(MetadataStorageProvider.class)) .addBinding(TYPE) .to(DerbyMetadataStorageProvider.class) .in(LazySingleton.class); PolyBind.optionBinder(binder, Key.get(MetadataStorageConnector.class)) .addBinding(TYPE) .to(DerbyConnector.class) .in(LazySingleton.class); PolyBind.optionBinder(binder, Key.get(SQLMetadataConnector.class)) .addBinding(TYPE) .to(DerbyConnector.class) .in(LazySingleton.class); PolyBind.optionBinder(binder, Key.get(MetadataStorageActionHandlerFactory.class)) .addBinding(TYPE) .to(DerbyMetadataStorageActionHandlerFactory.class) .in(LazySingleton.class); } }
/** * Initializes optional default command that will be executed if no explicit command is found in startup arguments. * * @param commandType a class of the default command. * @return this extender instance. */ public BQCoreModuleExtender setDefaultCommand(Class<? extends Command> commandType) { binder.bind(Key.get(Command.class, DefaultCommand.class)).to(commandType).in(Singleton.class); return this; }
@Override public void configure(Binder binder) { binder.bind(String.class).toInstance("Expected String"); JsonConfigProvider.bind(binder, "druid.emitter.", Emitter.class); binder.bind(CustomEmitter.class).toProvider(new CustomEmitterFactory()); } });
@Override public void configure(Binder binder) { Jerseys.addResource(binder, ChatHandlerResource.class); LifecycleModule.register(binder, ChatHandlerResource.class); if (properties.containsKey(MAX_CHAT_REQUESTS_PROPERTY)) { final int maxRequests = Integer.parseInt(properties.getProperty(MAX_CHAT_REQUESTS_PROPERTY)); JettyBindings.addQosFilter(binder, "/druid/worker/v1/chat/*", maxRequests); } Multibinder.newSetBinder(binder, ServletFilterHolder.class).addBinding().to(TaskIdResponseHeaderFilterHolder.class); /** * We bind {@link DruidNode} annotated with {@link RemoteChatHandler} to {@literal @}{@link Self} {@link DruidNode} * so that same Jetty Server is used for querying as well as ingestion. */ binder.bind(DruidNode.class).annotatedWith(RemoteChatHandler.class).to(Key.get(DruidNode.class, Self.class)); binder.bind(ServerConfig.class).annotatedWith(RemoteChatHandler.class).to(Key.get(ServerConfig.class)); binder.bind(TLSServerConfig.class).annotatedWith(RemoteChatHandler.class).to(Key.get(TLSServerConfig.class)); }
@Override public void configure(Binder binder) { binder.disableCircularProxies(); // NOTE: this MUST NOT be a singleton because ObjectMappers are mutable. This means // one component could reconfigure the mapper and break all other components binder.bind(ObjectMapper.class).toProvider(ObjectMapperProvider.class); binder.bind(JsonCodecFactory.class).in(Scopes.SINGLETON); } }
@Override public void configure(Binder binder) { binder.bind(TypeManager.class).toInstance(typeManager); binder.bind(NodeManager.class).toInstance(nodeManager); binder.bind(MemoryConnector.class).in(Scopes.SINGLETON); binder.bind(MemoryConnectorId.class).toInstance(new MemoryConnectorId(connectorId)); binder.bind(MemoryMetadata.class).in(Scopes.SINGLETON); binder.bind(MemorySplitManager.class).in(Scopes.SINGLETON); binder.bind(MemoryPagesStore.class).in(Scopes.SINGLETON); binder.bind(MemoryPageSourceProvider.class).in(Scopes.SINGLETON); binder.bind(MemoryPageSinkProvider.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(MemoryConfig.class); }
@Override public void configure(Binder binder) { binder.bind(KafkaConnector.class).in(Scopes.SINGLETON); binder.bind(KafkaMetadata.class).in(Scopes.SINGLETON); binder.bind(KafkaSplitManager.class).in(Scopes.SINGLETON); binder.bind(KafkaRecordSetProvider.class).in(Scopes.SINGLETON); binder.bind(KafkaSimpleConsumerManager.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(KafkaConnectorConfig.class); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); jsonCodecBinder(binder).bindJsonCodec(KafkaTopicDescription.class); binder.install(new DecoderModule()); }
@Override public void configure(Binder binder) { MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer(); binder.bind(MBeanServer.class).toInstance(new RebindSafeMBeanServer(platformMBeanServer)); } });