use of org.craftercms.engine.store.s3.S3ContentStoreAdapter.DELIMITER in project engine by craftercms.
the class S3SiteListResolver method getSiteListFromBucketKeys.
protected Collection<String> getSiteListFromBucketKeys(String bucketName, String rootPrefix) {
List<String> siteNames = new ArrayList<>();
AmazonS3 client = clientBuilder.getClient();
ListObjectsV2Request request = new ListObjectsV2Request().withBucketName(bucketName).withPrefix(rootPrefix).withDelimiter(DELIMITER);
ListObjectsV2Result result = client.listObjectsV2(request);
if (CollectionUtils.isNotEmpty(result.getCommonPrefixes())) {
result.getCommonPrefixes().stream().map(prefix -> StringUtils.stripEnd(StringUtils.removeStart(prefix, rootPrefix), DELIMITER)).forEach(siteNames::add);
}
return siteNames;
}
Aggregations