use of liquibase.servicelocator.StandardServiceLocator in project liquibase by liquibase.
the class Scope method getCurrentScope.
public static Scope getCurrentScope() {
if (scopeManager == null) {
scopeManager = new SingletonScopeManager();
}
if (scopeManager.getCurrentScope() == null) {
Scope rootScope = new Scope();
scopeManager.setCurrentScope(rootScope);
rootScope.values.put(Attr.logService.name(), new JavaLogService());
rootScope.values.put(Attr.resourceAccessor.name(), new ClassLoaderResourceAccessor());
rootScope.values.put(Attr.serviceLocator.name(), new StandardServiceLocator());
rootScope.values.put(Attr.ui.name(), new ConsoleUIService());
rootScope.getSingleton(LiquibaseConfiguration.class).init(rootScope);
LogService overrideLogService = rootScope.getSingleton(LogServiceFactory.class).getDefaultLogService();
if (overrideLogService == null) {
throw new UnexpectedLiquibaseException("Cannot find default log service");
}
rootScope.values.put(Attr.logService.name(), overrideLogService);
// check for higher-priority serviceLocator
ServiceLocator serviceLocator = rootScope.getServiceLocator();
for (ServiceLocator possibleLocator : serviceLocator.findInstances(ServiceLocator.class)) {
if (possibleLocator.getPriority() > serviceLocator.getPriority()) {
serviceLocator = possibleLocator;
}
}
rootScope.values.put(Attr.serviceLocator.name(), serviceLocator);
rootScope.values.put(Attr.osgiPlatform.name(), Activator.OSGIContainerChecker.isOsgiPlatform());
}
return scopeManager.getCurrentScope();
}
Aggregations