@Test void list() { writeData(OTHER_FILE, MESSAGE); try (Stream<AbsoluteLocation<ResolvedResource>> ls = storageService.list(FILE)) { assertThat(ls) .extracting(it -> it.getResource().location().asString()) .containsOnly("jdbc: } try (Stream<AbsoluteLocation<ResolvedResource>> ls = storageService.list(ROOT)) { assertThat(ls) .extracting(it -> it.getResource().location().asString()) .containsOnly( "jdbc: "jdbc: ); } }
@SneakyThrows @Override public Stream<AbsoluteLocation<ResolvedResource>> list(AbsoluteLocation location) { ParsedLocation parsed = new ParsedLocation(location, allowedTables); String sql = "SELECT `key`,`last_modified` FROM " + parsed.getTableName() + " WHERE `key` LIKE '" + parsed.getPathWithUser() + "%'"; List<Map<String, Object>> keys = conn.jdbcTemplate(location).queryForList(sql); return keys.stream().map(it -> new AbsoluteLocation<>( new BaseResolvedResource( createPath(location, (String) it.get("key")), ((Date) it.get("last_modified")).toInstant() ) )); }
DatabaseStorageService implements StorageService { @SneakyThrows @Override public Stream<AbsoluteLocation<ResolvedResource>> list(AbsoluteLocation location) { ParsedLocation parsed = new ParsedLocation(location, allowedTables); String sql = "SELECT `key`,`last_modified` FROM " + parsed.getTableName() + " WHERE `key` LIKE '" + parsed.getPathWithUser() + "%'"; List<Map<String, Object>> keys = conn.jdbcTemplate(location).queryForList(sql); return keys.stream().map(it -> new AbsoluteLocation<>( new BaseResolvedResource( createPath(location, (String) it.get("key")), ((Date) it.get("last_modified")).toInstant() ) )); } }
DatabaseStorageService implements StorageService { @SneakyThrows @Override public Stream<AbsoluteLocation<ResolvedResource>> list(AbsoluteLocation location) { ParsedLocation parsed = new ParsedLocation(location, allowedTables); String sql = "SELECT `key`,`last_modified` FROM " + parsed.getTableName() + " WHERE `key` LIKE '" + parsed.getPathWithUser() + "%'"; List<Map<String, Object>> keys = conn.jdbcTemplate(location).queryForList(sql); return keys.stream().map(it -> new AbsoluteLocation<>( new BaseResolvedResource( createPath(location, (String) it.get("key")), ((Date) it.get("last_modified")).toInstant() ) )); }  }
DatabaseStorageService implements StorageService { @SneakyThrows @Override public Stream<AbsoluteLocation<ResolvedResource>> list(AbsoluteLocation location) { ParsedLocation parsed = new ParsedLocation(location, allowedTables); String sql = "SELECT `key`,`last_modified` FROM " + parsed.getTableName() + " WHERE `key` LIKE '" + parsed.getPathWithUser() + "%'"; List<Map<String, Object>> keys = conn.jdbcTemplate(location).queryForList(sql); return keys.stream().map(it -> new AbsoluteLocation<>( new BaseResolvedResource( createPath(location, (String) it.get("key")), ((Date) it.get("last_modified")).toInstant() ) )); }  @SneakyThrows @Override boolean objectExists(AbsoluteLocation location); @SneakyThrows @Override Stream<AbsoluteLocation<ResolvedResource>> list(AbsoluteLocation location); @SneakyThrows @Override InputStream read(AbsoluteLocation location); @SneakyThrows @Override void remove(AbsoluteLocation location); @SneakyThrows @Override OutputStream write(WithCallback<AbsoluteLocation, ? extends ResourceWriteCallback> locationWithCallback); }
DatabaseStorageService implements StorageService { @SneakyThrows @Override public Stream<AbsoluteLocation<ResolvedResource>> list(AbsoluteLocation location) { ParsedLocation parsed = new ParsedLocation(location, allowedTables); String sql = "SELECT `key`,`last_modified` FROM " + parsed.getTableName() + " WHERE `key` LIKE '" + parsed.getPathWithUser() + "%'"; List<Map<String, Object>> keys = conn.jdbcTemplate(location).queryForList(sql); return keys.stream().map(it -> new AbsoluteLocation<>( new BaseResolvedResource( createPath(location, (String) it.get("key")), ((Date) it.get("last_modified")).toInstant() ) )); }  @SneakyThrows @Override boolean objectExists(AbsoluteLocation location); @SneakyThrows @Override Stream<AbsoluteLocation<ResolvedResource>> list(AbsoluteLocation location); @SneakyThrows @Override InputStream read(AbsoluteLocation location); @SneakyThrows @Override void remove(AbsoluteLocation location); @SneakyThrows @Override OutputStream write(WithCallback<AbsoluteLocation, ? extends ResourceWriteCallback> locationWithCallback);  }