Search in sources :

Example 1 with ReceiveCommitsExecutorModule

use of com.google.gerrit.server.git.ReceiveCommitsExecutorModule in project gerrit by GerritCodeReview.

the class Daemon method createSysInjector.

private Injector createSysInjector() {
    final List<Module> modules = new ArrayList<>();
    modules.add(SchemaVersionCheck.module());
    modules.add(new DropWizardMetricMaker.RestModule());
    modules.add(new LogFileCompressor.Module());
    // Index module shutdown must happen before work queue shutdown, otherwise
    // work queue can get stuck waiting on index futures that will never return.
    modules.add(createIndexModule());
    modules.add(new WorkQueue.Module());
    modules.add(new StreamEventsApiListener.Module());
    modules.add(new EventBroker.Module());
    modules.add(test ? new H2AccountPatchReviewStore.InMemoryModule() : new JdbcAccountPatchReviewStore.Module(config));
    modules.add(new ReceiveCommitsExecutorModule());
    modules.add(new DiffExecutorModule());
    modules.add(new MimeUtil2Module());
    modules.add(cfgInjector.getInstance(GerritGlobalModule.class));
    modules.add(new SearchingChangeCacheImpl.Module(slave));
    modules.add(new InternalAccountDirectory.Module());
    modules.add(new DefaultPermissionBackendModule());
    modules.add(new DefaultCacheFactory.Module());
    modules.add(cfgInjector.getInstance(MailReceiver.Module.class));
    if (emailModule != null) {
        modules.add(emailModule);
    } else {
        modules.add(new SmtpEmailSender.Module());
    }
    modules.add(new SignedTokenEmailTokenVerifier.Module());
    modules.add(new PluginRestApiModule());
    modules.add(new RestCacheAdminModule());
    modules.add(new GpgModule(config));
    modules.add(new StartupChecks.Module());
    if (MoreObjects.firstNonNull(httpd, true)) {
        modules.add(new CanonicalWebUrlModule() {

            @Override
            protected Class<? extends Provider<String>> provider() {
                return HttpCanonicalWebUrlProvider.class;
            }
        });
    } else {
        modules.add(new CanonicalWebUrlModule() {

            @Override
            protected Class<? extends Provider<String>> provider() {
                return CanonicalWebUrlProvider.class;
            }
        });
    }
    if (sshd) {
        modules.add(SshKeyCacheImpl.module());
    } else {
        modules.add(NoSshKeyCache.module());
    }
    modules.add(new AbstractModule() {

        @Override
        protected void configure() {
            bind(GerritOptions.class).toInstance(new GerritOptions(config, headless, slave, polyGerritDev));
            if (test) {
                bind(String.class).annotatedWith(SecureStoreClassName.class).toInstance(DefaultSecureStore.class.getName());
                bind(SecureStore.class).toProvider(SecureStoreProvider.class);
            }
        }
    });
    modules.add(new GarbageCollectionModule());
    if (!slave) {
        modules.add(new ChangeCleanupRunner.Module());
    }
    return cfgInjector.createChildInjector(modules);
}
Also used : ArrayList(java.util.ArrayList) InternalAccountDirectory(com.google.gerrit.server.account.InternalAccountDirectory) WorkQueue(com.google.gerrit.server.git.WorkQueue) MimeUtil2Module(com.google.gerrit.server.mime.MimeUtil2Module) SignedTokenEmailTokenVerifier(com.google.gerrit.server.mail.SignedTokenEmailTokenVerifier) GerritGlobalModule(com.google.gerrit.server.config.GerritGlobalModule) StartupChecks(com.google.gerrit.server.StartupChecks) ChangeCleanupRunner(com.google.gerrit.server.change.ChangeCleanupRunner) GarbageCollectionModule(com.google.gerrit.server.git.GarbageCollectionModule) RestCacheAdminModule(com.google.gerrit.server.config.RestCacheAdminModule) DropWizardMetricMaker(com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker) GpgModule(com.google.gerrit.gpg.GpgModule) DefaultPermissionBackendModule(com.google.gerrit.server.project.DefaultPermissionBackendModule) EventBroker(com.google.gerrit.common.EventBroker) SearchingChangeCacheImpl(com.google.gerrit.server.git.SearchingChangeCacheImpl) PluginRestApiModule(com.google.gerrit.server.plugins.PluginRestApiModule) DefaultCacheFactory(com.google.gerrit.server.cache.h2.DefaultCacheFactory) GerritOptions(com.google.gerrit.server.config.GerritOptions) SecureStoreProvider(com.google.gerrit.server.securestore.SecureStoreProvider) StreamEventsApiListener(com.google.gerrit.server.events.StreamEventsApiListener) CanonicalWebUrlModule(com.google.gerrit.server.config.CanonicalWebUrlModule) DataSourceProvider(com.google.gerrit.server.schema.DataSourceProvider) CanonicalWebUrlProvider(com.google.gerrit.server.config.CanonicalWebUrlProvider) HttpCanonicalWebUrlProvider(com.google.gerrit.httpd.HttpCanonicalWebUrlProvider) SecureStoreProvider(com.google.gerrit.server.securestore.SecureStoreProvider) Provider(com.google.inject.Provider) AbstractModule(com.google.inject.AbstractModule) LogFileCompressor(com.google.gerrit.pgm.util.LogFileCompressor) DiffExecutorModule(com.google.gerrit.server.patch.DiffExecutorModule) SmtpEmailSender(com.google.gerrit.server.mail.send.SmtpEmailSender) AuthConfigModule(com.google.gerrit.server.config.AuthConfigModule) Module(com.google.inject.Module) CanonicalWebUrlModule(com.google.gerrit.server.config.CanonicalWebUrlModule) DummyIndexModule(com.google.gerrit.server.index.DummyIndexModule) GerritGlobalModule(com.google.gerrit.server.config.GerritGlobalModule) LuceneIndexModule(com.google.gerrit.lucene.LuceneIndexModule) DefaultPermissionBackendModule(com.google.gerrit.server.project.DefaultPermissionBackendModule) OAuthModule(com.google.gerrit.httpd.auth.oauth.OAuthModule) MimeUtil2Module(com.google.gerrit.server.mime.MimeUtil2Module) GarbageCollectionModule(com.google.gerrit.server.git.GarbageCollectionModule) WebSshGlueModule(com.google.gerrit.httpd.WebSshGlueModule) SshModule(com.google.gerrit.sshd.SshModule) SshAddressesModule(com.google.gerrit.server.ssh.SshAddressesModule) HttpPluginModule(com.google.gerrit.httpd.plugins.HttpPluginModule) DefaultCommandModule(com.google.gerrit.sshd.commands.DefaultCommandModule) WebModule(com.google.gerrit.httpd.WebModule) PluginRestApiModule(com.google.gerrit.server.plugins.PluginRestApiModule) ReceiveCommitsExecutorModule(com.google.gerrit.server.git.ReceiveCommitsExecutorModule) ElasticIndexModule(com.google.gerrit.elasticsearch.ElasticIndexModule) GitOverHttpModule(com.google.gerrit.httpd.GitOverHttpModule) IndexModule(com.google.gerrit.server.index.IndexModule) StaticModule(com.google.gerrit.httpd.raw.StaticModule) RestCacheAdminModule(com.google.gerrit.server.config.RestCacheAdminModule) IndexCommandsModule(com.google.gerrit.sshd.commands.IndexCommandsModule) JettyModule(com.google.gerrit.pgm.http.jetty.JettyModule) DiffExecutorModule(com.google.gerrit.server.patch.DiffExecutorModule) NoSshModule(com.google.gerrit.server.ssh.NoSshModule) GpgModule(com.google.gerrit.gpg.GpgModule) OpenIdModule(com.google.gerrit.httpd.auth.openid.OpenIdModule) SshHostKeyModule(com.google.gerrit.sshd.SshHostKeyModule) AbstractModule(com.google.inject.AbstractModule) ReceiveCommitsExecutorModule(com.google.gerrit.server.git.ReceiveCommitsExecutorModule)

