Refactor ChangeHookRunner as an interface
This enables deciding at startup time if hooks will be supported, and if not stub in a dummy implementation that does nothing. This is mainly useful for my gerrit-review.googlesource.com environment where the standard hook system of spawning an external program is not supportable. The factoring is a simple step towards a more pluggable event system. Someone could implement a new version of ChangeHooks that uses a Guice multibinding to dispatch these events to multiple instances of the ChangeHooks API. Change-Id: I6e9fba78f87d6e9ba8aaf80d386230334a492ea2
This commit is contained in:
@@ -17,6 +17,7 @@ package com.google.gerrit.httpd;
|
||||
import static com.google.inject.Scopes.SINGLETON;
|
||||
import static com.google.inject.Stage.PRODUCTION;
|
||||
|
||||
import com.google.gerrit.common.ChangeHookRunner;
|
||||
import com.google.gerrit.lifecycle.LifecycleManager;
|
||||
import com.google.gerrit.lifecycle.LifecycleModule;
|
||||
import com.google.gerrit.server.config.AuthConfigModule;
|
||||
@@ -184,6 +185,7 @@ public class WebAppInitializer extends GuiceServletContextListener {
|
||||
private Injector createSysInjector() {
|
||||
final List<Module> modules = new ArrayList<Module>();
|
||||
modules.add(new WorkQueue.Module());
|
||||
modules.add(new ChangeHookRunner.Module());
|
||||
modules.add(cfgInjector.getInstance(GerritGlobalModule.class));
|
||||
modules.add(new SmtpEmailSender.Module());
|
||||
modules.add(new SignedTokenEmailTokenVerifier.Module());
|
||||
|
||||
Reference in New Issue
Block a user