Search in sources :

Example 1 with PluginModule

use of com.google.gerrit.server.plugins.PluginModule in project gerrit by GerritCodeReview.

the class Daemon method createSysInjector.

private Injector createSysInjector() {
    final List<Module> modules = new ArrayList<>();
    modules.add(NoteDbSchemaVersionCheck.module());
    modules.add(new DropWizardMetricMaker.RestModule());
    modules.add(new LogFileCompressorModule());
    // 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 SubscriptionGraphModule());
    modules.add(new SuperprojectUpdateSubmissionListenerModule());
    modules.add(new WorkQueueModule());
    modules.add(new StreamEventsApiListenerModule());
    modules.add(new EventBrokerModule());
    modules.add(new JdbcAccountPatchReviewStoreModule(config));
    modules.add(new SysExecutorModule());
    modules.add(new DiffExecutorModule());
    modules.add(new MimeUtil2Module());
    modules.add(cfgInjector.getInstance(GerritGlobalModule.class));
    modules.add(new GerritApiModule());
    modules.add(new PluginApiModule());
    modules.add(new SearchingChangeCacheImplModule(replica));
    modules.add(new InternalAccountDirectoryModule());
    modules.add(new DefaultPermissionBackendModule());
    modules.add(new DefaultMemoryCacheModule());
    modules.add(new H2CacheModule());
    modules.add(cfgInjector.getInstance(MailReceiverModule.class));
    if (emailModule != null) {
        modules.add(emailModule);
    } else {
        modules.add(new SmtpEmailSenderModule());
    }
    if (auditEventModule != null) {
        modules.add(auditEventModule);
    } else {
        modules.add(new AuditModule());
    }
    modules.add(new SignedTokenEmailTokenVerifierModule());
    modules.add(new PluginModule());
    if (VersionManager.getOnlineUpgrade(config)) {
        modules.add(new OnlineUpgraderModule());
    }
    modules.add(new OAuthRestModule());
    modules.add(new RestApiModule());
    modules.add(new GpgModule(config));
    modules.add(new StartupChecksModule());
    modules.add(new GerritInstanceNameModule());
    modules.add(new GerritInstanceIdModule());
    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;
            }
        });
    }
    modules.add(new DefaultUrlFormatterModule());
    SshSessionFactoryInitializer.init();
    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(headless, replica, devCdn));
            if (inMemoryTest) {
                bind(String.class).annotatedWith(SecureStoreClassName.class).toInstance(DefaultSecureStore.class.getName());
                bind(SecureStore.class).toProvider(SecureStoreProvider.class);
            }
        }
    });
    modules.add(new GarbageCollectionModule());
    if (replica) {
        modules.add(new PeriodicGroupIndexerModule());
    } else {
        modules.add(new AccountDeactivatorModule());
        modules.add(new ChangeCleanupRunnerModule());
    }
    modules.add(new LocalMergeSuperSetComputationModule());
    modules.add(new DefaultProjectNameLockManagerModule());
    List<Module> libModules = LibModuleLoader.loadModules(cfgInjector, LibModuleType.SYS_MODULE_TYPE);
    libModules.addAll(LibModuleLoader.loadModules(cfgInjector, LibModuleType.INDEX_MODULE_TYPE));
    libModules.addAll(testSysModules);
    AuthConfig authConfig = cfgInjector.getInstance(AuthConfig.class);
    modules.add(new AuthModule(authConfig));
    modules.add(new ExternalIdCaseSensitivityMigrator.ExternalIdCaseSensitivityMigratorModule());
    return cfgInjector.createChildInjector(ModuleOverloader.override(modules, libModules));
}
Also used : JdbcAccountPatchReviewStoreModule(com.google.gerrit.server.schema.JdbcAccountPatchReviewStore.JdbcAccountPatchReviewStoreModule) RestApiModule(com.google.gerrit.server.restapi.RestApiModule) ArrayList(java.util.ArrayList) AuthConfig(com.google.gerrit.server.config.AuthConfig) HttpPluginModule(com.google.gerrit.httpd.plugins.HttpPluginModule) PluginModule(com.google.gerrit.server.plugins.PluginModule) SmtpEmailSenderModule(com.google.gerrit.server.mail.send.SmtpEmailSender.SmtpEmailSenderModule) DefaultProjectNameLockManagerModule(com.google.gerrit.server.project.DefaultProjectNameLockManager.DefaultProjectNameLockManagerModule) GerritGlobalModule(com.google.gerrit.server.config.GerritGlobalModule) SearchingChangeCacheImplModule(com.google.gerrit.server.git.SearchingChangeCacheImpl.SearchingChangeCacheImplModule) SuperprojectUpdateSubmissionListenerModule(com.google.gerrit.server.update.SuperprojectUpdateSubmissionListener.SuperprojectUpdateSubmissionListenerModule) SysExecutorModule(com.google.gerrit.server.config.SysExecutorModule) DropWizardMetricMaker(com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker) DefaultPermissionBackendModule(com.google.gerrit.server.permissions.DefaultPermissionBackendModule) LogFileCompressorModule(com.google.gerrit.pgm.util.LogFileCompressor.LogFileCompressorModule) GerritOptions(com.google.gerrit.server.config.GerritOptions) SecureStoreProvider(com.google.gerrit.server.securestore.SecureStoreProvider) SignedTokenEmailTokenVerifierModule(com.google.gerrit.server.mail.SignedTokenEmailTokenVerifier.SignedTokenEmailTokenVerifierModule) OnlineUpgraderModule(com.google.gerrit.server.index.OnlineUpgrader.OnlineUpgraderModule) DiffExecutorModule(com.google.gerrit.server.patch.DiffExecutorModule) AuditModule(com.google.gerrit.server.audit.AuditModule) SubscriptionGraphModule(com.google.gerrit.server.submit.SubscriptionGraph.SubscriptionGraphModule) H2CacheModule(com.google.gerrit.server.cache.h2.H2CacheModule) PluginApiModule(com.google.gerrit.server.api.PluginApiModule) CanonicalWebUrlModule(com.google.gerrit.server.config.CanonicalWebUrlModule) OAuthModule(com.google.gerrit.httpd.auth.oauth.OAuthModule) ProjectQoSFilterModule(com.google.gerrit.pgm.http.jetty.ProjectQoSFilter.ProjectQoSFilterModule) InternalAccountDirectoryModule(com.google.gerrit.server.account.InternalAccountDirectory.InternalAccountDirectoryModule) WorkQueueModule(com.google.gerrit.server.git.WorkQueue.WorkQueueModule) SshModule(com.google.gerrit.sshd.SshModule) DefaultPermissionBackendModule(com.google.gerrit.server.permissions.DefaultPermissionBackendModule) ChangeCleanupRunnerModule(com.google.gerrit.server.change.ChangeCleanupRunner.ChangeCleanupRunnerModule) SshAddressesModule(com.google.gerrit.server.ssh.SshAddressesModule) DefaultMemoryCacheModule(com.google.gerrit.server.cache.mem.DefaultMemoryCacheModule) HttpPluginModule(com.google.gerrit.httpd.plugins.HttpPluginModule) DefaultCommandModule(com.google.gerrit.sshd.commands.DefaultCommandModule) WebModule(com.google.gerrit.httpd.WebModule) GetUserFilterModule(com.google.gerrit.httpd.GetUserFilter.GetUserFilterModule) SmtpEmailSenderModule(com.google.gerrit.server.mail.send.SmtpEmailSender.SmtpEmailSenderModule) StreamEventsApiListenerModule(com.google.gerrit.server.events.StreamEventsApiListener.StreamEventsApiListenerModule) PluginModule(com.google.gerrit.server.plugins.PluginModule) IndexModule(com.google.gerrit.server.index.IndexModule) StaticModule(com.google.gerrit.httpd.raw.StaticModule) AccountDeactivatorModule(com.google.gerrit.server.account.AccountDeactivator.AccountDeactivatorModule) AbstractIndexModule(com.google.gerrit.server.index.AbstractIndexModule) JettyModule(com.google.gerrit.pgm.http.jetty.JettyModule) HttpdModule(com.google.gerrit.httpd.HttpdModule) LocalMergeSuperSetComputationModule(com.google.gerrit.server.submit.LocalMergeSuperSetComputation.LocalMergeSuperSetComputationModule) JdbcAccountPatchReviewStoreModule(com.google.gerrit.server.schema.JdbcAccountPatchReviewStore.JdbcAccountPatchReviewStoreModule) SearchingChangeCacheImplModule(com.google.gerrit.server.git.SearchingChangeCacheImpl.SearchingChangeCacheImplModule) PeriodicGroupIndexerModule(com.google.gerrit.server.group.PeriodicGroupIndexer.PeriodicGroupIndexerModule) GpgModule(com.google.gerrit.gpg.GpgModule) OpenIdModule(com.google.gerrit.httpd.auth.openid.OpenIdModule) AuthModule(com.google.gerrit.auth.AuthModule) SshHostKeyModule(com.google.gerrit.sshd.SshHostKeyModule) DefaultProjectNameLockManagerModule(com.google.gerrit.server.project.DefaultProjectNameLockManager.DefaultProjectNameLockManagerModule) OAuthRestModule(com.google.gerrit.httpd.auth.restapi.OAuthRestModule) SignedTokenEmailTokenVerifierModule(com.google.gerrit.server.mail.SignedTokenEmailTokenVerifier.SignedTokenEmailTokenVerifierModule) AbstractModule(com.google.inject.AbstractModule) AuthConfigModule(com.google.gerrit.server.config.AuthConfigModule) SequenceCommandsModule(com.google.gerrit.sshd.commands.SequenceCommandsModule) Module(com.google.inject.Module) DefaultUrlFormatterModule(com.google.gerrit.server.config.DefaultUrlFormatter.DefaultUrlFormatterModule) GerritGlobalModule(com.google.gerrit.server.config.GerritGlobalModule) LfsPluginAuthCommandModule(com.google.gerrit.sshd.plugin.LfsPluginAuthCommand.LfsPluginAuthCommandModule) LuceneIndexModule(com.google.gerrit.lucene.LuceneIndexModule) GerritInstanceIdModule(com.google.gerrit.server.config.GerritInstanceIdModule) MimeUtil2Module(com.google.gerrit.server.mime.MimeUtil2Module) SysExecutorModule(com.google.gerrit.server.config.SysExecutorModule) GarbageCollectionModule(com.google.gerrit.server.git.GarbageCollectionModule) GerritAuthModule(com.google.gerrit.httpd.GerritAuthModule) WebSshGlueModule(com.google.gerrit.httpd.WebSshGlueModule) MailReceiverModule(com.google.gerrit.server.mail.receive.MailReceiver.MailReceiverModule) ExternalIdCommandsModule(com.google.gerrit.sshd.commands.ExternalIdCommandsModule) RequireSslFilterModule(com.google.gerrit.httpd.RequireSslFilter.RequireSslFilterModule) OnlineUpgraderModule(com.google.gerrit.server.index.OnlineUpgrader.OnlineUpgraderModule) AuditModule(com.google.gerrit.server.audit.AuditModule) GitOverHttpModule(com.google.gerrit.httpd.GitOverHttpModule) RestApiModule(com.google.gerrit.server.restapi.RestApiModule) LogFileCompressorModule(com.google.gerrit.pgm.util.LogFileCompressor.LogFileCompressorModule) SuperprojectUpdateSubmissionListenerModule(com.google.gerrit.server.update.SuperprojectUpdateSubmissionListener.SuperprojectUpdateSubmissionListenerModule) IndexCommandsModule(com.google.gerrit.sshd.commands.IndexCommandsModule) DiffExecutorModule(com.google.gerrit.server.patch.DiffExecutorModule) NoSshModule(com.google.gerrit.server.ssh.NoSshModule) EventBrokerModule(com.google.gerrit.server.events.EventBroker.EventBrokerModule) StartupChecksModule(com.google.gerrit.server.StartupChecks.StartupChecksModule) GerritApiModule(com.google.gerrit.server.api.GerritApiModule) GerritInstanceNameModule(com.google.gerrit.server.config.GerritInstanceNameModule) LocalMergeSuperSetComputationModule(com.google.gerrit.server.submit.LocalMergeSuperSetComputation.LocalMergeSuperSetComputationModule) MimeUtil2Module(com.google.gerrit.server.mime.MimeUtil2Module) PluginApiModule(com.google.gerrit.server.api.PluginApiModule) ChangeCleanupRunnerModule(com.google.gerrit.server.change.ChangeCleanupRunner.ChangeCleanupRunnerModule) StreamEventsApiListenerModule(com.google.gerrit.server.events.StreamEventsApiListener.StreamEventsApiListenerModule) GarbageCollectionModule(com.google.gerrit.server.git.GarbageCollectionModule) GerritInstanceNameModule(com.google.gerrit.server.config.GerritInstanceNameModule) OAuthRestModule(com.google.gerrit.httpd.auth.restapi.OAuthRestModule) EventBrokerModule(com.google.gerrit.server.events.EventBroker.EventBrokerModule) GpgModule(com.google.gerrit.gpg.GpgModule) GerritApiModule(com.google.gerrit.server.api.GerritApiModule) WorkQueueModule(com.google.gerrit.server.git.WorkQueue.WorkQueueModule) PeriodicGroupIndexerModule(com.google.gerrit.server.group.PeriodicGroupIndexer.PeriodicGroupIndexerModule) StartupChecksModule(com.google.gerrit.server.StartupChecks.StartupChecksModule) DefaultUrlFormatterModule(com.google.gerrit.server.config.DefaultUrlFormatter.DefaultUrlFormatterModule) CanonicalWebUrlModule(com.google.gerrit.server.config.CanonicalWebUrlModule) 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) DefaultMemoryCacheModule(com.google.gerrit.server.cache.mem.DefaultMemoryCacheModule) H2CacheModule(com.google.gerrit.server.cache.h2.H2CacheModule) InternalAccountDirectoryModule(com.google.gerrit.server.account.InternalAccountDirectory.InternalAccountDirectoryModule) MailReceiverModule(com.google.gerrit.server.mail.receive.MailReceiver.MailReceiverModule) OAuthModule(com.google.gerrit.httpd.auth.oauth.OAuthModule) AuthModule(com.google.gerrit.auth.AuthModule) GerritAuthModule(com.google.gerrit.httpd.GerritAuthModule) GerritInstanceIdModule(com.google.gerrit.server.config.GerritInstanceIdModule) ExternalIdCaseSensitivityMigrator(com.google.gerrit.server.account.externalids.ExternalIdCaseSensitivityMigrator) SubscriptionGraphModule(com.google.gerrit.server.submit.SubscriptionGraph.SubscriptionGraphModule) AccountDeactivatorModule(com.google.gerrit.server.account.AccountDeactivator.AccountDeactivatorModule)

