@Override public boolean getStatus(final Path file) throws BackgroundException { return delegate.getStatus(vault.encrypt(session, file)); }
@Override public void configure(final boolean enable, final Path file) throws BackgroundException { delegate.configure(enable, vault.encrypt(session, file)); }
@Override public boolean prompt(final Host bookmark, final Path file, final ConnectionCallback prompt) throws BackgroundException { return delegate.prompt(bookmark, vault.encrypt(session, file), prompt); }
private boolean accelerate(final Path file, final ConnectionCallback prompt) throws BackgroundException { switch(session.getSignatureVersion()) { case AWS2: return false; } if(accelerationService.getStatus(file)) { log.info(String.format("S3 transfer acceleration enabled for file %s", file)); return true; } if(preferences.getBoolean("s3.accelerate.prompt")) { if(accelerationService.prompt(session.getHost(), file, prompt)) { log.info(String.format("S3 transfer acceleration enabled for file %s", file)); return true; } } return false; } }
private void write(final TransferAcceleration feature, final Path file) throws BackgroundException { feature.setStatus(file, enabled); }
@Override public void setStatus(final Path file, final boolean enabled) throws BackgroundException { delegate.setStatus(vault.encrypt(session, file), enabled); }
@Override public boolean getStatus(final Path file) throws BackgroundException { return registry.find(session, file).getFeature(session, TransferAcceleration.class, proxy).getStatus(file); }
@Override public void configure(final boolean enable, final Path file) throws BackgroundException { registry.find(session, file).getFeature(session, TransferAcceleration.class, proxy).configure(enable, file); }
@Override public boolean prompt(final Host bookmark, final Path file, final ConnectionCallback prompt) throws BackgroundException { return registry.find(session, file).getFeature(session, TransferAcceleration.class, proxy).prompt(bookmark, file, prompt); }
@Override public void setStatus(final Path file, final boolean enabled) throws BackgroundException { registry.find(session, file).getFeature(session, TransferAcceleration.class, proxy).setStatus(file, enabled); }
transferAcceleration = session.getFeature(TransferAcceleration.class).getStatus(file);
private void configure(final Map<TransferItem, TransferStatus> files, final ConnectionCallback callback, final boolean enabled) throws BackgroundException { final Set<Path> buckets = new HashSet<>(); for(TransferItem file : files.keySet()) { buckets.add(new S3PathContainerService().getContainer(file.remote)); } for(Path bucket : buckets) { if(enabled) { try { if(this.accelerate(bucket, callback)) { if(log.isInfoEnabled()) { log.info(String.format("Tunnel upload for file %s through accelerated endpoint %s", bucket, accelerationService)); } accelerationService.configure(true, bucket); break; } else { log.warn(String.format("Transfer acceleration disabled for %s", bucket)); } } catch(AccessDeniedException e) { log.warn(String.format("Ignore failure reading S3 accelerate configuration. %s", e.getMessage())); } } else { accelerationService.configure(false, bucket); } } }