mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +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.DefaultFileSystem;
|
||||||
import sonia.scm.io.FileSystem;
|
import sonia.scm.io.FileSystem;
|
||||||
import sonia.scm.plugin.DefaultPluginLoader;
|
import sonia.scm.plugin.DefaultPluginLoader;
|
||||||
import sonia.scm.repository.RepositoryDAO;
|
|
||||||
import sonia.scm.repository.RepositoryLocationResolver;
|
import sonia.scm.repository.RepositoryLocationResolver;
|
||||||
import sonia.scm.repository.xml.PathBasedRepositoryLocationResolver;
|
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.DefaultKeyGenerator;
|
||||||
import sonia.scm.security.KeyGenerator;
|
import sonia.scm.security.KeyGenerator;
|
||||||
import sonia.scm.store.BlobStoreFactory;
|
import sonia.scm.store.BlobStoreFactory;
|
||||||
@@ -32,8 +29,8 @@ public class BootstrapModule extends AbstractModule {
|
|||||||
private final ClassOverrides overrides;
|
private final ClassOverrides overrides;
|
||||||
private final DefaultPluginLoader pluginLoader;
|
private final DefaultPluginLoader pluginLoader;
|
||||||
|
|
||||||
public BootstrapModule(ClassOverrides overrides, DefaultPluginLoader pluginLoader) {
|
public BootstrapModule(DefaultPluginLoader pluginLoader) {
|
||||||
this.overrides = overrides;
|
this.overrides = ClassOverrides.findOverrides(pluginLoader.getUberClassLoader());
|
||||||
this.pluginLoader = pluginLoader;
|
this.pluginLoader = pluginLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import com.google.inject.assistedinject.FactoryModuleBuilder;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import sonia.scm.BootstrapModule;
|
import sonia.scm.BootstrapModule;
|
||||||
import sonia.scm.ClassOverrides;
|
|
||||||
import sonia.scm.SCMContext;
|
import sonia.scm.SCMContext;
|
||||||
import sonia.scm.ScmContextListener;
|
import sonia.scm.ScmContextListener;
|
||||||
import sonia.scm.Stage;
|
import sonia.scm.Stage;
|
||||||
@@ -152,44 +151,23 @@ public class BootstrapContextListener implements ServletContextListener
|
|||||||
logger.info("core plugin extraction is disabled");
|
logger.info("core plugin extraction is disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassLoader cl =
|
ClassLoader cl = ClassLoaders.getContextClassLoader(BootstrapContextListener.class);
|
||||||
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));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
Set<PluginWrapper> plugins = PluginsInternal.collectPlugins(cl, pluginDirectory.toPath());
|
||||||
|
|
||||||
DefaultPluginLoader pluginLoader = new DefaultPluginLoader(context, cl, plugins);
|
DefaultPluginLoader pluginLoader = new DefaultPluginLoader(context, cl, plugins);
|
||||||
|
|
||||||
Injector bootstrapInjector = Guice.createInjector(new BootstrapModule(
|
Module scmContextListenerModule = new ScmContextListenerModule();
|
||||||
ClassOverrides.findOverrides(pluginLoader.getUberClassLoader()),
|
BootstrapModule bootstrapModule = new BootstrapModule(pluginLoader);
|
||||||
pluginLoader
|
|
||||||
),
|
|
||||||
scmContextListenerModule
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Injector bootstrapInjector = Guice.createInjector(bootstrapModule, scmContextListenerModule);
|
||||||
|
|
||||||
contextListener = bootstrapInjector.getInstance(ScmContextListener.Factory.class).create(cl, plugins);
|
contextListener = bootstrapInjector.getInstance(ScmContextListener.Factory.class).create(cl, plugins);
|
||||||
|
|
||||||
|
// Set<MigrationStep> steps = bootstrapInjector.getInstance(....);
|
||||||
// Set<MigrationStep> steps = bootstrapInjector.getInstance(....);
|
|
||||||
// migrate
|
// migrate
|
||||||
|
|
||||||
|
// contextListener = new ScmContextListener(cl, plugins);
|
||||||
|
|
||||||
// contextListener = new ScmContextListener(cl, plugins);
|
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
@@ -443,4 +421,12 @@ public class BootstrapContextListener implements ServletContextListener
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private boolean registered = false;
|
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