use of sirius.biz.storage.s3.ObjectStore in project sirius-biz by scireum.
the class JupiterSync method syncUplinkRepository.
private void syncUplinkRepository(ProcessContext processContext, JupiterConnector connection, List<RepositoryFile> repositoryFiles, Set<String> filesToDelete) {
if (Strings.isEmpty(uplinkStore) || Strings.isEmpty(getEffectiveUplinkBucket())) {
processContext.debug(ProcessLog.info().withFormattedMessage("Skipping uplink checks for %s as no repository or bucket is configured.", connection.getName()));
return;
}
processContext.debug(ProcessLog.info().withFormattedMessage("Checking uplink repository (%s in %s) for %s...", getEffectiveUplinkBucket(), uplinkStore, connection.getName()));
try {
ObjectStore store = objectStores.getStore(uplinkStore);
BucketName uplinkBucketName = store.getBucketName(getEffectiveUplinkBucket());
store.listObjects(uplinkBucketName, null, object -> {
if (uplinkIgnoredPaths.stream().noneMatch(ignoredPath -> object.getKey().startsWith(ignoredPath))) {
handleUplinkFile(processContext, connection, repositoryFiles, filesToDelete, store, uplinkBucketName, object);
}
return true;
});
} catch (Exception e) {
processContext.handle(Exceptions.handle().error(e).withSystemErrorMessage("Failed to check the uplink repository %s for %s: %s (%s)", uplinkStore, connection.getName()).handle());
}
}
Aggregations