use of com.google.gerrit.pgm.init.index.IndexModuleOnInit in project gerrit by GerritCodeReview.
the class ElasticIndexModuleOnInit method configure.
@Override
protected void configure() {
install(new FactoryModuleBuilder().implement(AccountIndex.class, ElasticAccountIndex.class).build(AccountIndex.Factory.class));
install(new FactoryModuleBuilder().implement(GroupIndex.class, ElasticGroupIndex.class).build(GroupIndex.Factory.class));
install(new IndexModuleOnInit());
}
use of com.google.gerrit.pgm.init.index.IndexModuleOnInit in project gerrit by GerritCodeReview.
the class BaseInit method createSysInjector.
private Injector createSysInjector(SiteInit init) {
if (sysInjector == null) {
final List<Module> modules = new ArrayList<>();
modules.add(new AbstractModule() {
@Override
protected void configure() {
bind(ConsoleUI.class).toInstance(init.ui);
bind(InitFlags.class).toInstance(init.flags);
}
});
Injector dbInjector = createDbInjector();
IndexType indexType = IndexModule.getIndexType(dbInjector);
if (indexType.isLucene()) {
modules.add(new LuceneIndexModuleOnInit());
} else if (indexType.isFake()) {
try {
Class<?> clazz = Class.forName("com.google.gerrit.index.testing.FakeIndexModuleOnInit");
Module indexOnInitModule = (Module) clazz.getDeclaredConstructor().newInstance();
modules.add(indexOnInitModule);
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) {
throw new IllegalStateException("unable to create fake index", e);
}
modules.add(new IndexModuleOnInit());
} else {
throw new IllegalStateException("unsupported index.type = " + indexType);
}
sysInjector = dbInjector.createChildInjector(modules);
}
return sysInjector;
}
use of com.google.gerrit.pgm.init.index.IndexModuleOnInit in project gerrit by GerritCodeReview.
the class LuceneIndexModuleOnInit method configure.
@Override
protected void configure() {
install(new FactoryModuleBuilder().implement(AccountIndex.class, LuceneAccountIndex.class).build(AccountIndex.Factory.class));
install(new FactoryModuleBuilder().implement(GroupIndex.class, LuceneGroupIndex.class).build(GroupIndex.Factory.class));
install(new IndexModuleOnInit());
bind(AutoFlush.class).toInstance(AutoFlush.DISABLED);
}
Aggregations