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:
Shawn O. Pearce 2012-01-23 11:28:42 -08:00
parent d6bd00b5eb
commit 8dba895ad6
18 changed files with 249 additions and 95 deletions

View File

@ -14,7 +14,7 @@
package com.google.gerrit.httpd.rpc.account;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.common.data.AccountSecurity;
import com.google.gerrit.common.data.GroupDetail;
import com.google.gerrit.common.errors.ContactInformationStoreException;
@ -84,7 +84,7 @@ class AccountSecurityImpl extends BaseServiceImplementation implements
private final ExternalIdDetailFactory.Factory externalIdDetailFactory;
private final MyGroupsFactory.Factory myGroupsFactory;
private final ChangeHookRunner hooks;
private final ChangeHooks hooks;
@Inject
AccountSecurityImpl(final Provider<ReviewDb> schema,
@ -100,7 +100,7 @@ class AccountSecurityImpl extends BaseServiceImplementation implements
final DeleteExternalIds.Factory deleteExternalIdsFactory,
final ExternalIdDetailFactory.Factory externalIdDetailFactory,
final MyGroupsFactory.Factory myGroupsFactory,
final ChangeHookRunner hooks) {
final ChangeHooks hooks) {
super(schema, currentUser);
contactStore = cs;
authConfig = ac;

View File

@ -14,14 +14,11 @@
package com.google.gerrit.httpd.rpc.changedetail;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.data.ChangeDetail;
import com.google.gerrit.common.data.ReviewResult;
import com.google.gerrit.common.errors.NoSuchEntityException;
import com.google.gerrit.httpd.rpc.Handler;
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.PatchSet;
import com.google.gerrit.server.ChangeUtil;
import com.google.gerrit.server.changedetail.AbandonChange;
import com.google.gerrit.server.mail.EmailException;
import com.google.gerrit.server.patch.PatchSetInfoNotAvailableException;

View File

@ -14,7 +14,7 @@
package com.google.gerrit.httpd.rpc.changedetail;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.common.data.ChangeDetail;
import com.google.gerrit.common.errors.NoSuchEntityException;
import com.google.gerrit.httpd.rpc.Handler;
@ -50,7 +50,7 @@ class RestoreChange extends Handler<ChangeDetail> {
@Nullable
private final String message;
private final ChangeHookRunner hooks;
private final ChangeHooks hooks;
@Inject
RestoreChange(final ChangeControl.Factory changeControlFactory,
@ -58,7 +58,7 @@ class RestoreChange extends Handler<ChangeDetail> {
final RestoredSender.Factory senderFactory,
final ChangeDetailFactory.Factory changeDetailFactory,
@Assisted final PatchSet.Id patchSetId,
@Assisted @Nullable final String message, final ChangeHookRunner hooks) {
@Assisted @Nullable final String message, final ChangeHooks hooks) {
this.changeControlFactory = changeControlFactory;
this.db = db;
this.currentUser = currentUser;

View File

@ -14,7 +14,7 @@
package com.google.gerrit.httpd.rpc.changedetail;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.common.data.ChangeDetail;
import com.google.gerrit.common.errors.NoSuchEntityException;
import com.google.gerrit.httpd.rpc.Handler;
@ -60,7 +60,7 @@ class RevertChange extends Handler<ChangeDetail> {
@Nullable
private final String message;
private final ChangeHookRunner hooks;
private final ChangeHooks hooks;
private final GitRepositoryManager gitManager;
private final PatchSetInfoFactory patchSetInfoFactory;
@ -73,7 +73,7 @@ class RevertChange extends Handler<ChangeDetail> {
final RevertedSender.Factory revertedSenderFactory,
final ChangeDetailFactory.Factory changeDetailFactory,
@Assisted final PatchSet.Id patchSetId,
@Assisted @Nullable final String message, final ChangeHookRunner hooks,
@Assisted @Nullable final String message, final ChangeHooks hooks,
final GitRepositoryManager gitManager,
final PatchSetInfoFactory patchSetInfoFactory,
final ReplicationQueue replication,

View File

@ -14,7 +14,7 @@
package com.google.gerrit.httpd.rpc.project;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.common.data.ListBranchesResult;
import com.google.gerrit.common.errors.InvalidNameException;
import com.google.gerrit.common.errors.InvalidRevisionException;
@ -60,7 +60,7 @@ class AddBranch extends Handler<ListBranchesResult> {
private final IdentifiedUser identifiedUser;
private final GitRepositoryManager repoManager;
private final ReplicationQueue replication;
private final ChangeHookRunner hooks;
private final ChangeHooks hooks;
private final Project.NameKey projectName;
private final String branchName;
@ -72,7 +72,7 @@ class AddBranch extends Handler<ListBranchesResult> {
final IdentifiedUser identifiedUser,
final GitRepositoryManager repoManager,
final ReplicationQueue replication,
final ChangeHookRunner hooks,
final ChangeHooks hooks,
@Assisted Project.NameKey projectName,
@Assisted("branchName") String branchName,

View File

@ -14,7 +14,7 @@
package com.google.gerrit.httpd.rpc.project;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.httpd.rpc.Handler;
import com.google.gerrit.reviewdb.Branch;
import com.google.gerrit.reviewdb.Project;
@ -49,7 +49,7 @@ class DeleteBranches extends Handler<Set<Branch.NameKey>> {
private final GitRepositoryManager repoManager;
private final ReplicationQueue replication;
private final IdentifiedUser identifiedUser;
private final ChangeHookRunner hooks;
private final ChangeHooks hooks;
private final Project.NameKey projectName;
private final Set<Branch.NameKey> toRemove;
@ -59,7 +59,7 @@ class DeleteBranches extends Handler<Set<Branch.NameKey>> {
final GitRepositoryManager repoManager,
final ReplicationQueue replication,
final IdentifiedUser identifiedUser,
final ChangeHookRunner hooks,
final ChangeHooks hooks,
@Assisted Project.NameKey name, @Assisted Set<Branch.NameKey> toRemove) {
this.projectControlFactory = projectControlFactory;

View File

@ -16,6 +16,7 @@ package com.google.gerrit.pgm;
import static com.google.gerrit.server.schema.DataSourceProvider.Context.MULTI_USER;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.httpd.CacheBasedWebSession;
import com.google.gerrit.httpd.GitOverHttpModule;
import com.google.gerrit.httpd.HttpCanonicalWebUrlProvider;
@ -194,6 +195,7 @@ public class Daemon extends SiteProgram {
modules.add(SchemaVersionCheck.module());
modules.add(new LogFileCompressor.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());

View File

@ -46,6 +46,7 @@ import com.google.gerrit.server.project.ProjectCache;
import com.google.gerrit.server.project.ProjectControl;
import com.google.gerrit.server.project.ProjectState;
import com.google.gwtorm.client.OrmException;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@ -67,14 +68,20 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
/**
* This class implements hooks for certain gerrit events.
*/
/** Spawns local executables when a hook action occurs. */
@Singleton
public class ChangeHookRunner {
public class ChangeHookRunner implements ChangeHooks {
/** A logger for this class. */
private static final Logger log = LoggerFactory.getLogger(ChangeHookRunner.class);
public static class Module extends AbstractModule {
@Override
protected void configure() {
bind(ChangeHookRunner.class);
bind(ChangeHooks.class).to(ChangeHookRunner.class);
}
}
private static class ChangeListenerHolder {
final ChangeListener listener;
final IdentifiedUser user;
@ -216,13 +223,6 @@ public class ChangeHookRunner {
}
}
/**
* Fire the Patchset Created Hook.
*
* @param change The change itself.
* @param patchSet The Patchset that was created.
* @throws OrmException
*/
public void doPatchsetCreatedHook(final Change change, final PatchSet patchSet,
final ReviewDb db) throws OrmException {
final PatchSetCreatedEvent event = new PatchSetCreatedEvent();
@ -245,16 +245,6 @@ public class ChangeHookRunner {
runHook(openRepository(change), patchsetCreatedHook, args);
}
/**
* Fire the Comment Added Hook.
*
* @param change The change itself.
* @param patchSet The patchset this comment is related to.
* @param account The gerrit user who commited the change.
* @param comment The comment given.
* @param approvals Map of Approval Categories and Scores
* @throws OrmException
*/
public void doCommentAddedHook(final Change change, final Account account,
final PatchSet patchSet, final String comment, final Map<ApprovalCategory.Id,
ApprovalCategoryValue.Id> approvals, final ReviewDb db) throws OrmException {
@ -290,14 +280,6 @@ public class ChangeHookRunner {
runHook(openRepository(change), commentAddedHook, args);
}
/**
* Fire the Change Merged Hook.
*
* @param change The change itself.
* @param account The gerrit user who commited the change.
* @param patchSet The patchset that was merged.
* @throws OrmException
*/
public void doChangeMergedHook(final Change change, final Account account,
final PatchSet patchSet, final ReviewDb db) throws OrmException {
final ChangeMergedEvent event = new ChangeMergedEvent();
@ -318,14 +300,6 @@ public class ChangeHookRunner {
runHook(openRepository(change), changeMergedHook, args);
}
/**
* Fire the Change Abandoned Hook.
*
* @param change The change itself.
* @param account The gerrit user who abandoned the change.
* @param reason Reason for abandoning the change.
* @throws OrmException
*/
public void doChangeAbandonedHook(final Change change, final Account account,
final String reason, final ReviewDb db) throws OrmException {
final ChangeAbandonedEvent event = new ChangeAbandonedEvent();
@ -346,14 +320,6 @@ public class ChangeHookRunner {
runHook(openRepository(change), changeAbandonedHook, args);
}
/**
* Fire the Change Restored Hook.
*
* @param change The change itself.
* @param account The gerrit user who restored the change.
* @param reason Reason for restoring the change.
* @throws OrmException
*/
public void doChangeRestoreHook(final Change change, final Account account,
final String reason, final ReviewDb db) throws OrmException {
final ChangeRestoreEvent event = new ChangeRestoreEvent();
@ -374,23 +340,10 @@ public class ChangeHookRunner {
runHook(openRepository(change), changeRestoredHook, args);
}
/**
* Fire the Ref Updated Hook
* @param project The project the ref update occured on
* @param refUpdate An actual RefUpdate object
* @param account The gerrit user who moved the ref
*/
public void doRefUpdatedHook(final Branch.NameKey refName, final RefUpdate refUpdate, final Account account) {
doRefUpdatedHook(refName, refUpdate.getOldObjectId(), refUpdate.getNewObjectId(), account);
}
/**
* Fire the Ref Updated Hook
* @param refName The Branch.NameKey of the ref that was updated
* @param oldId The ref's old id
* @param newId The ref's new id
* @param account The gerrit user who moved the ref
*/
public void doRefUpdatedHook(final Branch.NameKey refName, final ObjectId oldId, final ObjectId newId, final Account account) {
final RefUpdatedEvent event = new RefUpdatedEvent();

View File

@ -0,0 +1,119 @@
// Copyright (C) 2012 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.common;
import com.google.gerrit.reviewdb.Account;
import com.google.gerrit.reviewdb.ApprovalCategory;
import com.google.gerrit.reviewdb.ApprovalCategoryValue;
import com.google.gerrit.reviewdb.Branch;
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.ContributorAgreement;
import com.google.gerrit.reviewdb.PatchSet;
import com.google.gerrit.reviewdb.ReviewDb;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gwtorm.client.OrmException;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.RefUpdate;
import java.util.Map;
/** Invokes hooks on server actions. */
public interface ChangeHooks {
public void addChangeListener(ChangeListener listener, IdentifiedUser user);
public void removeChangeListener(ChangeListener listener);
/**
* Fire the Patchset Created Hook.
*
* @param change The change itself.
* @param patchSet The Patchset that was created.
* @throws OrmException
*/
public void doPatchsetCreatedHook(Change change, PatchSet patchSet,
ReviewDb db) throws OrmException;
/**
* Fire the Comment Added Hook.
*
* @param change The change itself.
* @param patchSet The patchset this comment is related to.
* @param account The gerrit user who commited the change.
* @param comment The comment given.
* @param approvals Map of Approval Categories and Scores
* @throws OrmException
*/
public void doCommentAddedHook(Change change, Account account,
PatchSet patchSet, String comment,
Map<ApprovalCategory.Id, ApprovalCategoryValue.Id> approvals, ReviewDb db)
throws OrmException;
/**
* Fire the Change Merged Hook.
*
* @param change The change itself.
* @param account The gerrit user who commited the change.
* @param patchSet The patchset that was merged.
* @throws OrmException
*/
public void doChangeMergedHook(Change change, Account account,
PatchSet patchSet, ReviewDb db) throws OrmException;
/**
* Fire the Change Abandoned Hook.
*
* @param change The change itself.
* @param account The gerrit user who abandoned the change.
* @param reason Reason for abandoning the change.
* @throws OrmException
*/
public void doChangeAbandonedHook(Change change, Account account,
String reason, ReviewDb db) throws OrmException;
/**
* Fire the Change Restored Hook.
*
* @param change The change itself.
* @param account The gerrit user who restored the change.
* @param reason Reason for restoring the change.
* @throws OrmException
*/
public void doChangeRestoreHook(Change change, Account account,
String reason, ReviewDb db) throws OrmException;
/**
* Fire the Ref Updated Hook
*
* @param refName The updated project and branch.
* @param refUpdate An actual RefUpdate object
* @param account The gerrit user who moved the ref
*/
public void doRefUpdatedHook(Branch.NameKey refName, RefUpdate refUpdate,
Account account);
/**
* Fire the Ref Updated Hook
*
* @param refName The Branch.NameKey of the ref that was updated
* @param oldId The ref's old id
* @param newId The ref's new id
* @param account The gerrit user who moved the ref
*/
public void doRefUpdatedHook(Branch.NameKey refName, ObjectId oldId,
ObjectId newId, Account account);
public void doClaSignupHook(Account account, ContributorAgreement cla);
}

View File

@ -0,0 +1,81 @@
// Copyright (C) 2012 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.common;
import com.google.gerrit.reviewdb.Account;
import com.google.gerrit.reviewdb.ApprovalCategory;
import com.google.gerrit.reviewdb.ApprovalCategoryValue;
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.ContributorAgreement;
import com.google.gerrit.reviewdb.PatchSet;
import com.google.gerrit.reviewdb.ReviewDb;
import com.google.gerrit.reviewdb.Branch.NameKey;
import com.google.gerrit.server.IdentifiedUser;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.RefUpdate;
import java.util.Map;
/** Does not invoke hooks. */
public final class DisabledChangeHooks implements ChangeHooks {
@Override
public void addChangeListener(ChangeListener listener, IdentifiedUser user) {
}
@Override
public void doChangeAbandonedHook(Change change, Account account,
String reason, ReviewDb db) {
}
@Override
public void doChangeMergedHook(Change change, Account account,
PatchSet patchSet, ReviewDb db) {
}
@Override
public void doChangeRestoreHook(Change change, Account account,
String reason, ReviewDb db) {
}
@Override
public void doClaSignupHook(Account account, ContributorAgreement cla) {
}
@Override
public void doCommentAddedHook(Change change, Account account,
PatchSet patchSet, String comment,
Map<ApprovalCategory.Id, ApprovalCategoryValue.Id> approvals, ReviewDb db) {
}
@Override
public void doPatchsetCreatedHook(Change change, PatchSet patchSet,
ReviewDb db) {
}
@Override
public void doRefUpdatedHook(NameKey refName, RefUpdate refUpdate,
Account account) {
}
@Override
public void doRefUpdatedHook(NameKey refName, ObjectId oldId, ObjectId newId,
Account account) {
}
@Override
public void removeChangeListener(ChangeListener listener) {
}
}

View File

@ -16,7 +16,7 @@ package com.google.gerrit.server;
import static com.google.gerrit.reviewdb.ApprovalCategory.SUBMIT;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.ChangeMessage;
import com.google.gerrit.reviewdb.PatchSet;
@ -216,7 +216,7 @@ public class ChangeUtil {
public static Change.Id revert(final PatchSet.Id patchSetId,
final IdentifiedUser user, final String message, final ReviewDb db,
final RevertedSender.Factory revertedSenderFactory,
final ChangeHookRunner hooks, GitRepositoryManager gitManager,
final ChangeHooks hooks, GitRepositoryManager gitManager,
final PatchSetInfoFactory patchSetInfoFactory,
final ReplicationQueue replication, PersonIdent myIdent)
throws NoSuchChangeException, EmailException, OrmException,
@ -320,7 +320,7 @@ public class ChangeUtil {
public static void restore(final PatchSet.Id patchSetId,
final IdentifiedUser user, final String message, final ReviewDb db,
final RestoredSender.Factory senderFactory,
final ChangeHookRunner hooks) throws NoSuchChangeException,
final ChangeHooks hooks) throws NoSuchChangeException,
InvalidChangeOperationException, EmailException, OrmException {
final Change.Id changeId = patchSetId.getParentKey();
final PatchSet patch = db.patchSets().get(patchSetId);

View File

@ -15,7 +15,7 @@
package com.google.gerrit.server.changedetail;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.common.data.ReviewResult;
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.ChangeMessage;
@ -45,7 +45,7 @@ public class AbandonChange implements Callable<ReviewResult> {
private final ChangeControl.Factory changeControlFactory;
private final ReviewDb db;
private final IdentifiedUser currentUser;
private final ChangeHookRunner hooks;
private final ChangeHooks hooks;
private final PatchSet.Id patchSetId;
private final String changeComment;
@ -53,7 +53,7 @@ public class AbandonChange implements Callable<ReviewResult> {
@Inject
AbandonChange(final AbandonedSender.Factory abandonedSenderFactory,
final ChangeControl.Factory changeControlFactory, final ReviewDb db,
final IdentifiedUser currentUser, final ChangeHookRunner hooks,
final IdentifiedUser currentUser, final ChangeHooks hooks,
@Assisted final PatchSet.Id patchSetId,
@Assisted final String changeComment) {
this.abandonedSenderFactory = abandonedSenderFactory;

View File

@ -17,7 +17,7 @@ package com.google.gerrit.server.git;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.MINUTES;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.common.data.ApprovalType;
import com.google.gerrit.common.data.ApprovalTypes;
import com.google.gerrit.common.data.Capable;
@ -159,7 +159,7 @@ public class MergeOp {
private Set<RevCommit> alreadyAccepted;
private RefUpdate branchUpdate;
private final ChangeHookRunner hooks;
private final ChangeHooks hooks;
private final AccountCache accountCache;
private final TagCache tagCache;
private final CreateCodeReviewNotes.Factory codeReviewNotesFactory;
@ -176,7 +176,7 @@ public class MergeOp {
final ChangeControl.GenericFactory changeControlFactory,
@GerritPersonIdent final PersonIdent myIdent,
final MergeQueue mergeQueue, @Assisted final Branch.NameKey branch,
final ChangeHookRunner hooks, final AccountCache accountCache,
final ChangeHooks hooks, final AccountCache accountCache,
final TagCache tagCache, final CreateCodeReviewNotes.Factory crnf,
final SubmoduleOp.Factory subOpFactory) {
repoManager = grm;

View File

@ -14,7 +14,7 @@
package com.google.gerrit.server.git;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.common.data.ApprovalType;
import com.google.gerrit.common.data.ApprovalTypes;
@ -124,7 +124,7 @@ public class ReceiveCommits implements PreReceiveHook, PostReceiveHook {
private final ReplacePatchSetSender.Factory replacePatchSetFactory;
private final ReplicationQueue replication;
private final PatchSetInfoFactory patchSetInfoFactory;
private final ChangeHookRunner hooks;
private final ChangeHooks hooks;
private final GitRepositoryManager repoManager;
private final ProjectCache projectCache;
private final String canonicalWebUrl;
@ -163,7 +163,7 @@ public class ReceiveCommits implements PreReceiveHook, PostReceiveHook {
final ReplacePatchSetSender.Factory replacePatchSetFactory,
final ReplicationQueue replication,
final PatchSetInfoFactory patchSetInfoFactory,
final ChangeHookRunner hooks,
final ChangeHooks hooks,
final ProjectCache projectCache,
final GitRepositoryManager repoManager,
final TagCache tagCache,

View File

@ -14,7 +14,7 @@
package com.google.gerrit.server.patch;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.common.data.ApprovalType;
import com.google.gerrit.common.data.ApprovalTypes;
import com.google.gerrit.reviewdb.ApprovalCategory;
@ -67,7 +67,7 @@ public class PublishComments implements Callable<VoidResult> {
private final PatchSetInfoFactory patchSetInfoFactory;
private final ChangeControl.Factory changeControlFactory;
private final FunctionState.Factory functionStateFactory;
private final ChangeHookRunner hooks;
private final ChangeHooks hooks;
private final PatchSet.Id patchSetId;
private final String messageText;
@ -86,7 +86,7 @@ public class PublishComments implements Callable<VoidResult> {
final PatchSetInfoFactory patchSetInfoFactory,
final ChangeControl.Factory changeControlFactory,
final FunctionState.Factory functionStateFactory,
final ChangeHookRunner hooks,
final ChangeHooks hooks,
@Assisted final PatchSet.Id patchSetId,
@Assisted final String messageText,

View File

@ -14,7 +14,7 @@
package com.google.gerrit.sshd.commands;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.common.data.ApprovalType;
import com.google.gerrit.common.data.ApprovalTypes;
import com.google.gerrit.common.data.ReviewResult;
@ -150,7 +150,7 @@ public class ReviewCommand extends BaseCommand {
private RestoredSender.Factory restoredSenderFactory;
@Inject
private ChangeHookRunner hooks;
private ChangeHooks hooks;
@Inject
private GitRepositoryManager gitManager;

View File

@ -14,7 +14,7 @@
package com.google.gerrit.sshd.commands;
import com.google.gerrit.common.ChangeHookRunner;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.common.ChangeListener;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.events.ChangeEvent;
@ -43,7 +43,7 @@ final class StreamEvents extends BaseCommand {
private IdentifiedUser currentUser;
@Inject
private ChangeHookRunner hooks;
private ChangeHooks hooks;
@Inject
@StreamCommandExecutor

View File

@ -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());