use of org.flywaydb.core.internal.scanner.Scanner in project flyway by flyway.
the class FlywayExecutor method createResourceAndClassProviders.
private Pair<ResourceProvider, ClassProvider<JavaMigration>> createResourceAndClassProviders(boolean scannerRequired) {
ResourceProvider resourceProvider;
ClassProvider<JavaMigration> classProvider;
if (!scannerRequired && configuration.isSkipDefaultResolvers() && configuration.isSkipDefaultCallbacks()) {
resourceProvider = NoopResourceProvider.INSTANCE;
// noinspection unchecked
classProvider = NoopClassProvider.INSTANCE;
} else {
if (configuration.getResourceProvider() != null && configuration.getJavaMigrationClassProvider() != null) {
// don't create the scanner at all in this case
resourceProvider = configuration.getResourceProvider();
classProvider = configuration.getJavaMigrationClassProvider();
} else {
boolean stream = false;
Scanner<JavaMigration> scanner = new Scanner<>(JavaMigration.class, Arrays.asList(configuration.getLocations()), configuration.getClassLoader(), configuration.getEncoding(), configuration.isDetectEncoding(), stream, resourceNameCache, locationScannerCache, configuration.isFailOnMissingLocations());
// set the defaults
resourceProvider = scanner;
classProvider = scanner;
if (configuration.getResourceProvider() != null) {
resourceProvider = configuration.getResourceProvider();
}
if (configuration.getJavaMigrationClassProvider() != null) {
classProvider = configuration.getJavaMigrationClassProvider();
}
}
}
return Pair.of(resourceProvider, classProvider);
}
Aggregations