@Override public void archive(final Archive archive, final Path workdir, final List<Path> files, final ProgressListener listener, final TranscriptListener transcript) throws BackgroundException { final List<Path> encrypted = new ArrayList<>(); for(Path f : files) { encrypted.add(vault.encrypt(session, f)); } delegate.archive(archive, vault.encrypt(session, workdir), encrypted, listener, transcript); }
@Override public boolean offset(final Path file) throws BackgroundException { try { return proxy.offset(vault.encrypt(session, file)); } catch(NotfoundException e) { return false; } }
@Override public void setConfiguration(final Path container, final LifecycleConfiguration configuration) throws BackgroundException { delegate.setConfiguration(vault.encrypt(session, container), configuration); }
@Override public void setConfiguration(final Path container, final PasswordCallback prompt, final VersioningConfiguration configuration) throws BackgroundException { delegate.setConfiguration(vault.encrypt(session, container), prompt, configuration); }
@Override public void setClass(final Path file, final String redundancy) throws BackgroundException { delegate.setClass(vault.encrypt(session, file), redundancy); }
@Override public void setConfiguration(final Path container, final LoggingConfiguration configuration) throws BackgroundException { delegate.setConfiguration(vault.encrypt(session, container), configuration); }
@Override public AttributedList<Path> search(final Path workdir, final Filter<Path> regex, final ListProgressListener listener) throws BackgroundException { return delegate.search(vault.encrypt(session, workdir), regex, listener); }
@Override public boolean prompt(final Host bookmark, final Path file, final ConnectionCallback prompt) throws BackgroundException { return delegate.prompt(bookmark, vault.encrypt(session, file), prompt); }
@Override public void configure(final boolean enable, final Path file) throws BackgroundException { delegate.configure(enable, vault.encrypt(session, file)); }
@Override public void setUnixOwner(final Path file, final String owner) throws BackgroundException { delegate.setUnixOwner(cryptomator.encrypt(session, file), owner); }
@Override public LifecycleConfiguration getConfiguration(final Path container) throws BackgroundException { return delegate.getConfiguration(vault.encrypt(session, container)); }
@Override public Algorithm getDefault(final Path file) throws BackgroundException { return delegate.getDefault(vault.encrypt(session, file)); }
@Override public Set<Algorithm> getKeys(final Path file, final LoginCallback prompt) throws BackgroundException { return delegate.getKeys(vault.encrypt(session, file), prompt); }
@Override public void unarchive(final Archive archive, final Path file, final ProgressListener listener, final TranscriptListener transcript) throws BackgroundException { delegate.unarchive(archive, vault.encrypt(session, file), listener, transcript); }
@Override public Path find(final Path workdir, final String path) { try { return delegate.find(vault.encrypt(session, workdir), path); } catch(BackgroundException ignored) { return delegate.find(workdir, path); } }
@Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { return delegate.list(vault.encrypt(session, directory), new DecryptingListProgressListener(session, vault, listener)); }
@Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { // Move inside vault moves actual files and only metadata files for directories but not the actual directories final Path target = proxy.move( vault.encrypt(session, file, file.isDirectory()), vault.encrypt(session, renamed, file.isDirectory()), status, callback, connectionCallback); return vault.decrypt(session, target); }
@Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { return delegate.list(directory, new ProxyListProgressListener(finder, listener)); } catch(VaultFoundListCanceledException finder) { final Vault cryptomator = finder.getVault(); if(log.isInfoEnabled()) { log.info(String.format("Found vault %s", cryptomator)); } return delegate.list(cryptomator.encrypt(session, directory), new DecryptingListProgressListener(session, cryptomator, listener.reset())); } }
@Override public boolean find(final Path file) throws BackgroundException { try { // Look for metadata file to exist when searching for folder return delegate.withCache(new CryptoPathCache(cache)).find(vault.encrypt(session, file, file.isDirectory())); } catch(NotfoundException e) { return false; } }
@Override public PathAttributes find(final Path file) throws BackgroundException { final PathAttributes attributes = new PathAttributes(delegate.withCache(new CryptoPathCache(cache)).find(vault.encrypt(session, file))); if(file.isFile()) { attributes.setSize(vault.toCleartextSize(attributes.getSize())); } return attributes; }