mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-07 15:19:15 +01:00
We have simplified the scm-manager bootstrap process, by replacing the ServletContextListener call hierarchy with much simpler ModuleProviders. We have also removed the parent injector. Now we create always a new injector. If something goes wrong in the process of injector creation, we will show a nicely styled error page instead of stacktrace on a white page.
28 lines
794 B
Java
28 lines
794 B
Java
package sonia.scm.update;
|
|
|
|
import com.google.inject.Injector;
|
|
import com.google.inject.Module;
|
|
import sonia.scm.boot.ModuleProvider;
|
|
import sonia.scm.update.repository.XmlRepositoryV1UpdateStep;
|
|
|
|
import java.util.Collection;
|
|
import java.util.Collections;
|
|
|
|
public class MigrationWizardModuleProvider implements ModuleProvider {
|
|
|
|
private final Injector bootstrapInjector;
|
|
|
|
public MigrationWizardModuleProvider(Injector bootstrapInjector) {
|
|
this.bootstrapInjector = bootstrapInjector;
|
|
}
|
|
|
|
public boolean wizardNecessary() {
|
|
return !bootstrapInjector.getInstance(XmlRepositoryV1UpdateStep.class).getRepositoriesWithoutMigrationStrategies().isEmpty();
|
|
}
|
|
|
|
@Override
|
|
public Collection<Module> createModules() {
|
|
return Collections.singleton(new MigrationWizardModule());
|
|
}
|
|
}
|