public void sendOutgoingRequest(IFileID targetID, IFileTransferInfo localFileToSend, IFileTransferListener transferListener, Map options) throws SendFileTransferException { Assert.isNotNull(targetID); Assert.isNotNull(localFileToSend); Assert.isNotNull(transferListener); String protocol = null; try { protocol = targetID.getURI().getScheme(); } catch (URISyntaxException e) { try { protocol = targetID.getURL().getProtocol(); } catch (final MalformedURLException e1) { throw new SendFileTransferException(Messages.AbstractRetrieveFileTransfer_MalformedURLException); } } ISendFileTransferContainerAdapter fileTransfer = Activator.getDefault().getSendFileTransfer(protocol); // If no handler setup for this protocol then throw if (fileTransfer == null) { throw new SendFileTransferException(NLS.bind(Messages.MultiProtocolOutgoingAdapter_EXCEPTION_NO_PROTOCOL_HANDER, targetID)); } fileTransfer.setConnectContextForAuthentication(connectContext); fileTransfer.setProxy(proxy); fileTransfer.sendOutgoingRequest(targetID, localFileToSend, transferListener, options); }
public void sendOutgoingRequest(IFileID targetID, File outgoingFile, IFileTransferListener transferListener, Map options) throws SendFileTransferException { Assert.isNotNull(targetID); Assert.isNotNull(outgoingFile); Assert.isNotNull(transferListener); String protocol = null; try { protocol = targetID.getURI().getScheme(); } catch (URISyntaxException e) { try { protocol = targetID.getURL().getProtocol(); } catch (final MalformedURLException e1) { throw new SendFileTransferException(Messages.AbstractRetrieveFileTransfer_MalformedURLException); } } ISendFileTransferContainerAdapter fileTransfer = Activator.getDefault().getSendFileTransfer(protocol); // If no handler setup for this protocol then throw if (fileTransfer == null) { if (protocol.equalsIgnoreCase("file")) { //$NON-NLS-1$ fileTransfer = new LocalFileOutgoingFileTransfer(); } } if (fileTransfer == null) { throw new SendFileTransferException(NLS.bind(Messages.MultiProtocolOutgoingAdapter_EXCEPTION_NO_PROTOCOL_HANDER, targetID)); } fileTransfer.setConnectContextForAuthentication(connectContext); fileTransfer.setProxy(proxy); fileTransfer.sendOutgoingRequest(targetID, outgoingFile, transferListener, options); }
public void sendRetrieveRequest(IFileID remoteFileID, IFileTransferListener transferListener, Map options) throws IncomingFileTransferException { Assert.isNotNull(remoteFileID); Assert.isNotNull(transferListener); String protocol = null; try { protocol = remoteFileID.getURI().getScheme(); } catch (URISyntaxException e) { try { protocol = remoteFileID.getURL().getProtocol(); } catch (final MalformedURLException e1) { throw new IncomingFileTransferException(Messages.AbstractRetrieveFileTransfer_MalformedURLException); } } IRetrieveFileTransferContainerAdapter fileTransfer = Activator.getDefault().getFileTransfer(protocol); // We will default to JRE-provided file transfer if nothing else // available // for given protocol if (fileTransfer == null) fileTransfer = new UrlConnectionRetrieveFileTransfer(); // Set connect context fileTransfer.setConnectContextForAuthentication(connectContext); // Set Proxy fileTransfer.setProxy(proxy); // send request using given file transfer protocol fileTransfer.sendRetrieveRequest(remoteFileID, transferListener, options); }
public void sendRetrieveRequest(IFileID remoteFileID, IFileRangeSpecification rangeSpecification, IFileTransferListener transferListener, Map options) throws IncomingFileTransferException { Assert.isNotNull(remoteFileID); Assert.isNotNull(transferListener); String protocol = null; try { protocol = remoteFileID.getURI().getScheme(); } catch (URISyntaxException e) { try { protocol = remoteFileID.getURL().getProtocol(); } catch (final MalformedURLException e1) { throw new IncomingFileTransferException(Messages.AbstractRetrieveFileTransfer_MalformedURLException); } } IRetrieveFileTransferContainerAdapter fileTransfer = Activator.getDefault().getFileTransfer(protocol); // We will default to JRE-provided file transfer if nothing else // available // for given protocol if (fileTransfer == null) fileTransfer = new UrlConnectionRetrieveFileTransfer(); // Set connect context fileTransfer.setConnectContextForAuthentication(connectContext); // Set Proxy fileTransfer.setProxy(proxy); // send request using given file transfer protocol fileTransfer.sendRetrieveRequest(remoteFileID, rangeSpecification, transferListener, options); }