@Test public void toDownloadUrl() throws Exception { final StoregateIdProvider nodeid = new StoregateIdProvider(session).withCache(cache); final Path room = new StoregateDirectoryFeature(session, nodeid).mkdir( new Path(String.format("/My files/%s", new AlphanumericRandomStringService().random()), EnumSet.of(Path.Type.directory, Path.Type.volume)), null, new TransferStatus()); final Path test = new StoregateTouchFeature(session, nodeid).touch( new Path(room, String.format("%s", new AlphanumericRandomStringService().random()), EnumSet.of(Path.Type.file)), new TransferStatus()); assertNotNull(new StoregateShareFeature(session, nodeid).toDownloadUrl(test, null, new DisabledPasswordCallback()).getUrl()); new StoregateDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledPasswordCallback(), new Delete.DisabledCallback()); }
@Override public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { try { final Host bookmark = session.getHost(); final CreateFileShareRequest request = new CreateFileShareRequest() .fileId(fileid.getFileid(file, new DisabledListProgressListener())); try { request.setPassword(callback.prompt(bookmark, LocaleFactory.localizedString("Passphrase", "Cryptomator"), MessageFormat.format(LocaleFactory.localizedString("Create a passphrase required to access {0}", "Credentials"), file.getName()), new LoginOptions().keychain(false).icon(bookmark.getProtocol().disk())).getPassword()); } catch(LoginCanceledException e) { } return new DescriptiveUrl(URI.create( new FileSharesApi(session.getClient()).fileSharesPost(request).getUrl()), DescriptiveUrl.Type.signed); } catch(ApiException e) { throw new StoregateExceptionMappingService().map(e); } }
StoregateShareFeature implements PromptUrlProvider<Void, Void> { @Override public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { try { final Host bookmark = session.getHost(); final CreateFileShareRequest request = new CreateFileShareRequest() .fileId(fileid.getFileid(file, new DisabledListProgressListener())); try { request.setPassword(callback.prompt(bookmark, LocaleFactory.localizedString("Passphrase", "Cryptomator"), MessageFormat.format(LocaleFactory.localizedString("Create a passphrase required to access {0}", "Credentials"), file.getName()), new LoginOptions().keychain(false).icon(bookmark.getProtocol().disk())).getPassword()); } catch(LoginCanceledException e) { } return new DescriptiveUrl(URI.create( new FileSharesApi(session.getClient()).fileSharesPost(request).getUrl()), DescriptiveUrl.Type.signed); } catch(ApiException e) { throw new StoregateExceptionMappingService().map(e); } } }
StoregateShareFeature implements PromptUrlProvider<Void, Void> { @Override public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { try { final Host bookmark = session.getHost(); final CreateFileShareRequest request = new CreateFileShareRequest() .fileId(fileid.getFileid(file, new DisabledListProgressListener())); try { request.setPassword(callback.prompt(bookmark, LocaleFactory.localizedString("Passphrase", "Cryptomator"), MessageFormat.format(LocaleFactory.localizedString("Create a passphrase required to access {0}", "Credentials"), file.getName()), new LoginOptions().keychain(false).icon(bookmark.getProtocol().disk())).getPassword()); } catch(LoginCanceledException e) { } return new DescriptiveUrl(URI.create( new FileSharesApi(session.getClient()).fileSharesPost(request).getUrl()), DescriptiveUrl.Type.signed); } catch(ApiException e) { throw new StoregateExceptionMappingService().map(e); } } StoregateShareFeature(final StoregateSession session, final StoregateIdProvider fileid); }
StoregateShareFeature implements PromptUrlProvider<Void, Void> { @Override public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { try { final Host bookmark = session.getHost(); final CreateFileShareRequest request = new CreateFileShareRequest() .fileId(fileid.getFileid(file, new DisabledListProgressListener())); try { request.setPassword(callback.prompt(bookmark, LocaleFactory.localizedString("Passphrase", "Cryptomator"), MessageFormat.format(LocaleFactory.localizedString("Create a passphrase required to access {0}", "Credentials"), file.getName()), new LoginOptions().keychain(false).icon(bookmark.getProtocol().disk())).getPassword()); } catch(LoginCanceledException e) { } return new DescriptiveUrl(URI.create( new FileSharesApi(session.getClient()).fileSharesPost(request).getUrl()), DescriptiveUrl.Type.signed); } catch(ApiException e) { throw new StoregateExceptionMappingService().map(e); } } StoregateShareFeature(final StoregateSession session, final StoregateIdProvider fileid); @Override boolean isSupported(final Path file, final Type type); @Override DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback); @Override DescriptiveUrl toUploadUrl(final Path file, final Void options, final PasswordCallback callback); }
StoregateShareFeature implements PromptUrlProvider<Void, Void> { @Override public DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback) throws BackgroundException { try { final Host bookmark = session.getHost(); final CreateFileShareRequest request = new CreateFileShareRequest() .fileId(fileid.getFileid(file, new DisabledListProgressListener())); try { request.setPassword(callback.prompt(bookmark, LocaleFactory.localizedString("Passphrase", "Cryptomator"), MessageFormat.format(LocaleFactory.localizedString("Create a passphrase required to access {0}", "Credentials"), file.getName()), new LoginOptions().keychain(false).icon(bookmark.getProtocol().disk())).getPassword()); } catch(LoginCanceledException e) { } return new DescriptiveUrl(URI.create( new FileSharesApi(session.getClient()).fileSharesPost(request).getUrl()), DescriptiveUrl.Type.signed); } catch(ApiException e) { throw new StoregateExceptionMappingService().map(e); } } StoregateShareFeature(final StoregateSession session, final StoregateIdProvider fileid); @Override boolean isSupported(final Path file, final Type type); @Override DescriptiveUrl toDownloadUrl(final Path file, final Void options, final PasswordCallback callback); @Override DescriptiveUrl toUploadUrl(final Path file, final Void options, final PasswordCallback callback);  }