Example 2 with PluginModule

use of com.google.gerrit.server.plugins.PluginModule 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 LogFileCompressorModule());
    modules.add(new EventBrokerModule());
    modules.add(new JdbcAccountPatchReviewStoreModule(config));
    modules.add(cfgInjector.getInstance(GitRepositoryManagerModule.class));
    modules.add(new StreamEventsApiListenerModule());
    modules.add(new SysExecutorModule());
    modules.add(new DiffExecutorModule());
    modules.add(new MimeUtil2Module());
    modules.add(cfgInjector.getInstance(GerritGlobalModule.class));
    modules.add(new GerritApiModule());
    modules.add(new PluginApiModule());
    modules.add(new SearchingChangeCacheImplModule());
    modules.add(new InternalAccountDirectoryModule());
    modules.add(new DefaultPermissionBackendModule());
    modules.add(new DefaultMemoryCacheModule());
    modules.add(new H2CacheModule());
    modules.add(cfgInjector.getInstance(MailReceiverModule.class));
    modules.add(new SmtpEmailSenderModule());
    modules.add(new SignedTokenEmailTokenVerifierModule());
    modules.add(new LocalMergeSuperSetComputationModule());
    modules.add(new AuditModule());
    modules.add(new GpgModule(config));
    modules.add(new StartupChecksModule());
    // 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 PluginModule());
    if (VersionManager.getOnlineUpgrade(config)) {
        modules.add(new OnlineUpgraderModule());
    }
    modules.add(new OAuthRestModule());
    modules.add(new RestApiModule());
    modules.add(new SubscriptionGraphModule());
    modules.add(new SuperprojectUpdateSubmissionListenerModule());
    modules.add(new WorkQueueModule());
    modules.add(new GerritInstanceNameModule());
    modules.add(new CanonicalWebUrlModule() {

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

        @Override
        protected void configure() {
            bind(GerritOptions.class).toInstance(new GerritOptions(false, false));
            bind(GerritRuntime.class).toInstance(GerritRuntime.DAEMON);
        }
    });
    modules.add(new GarbageCollectionModule());
    modules.add(new ChangeCleanupRunnerModule());
    modules.add(new AccountDeactivatorModule());
    modules.add(new DefaultProjectNameLockManagerModule());
    modules.add(new ExternalIdCaseSensitivityMigrator.ExternalIdCaseSensitivityMigratorModule());
    return dbInjector.createChildInjector(ModuleOverloader.override(modules, LibModuleLoader.loadModules(cfgInjector, LibModuleType.SYS_MODULE_TYPE)));
}
Also used : JdbcAccountPatchReviewStoreModule(com.google.gerrit.server.schema.JdbcAccountPatchReviewStore.JdbcAccountPatchReviewStoreModule) RestApiModule(com.google.gerrit.server.restapi.RestApiModule) ArrayList(java.util.ArrayList) HttpPluginModule(com.google.gerrit.httpd.plugins.HttpPluginModule) PluginModule(com.google.gerrit.server.plugins.PluginModule) SmtpEmailSenderModule(com.google.gerrit.server.mail.send.SmtpEmailSender.SmtpEmailSenderModule) DefaultProjectNameLockManagerModule(com.google.gerrit.server.project.DefaultProjectNameLockManager.DefaultProjectNameLockManagerModule) GerritGlobalModule(com.google.gerrit.server.config.GerritGlobalModule) SearchingChangeCacheImplModule(com.google.gerrit.server.git.SearchingChangeCacheImpl.SearchingChangeCacheImplModule) SuperprojectUpdateSubmissionListenerModule(com.google.gerrit.server.update.SuperprojectUpdateSubmissionListener.SuperprojectUpdateSubmissionListenerModule) SysExecutorModule(com.google.gerrit.server.config.SysExecutorModule) DropWizardMetricMaker(com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker) DefaultPermissionBackendModule(com.google.gerrit.server.permissions.DefaultPermissionBackendModule) LogFileCompressorModule(com.google.gerrit.pgm.util.LogFileCompressor.LogFileCompressorModule) GerritOptions(com.google.gerrit.server.config.GerritOptions) GitRepositoryManagerModule(com.google.gerrit.server.git.GitRepositoryManagerModule) SignedTokenEmailTokenVerifierModule(com.google.gerrit.server.mail.SignedTokenEmailTokenVerifier.SignedTokenEmailTokenVerifierModule) OnlineUpgraderModule(com.google.gerrit.server.index.OnlineUpgrader.OnlineUpgraderModule) DiffExecutorModule(com.google.gerrit.server.patch.DiffExecutorModule) AuditModule(com.google.gerrit.server.audit.AuditModule) SubscriptionGraphModule(com.google.gerrit.server.submit.SubscriptionGraph.SubscriptionGraphModule) H2CacheModule(com.google.gerrit.server.cache.h2.H2CacheModule) PluginApiModule(com.google.gerrit.server.api.PluginApiModule) CanonicalWebUrlModule(com.google.gerrit.server.config.CanonicalWebUrlModule) OAuthModule(com.google.gerrit.httpd.auth.oauth.OAuthModule) InternalAccountDirectoryModule(com.google.gerrit.server.account.InternalAccountDirectory.InternalAccountDirectoryModule) WorkQueueModule(com.google.gerrit.server.git.WorkQueue.WorkQueueModule) SshModule(com.google.gerrit.sshd.SshModule) DefaultPermissionBackendModule(com.google.gerrit.server.permissions.DefaultPermissionBackendModule) ChangeCleanupRunnerModule(com.google.gerrit.server.change.ChangeCleanupRunner.ChangeCleanupRunnerModule) SshAddressesModule(com.google.gerrit.server.ssh.SshAddressesModule) DefaultMemoryCacheModule(com.google.gerrit.server.cache.mem.DefaultMemoryCacheModule) HttpPluginModule(com.google.gerrit.httpd.plugins.HttpPluginModule) DefaultCommandModule(com.google.gerrit.sshd.commands.DefaultCommandModule) WebModule(com.google.gerrit.httpd.WebModule) SmtpEmailSenderModule(com.google.gerrit.server.mail.send.SmtpEmailSender.SmtpEmailSenderModule) StreamEventsApiListenerModule(com.google.gerrit.server.events.StreamEventsApiListener.StreamEventsApiListenerModule) PluginModule(com.google.gerrit.server.plugins.PluginModule) IndexModule(com.google.gerrit.server.index.IndexModule) StaticModule(com.google.gerrit.httpd.raw.StaticModule) AccountDeactivatorModule(com.google.gerrit.server.account.AccountDeactivator.AccountDeactivatorModule) HttpdModule(com.google.gerrit.httpd.HttpdModule) LocalMergeSuperSetComputationModule(com.google.gerrit.server.submit.LocalMergeSuperSetComputation.LocalMergeSuperSetComputationModule) JdbcAccountPatchReviewStoreModule(com.google.gerrit.server.schema.JdbcAccountPatchReviewStore.JdbcAccountPatchReviewStoreModule) SearchingChangeCacheImplModule(com.google.gerrit.server.git.SearchingChangeCacheImpl.SearchingChangeCacheImplModule) GpgModule(com.google.gerrit.gpg.GpgModule) OpenIdModule(com.google.gerrit.httpd.auth.openid.OpenIdModule) AuthModule(com.google.gerrit.auth.AuthModule) SshHostKeyModule(com.google.gerrit.sshd.SshHostKeyModule) DefaultProjectNameLockManagerModule(com.google.gerrit.server.project.DefaultProjectNameLockManager.DefaultProjectNameLockManagerModule) OAuthRestModule(com.google.gerrit.httpd.auth.restapi.OAuthRestModule) SignedTokenEmailTokenVerifierModule(com.google.gerrit.server.mail.SignedTokenEmailTokenVerifier.SignedTokenEmailTokenVerifierModule) AbstractModule(com.google.inject.AbstractModule) GitRepositoryManagerModule(com.google.gerrit.server.git.GitRepositoryManagerModule) AuthConfigModule(com.google.gerrit.server.config.AuthConfigModule) SequenceCommandsModule(com.google.gerrit.sshd.commands.SequenceCommandsModule) Module(com.google.inject.Module) DefaultUrlFormatterModule(com.google.gerrit.server.config.DefaultUrlFormatter.DefaultUrlFormatterModule) GerritGlobalModule(com.google.gerrit.server.config.GerritGlobalModule) LfsPluginAuthCommandModule(com.google.gerrit.sshd.plugin.LfsPluginAuthCommand.LfsPluginAuthCommandModule) LifecycleModule(com.google.gerrit.lifecycle.LifecycleModule) LuceneIndexModule(com.google.gerrit.lucene.LuceneIndexModule) SchemaModule(com.google.gerrit.server.schema.SchemaModule) MimeUtil2Module(com.google.gerrit.server.mime.MimeUtil2Module) SysExecutorModule(com.google.gerrit.server.config.SysExecutorModule) GarbageCollectionModule(com.google.gerrit.server.git.GarbageCollectionModule) GerritAuthModule(com.google.gerrit.httpd.GerritAuthModule) WebSshGlueModule(com.google.gerrit.httpd.WebSshGlueModule) MailReceiverModule(com.google.gerrit.server.mail.receive.MailReceiver.MailReceiverModule) ExternalIdCommandsModule(com.google.gerrit.sshd.commands.ExternalIdCommandsModule) RequireSslFilterModule(com.google.gerrit.httpd.RequireSslFilter.RequireSslFilterModule) GerritServerConfigModule(com.google.gerrit.server.config.GerritServerConfigModule) OnlineUpgraderModule(com.google.gerrit.server.index.OnlineUpgrader.OnlineUpgraderModule) AuditModule(com.google.gerrit.server.audit.AuditModule) GitOverHttpModule(com.google.gerrit.httpd.GitOverHttpModule) RestApiModule(com.google.gerrit.server.restapi.RestApiModule) LogFileCompressorModule(com.google.gerrit.pgm.util.LogFileCompressor.LogFileCompressorModule) SuperprojectUpdateSubmissionListenerModule(com.google.gerrit.server.update.SuperprojectUpdateSubmissionListener.SuperprojectUpdateSubmissionListenerModule) IndexCommandsModule(com.google.gerrit.sshd.commands.IndexCommandsModule) DiffExecutorModule(com.google.gerrit.server.patch.DiffExecutorModule) NoSshModule(com.google.gerrit.server.ssh.NoSshModule) EventBrokerModule(com.google.gerrit.server.events.EventBroker.EventBrokerModule) StartupChecksModule(com.google.gerrit.server.StartupChecks.StartupChecksModule) GerritApiModule(com.google.gerrit.server.api.GerritApiModule) GerritInstanceNameModule(com.google.gerrit.server.config.GerritInstanceNameModule) LocalMergeSuperSetComputationModule(com.google.gerrit.server.submit.LocalMergeSuperSetComputation.LocalMergeSuperSetComputationModule) MimeUtil2Module(com.google.gerrit.server.mime.MimeUtil2Module) PluginApiModule(com.google.gerrit.server.api.PluginApiModule) ChangeCleanupRunnerModule(com.google.gerrit.server.change.ChangeCleanupRunner.ChangeCleanupRunnerModule) StreamEventsApiListenerModule(com.google.gerrit.server.events.StreamEventsApiListener.StreamEventsApiListenerModule) GarbageCollectionModule(com.google.gerrit.server.git.GarbageCollectionModule) GerritInstanceNameModule(com.google.gerrit.server.config.GerritInstanceNameModule) OAuthRestModule(com.google.gerrit.httpd.auth.restapi.OAuthRestModule) EventBrokerModule(com.google.gerrit.server.events.EventBroker.EventBrokerModule) GpgModule(com.google.gerrit.gpg.GpgModule) GerritApiModule(com.google.gerrit.server.api.GerritApiModule) WorkQueueModule(com.google.gerrit.server.git.WorkQueue.WorkQueueModule) StartupChecksModule(com.google.gerrit.server.StartupChecks.StartupChecksModule) DefaultUrlFormatterModule(com.google.gerrit.server.config.DefaultUrlFormatter.DefaultUrlFormatterModule) CanonicalWebUrlModule(com.google.gerrit.server.config.CanonicalWebUrlModule) HttpCanonicalWebUrlProvider(com.google.gerrit.httpd.HttpCanonicalWebUrlProvider) Provider(com.google.inject.Provider) AbstractModule(com.google.inject.AbstractModule) DefaultMemoryCacheModule(com.google.gerrit.server.cache.mem.DefaultMemoryCacheModule) H2CacheModule(com.google.gerrit.server.cache.h2.H2CacheModule) InternalAccountDirectoryModule(com.google.gerrit.server.account.InternalAccountDirectory.InternalAccountDirectoryModule) MailReceiverModule(com.google.gerrit.server.mail.receive.MailReceiver.MailReceiverModule) ExternalIdCaseSensitivityMigrator(com.google.gerrit.server.account.externalids.ExternalIdCaseSensitivityMigrator) SubscriptionGraphModule(com.google.gerrit.server.submit.SubscriptionGraph.SubscriptionGraphModule) AccountDeactivatorModule(com.google.gerrit.server.account.AccountDeactivator.AccountDeactivatorModule)

