use of com.google.gerrit.pgm.init.index.lucene.LuceneIndexModuleOnInit 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;
}
Aggregations