Define module for having group related Guice bindings in one place
Instead of having the same Guice bindings twice in Reindex and GerritGlobalModule have one dedicated GroupModule for this and use it in both places. Change-Id: Ic30856413723e87c88af0e67df100aa13a03d8aa Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
parent
8fae529d13
commit
eeecffd36a
@ -34,16 +34,11 @@ import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.rules.PrologModule;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.InternalUser;
|
||||
import com.google.gerrit.server.account.AccountByEmailCacheImpl;
|
||||
import com.google.gerrit.server.account.AccountCacheImpl;
|
||||
import com.google.gerrit.server.account.CapabilityControl;
|
||||
import com.google.gerrit.server.account.GroupBackend;
|
||||
import com.google.gerrit.server.account.GroupCacheImpl;
|
||||
import com.google.gerrit.server.account.GroupIncludeCacheImpl;
|
||||
import com.google.gerrit.server.account.IncludingGroupMembership;
|
||||
import com.google.gerrit.server.account.InternalGroupBackend;
|
||||
import com.google.gerrit.server.account.UniversalGroupBackend;
|
||||
import com.google.gerrit.server.cache.CacheRemovalListener;
|
||||
import com.google.gerrit.server.cache.h2.DefaultCacheFactory;
|
||||
import com.google.gerrit.server.change.ChangeKindCache;
|
||||
@ -59,7 +54,7 @@ import com.google.gerrit.server.git.MergeUtil;
|
||||
import com.google.gerrit.server.git.WorkQueue;
|
||||
import com.google.gerrit.server.git.validators.CommitValidationListener;
|
||||
import com.google.gerrit.server.git.validators.CommitValidators;
|
||||
import com.google.gerrit.server.group.SystemGroupBackend;
|
||||
import com.google.gerrit.server.group.GroupModule;
|
||||
import com.google.gerrit.server.index.ChangeBatchIndexer;
|
||||
import com.google.gerrit.server.index.ChangeIndex;
|
||||
import com.google.gerrit.server.index.ChangeSchemas;
|
||||
@ -263,14 +258,6 @@ public class Reindex extends SiteProgram {
|
||||
bind(String.class).annotatedWith(CanonicalWebUrl.class)
|
||||
.toProvider(CanonicalWebUrlProvider.class);
|
||||
|
||||
factory(IncludingGroupMembership.Factory.class);
|
||||
bind(GroupBackend.class).to(UniversalGroupBackend.class).in(SINGLETON);
|
||||
DynamicSet.setOf(binder(), GroupBackend.class);
|
||||
bind(InternalGroupBackend.class).in(SINGLETON);
|
||||
DynamicSet.bind(binder(), GroupBackend.class).to(SystemGroupBackend.class);
|
||||
DynamicSet.bind(binder(), GroupBackend.class).to(InternalGroupBackend.class);
|
||||
factory(InternalUser.Factory.class);
|
||||
|
||||
factory(PatchSetInserter.Factory.class);
|
||||
bind(ChangeHooks.class).to(DisabledChangeHooks.class);
|
||||
bind(ReplacePatchSetSender.Factory.class).toProvider(
|
||||
@ -292,6 +279,7 @@ public class Reindex extends SiteProgram {
|
||||
|
||||
install(new AccessControlModule());
|
||||
install(new GitModule());
|
||||
install(new GroupModule());
|
||||
install(new NoteDbModule());
|
||||
install(new PrologModule());
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ import com.google.gerrit.server.ApprovalsUtil;
|
||||
import com.google.gerrit.server.CmdLineParserModule;
|
||||
import com.google.gerrit.server.FileTypeRegistry;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.InternalUser;
|
||||
import com.google.gerrit.server.MimeUtilFileTypeRegistry;
|
||||
import com.google.gerrit.server.PluginUser;
|
||||
import com.google.gerrit.server.account.AccountByEmailCacheImpl;
|
||||
@ -54,18 +53,14 @@ import com.google.gerrit.server.account.AccountVisibilityProvider;
|
||||
import com.google.gerrit.server.account.CapabilityControl;
|
||||
import com.google.gerrit.server.account.ChangeUserName;
|
||||
import com.google.gerrit.server.account.EmailExpander;
|
||||
import com.google.gerrit.server.account.GroupBackend;
|
||||
import com.google.gerrit.server.account.GroupCacheImpl;
|
||||
import com.google.gerrit.server.account.GroupControl;
|
||||
import com.google.gerrit.server.account.GroupDetailFactory;
|
||||
import com.google.gerrit.server.account.GroupIncludeCacheImpl;
|
||||
import com.google.gerrit.server.account.GroupInfoCacheFactory;
|
||||
import com.google.gerrit.server.account.GroupMembers;
|
||||
import com.google.gerrit.server.account.IncludingGroupMembership;
|
||||
import com.google.gerrit.server.account.InternalGroupBackend;
|
||||
import com.google.gerrit.server.account.PerformCreateGroup;
|
||||
import com.google.gerrit.server.account.PerformRenameGroup;
|
||||
import com.google.gerrit.server.account.UniversalGroupBackend;
|
||||
import com.google.gerrit.server.auth.AuthBackend;
|
||||
import com.google.gerrit.server.auth.UniversalAuthBackend;
|
||||
import com.google.gerrit.server.avatar.AvatarProvider;
|
||||
@ -89,7 +84,7 @@ import com.google.gerrit.server.git.validators.CommitValidators;
|
||||
import com.google.gerrit.server.git.validators.MergeValidationListener;
|
||||
import com.google.gerrit.server.git.validators.MergeValidators;
|
||||
import com.google.gerrit.server.git.validators.MergeValidators.ProjectConfigValidator;
|
||||
import com.google.gerrit.server.group.SystemGroupBackend;
|
||||
import com.google.gerrit.server.group.GroupModule;
|
||||
import com.google.gerrit.server.mail.AddReviewerSender;
|
||||
import com.google.gerrit.server.mail.CreateChangeSender;
|
||||
import com.google.gerrit.server.mail.EmailModule;
|
||||
@ -166,6 +161,7 @@ public class GerritGlobalModule extends FactoryModule {
|
||||
install(new CmdLineParserModule());
|
||||
install(new EmailModule());
|
||||
install(new GitModule());
|
||||
install(new GroupModule());
|
||||
install(new NoteDbModule());
|
||||
install(new PrologModule());
|
||||
install(new SshAddressesModule());
|
||||
@ -182,7 +178,6 @@ public class GerritGlobalModule extends FactoryModule {
|
||||
factory(GroupDetailFactory.Factory.class);
|
||||
factory(GroupInfoCacheFactory.Factory.class);
|
||||
factory(GroupMembers.Factory.class);
|
||||
factory(InternalUser.Factory.class);
|
||||
factory(MergedSender.Factory.class);
|
||||
factory(MergeFailSender.Factory.class);
|
||||
factory(MergeUtil.Factory.class);
|
||||
@ -209,13 +204,6 @@ public class GerritGlobalModule extends FactoryModule {
|
||||
|
||||
bind(GroupControl.Factory.class).in(SINGLETON);
|
||||
bind(GroupControl.GenericFactory.class).in(SINGLETON);
|
||||
factory(IncludingGroupMembership.Factory.class);
|
||||
bind(GroupBackend.class).to(UniversalGroupBackend.class).in(SINGLETON);
|
||||
DynamicSet.setOf(binder(), GroupBackend.class);
|
||||
|
||||
bind(InternalGroupBackend.class).in(SINGLETON);
|
||||
DynamicSet.bind(binder(), GroupBackend.class).to(SystemGroupBackend.class);
|
||||
DynamicSet.bind(binder(), GroupBackend.class).to(InternalGroupBackend.class);
|
||||
|
||||
bind(FileTypeRegistry.class).to(MimeUtilFileTypeRegistry.class);
|
||||
bind(ToolsCatalog.class);
|
||||
|
@ -0,0 +1,41 @@
|
||||
// Copyright (C) 2014 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.server.group;
|
||||
|
||||
import static com.google.inject.Scopes.SINGLETON;
|
||||
|
||||
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||
import com.google.gerrit.server.InternalUser;
|
||||
import com.google.gerrit.server.account.GroupBackend;
|
||||
import com.google.gerrit.server.account.IncludingGroupMembership;
|
||||
import com.google.gerrit.server.account.InternalGroupBackend;
|
||||
import com.google.gerrit.server.account.UniversalGroupBackend;
|
||||
import com.google.gerrit.server.config.FactoryModule;
|
||||
|
||||
public class GroupModule extends FactoryModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
factory(InternalUser.Factory.class);
|
||||
factory(IncludingGroupMembership.Factory.class);
|
||||
|
||||
bind(GroupBackend.class).to(UniversalGroupBackend.class).in(SINGLETON);
|
||||
DynamicSet.setOf(binder(), GroupBackend.class);
|
||||
|
||||
bind(InternalGroupBackend.class).in(SINGLETON);
|
||||
DynamicSet.bind(binder(), GroupBackend.class).to(SystemGroupBackend.class);
|
||||
DynamicSet.bind(binder(), GroupBackend.class).to(InternalGroupBackend.class);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user