Example 3 with PluginModule

use of com.google.gerrit.server.plugins.PluginModule in project gerrit by GerritCodeReview.

the class BatchProgramModule method configure.

@SuppressWarnings("rawtypes")
@Override
protected void configure() {
    List<Module> modules = new ArrayList<>();
    modules.add(new DiffExecutorModule());
    modules.add(new SysExecutorModule());
    modules.add(BatchUpdate.module());
    modules.add(PatchListCacheImpl.module());
    modules.add(new DefaultUrlFormatterModule());
    modules.add(DiffOperationsImpl.module());
    // There is the concept of LifecycleModule, in Gerrit's own extension to Guice, which has these:
    // listener().to(SomeClassImplementingLifecycleListener.class);
    // and the start() methods of each such listener are executed in the order they are declared.
    // Makes sure that PluginLoader.start() is executed before the LuceneIndexModule.start() so that
    // plugins get loaded and the respective Guice modules installed so that the on-line reindexing
    // will happen with the proper classes (e.g. group backends, custom Prolog predicates) and the
    // associated rules ready to be evaluated.
    modules.add(new PluginModule());
    // We're just running through each change
    // once, so don't worry about cache removal.
    bind(new TypeLiteral<DynamicSet<CacheRemovalListener>>() {
    }).toInstance(DynamicSet.emptySet());
    DynamicMap.mapOf(binder(), new TypeLiteral<Cache<?, ?>>() {
    });
    bind(new TypeLiteral<List<CommentLinkInfo>>() {
    }).toProvider(CommentLinkProvider.class).in(SINGLETON);
    bind(new TypeLiteral<DynamicMap<RestView<CommitResource>>>() {
    }).toInstance(DynamicMap.emptyMap());
    bind(String.class).annotatedWith(CanonicalWebUrl.class).toProvider(CanonicalWebUrlProvider.class);
    bind(Boolean.class).annotatedWith(EnablePeerIPInReflogRecord.class).toProvider(EnablePeerIPInReflogRecordProvider.class).in(SINGLETON);
    bind(Realm.class).to(FakeRealm.class);
    bind(IdentifiedUser.class).toProvider(Providers.of(null));
    bind(ReplacePatchSetSender.Factory.class).toProvider(Providers.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.of(null));
    bind(new TypeLiteral<ImmutableSet<GroupReference>>() {
    }).annotatedWith(AdministrateServerGroups.class).toInstance(ImmutableSet.of());
    bind(new TypeLiteral<Set<AccountGroup.UUID>>() {
    }).annotatedWith(GitUploadPackGroups.class).toInstance(Collections.emptySet());
    bind(new TypeLiteral<Set<AccountGroup.UUID>>() {
    }).annotatedWith(GitReceivePackGroups.class).toInstance(Collections.emptySet());
    modules.add(new BatchGitModule());
    modules.add(new DefaultPermissionBackendModule());
    modules.add(new DefaultMemoryCacheModule());
    modules.add(new H2CacheModule());
    modules.add(new ExternalIdCacheModule());
    modules.add(new GroupModule());
    modules.add(new NoteDbModule());
    modules.add(AccountCacheImpl.module());
    modules.add(ConflictsCacheImpl.module());
    modules.add(DefaultPreferencesCacheImpl.module());
    modules.add(GroupCacheImpl.module());
    modules.add(GroupIncludeCacheImpl.module());
    modules.add(ProjectCacheImpl.module());
    modules.add(SectionSortCache.module());
    modules.add(ChangeKindCacheImpl.module());
    modules.add(MergeabilityCacheImpl.module());
    modules.add(ServiceUserClassifierImpl.module());
    modules.add(TagCache.module());
    modules.add(PureRevertCache.module());
    modules.add(new ApprovalModule());
    modules.add(SubmitRequirementsEvaluatorImpl.module());
    factory(CapabilityCollection.Factory.class);
    factory(ChangeData.AssistedFactory.class);
    factory(ChangeIsVisibleToPredicate.Factory.class);
    factory(DistinctVotersPredicate.Factory.class);
    factory(ProjectState.Factory.class);
    DynamicMap.mapOf(binder(), ChangeQueryBuilder.ChangeOperatorFactory.class);
    DynamicMap.mapOf(binder(), ChangeQueryBuilder.ChangeHasOperandFactory.class);
    DynamicMap.mapOf(binder(), ChangeQueryBuilder.ChangeIsOperandFactory.class);
    // Submit rules
    DynamicSet.setOf(binder(), SubmitRule.class);
    factory(SubmitRuleEvaluator.Factory.class);
    modules.add(new PrologModule());
    modules.add(new DefaultSubmitRuleModule());
    modules.add(new IgnoreSelfApprovalRuleModule());
    // Global submit requirements
    DynamicSet.setOf(binder(), SubmitRequirement.class);
    factory(FileEditsPredicate.Factory.class);
    bind(ChangeJson.Factory.class).toProvider(Providers.of(null));
    bind(EventUtil.class).toProvider(Providers.of(null));
    bind(GitReferenceUpdated.class).toInstance(GitReferenceUpdated.DISABLED);
    bind(RevisionCreated.class).toInstance(RevisionCreated.DISABLED);
    bind(WorkInProgressStateChanged.class).toInstance(WorkInProgressStateChanged.DISABLED);
    bind(AccountVisibility.class).toProvider(AccountVisibilityProvider.class).in(SINGLETON);
    ModuleOverloader.override(modules, LibModuleLoader.loadModules(parentInjector, LibModuleType.SYS_BATCH_MODULE_TYPE)).stream().forEach(this::install);
}
Also used : CurrentUser(com.google.gerrit.server.CurrentUser) RestView(com.google.gerrit.extensions.restapi.RestView) ArrayList(java.util.ArrayList) NoteDbModule(com.google.gerrit.server.notedb.NoteDbModule) GroupModule(com.google.gerrit.server.restapi.group.GroupModule) PluginModule(com.google.gerrit.server.plugins.PluginModule) ExternalIdCacheModule(com.google.gerrit.server.account.externalids.ExternalIdCacheModule) IgnoreSelfApprovalRuleModule(com.google.gerrit.server.rules.IgnoreSelfApprovalRule.IgnoreSelfApprovalRuleModule) ImmutableSet(com.google.common.collect.ImmutableSet) ApprovalModule(com.google.gerrit.server.query.approval.ApprovalModule) SysExecutorModule(com.google.gerrit.server.config.SysExecutorModule) GitReferenceUpdated(com.google.gerrit.server.extensions.events.GitReferenceUpdated) List(java.util.List) ArrayList(java.util.ArrayList) DefaultPermissionBackendModule(com.google.gerrit.server.permissions.DefaultPermissionBackendModule) GitReceivePackGroups(com.google.gerrit.server.config.GitReceivePackGroups) CanonicalWebUrl(com.google.gerrit.server.config.CanonicalWebUrl) DefaultSubmitRuleModule(com.google.gerrit.server.rules.DefaultSubmitRule.DefaultSubmitRuleModule) CapabilityCollection(com.google.gerrit.server.account.CapabilityCollection) ChangeData(com.google.gerrit.server.query.change.ChangeData) SubmitRuleEvaluator(com.google.gerrit.server.project.SubmitRuleEvaluator) PatchSetInserter(com.google.gerrit.server.change.PatchSetInserter) RevisionCreated(com.google.gerrit.server.extensions.events.RevisionCreated) DiffExecutorModule(com.google.gerrit.server.patch.DiffExecutorModule) ProjectState(com.google.gerrit.server.project.ProjectState) Module(com.google.inject.Module) H2CacheModule(com.google.gerrit.server.cache.h2.H2CacheModule) DefaultUrlFormatterModule(com.google.gerrit.server.config.DefaultUrlFormatter.DefaultUrlFormatterModule) SysExecutorModule(com.google.gerrit.server.config.SysExecutorModule) DefaultSubmitRuleModule(com.google.gerrit.server.rules.DefaultSubmitRule.DefaultSubmitRuleModule) DefaultPermissionBackendModule(com.google.gerrit.server.permissions.DefaultPermissionBackendModule) ExternalIdCacheModule(com.google.gerrit.server.account.externalids.ExternalIdCacheModule) DefaultMemoryCacheModule(com.google.gerrit.server.cache.mem.DefaultMemoryCacheModule) NoteDbModule(com.google.gerrit.server.notedb.NoteDbModule) GroupModule(com.google.gerrit.server.restapi.group.GroupModule) FactoryModule(com.google.gerrit.extensions.config.FactoryModule) PluginModule(com.google.gerrit.server.plugins.PluginModule) ApprovalModule(com.google.gerrit.server.query.approval.ApprovalModule) DiffExecutorModule(com.google.gerrit.server.patch.DiffExecutorModule) PrologModule(com.google.gerrit.server.rules.PrologModule) IgnoreSelfApprovalRuleModule(com.google.gerrit.server.rules.IgnoreSelfApprovalRule.IgnoreSelfApprovalRuleModule) TagCache(com.google.gerrit.server.git.TagCache) SectionSortCache(com.google.gerrit.server.permissions.SectionSortCache) Cache(com.google.common.cache.Cache) PureRevertCache(com.google.gerrit.server.git.PureRevertCache) DistinctVotersPredicate(com.google.gerrit.server.query.change.DistinctVotersPredicate) EnablePeerIPInReflogRecordProvider(com.google.gerrit.server.config.EnablePeerIPInReflogRecordProvider) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) DynamicSet(com.google.gerrit.extensions.registration.DynamicSet) WorkInProgressStateChanged(com.google.gerrit.server.extensions.events.WorkInProgressStateChanged) AdministrateServerGroups(com.google.gerrit.server.config.AdministrateServerGroups) CacheRemovalListener(com.google.gerrit.server.cache.CacheRemovalListener) EventUtil(com.google.gerrit.server.extensions.events.EventUtil) TypeLiteral(com.google.inject.TypeLiteral) ChangeIsVisibleToPredicate(com.google.gerrit.server.query.change.ChangeIsVisibleToPredicate) GitUploadPackGroups(com.google.gerrit.server.config.GitUploadPackGroups) MergeUtil(com.google.gerrit.server.git.MergeUtil) FakeRealm(com.google.gerrit.server.account.FakeRealm) Realm(com.google.gerrit.server.account.Realm) CommentLinkProvider(com.google.gerrit.server.project.CommentLinkProvider) ChangeQueryBuilder(com.google.gerrit.server.query.change.ChangeQueryBuilder) SearchingChangeCacheImpl(com.google.gerrit.server.git.SearchingChangeCacheImpl) PrologModule(com.google.gerrit.server.rules.PrologModule) RebaseChangeOp(com.google.gerrit.server.change.RebaseChangeOp) IdentifiedUser(com.google.gerrit.server.IdentifiedUser) DefaultUrlFormatterModule(com.google.gerrit.server.config.DefaultUrlFormatter.DefaultUrlFormatterModule) DefaultMemoryCacheModule(com.google.gerrit.server.cache.mem.DefaultMemoryCacheModule) AccountVisibilityProvider(com.google.gerrit.server.account.AccountVisibilityProvider) AccountGroup(com.google.gerrit.entities.AccountGroup) H2CacheModule(com.google.gerrit.server.cache.h2.H2CacheModule) FileEditsPredicate(com.google.gerrit.server.query.FileEditsPredicate)