Example 2 with ReceiveCommitsExecutorModule

use of com.google.gerrit.server.git.ReceiveCommitsExecutorModule in project gerrit by GerritCodeReview.

the class BatchProgramModule method configure.

@SuppressWarnings("rawtypes")
@Override
protected void configure() {
    install(reviewDbModule);
    install(new DiffExecutorModule());
    install(new ReceiveCommitsExecutorModule());
    install(BatchUpdate.module());
    install(PatchListCacheImpl.module());
    // Plugins are not loaded and we're just running through each change
    // once, so don't worry about cache removal.
    bind(new TypeLiteral<DynamicSet<CacheRemovalListener>>() {
    }).toInstance(DynamicSet.<CacheRemovalListener>emptySet());
    bind(new TypeLiteral<DynamicMap<Cache<?, ?>>>() {
    }).toInstance(DynamicMap.<Cache<?, ?>>emptyMap());
    bind(new TypeLiteral<List<CommentLinkInfo>>() {
    }).toProvider(CommentLinkProvider.class).in(SINGLETON);
    bind(new TypeLiteral<DynamicMap<ChangeQueryProcessor.ChangeAttributeFactory>>() {
    }).toInstance(DynamicMap.<ChangeQueryProcessor.ChangeAttributeFactory>emptyMap());
    bind(String.class).annotatedWith(CanonicalWebUrl.class).toProvider(CanonicalWebUrlProvider.class);
    bind(Boolean.class).annotatedWith(DisableReverseDnsLookup.class).toProvider(DisableReverseDnsLookupProvider.class).in(SINGLETON);
    bind(Realm.class).to(FakeRealm.class);
    bind(IdentifiedUser.class).toProvider(Providers.<IdentifiedUser>of(null));
    bind(ReplacePatchSetSender.Factory.class).toProvider(Providers.<ReplacePatchSetSender.Factory>of(null));
    bind(CurrentUser.class).to(IdentifiedUser.class);
    factory(MergeUtil.Factory.class);
    factory(PatchSetInserter.Factory.class);
    factory(RebaseChangeOp.Factory.class);
    // As Reindex is a batch program, don't assume the index is available for
    // the change cache.
    bind(SearchingChangeCacheImpl.class).toProvider(Providers.<SearchingChangeCacheImpl>of(null));
    bind(new TypeLiteral<ImmutableSet<GroupReference>>() {
    }).annotatedWith(AdministrateServerGroups.class).toInstance(ImmutableSet.<GroupReference>of());
    bind(new TypeLiteral<Set<AccountGroup.UUID>>() {
    }).annotatedWith(GitUploadPackGroups.class).toInstance(Collections.<AccountGroup.UUID>emptySet());
    bind(new TypeLiteral<Set<AccountGroup.UUID>>() {
    }).annotatedWith(GitReceivePackGroups.class).toInstance(Collections.<AccountGroup.UUID>emptySet());
    install(new BatchGitModule());
    install(new DefaultPermissionBackendModule());
    install(new DefaultCacheFactory.Module());
    install(new ExternalIdModule());
    install(new GroupModule());
    install(new NoteDbModule(cfg));
    install(new PrologModule());
    install(AccountByEmailCacheImpl.module());
    install(AccountCacheImpl.module());
    install(GroupCacheImpl.module());
    install(GroupIncludeCacheImpl.module());
    install(ProjectCacheImpl.module());
    install(SectionSortCache.module());
    install(ChangeKindCacheImpl.module());
    install(MergeabilityCacheImpl.module());
    install(TagCache.module());
    factory(CapabilityCollection.Factory.class);
    factory(CapabilityControl.Factory.class);
    factory(ChangeData.Factory.class);
    factory(ProjectState.Factory.class);
    bind(ChangeJson.Factory.class).toProvider(Providers.<ChangeJson.Factory>of(null));
    bind(AccountVisibility.class).toProvider(AccountVisibilityProvider.class).in(SINGLETON);
}
Also used : ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) DynamicSet(com.google.gerrit.extensions.registration.DynamicSet) CurrentUser(com.google.gerrit.server.CurrentUser) CapabilityControl(com.google.gerrit.server.account.CapabilityControl) NoteDbModule(com.google.gerrit.server.notedb.NoteDbModule) DefaultCacheFactory(com.google.gerrit.server.cache.h2.DefaultCacheFactory) AdministrateServerGroups(com.google.gerrit.server.config.AdministrateServerGroups) GroupModule(com.google.gerrit.server.group.GroupModule) CacheRemovalListener(com.google.gerrit.server.cache.CacheRemovalListener) TypeLiteral(com.google.inject.TypeLiteral) ImmutableSet(com.google.common.collect.ImmutableSet) GitUploadPackGroups(com.google.gerrit.server.config.GitUploadPackGroups) MergeUtil(com.google.gerrit.server.git.MergeUtil) List(java.util.List) DefaultPermissionBackendModule(com.google.gerrit.server.project.DefaultPermissionBackendModule) FakeRealm(com.google.gerrit.server.account.FakeRealm) Realm(com.google.gerrit.server.account.Realm) CommentLinkProvider(com.google.gerrit.server.project.CommentLinkProvider) SearchingChangeCacheImpl(com.google.gerrit.server.git.SearchingChangeCacheImpl) ChangeJson(com.google.gerrit.server.change.ChangeJson) GitReceivePackGroups(com.google.gerrit.server.config.GitReceivePackGroups) DisableReverseDnsLookupProvider(com.google.gerrit.server.config.DisableReverseDnsLookupProvider) PrologModule(com.google.gerrit.rules.PrologModule) CanonicalWebUrl(com.google.gerrit.server.config.CanonicalWebUrl) ChangeQueryProcessor(com.google.gerrit.server.query.change.ChangeQueryProcessor) DefaultCacheFactory(com.google.gerrit.server.cache.h2.DefaultCacheFactory) RebaseChangeOp(com.google.gerrit.server.change.RebaseChangeOp) CapabilityCollection(com.google.gerrit.server.account.CapabilityCollection) IdentifiedUser(com.google.gerrit.server.IdentifiedUser) ChangeData(com.google.gerrit.server.query.change.ChangeData) AccountVisibilityProvider(com.google.gerrit.server.account.AccountVisibilityProvider) AccountGroup(com.google.gerrit.reviewdb.client.AccountGroup) PatchSetInserter(com.google.gerrit.server.change.PatchSetInserter) ExternalIdModule(com.google.gerrit.server.account.externalids.ExternalIdModule) DiffExecutorModule(com.google.gerrit.server.patch.DiffExecutorModule) ProjectState(com.google.gerrit.server.project.ProjectState) ReceiveCommitsExecutorModule(com.google.gerrit.server.git.ReceiveCommitsExecutorModule) ReplacePatchSetSender(com.google.gerrit.server.mail.send.ReplacePatchSetSender) TagCache(com.google.gerrit.server.git.TagCache) SectionSortCache(com.google.gerrit.server.project.SectionSortCache) Cache(com.google.common.cache.Cache)

