/** * Transfers the files either using the queue or using the browser session if #connection.pool.max is 1 * * @param transfer Transfer Operation */ public void transfer(final Transfer transfer, final List<Path> selected) { // Determine from current browser session if new connection should be opened for transfers this.transfer(transfer, selected, transfer.getSource().getTransferType().equals(Host.TransferType.browser)); }
@Override public void change(Host bookmark) { transferPopup.selectItemAtIndex(transferPopup.indexOfItemWithRepresentedObject(bookmark.getTransferType().name())); } });
public ConcurrentTransferWorker(final SessionPool source, final SessionPool destination, final Transfer transfer, final ThreadPool.Priority priority, final TransferOptions options, final TransferSpeedometer meter, final TransferPrompt prompt, final TransferErrorCallback error, final ConnectionCallback connectionCallback, final PasswordCallback passwordCallback, final ProgressListener progressListener, final StreamListener streamListener, final NotificationService notification) { super(transfer, options, prompt, meter, error, progressListener, streamListener, connectionCallback, passwordCallback, notification); this.source = source; this.destination = destination; this.pool = ThreadPoolFactory.get(String.format("%s-transfer", new AlphanumericRandomStringService().random()), transfer.getSource().getTransferType() == Host.TransferType.newconnection ? 1 : PreferencesFactory.get().getInteger("queue.connections.limit"), priority); this.completion = new ExecutorCompletionService<TransferStatus>(pool.executor()); }
@Override public boolean validate(final Transfer transfer) { final NSPopUpButton popup = Rococoa.cast(item.view(), NSPopUpButton.class); switch(transfer.getSource().getTransferType()) { case newconnection: popup.selectItemAtIndex(popup.indexOfItemWithRepresentedObject(String.valueOf(1))); break; default: popup.selectItemAtIndex(popup.indexOfItemWithRepresentedObject(PreferencesFactory.get().getProperty("queue.connections.limit"))); break; } return true; } });
@Override public boolean prompt(final Host bookmark, final Path file, final ConnectionCallback prompt) throws BackgroundException { if(Host.TransferType.unknown == bookmark.getTransferType()) { if(!preferences.getBoolean(String.format("connection.qloudsonic.%s", bookmark.getHostname()))) { final List<License> receipts = voucher.open(); return bookmark.getTransferType() == Host.TransferType.udt;
preferences.getInteger("connection.retry")); final TransferOptions options = new DefaultTransferOptionsConfigurer().configure(new TransferOptions()); options.setUseParallelTransfer(session.getHost().getTransferType().equals(Host.TransferType.concurrent)); block.setTransferOptions(options); final TransferStatus copy = new TransferStatus(status);
@Override public void download(final Path file, final Local local, final BandwidthThrottle throttle, final StreamListener listener, final TransferStatus status, final ConnectionCallback connectionCallback, final PasswordCallback passwordCallback) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute()); if(f.exists()) { final TransferControlBlock block = DefaultTransferControlBlock.instance(StringUtils.EMPTY, preferences.getInteger("connection.retry")); final TransferOptions options = new DefaultTransferOptionsConfigurer().configure(new TransferOptions()); options.setUseParallelTransfer(session.getHost().getTransferType().equals(Host.TransferType.concurrent)); block.setTransferOptions(options); final DataTransferOperations transfer = fs.getIRODSAccessObjectFactory() .getDataTransferOperations(fs.getIRODSAccount()); transfer.getOperation(f, new File(local.getAbsolute()), new DefaultTransferStatusCallbackListener(status, listener, block), block); } else { throw new NotfoundException(file.getAbsolute()); } } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Download {0} failed", e, file); } }