Aggregations

H2CacheModule (com.google.gerrit.server.cache.h2.H2CacheModule)3 DefaultMemoryCacheModule (com.google.gerrit.server.cache.mem.DefaultMemoryCacheModule)3 DefaultUrlFormatterModule (com.google.gerrit.server.config.DefaultUrlFormatter.DefaultUrlFormatterModule)3 SysExecutorModule (com.google.gerrit.server.config.SysExecutorModule)3 AuthModule (com.google.gerrit.auth.AuthModule)2 GpgModule (com.google.gerrit.gpg.GpgModule)2 GerritAuthModule (com.google.gerrit.httpd.GerritAuthModule)2 GitOverHttpModule (com.google.gerrit.httpd.GitOverHttpModule)2 HttpCanonicalWebUrlProvider (com.google.gerrit.httpd.HttpCanonicalWebUrlProvider)2 HttpdModule (com.google.gerrit.httpd.HttpdModule)2 RequireSslFilterModule (com.google.gerrit.httpd.RequireSslFilter.RequireSslFilterModule)2 WebModule (com.google.gerrit.httpd.WebModule)2 WebSshGlueModule (com.google.gerrit.httpd.WebSshGlueModule)2 OAuthModule (com.google.gerrit.httpd.auth.oauth.OAuthModule)2 OpenIdModule (com.google.gerrit.httpd.auth.openid.OpenIdModule)2 OAuthRestModule (com.google.gerrit.httpd.auth.restapi.OAuthRestModule)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