Example 3 with ReceiveCommitsExecutorModule

use of com.google.gerrit.server.git.ReceiveCommitsExecutorModule in project gerrit by GerritCodeReview.

the class WebAppInitializer method createSysInjector.

private Injector createSysInjector() {
    final List<Module> modules = new ArrayList<>();
    modules.add(new DropWizardMetricMaker.RestModule());
    modules.add(new LogFileCompressor.Module());
    modules.add(new EventBroker.Module());
    modules.add(new JdbcAccountPatchReviewStore.Module(config));
    modules.add(cfgInjector.getInstance(GitRepositoryManagerModule.class));
    modules.add(new StreamEventsApiListener.Module());
    modules.add(new ReceiveCommitsExecutorModule());
    modules.add(new DiffExecutorModule());
    modules.add(new MimeUtil2Module());
    modules.add(cfgInjector.getInstance(GerritGlobalModule.class));
    modules.add(new SearchingChangeCacheImpl.Module());
    modules.add(new InternalAccountDirectory.Module());
    modules.add(new DefaultPermissionBackendModule());
    modules.add(new DefaultCacheFactory.Module());
    modules.add(cfgInjector.getInstance(MailReceiver.Module.class));
    modules.add(new SmtpEmailSender.Module());
    modules.add(new SignedTokenEmailTokenVerifier.Module());
    modules.add(new PluginRestApiModule());
    modules.add(new RestCacheAdminModule());
    modules.add(new GpgModule(config));
    modules.add(new StartupChecks.Module());
    // Index module shutdown must happen before work queue shutdown, otherwise
    // work queue can get stuck waiting on index futures that will never return.
    modules.add(createIndexModule());
    modules.add(new WorkQueue.Module());
    modules.add(new CanonicalWebUrlModule() {

        @Override
        protected Class<? extends Provider<String>> provider() {
            return HttpCanonicalWebUrlProvider.class;
        }
    });
    modules.add(SshKeyCacheImpl.module());
    modules.add(new AbstractModule() {

        @Override
        protected void configure() {
            bind(GerritOptions.class).toInstance(new GerritOptions(config, false, false, false));
        }
    });
    modules.add(new GarbageCollectionModule());
    modules.add(new ChangeCleanupRunner.Module());
    modules.addAll(LibModuleLoader.loadModules(cfgInjector));
    return cfgInjector.createChildInjector(modules);
}
Also used : JdbcAccountPatchReviewStore(com.google.gerrit.server.schema.JdbcAccountPatchReviewStore) ArrayList(java.util.ArrayList) InternalAccountDirectory(com.google.gerrit.server.account.InternalAccountDirectory) MimeUtil2Module(com.google.gerrit.server.mime.MimeUtil2Module) WorkQueue(com.google.gerrit.server.git.WorkQueue) SignedTokenEmailTokenVerifier(com.google.gerrit.server.mail.SignedTokenEmailTokenVerifier) GerritGlobalModule(com.google.gerrit.server.config.GerritGlobalModule) StartupChecks(com.google.gerrit.server.StartupChecks) ChangeCleanupRunner(com.google.gerrit.server.change.ChangeCleanupRunner) GarbageCollectionModule(com.google.gerrit.server.git.GarbageCollectionModule) RestCacheAdminModule(com.google.gerrit.server.config.RestCacheAdminModule) DropWizardMetricMaker(com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker) GpgModule(com.google.gerrit.gpg.GpgModule) DefaultPermissionBackendModule(com.google.gerrit.server.project.DefaultPermissionBackendModule) EventBroker(com.google.gerrit.common.EventBroker) SearchingChangeCacheImpl(com.google.gerrit.server.git.SearchingChangeCacheImpl) PluginRestApiModule(com.google.gerrit.server.plugins.PluginRestApiModule) DefaultCacheFactory(com.google.gerrit.server.cache.h2.DefaultCacheFactory) GerritOptions(com.google.gerrit.server.config.GerritOptions) GitRepositoryManagerModule(com.google.gerrit.server.git.GitRepositoryManagerModule) StreamEventsApiListener(com.google.gerrit.server.events.StreamEventsApiListener) CanonicalWebUrlModule(com.google.gerrit.server.config.CanonicalWebUrlModule) DataSourceProvider(com.google.gerrit.server.schema.DataSourceProvider) Provider(com.google.inject.Provider) AbstractModule(com.google.inject.AbstractModule) LogFileCompressor(com.google.gerrit.pgm.util.LogFileCompressor) DiffExecutorModule(com.google.gerrit.server.patch.DiffExecutorModule) SmtpEmailSender(com.google.gerrit.server.mail.send.SmtpEmailSender) GitRepositoryManagerModule(com.google.gerrit.server.git.GitRepositoryManagerModule) AuthConfigModule(com.google.gerrit.server.config.AuthConfigModule) Module(com.google.inject.Module) CanonicalWebUrlModule(com.google.gerrit.server.config.CanonicalWebUrlModule) GerritGlobalModule(com.google.gerrit.server.config.GerritGlobalModule) DataSourceModule(com.google.gerrit.server.schema.DataSourceModule) DatabaseModule(com.google.gerrit.server.schema.DatabaseModule) LifecycleModule(com.google.gerrit.lifecycle.LifecycleModule) LuceneIndexModule(com.google.gerrit.lucene.LuceneIndexModule) DefaultPermissionBackendModule(com.google.gerrit.server.project.DefaultPermissionBackendModule) OAuthModule(com.google.gerrit.httpd.auth.oauth.OAuthModule) SchemaModule(com.google.gerrit.server.schema.SchemaModule) MimeUtil2Module(com.google.gerrit.server.mime.MimeUtil2Module) GarbageCollectionModule(com.google.gerrit.server.git.GarbageCollectionModule) SshModule(com.google.gerrit.sshd.SshModule) GerritServerConfigModule(com.google.gerrit.server.config.GerritServerConfigModule) SshAddressesModule(com.google.gerrit.server.ssh.SshAddressesModule) HttpPluginModule(com.google.gerrit.httpd.plugins.HttpPluginModule) DefaultCommandModule(com.google.gerrit.sshd.commands.DefaultCommandModule) PluginRestApiModule(com.google.gerrit.server.plugins.PluginRestApiModule) ReceiveCommitsExecutorModule(com.google.gerrit.server.git.ReceiveCommitsExecutorModule) ElasticIndexModule(com.google.gerrit.elasticsearch.ElasticIndexModule) IndexModule(com.google.gerrit.server.index.IndexModule) StaticModule(com.google.gerrit.httpd.raw.StaticModule) RestCacheAdminModule(com.google.gerrit.server.config.RestCacheAdminModule) IndexCommandsModule(com.google.gerrit.sshd.commands.IndexCommandsModule) DiffExecutorModule(com.google.gerrit.server.patch.DiffExecutorModule) NoSshModule(com.google.gerrit.server.ssh.NoSshModule) GpgModule(com.google.gerrit.gpg.GpgModule) OpenIdModule(com.google.gerrit.httpd.auth.openid.OpenIdModule) SshHostKeyModule(com.google.gerrit.sshd.SshHostKeyModule) AbstractModule(com.google.inject.AbstractModule) ReceiveCommitsExecutorModule(com.google.gerrit.server.git.ReceiveCommitsExecutorModule)

