@Override public void configure(Binder binder) { binder.install(new MBeanModule()); // bind the configuration configBinder(binder).bindConfig(H2EmbeddedDataSourceConfig.class, annotation, propertyPrefix); // Bind the datasource binder.bind(DataSource.class).annotatedWith(annotation).toProvider(new H2EmbeddedDataSourceProvider(annotation)).in(Scopes.SINGLETON); newExporter(binder).export(DataSource.class).annotatedWith(annotation).withGeneratedName(); // Bind aliases Key<DataSource> key = Key.get(DataSource.class, annotation); for (Class<? extends Annotation> alias : aliases) { binder.bind(DataSource.class).annotatedWith(alias).to(key); } }
@Override public void configure(Binder binder) { binder.install(new MBeanModule()); // bind the configuration configBinder(binder).bindConfig(H2EmbeddedDataSourceConfig.class, annotation, propertyPrefix); // Bind the datasource binder.bind(DataSource.class).annotatedWith(annotation).toProvider(new H2EmbeddedDataSourceProvider(annotation)).in(Scopes.SINGLETON); newExporter(binder).export(DataSource.class).annotatedWith(annotation).withGeneratedName(); // Bind aliases Key<DataSource> key = Key.get(DataSource.class, annotation); for (Class<? extends Annotation> alias : aliases) { binder.bind(DataSource.class).annotatedWith(alias).to(key); } }
@Override public void configure(Binder binder) { this.binder = requireNonNull(binder, "binder is null"); // bind the configuration configBinder(binder).bindConfig(KerberosConfig.class); configBinder(binder).bindConfig(HttpClientConfig.class, annotation, name); // bind the client binder.bind(HttpClient.class).annotatedWith(annotation).toProvider(new HttpClientProvider(name, annotation)).in(Scopes.SINGLETON); // kick off the binding for the default filters newSetBinder(binder, HttpRequestFilter.class, GlobalFilter.class); // kick off the binding for the filter set newSetBinder(binder, HttpRequestFilter.class, annotation); // export stats newExporter(binder).export(HttpClient.class).annotatedWith(annotation).withGeneratedName(); }
@Override public void configure() { // bind the configuration bindConfig(binder).annotatedWith(annotation).prefixedWith(name).to(HttpClientConfig.class); // bind the client binder.bind(HttpClient.class).annotatedWith(annotation).toProvider(new HttpClientProvider(annotation)).in(Scopes.SINGLETON); // kick off the binding for the filter set newSetBinder(binder, HttpRequestFilter.class, filterQualifier(annotation)); // export stats newExporter(rootBinder).export(HttpClient.class).annotatedWith(annotation).withGeneratedName(); }
@Override public void configure(Binder binder) { binder.install(new MBeanModule()); // bind the configuration configBinder(binder).bindConfig(MySqlDataSourceConfig.class, annotation, type); // bind the service selector discoveryBinder(binder).bindSelector(type); // Bind the datasource binder.bind(DataSource.class).annotatedWith(annotation).toProvider(new MySqlDataSourceProvider(type, annotation)).in(Scopes.SINGLETON); newExporter(binder).export(DataSource.class).annotatedWith(annotation).withGeneratedName(); // Bind aliases Key<DataSource> key = Key.get(DataSource.class, annotation); for (Class<? extends Annotation> alias : aliases) { binder.bind(DataSource.class).annotatedWith(alias).to(key); } }
@Override public void configure(Binder binder) { binder.install(new MBeanModule()); // bind the configuration configBinder(binder).bindConfig(PostgreSqlDataSourceConfig.class, annotation, type); // bind the service selector discoveryBinder(binder).bindSelector(type); // Bind the datasource binder.bind(DataSource.class).annotatedWith(annotation).toProvider(new PostgreSqlDataSourceProvider(type, annotation)).in(Scopes.SINGLETON); newExporter(binder).export(DataSource.class).annotatedWith(annotation).withGeneratedName(); // Bind aliases Key<DataSource> key = Key.get(DataSource.class, annotation); for (Class<? extends Annotation> alias : aliases) { binder.bind(DataSource.class).annotatedWith(alias).to(key); } }
@Override public void configure(Binder binder) { binder.install(new MBeanModule()); // bind the configuration configBinder(binder).bindConfig(MySqlDataSourceConfig.class, annotation, type); // bind the service selector discoveryBinder(binder).bindSelector(type); // Bind the datasource binder.bind(DataSource.class).annotatedWith(annotation).toProvider(new MySqlDataSourceProvider(type, annotation)).in(Scopes.SINGLETON); newExporter(binder).export(DataSource.class).annotatedWith(annotation).withGeneratedName(); // Bind aliases Key<DataSource> key = Key.get(DataSource.class, annotation); for (Class<? extends Annotation> alias : aliases) { binder.bind(DataSource.class).annotatedWith(alias).to(key); } }
newExporter(binder).export(DistributedStore.class).annotatedWith(annotation).as(generatedNameOf(DistributedStore.class, named(name))); newExporter(binder).export(HttpRemoteStore.class).annotatedWith(annotation).as(generatedNameOf(HttpRemoteStore.class, named(name))); newExporter(binder).export(Replicator.class).annotatedWith(annotation).as(generatedNameOf(Replicator.class, named(name)));
@Override public void configure(Binder binder) { binder.install(new MBeanModule()); // bind the configuration configBinder(binder).bindConfig(PostgreSqlDataSourceConfig.class, annotation, type); // bind the service selector discoveryBinder(binder).bindSelector(type); // Bind the datasource binder.bind(DataSource.class).annotatedWith(annotation).toProvider(new PostgreSqlDataSourceProvider(type, annotation)).in(Scopes.SINGLETON); newExporter(binder).export(DataSource.class).annotatedWith(annotation).withGeneratedName(); // Bind aliases Key<DataSource> key = Key.get(DataSource.class, annotation); for (Class<? extends Annotation> alias : aliases) { binder.bind(DataSource.class).annotatedWith(alias).to(key); } }
@Override public void configure() { // bind the configuration bindConfig(binder).annotatedWith(annotation).prefixedWith(name).to(HttpClientConfig.class); bindConfig(binder).annotatedWith(annotation).prefixedWith(name).to(NettyAsyncHttpClientConfig.class); // Shared thread pool bindConfig(binder).to(NettyIoPoolConfig.class); binder.bind(NettyIoPool.class).toProvider(SharedNettyIoPoolProvider.class).in(Scopes.SINGLETON); // bind the async client binder.bind(AsyncHttpClient.class).annotatedWith(annotation).toProvider(new HttpClientProvider(name, annotation)).in(Scopes.SINGLETON); // bind the a sync client also binder.bind(HttpClient.class).annotatedWith(annotation).to(Key.get(AsyncHttpClient.class, annotation)); // kick off the binding for the filter set newSetBinder(binder, HttpRequestFilter.class, filterQualifier(annotation)); // export stats newExporter(firstNonNull(rootBinder, binder)).export(AsyncHttpClient.class).annotatedWith(annotation).withGeneratedName(); }
private BalancingHttpClientBindingBuilder createBalancingHttpClientBindingBuilder(PrivateBinder privateBinder, String name, Class<? extends Annotation> annotation) { HttpClientBindingBuilder delegateBindingBuilder = httpClientPrivateBinder(privateBinder, binder).bindHttpClient(name, ForBalancingHttpClient.class); bindConfig(privateBinder).bind(BalancingHttpClientConfig.class).prefixedWith(name); privateBinder.bind(HttpClient.class).annotatedWith(annotation).to(BalancingHttpClient.class).in(Scopes.SINGLETON); privateBinder.expose(HttpClient.class).annotatedWith(annotation); reportBinder(binder).export(HttpClient.class).annotatedWith(annotation); newExporter(binder).export(HttpClient.class).annotatedWith(annotation).withGeneratedName(); binder.bind(ScheduledExecutorService.class).annotatedWith(ForBalancingHttpClient.class).toProvider(RetryExecutorProvider.class); return new BalancingHttpClientBindingBuilder(binder, annotation, delegateBindingBuilder); }
@Override public final void configure(Binder binder) { this.binder = requireNonNull(binder, "binder is null"); // bind the configuration bindConfig(binder).bind(HttpClientConfig.class).annotatedWith(annotation).prefixedWith(name); // Bind the deprecated shared thread pool config, which is not used, // so that it can consume the deprecated config properties. bindConfig(rootBinder).bind(JettyIoPoolConfig.class); // bind the client this.binder.bind(HttpClient.class).annotatedWith(annotation).toProvider(new HttpClientProvider(name, annotation)).in(Scopes.SINGLETON); // kick off the binding for the filter set newSetBinder(binder, HttpRequestFilter.class, annotation); // export stats if (!isPrivate) { reportBinder(binder).export(HttpClient.class).annotatedWith(annotation); newExporter(binder).export(HttpClient.class).annotatedWith(annotation).withGeneratedName(); } }
private BalancingHttpClientBindingBuilder createBalancingHttpClientBindingBuilder(PrivateBinder privateBinder, String name, Annotation annotation, String serviceName) { HttpClientBindingBuilder delegateBindingBuilder = httpClientPrivateBinder(privateBinder, binder).bindHttpClient(name, ForBalancingHttpClient.class); bindConfig(privateBinder).bind(BalancingHttpClientConfig.class).prefixedWith(name); privateBinder.bind(HttpClient.class).annotatedWith(annotation).to(BalancingHttpClient.class).in(Scopes.SINGLETON); privateBinder.expose(HttpClient.class).annotatedWith(annotation); reportBinder(binder).export(HttpClient.class).annotatedWith(annotation).withNamePrefix("HttpClient." + serviceName); newExporter(binder).export(HttpClient.class).annotatedWith(annotation).as(new ObjectNameBuilder(HttpClient.class.getPackage().getName()) .withProperty("type", "HttpClient") .withProperty("name", serviceName) .build() ); binder.bind(ScheduledExecutorService.class).annotatedWith(ForBalancingHttpClient.class).toProvider(RetryExecutorProvider.class); return new BalancingHttpClientBindingBuilder(binder, annotation, delegateBindingBuilder); }