Separate out the plugin API from other Gerrit plugins
The googlesource.com instantiation doesn't support dynamic plugin-loading, so we must be able to separate the module for normal Gerrit APIs and the plugin (un)loading. Change-Id: I480d3cb422b1d5322c5ca3cdeb1f29a775c36a83
This commit is contained in:
@@ -53,6 +53,7 @@ import com.google.gerrit.server.StartupChecks;
|
|||||||
import com.google.gerrit.server.account.AccountDeactivator;
|
import com.google.gerrit.server.account.AccountDeactivator;
|
||||||
import com.google.gerrit.server.account.InternalAccountDirectory;
|
import com.google.gerrit.server.account.InternalAccountDirectory;
|
||||||
import com.google.gerrit.server.api.GerritApiModule;
|
import com.google.gerrit.server.api.GerritApiModule;
|
||||||
|
import com.google.gerrit.server.api.PluginApiModule;
|
||||||
import com.google.gerrit.server.cache.h2.DefaultCacheFactory;
|
import com.google.gerrit.server.cache.h2.DefaultCacheFactory;
|
||||||
import com.google.gerrit.server.change.ChangeCleanupRunner;
|
import com.google.gerrit.server.change.ChangeCleanupRunner;
|
||||||
import com.google.gerrit.server.config.AuthConfig;
|
import com.google.gerrit.server.config.AuthConfig;
|
||||||
@@ -413,6 +414,7 @@ public class Daemon extends SiteProgram {
|
|||||||
modules.add(new MimeUtil2Module());
|
modules.add(new MimeUtil2Module());
|
||||||
modules.add(cfgInjector.getInstance(GerritGlobalModule.class));
|
modules.add(cfgInjector.getInstance(GerritGlobalModule.class));
|
||||||
modules.add(new GerritApiModule());
|
modules.add(new GerritApiModule());
|
||||||
|
modules.add(new PluginApiModule());
|
||||||
|
|
||||||
modules.add(new SearchingChangeCacheImpl.Module(slave));
|
modules.add(new SearchingChangeCacheImpl.Module(slave));
|
||||||
modules.add(new InternalAccountDirectory.Module());
|
modules.add(new InternalAccountDirectory.Module());
|
||||||
|
|||||||
@@ -15,10 +15,7 @@
|
|||||||
package com.google.gerrit.server.api;
|
package com.google.gerrit.server.api;
|
||||||
|
|
||||||
import com.google.gerrit.extensions.api.GerritApi;
|
import com.google.gerrit.extensions.api.GerritApi;
|
||||||
import com.google.gerrit.extensions.api.plugins.Plugins;
|
|
||||||
import com.google.gerrit.extensions.config.FactoryModule;
|
import com.google.gerrit.extensions.config.FactoryModule;
|
||||||
import com.google.gerrit.server.api.plugins.PluginApiImpl;
|
|
||||||
import com.google.gerrit.server.api.plugins.PluginsImpl;
|
|
||||||
|
|
||||||
public class GerritApiModule extends FactoryModule {
|
public class GerritApiModule extends FactoryModule {
|
||||||
@Override
|
@Override
|
||||||
@@ -30,8 +27,5 @@ public class GerritApiModule extends FactoryModule {
|
|||||||
install(new com.google.gerrit.server.api.config.Module());
|
install(new com.google.gerrit.server.api.config.Module());
|
||||||
install(new com.google.gerrit.server.api.groups.Module());
|
install(new com.google.gerrit.server.api.groups.Module());
|
||||||
install(new com.google.gerrit.server.api.projects.Module());
|
install(new com.google.gerrit.server.api.projects.Module());
|
||||||
|
|
||||||
bind(Plugins.class).to(PluginsImpl.class);
|
|
||||||
factory(PluginApiImpl.Factory.class);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
28
java/com/google/gerrit/server/api/PluginApiModule.java
Normal file
28
java/com/google/gerrit/server/api/PluginApiModule.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// Copyright (C) 2017 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.api;
|
||||||
|
|
||||||
|
import com.google.gerrit.extensions.api.plugins.Plugins;
|
||||||
|
import com.google.gerrit.extensions.config.FactoryModule;
|
||||||
|
import com.google.gerrit.server.api.plugins.PluginApiImpl;
|
||||||
|
import com.google.gerrit.server.api.plugins.PluginsImpl;
|
||||||
|
|
||||||
|
public class PluginApiModule extends FactoryModule {
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
bind(Plugins.class).to(PluginsImpl.class);
|
||||||
|
factory(PluginApiImpl.Factory.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ import com.google.gerrit.reviewdb.server.ReviewDb;
|
|||||||
import com.google.gerrit.server.GerritPersonIdent;
|
import com.google.gerrit.server.GerritPersonIdent;
|
||||||
import com.google.gerrit.server.GerritPersonIdentProvider;
|
import com.google.gerrit.server.GerritPersonIdentProvider;
|
||||||
import com.google.gerrit.server.api.GerritApiModule;
|
import com.google.gerrit.server.api.GerritApiModule;
|
||||||
|
import com.google.gerrit.server.api.PluginApiModule;
|
||||||
import com.google.gerrit.server.cache.h2.DefaultCacheFactory;
|
import com.google.gerrit.server.cache.h2.DefaultCacheFactory;
|
||||||
import com.google.gerrit.server.config.AllProjectsName;
|
import com.google.gerrit.server.config.AllProjectsName;
|
||||||
import com.google.gerrit.server.config.AllProjectsNameProvider;
|
import com.google.gerrit.server.config.AllProjectsNameProvider;
|
||||||
@@ -163,6 +164,7 @@ public class InMemoryModule extends FactoryModule {
|
|||||||
bind(MetricMaker.class).to(DisabledMetricMaker.class);
|
bind(MetricMaker.class).to(DisabledMetricMaker.class);
|
||||||
install(cfgInjector.getInstance(GerritGlobalModule.class));
|
install(cfgInjector.getInstance(GerritGlobalModule.class));
|
||||||
install(new GerritApiModule());
|
install(new GerritApiModule());
|
||||||
|
install(new PluginApiModule());
|
||||||
install(new DefaultPermissionBackendModule());
|
install(new DefaultPermissionBackendModule());
|
||||||
install(new SearchingChangeCacheImpl.Module());
|
install(new SearchingChangeCacheImpl.Module());
|
||||||
factory(GarbageCollection.Factory.class);
|
factory(GarbageCollection.Factory.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user