}
private Injector createDbInjector() {
final List<Module> modules = new ArrayList<Module>();
if (sitePath != null) {
modules.add(new LifecycleModule() {
@Override
protected void configure() {
bind(File.class).annotatedWith(SitePath.class).toInstance(sitePath);
bind(DataSourceProvider.Context.class).toInstance(
DataSourceProvider.Context.MULTI_USER);
bind(Key.get(DataSource.class, Names.named("ReviewDb"))).toProvider(
DataSourceProvider.class).in(SINGLETON);
listener().to(DataSourceProvider.class);
}
});
modules.add(new GerritServerConfigModule());
} else {
modules.add(new LifecycleModule() {
@Override
protected void configure() {
bind(Key.get(DataSource.class, Names.named("ReviewDb"))).toProvider(
ReviewDbDataSourceProvider.class).in(SINGLETON);
listener().to(ReviewDbDataSourceProvider.class);