use of synapticloop.b2.LifecycleRule in project cyberduck by iterate-ch.
the class B2LifecycleFeature method getConfiguration.
@Override
public LifecycleConfiguration getConfiguration(final Path container) throws BackgroundException {
try {
final B2BucketResponse response = session.getClient().listBucket(containerService.getContainer(container).getName());
final List<LifecycleRule> lifecycleRules = response.getLifecycleRules();
for (LifecycleRule rule : lifecycleRules) {
return new LifecycleConfiguration(null == rule.getDaysFromUploadingToHiding() ? null : rule.getDaysFromUploadingToHiding().intValue(), null == rule.getDaysFromHidingToDeleting() ? null : rule.getDaysFromHidingToDeleting().intValue());
}
return LifecycleConfiguration.empty();
} catch (B2ApiException e) {
throw new B2ExceptionMappingService(fileid).map("Failure to write attributes of {0}", e, container);
} catch (IOException e) {
throw new DefaultIOExceptionMappingService().map("Failure to write attributes of {0}", e, container);
}
}
Aggregations