@Override public void configure(Binder binder) binder.bindConstant().annotatedWith(Names.named("serviceName")).to("druid/tool"); binder.bindConstant().annotatedWith(Names.named("servicePort")).to(9999); binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(-1); binder.bind(DruidProcessingConfig.class).toInstance( new DruidProcessingConfig() binder.bind(ColumnConfig.class).to(DruidProcessingConfig.class);
@Override public void configure() { bindConstant().annotatedWith(DiscoveryClientModule.ZOOKEEPER_CONNECT_NAMED).to("1.1.1.1:2345"); bind(new TypeLiteral<Map<Integer, InetSocketAddress>>() {}).annotatedWith(DiscoveryClientModule.ZOOKEEPER_CONNECT_NAMED).toInstance(ImmutableMap.of(1, new InetSocketAddress("1.1.1.1", 2345))); }
@Override public void configure(Binder binder) { binder.bind(HostAndPort.class).annotatedWith(named(HTTP_HOST_AND_PORT)).toProvider(SingularityHostAndPortProvider.class).in(Scopes.SINGLETON); binder.bind(LeaderLatch.class).to(SingularityLeaderLatch.class).in(Scopes.SINGLETON); binder.bind(CuratorFramework.class).toProvider(SingularityCuratorProvider.class).in(Scopes.SINGLETON); connectionStateListeners.addBinding().to(SingularityAbort.class).in(Scopes.SINGLETON); leaderLatchListeners.addBinding().to(SingularityLeaderController.class).in(Scopes.SINGLETON); binder.bind(SingularityLeaderController.class).in(Scopes.SINGLETON); binder.bind(SingularityDropwizardHealthcheck.class).in(Scopes.SINGLETON); binder.bindConstant().annotatedWith(Names.named(SERVER_ID_PROPERTY)).to(UUID.randomUUID().toString()); binder.bind(SingularityManagedScheduledExecutorServiceFactory.class).in(Scopes.SINGLETON);
bind(FilterEventBus.class).toInstance(m_eventBus); bind(KairosRootConfig.class).toInstance(m_config); bind(QueryQueuingManager.class).in(Singleton.class); bind(KairosDatastore.class).in(Singleton.class); bind(new TypeLiteral<FeatureProcessingFactory<Aggregator>>() {}).to(AggregatorFactory.class).in(Singleton.class); bind(new TypeLiteral<FeatureProcessingFactory<GroupBy>>() {}).to(GroupByFactory.class).in(Singleton.class); bind(FeatureProcessor.class).to(KairosFeatureProcessor.class).in(Singleton.class); bind(QueryPluginFactory.class).to(GuiceQueryPluginFactory.class).in(Singleton.class); bindConstant().annotatedWith(Names.named("HOSTNAME")).to(hostname != null ? hostname: Util.getHostName()); bindConstant().annotatedWith(Names.named("HOST_IP")).to(hostIp != null ? hostIp: InetAddresses.toAddrString(Util.findPublicIp())); bind(QueryPreProcessorContainer.class).to(GuiceQueryPreProcessor.class).in(Singleton.class);
protected void configure() { bind(ServerResource.class).annotatedWith(HelloWorld.class).to( HelloServerResource.class); bindConstant().annotatedWith(named(MSG_QUALIFIER)) .to(HELLO_MSG); bindConstant().annotatedWith(named(PATH_QUALIFIER)).to( HELLO_PATH); } };
@Override protected void configure() { bind(SnapshotCodecProvider.class).in(Singleton.class); bind(TransactionStateStorage.class).annotatedWith(Names.named("persist")) .to(LocalFileTransactionStateStorage.class).in(Scopes.SINGLETON); bind(TransactionStateStorage.class).toProvider(TransactionStateStorageProvider.class).in(Scopes.SINGLETON); bind(TransactionManager.class).in(Scopes.SINGLETON); bind(TransactionSystemClient.class).to(InMemoryTxSystemClient.class).in(Singleton.class); bind(MetricsCollector.class).to(DefaultMetricsCollector.class); bindConstant().annotatedWith(Names.named(TxConstants.CLIENT_ID)).to(clientId); install(new FactoryModuleBuilder() .implement(TransactionExecutor.class, DefaultTransactionExecutor.class) .build(TransactionExecutorFactory.class)); } }
@Override protected void configure() { bindConstant().annotatedWith(Names.named("updateCheckMode")).to(updateCheckMode); bindConstant().annotatedWith(Names.named("developerMode")).to(developerMode); bind(ScheduledExecutorService.class).toInstance(new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor())); bind(OkHttpClient.class).toInstance(RuneLiteAPI.CLIENT); bind(QueryRunner.class); bind(MenuManager.class); bind(ChatMessageManager.class); bind(ItemManager.class); bind(Scheduler.class); bind(PluginManager.class); bind(RuneLiteProperties.class); bind(SessionManager.class); bind(Callbacks.class).to(Hooks.class); bind(EventBus.class) .toInstance(new EventBus()); bind(EventBus.class) .annotatedWith(Names.named("Deferred EventBus")) .to(DeferredEventBus.class); bind(Logger.class) .annotatedWith(Names.named("Core Logger")) .toInstance(LoggerFactory.getLogger(RuneLite.class)); }
@Override protected void configure() { bind(DbStarter.class).to(MongoDefaultStarterImpl.class).asEagerSingleton(); bind(Config.class).toProvider(ConfigProvider.class).in(Singleton.class); bind(EntityCollectionManager.class).in(Singleton.class); bindConstant().annotatedWith(Names.named("default_db")).to("test_project_db"); install(new MongoDaoModule()); } }
@Override public void configure(Binder binder) { binder.bind(FlowConfigsResourceHandler.class) .annotatedWith(Names.named(FlowConfigsResource.INJECT_FLOW_CONFIG_RESOURCE_HANDLER)) .toInstance(GobblinServiceManager.this.resourceHandler); binder.bind(FlowConfigsResourceHandler.class) .annotatedWith(Names.named(FlowConfigsV2Resource.FLOW_CONFIG_GENERATOR_INJECT_NAME)) .toInstance(GobblinServiceManager.this.v2ResourceHandler); binder.bindConstant() .annotatedWith(Names.named(FlowConfigsResource.INJECT_READY_TO_USE)) .to(Boolean.TRUE); binder.bind(RequesterService.class) .annotatedWith(Names.named(FlowConfigsResource.INJECT_REQUESTER_SERVICE)) .toInstance(new NoopRequesterService(config)); } });
@Override protected void configure() { bind(ProviderMetadata.class).toInstance(providerMetadata); Properties toBind = new Properties(); toBind.putAll(providerMetadata.getApiMetadata().getDefaultProperties()); toBind.putAll(providerMetadata.getDefaultProperties()); Names.bindProperties(binder(), toBind); bind(new TypeLiteral<Supplier<Credentials>>(){}).annotatedWith(Provider.class).toInstance(creds); bindConstant().annotatedWith(Provider.class).to(providerMetadata.getId()); bind(new TypeLiteral<Set<String>>() { }).annotatedWith(Iso3166.class).toInstance(providerMetadata.getIso3166Codes()); bindConstant().annotatedWith(Api.class).to(providerMetadata.getApiMetadata().getId()); bindConstant().annotatedWith(ApiVersion.class).to(providerMetadata.getApiMetadata().getVersion()); // nullable bind(String.class).annotatedWith(BuildVersion.class).toProvider( com.google.inject.util.Providers.of(providerMetadata.getApiMetadata().getBuildVersion().orNull())); bind(new TypeLiteral<TypeToken<? extends Context>>() { }).annotatedWith(Provider.class).toInstance(providerMetadata.getApiMetadata().getContext()); }
@Override protected void configure() { bind(CassandraSchedulerConfiguration.class).toInstance(this.configuration); bind(new TypeLiteral<Serializer<Integer>>() {}).toInstance(IntegerStringSerializer.get()); bind(new TypeLiteral<Serializer<Boolean>>() {}).toInstance(BooleanStringSerializer.get()); bind(new TypeLiteral<Serializer<CassandraTask>>() {}).toInstance(CassandraTask.PROTO_SERIALIZER); bind(MesosConfig.class).toInstance(mesosConfig); .annotatedWith(Names.named("ConfiguredIdentity")) .toInstance(configuration.getServiceConfig()); bindConstant() .annotatedWith(Names.named("ConfiguredEnableUpgradeSSTableEndpoint")) .to(configuration.getEnableUpgradeSSTableEndpoint()); bind(BackupManager.class).asEagerSingleton(); bind(ClusterTaskOfferRequirementProvider.class); bind(Reconciler.class).to(DefaultReconciler.class).asEagerSingleton(); bind(RestoreManager.class).asEagerSingleton(); bind(CleanupManager.class).asEagerSingleton();
@Override protected List<? extends com.google.inject.Module> getModules() { return ImmutableList.of( // It's unknown if those modules are required in DruidJsonValidator. // Maybe some of those modules could be removed. // See https://github.com/apache/incubator-druid/pull/4429#discussion_r123603498 new DruidProcessingModule(), new QueryableModule(), new QueryRunnerFactoryModule(), binder -> { binder.bindConstant().annotatedWith(Names.named("serviceName")).to("druid/validator"); binder.bindConstant().annotatedWith(Names.named("servicePort")).to(0); binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(-1); } ); }
@Override protected void configure() { bind(DeLorian.class); bind(EnergySource.class).annotatedWith(Nuclear.class).to(Plutonium.class); bind(EnergySource.class).annotatedWith(Renewable.class).to(Lightning.class); bind(Plutonium.class).toProvider(PlutoniumProvider.class); bind(PinballParts.class).annotatedWith(Used.class).toInstance(new PinballParts()); bind(Person.class).annotatedWith(Driver.class).to(MartyMcFly.class).in(Singleton.class); bind(Person.class).annotatedWith(Inventor.class).to(DocBrown.class).in(Singleton.class); bindConstant().annotatedWith(Names.named("year")).to("1955"); }
@Override protected void configure() { binder().requireExplicitBindings(); bind(benchmarkClass); // TypeListener doesn't fire without this bind(Object.class).annotatedWith(Running.Benchmark.class).to(benchmarkClass); bindConstant().annotatedWith(Running.BenchmarkMethod.class).to(benchmarkMethod.getName()); bind(Method.class).annotatedWith(Running.BenchmarkMethod.class).toInstance(benchmarkMethod); bindListener(new BenchmarkTypeMatcher(), new BenchmarkParameterInjector()); }
@Override protected void configure() { bind(ExplicitDAO.class); bindConstant().annotatedWith(Names.named("TestTaskName")).to("injected task"); bindConstant().annotatedWith(Names.named("ProvidedTaskName")).to("provided task"); bind(InstanceManaged.class).toInstance(new InstanceManaged()); bind(ProviderManaged.class).toProvider(ProviderManagedProvider.class).in(Scopes.SINGLETON); bind(InjectedManaged.class).asEagerSingleton(); bind(InjectedTask.class).asEagerSingleton(); bind(InjectedHealthCheck.class).asEagerSingleton(); bind(InjectedServerLifecycleListener.class).asEagerSingleton(); bind(InjectedProvider.class); bind(ExplicitResource.class); bind(JerseyContextResource.class); }
@Override protected void configure() { bind(RequestSigner.class).toInstance(createMock(RequestSigner.class)); bindConstant().annotatedWith(Names.named(PROPERTY_HEADER_TAG)).to(S3Headers.DEFAULT_AMAZON_HEADERTAG); bindConstant().annotatedWith(Names.named(PROPERTY_S3_SERVICE_PATH)).to(SERVICE_PATH); bindConstant().annotatedWith(Names.named(PROPERTY_S3_VIRTUAL_HOST_BUCKETS)).to(virtualHost); }
@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(Cache.class).toProvider(CacheProvider.class); JsonConfigProvider.bind(binder, uuid, CacheProvider.class); } }
@Override protected void configure() { bindConstant().annotatedWith(Names.named("serverDomain")).to(serverDomain); bindConstant().annotatedWith(Names.named("serverVersion")).to(serverVersion); bind(SynaptixTCPEndpoint.class).in(Singleton.class); bind(SynaptixXMPPServer.class).in(Singleton.class); Multibinder<Module> moduleMultibinder = Multibinder.newSetBinder(binder(), Module.class); bind(SynaptixAbonnementIQHandler.class).in(Singleton.class); moduleMultibinder.addBinding().to(SynaptixAbonnementModule.class).in(Singleton.class); bind(SynaptixServiceFactoryIQHandler.class).in(Singleton.class); moduleMultibinder.addBinding().to(SynaptixServiceFactoryModule.class).in(Singleton.class); bind(SynaptixServiceIQHandler.class).in(Singleton.class); moduleMultibinder.addBinding().to(SynaptixServiceModule.class).in(Singleton.class); bind(SynaptixServerVersionIQHandler.class).in(Singleton.class); moduleMultibinder.addBinding().to(SynaptixServerVersionModule.class).in(Singleton.class); // bind(PingIQHandler.class).in(Singleton.class); // moduleMultibinder.addBinding().to(PingModule.class).in(Singleton.class); } }
@Override protected void configureServlets() { bindConstant().annotatedWith(Names.named(SomeObject.INVALID)).to(SHOULDNEVERBESEEN); bind(SomeObject.class).in(RequestScoped.class); } });
@Override public void configure(Binder binder) { // To make druid happy binder.bindConstant().annotatedWith(named("JDBC.driverClassName")).to(driverClass); binder.bindConstant().annotatedWith(named("JDBC.driver")).to(driverClass); binder.bind(Key.get(String.class, named("JDBC.url"))).toProvider(guicify(new Formatter(urlTemplate))); // To make custom initialize binder.bind(Key.get(String.class, named("JDBC.rawUrl"))).toProvider(guicify(new Formatter(rawUrlTemplate))); binder.bind(Key.get(String.class, named("JDBC.type"))).toProvider(of(dbType)); }