use of org.flywaydb.core.internal.util.scanner.filesystem.FileSystemScanner in project che by eclipse.
the class ResourcesFinder method findResources.
/**
* Finds script resources in configured {@link FlywayConfiguration#getLocations()}.
*
* @param configuration
* flyway configuration to find scripts
* @return found scripts or an empty list if nothing found
* @throws IOException
* when any io error occurs during scripts look up
*/
Map<Location, List<Resource>> findResources(FlywayConfiguration configuration) throws IOException {
final String prefix = configuration.getSqlMigrationPrefix();
final String suffix = configuration.getSqlMigrationSuffix();
final ClassPathScanner cpScanner = new ClassPathScanner(configuration.getClassLoader());
final FileSystemScanner fsScanner = new FileSystemScanner();
final Map<Location, List<Resource>> resources = new HashMap<>();
for (String rawLocation : configuration.getLocations()) {
final Location location = new Location(rawLocation);
if (location.isClassPath()) {
resources.put(location, newArrayList(cpScanner.scanForResources(location, prefix, suffix)));
} else {
resources.put(location, newArrayList(fsScanner.scanForResources(location, prefix, suffix)));
}
}
return resources;
}
Aggregations