Move ProjectDeletionAction/CacheDeleteHandler PullReplicationModule Following I31cb7378ba7a the classes responsible for providing the delete project functionality need to be moved to PullReplicationModule as it is used also in the stream event listener and therefore used even without the HTTP REST-APIs. Having the binding in the HttpModule caused two conflicting bindings, one done just-in-time indirectly by the StreamEventListener and another one explicitly bound in the PullReplicationModule which was making the plugin failing to load because of a double binding. Change-Id: I9dd29693ee48851a45bff79078f7de27d7c631fc (cherry picked from commit f426afbc98efb346538d26cf08cdaafd75827060)
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationModule.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationModule.java index 251f39f..a01a6d8 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationModule.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationModule.java
@@ -34,6 +34,7 @@ import com.google.inject.assistedinject.FactoryModuleBuilder; import com.google.inject.internal.UniqueAnnotations; import com.google.inject.name.Names; +import com.googlesource.gerrit.plugins.deleteproject.cache.CacheDeleteHandler; import com.googlesource.gerrit.plugins.replication.AutoReloadSecureCredentialsFactoryDecorator; import com.googlesource.gerrit.plugins.replication.ConfigParser; import com.googlesource.gerrit.plugins.replication.CredentialsFactory; @@ -42,6 +43,7 @@ import com.googlesource.gerrit.plugins.replication.StartReplicationCapability; import com.googlesource.gerrit.plugins.replication.pull.api.FetchApiCapability; import com.googlesource.gerrit.plugins.replication.pull.api.FetchJob; +import com.googlesource.gerrit.plugins.replication.pull.api.ProjectDeletionAction; import com.googlesource.gerrit.plugins.replication.pull.auth.PullReplicationGroupModule; import com.googlesource.gerrit.plugins.replication.pull.client.FetchApiClient; import com.googlesource.gerrit.plugins.replication.pull.client.FetchRestApiClient; @@ -68,6 +70,9 @@ @Override protected void configure() { + bind(CacheDeleteHandler.class); + bind(ProjectDeletionAction.class).in(Scopes.SINGLETON); + bind(MetricMaker.class) .annotatedWith(Names.named(ReplicationQueueMetrics.REPLICATION_QUEUE_METRICS)) .toInstance(pluginMetricMaker);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/HttpModule.java index 72a0182..95082b8 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/HttpModule.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/HttpModule.java
@@ -20,7 +20,6 @@ import com.google.inject.Scopes; import com.google.inject.name.Names; import com.google.inject.servlet.ServletModule; -import com.googlesource.gerrit.plugins.deleteproject.cache.CacheDeleteHandler; import com.googlesource.gerrit.plugins.replication.pull.BearerTokenProvider; public class HttpModule extends ServletModule { @@ -47,9 +46,6 @@ .in(Scopes.SINGLETON); }); - bind(CacheDeleteHandler.class); - bind(ProjectDeletionAction.class).in(Scopes.SINGLETON); - DynamicSet.bind(binder(), AllRequestFilter.class) .to(PullReplicationFilter.class) .in(Scopes.SINGLETON);