class CollectedResource {

    public static Collection<CollectedResource> fromDirectory(Path path) {
        Collection<CollectedResource> resources = new ArrayList<>();
        try (Stream<Path> paths = Files.walk(path)) {
            paths.filter(Files::isRegularFile)
                    .map(Path::toFile)
                    .map(f -> new FileSystemResource(f)
                            .setResourceType(determineResourceType(f.getName())))
                    .map(f -> new CollectedResource(path, f))
                    .forEach(resources::add);
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
        return resources;
    }

    public  CollectedResource(Path basePath, Resource resource);

}