Aggregations

DefaultCacheFactory (com.google.gerrit.server.cache.h2.DefaultCacheFactory)3 ReceiveCommitsExecutorModule (com.google.gerrit.server.git.ReceiveCommitsExecutorModule)3 SearchingChangeCacheImpl (com.google.gerrit.server.git.SearchingChangeCacheImpl)3 DiffExecutorModule (com.google.gerrit.server.patch.DiffExecutorModule)3 DefaultPermissionBackendModule (com.google.gerrit.server.project.DefaultPermissionBackendModule)3 EventBroker (com.google.gerrit.common.EventBroker)2 ElasticIndexModule (com.google.gerrit.elasticsearch.ElasticIndexModule)2 GpgModule (com.google.gerrit.gpg.GpgModule)2 OAuthModule (com.google.gerrit.httpd.auth.oauth.OAuthModule)2 OpenIdModule (com.google.gerrit.httpd.auth.openid.OpenIdModule)2 HttpPluginModule (com.google.gerrit.httpd.plugins.HttpPluginModule)2 StaticModule (com.google.gerrit.httpd.raw.StaticModule)2 LuceneIndexModule (com.google.gerrit.lucene.LuceneIndexModule)2 DropWizardMetricMaker (com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker)2 LogFileCompressor (com.google.gerrit.pgm.util.LogFileCompressor)2 StartupChecks (com.google.gerrit.server.StartupChecks)2 InternalAccountDirectory (com.google.gerrit.server.account.InternalAccountDirectory)2 ChangeCleanupRunner (com.google.gerrit.server.change.ChangeCleanupRunner)2 AuthConfigModule (com.google.gerrit.server.config.AuthConfigModule)2 CanonicalWebUrlModule (com.google.gerrit.server.config.CanonicalWebUrlModule)2