Search in sources :

Example 41 with FactoryModuleBuilder

use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.

the class Graylog2Module method installLookupCache.

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);
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder)

Example 42 with FactoryModuleBuilder

use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.

the class Graylog2Module method installInput.

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));
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder)

Example 43 with FactoryModuleBuilder

use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.

the class PluginModule method addEventFieldValueProvider.

protected void addEventFieldValueProvider(String name, Class<? extends FieldValueProvider> fieldValueProviderClass, Class<? extends FieldValueProvider.Factory> factoryClass, Class<? extends FieldValueProvider.Config> configClass) {
    install(new FactoryModuleBuilder().implement(FieldValueProvider.class, fieldValueProviderClass).build(factoryClass));
    eventFieldValueProviderBinder().addBinding(name).to(factoryClass);
    registerJacksonSubtype(configClass, name);
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder)

Example 44 with FactoryModuleBuilder

use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.

the class PluginModule method addAuthServiceBackend.

protected void addAuthServiceBackend(String name, Class<? extends AuthServiceBackend> backendClass, Class<? extends AuthServiceBackend.Factory<? extends AuthServiceBackend>> factoryClass, Class<? extends AuthServiceBackendConfig> configClass) {
    install(new FactoryModuleBuilder().implement(AuthServiceBackend.class, backendClass).build(factoryClass));
    authServiceBackendBinder().addBinding(name).to(factoryClass);
    registerJacksonSubtype(configClass, name);
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder)

Example 45 with FactoryModuleBuilder

use of com.google.inject.assistedinject.FactoryModuleBuilder in project gerrit by GerritCodeReview.

the class AbstractIndexModule method configure.

@Override
protected void configure() {
    if (slave) {
        bind(AccountIndex.Factory.class).toInstance(s -> {
            throw new UnsupportedOperationException();
        });
        bind(ChangeIndex.Factory.class).toInstance(s -> {
            throw new UnsupportedOperationException();
        });
        bind(ProjectIndex.Factory.class).toInstance(s -> {
            throw new UnsupportedOperationException();
        });
    } else {
        install(new FactoryModuleBuilder().implement(AccountIndex.class, getAccountIndex()).build(AccountIndex.Factory.class));
        install(new FactoryModuleBuilder().implement(ChangeIndex.class, getChangeIndex()).build(ChangeIndex.Factory.class));
        install(new FactoryModuleBuilder().implement(ProjectIndex.class, getProjectIndex()).build(ProjectIndex.Factory.class));
    }
    install(new FactoryModuleBuilder().implement(GroupIndex.class, getGroupIndex()).build(GroupIndex.Factory.class));
    install(new IndexModule(threads, slave));
    if (singleVersions == null) {
        install(new MultiVersionModule());
    } else {
        install(new SingleVersionModule(singleVersions));
    }
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder)

Aggregations

FactoryModuleBuilder (com.google.inject.assistedinject.FactoryModuleBuilder)85 AbstractModule (com.google.inject.AbstractModule)20 Injector (com.google.inject.Injector)12 ConfigModule (co.cask.cdap.common.guice.ConfigModule)10 PrivateModule (com.google.inject.PrivateModule)10 DatasetDefinitionRegistry (co.cask.cdap.api.dataset.module.DatasetDefinitionRegistry)8 DefaultDatasetDefinitionRegistry (co.cask.cdap.data2.dataset2.DefaultDatasetDefinitionRegistry)8 InMemoryDatasetFramework (co.cask.cdap.data2.dataset2.InMemoryDatasetFramework)8 TypeLiteral (com.google.inject.TypeLiteral)8 DatasetFramework (co.cask.cdap.data2.dataset2.DatasetFramework)7 DiscoveryRuntimeModule (co.cask.cdap.common.guice.DiscoveryRuntimeModule)6 LocationRuntimeModule (co.cask.cdap.common.guice.LocationRuntimeModule)6 SystemDatasetRuntimeModule (co.cask.cdap.data.runtime.SystemDatasetRuntimeModule)6 DatasetOpExecutor (co.cask.cdap.data2.datafabric.dataset.service.executor.DatasetOpExecutor)6 DatasetDefinitionRegistryFactory (co.cask.cdap.data2.dataset2.DatasetDefinitionRegistryFactory)6 Singleton (com.google.inject.Singleton)6 TransactionManager (org.apache.tephra.TransactionManager)6 DatasetService (co.cask.cdap.data2.datafabric.dataset.service.DatasetService)5 DatasetAdminOpHTTPHandler (co.cask.cdap.data2.datafabric.dataset.service.executor.DatasetAdminOpHTTPHandler)5 CConfiguration (co.cask.cdap.common.conf.CConfiguration)4