protected void configure()

in src/main/java/com/googlesource/gerrit/plugins/multisite/validation/ValidationModule.java [53:86]


  protected void configure() {
    install(new ReplicationExtensionPointModule());

    bind(SharedRefDatabaseWrapper.class).in(Scopes.SINGLETON);
    bind(SharedRefLogger.class).to(Log4jSharedRefLogger.class);
    bind(ProjectVersionLogger.class).to(Log4jProjectVersionLogger.class);
    factory(LockWrapper.Factory.class);

    factory(SharedRefDbRepository.Factory.class);
    factory(SharedRefDbRefDatabase.Factory.class);
    factory(SharedRefDbRefUpdate.Factory.class);
    factory(SharedRefDbBatchRefUpdate.Factory.class);
    factory(RefUpdateValidator.Factory.class);
    factory(BatchRefUpdateValidator.Factory.class);

    bind(SharedRefDbConfiguration.class).toInstance(cfg.getSharedRefDbConfiguration());
    bind(new TypeLiteral<ImmutableSet<String>>() {})
        .annotatedWith(Names.named(SharedRefDbGitRepositoryManager.IGNORED_REFS))
        .toInstance(
            ImmutableSet.of(
                ProjectVersionRefUpdate.MULTI_SITE_VERSIONING_REF,
                ProjectVersionRefUpdate.MULTI_SITE_VERSIONING_VALUE_REF));
    bind(GitRepositoryManager.class).to(SharedRefDbGitRepositoryManager.class);
    DynamicItem.bind(binder(), ReplicationPushFilter.class)
        .to(MultisiteReplicationPushFilter.class);

    if (cfg.getSharedRefDbConfiguration().getSharedRefDb().getEnforcementRules().isEmpty()) {
      bind(SharedRefEnforcement.class).to(DefaultSharedRefEnforcement.class).in(Scopes.SINGLETON);
    } else {
      bind(SharedRefEnforcement.class)
          .to(CustomSharedRefEnforcementByProject.class)
          .in(Scopes.SINGLETON);
    }
  }