mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
Cleanup code
This commit is contained in:
@@ -8,11 +8,8 @@ import sonia.scm.config.ScmConfiguration;
|
||||
import sonia.scm.io.DefaultFileSystem;
|
||||
import sonia.scm.io.FileSystem;
|
||||
import sonia.scm.plugin.DefaultPluginLoader;
|
||||
import sonia.scm.repository.RepositoryDAO;
|
||||
import sonia.scm.repository.RepositoryLocationResolver;
|
||||
import sonia.scm.repository.xml.PathBasedRepositoryLocationResolver;
|
||||
import sonia.scm.repository.xml.XmlRepositoryDAO;
|
||||
import sonia.scm.security.CipherUtil;
|
||||
import sonia.scm.security.DefaultKeyGenerator;
|
||||
import sonia.scm.security.KeyGenerator;
|
||||
import sonia.scm.store.BlobStoreFactory;
|
||||
@@ -32,8 +29,8 @@ public class BootstrapModule extends AbstractModule {
|
||||
private final ClassOverrides overrides;
|
||||
private final DefaultPluginLoader pluginLoader;
|
||||
|
||||
public BootstrapModule(ClassOverrides overrides, DefaultPluginLoader pluginLoader) {
|
||||
this.overrides = overrides;
|
||||
public BootstrapModule(DefaultPluginLoader pluginLoader) {
|
||||
this.overrides = ClassOverrides.findOverrides(pluginLoader.getUberClassLoader());
|
||||
this.pluginLoader = pluginLoader;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.google.inject.assistedinject.FactoryModuleBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sonia.scm.BootstrapModule;
|
||||
import sonia.scm.ClassOverrides;
|
||||
import sonia.scm.SCMContext;
|
||||
import sonia.scm.ScmContextListener;
|
||||
import sonia.scm.Stage;
|
||||
@@ -152,43 +151,22 @@ public class BootstrapContextListener implements ServletContextListener
|
||||
logger.info("core plugin extraction is disabled");
|
||||
}
|
||||
|
||||
ClassLoader cl =
|
||||
ClassLoaders.getContextClassLoader(BootstrapContextListener.class);
|
||||
|
||||
Set<PluginWrapper> plugins = PluginsInternal.collectPlugins(cl,
|
||||
pluginDirectory.toPath());
|
||||
|
||||
|
||||
Module scmContextListenerModule = new AbstractModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
|
||||
install(new FactoryModuleBuilder().build(ScmContextListener.Factory.class));
|
||||
}
|
||||
};
|
||||
|
||||
ClassLoader cl = ClassLoaders.getContextClassLoader(BootstrapContextListener.class);
|
||||
|
||||
Set<PluginWrapper> plugins = PluginsInternal.collectPlugins(cl, pluginDirectory.toPath());
|
||||
|
||||
DefaultPluginLoader pluginLoader = new DefaultPluginLoader(context, cl, plugins);
|
||||
|
||||
Injector bootstrapInjector = Guice.createInjector(new BootstrapModule(
|
||||
ClassOverrides.findOverrides(pluginLoader.getUberClassLoader()),
|
||||
pluginLoader
|
||||
),
|
||||
scmContextListenerModule
|
||||
);
|
||||
|
||||
|
||||
Module scmContextListenerModule = new ScmContextListenerModule();
|
||||
BootstrapModule bootstrapModule = new BootstrapModule(pluginLoader);
|
||||
|
||||
Injector bootstrapInjector = Guice.createInjector(bootstrapModule, scmContextListenerModule);
|
||||
|
||||
contextListener = bootstrapInjector.getInstance(ScmContextListener.Factory.class).create(cl, plugins);
|
||||
|
||||
|
||||
// Set<MigrationStep> steps = bootstrapInjector.getInstance(....);
|
||||
// migrate
|
||||
|
||||
|
||||
|
||||
// contextListener = new ScmContextListener(cl, plugins);
|
||||
}
|
||||
catch (IOException ex)
|
||||
@@ -443,4 +421,12 @@ public class BootstrapContextListener implements ServletContextListener
|
||||
|
||||
/** Field description */
|
||||
private boolean registered = false;
|
||||
|
||||
private static class ScmContextListenerModule extends AbstractModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
|
||||
install(new FactoryModuleBuilder().build(ScmContextListener.Factory.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user