/** * Scans this location for resources matching the given predicate. * <p> * The location can have a prefix of <code>filesystem:</code> or <code>classpath:</code> to determine * how to scan. If no prefix is used then classpath scan is the default. * </p> * * @param location The location to start searching. Subdirectories are also searched. * @param predicate The predicate used to match resource names. * @return The resources that were found. */ @Override public List<Resource> scanForResources(String location, ResourceFilter predicate) { return scanForResources(new Location(location), predicate); }
private boolean readResourcesForPath(String path) { ClassLoader classLoader = migrationConfig.getClassLoader(); Scanner scanner = new Scanner(classLoader); List<Resource> resourceList = scanner.scanForResources(path, new Match(migrationConfig)); logger.debug("resources: {}", resourceList); for (Resource resource : resourceList) { String filename = resource.getFilename(); if (filename.endsWith(migrationConfig.getApplySuffix())) { versions.add(createScriptMigration(resource, filename)); } else if (migrationConfig.getJdbcMigrationFactory() != null && filename.endsWith(".class")) { versions.add(createJdbcMigration(resource, filename)); } } Collections.sort(versions); return !versions.isEmpty(); }