public abstract class AbstractOutgoingFileTransfer extends Object implements IOutgoingFileTransfer, ISendFileTransfer
| Modifier and Type | Field and Description |
|---|---|
protected int |
buff_length |
protected long |
bytesSent |
protected IConnectContext |
connectContext |
static int |
DEFAULT_BUF_LENGTH |
protected boolean |
done |
protected Exception |
exception |
protected IFileTransferInfo |
fileTransferInfo |
protected org.eclipse.core.runtime.jobs.Job |
job |
protected IFileTransferListener |
listener |
protected InputStream |
localFileContents |
protected Map |
options |
protected Proxy |
proxy |
protected OutputStream |
remoteFileContents |
protected IFileID |
remoteFileID |
protected URL |
remoteFileURL |
| Constructor and Description |
|---|
AbstractOutgoingFileTransfer() |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(IIncomingFileTransferRequestListener l)
Add incoming file transfer listener.
|
void |
cancel()
Cancel this file transfer.
|
protected String |
createJobName() |
protected void |
fireSendStartEvent() |
protected void |
fireTransferSendDataEvent() |
protected void |
fireTransferSendDoneEvent() |
Object |
getAdapter(Class adapter) |
long |
getBytesSent()
Get the number of bytes sent for this outgoing file transfer.
|
Exception |
getException()
Get any exception associated with this file transfer.
|
long |
getFileLength()
Return resulting file length (in bytes) for this file transfer instance.
|
protected IFileTransferInfo |
getFileTransferInfo() |
protected org.eclipse.core.runtime.IStatus |
getFinalStatus(Throwable exception1) |
ID |
getID()
Return the ID for this 'identifiable' object.
|
IFileTransferListener |
getListener() |
protected Map |
getOptions() |
Namespace |
getOutgoingNamespace()
Get namespace for outgoing file transfer.
|
double |
getPercentComplete()
Get the percent complete for this file transfer.
|
protected URL |
getRemoteFileURL() |
protected void |
hardClose() |
boolean |
isDone()
Return true if this file transfer is done, false if not yet completed.
|
protected abstract void |
openStreams()
Open incoming and outgoing streams associated with this file transfer.
|
boolean |
removeListener(IIncomingFileTransferRequestListener l)
Remove incoming file transfer listener
|
protected org.eclipse.core.net.proxy.IProxyData |
selectProxyFromProxies(String protocol,
org.eclipse.core.net.proxy.IProxyData[] proxies)
Select a single proxy from a set of proxies available for the given host.
|
void |
sendOutgoingRequest(IFileID targetReceiver,
File localFileToSend,
IFileTransferListener transferListener,
Map ops)
Send request for outgoing file transfer.
|
void |
sendOutgoingRequest(IFileID targetReceiver,
IFileTransferInfo localFileToSend,
IFileTransferListener transferListener,
Map ops)
Send request for outgoing file transfer.
|
void |
setConnectContextForAuthentication(IConnectContext connectContext)
Set connect context for authentication upon subsequent
ISendFileTransferContainerAdapter.sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map). |
protected void |
setInputStream(InputStream ins) |
protected void |
setOutputStream(OutputStream outs) |
void |
setProxy(Proxy proxy)
Set proxy for use upon subsequent
ISendFileTransferContainerAdapter.sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map). |
protected void |
setupAndScheduleJob() |
protected void |
setupProxies() |
protected abstract void |
setupProxy(Proxy proxy) |
public static final int DEFAULT_BUF_LENGTH
protected org.eclipse.core.runtime.jobs.Job job
protected URL remoteFileURL
protected IFileID remoteFileID
protected IFileTransferListener listener
protected int buff_length
protected boolean done
protected long bytesSent
protected InputStream localFileContents
protected OutputStream remoteFileContents
protected Exception exception
protected IFileTransferInfo fileTransferInfo
protected Map options
protected IConnectContext connectContext
protected Proxy proxy
protected URL getRemoteFileURL()
protected void setInputStream(InputStream ins)
protected void setOutputStream(OutputStream outs)
protected IFileTransferInfo getFileTransferInfo()
protected Map getOptions()
protected org.eclipse.core.runtime.IStatus getFinalStatus(Throwable exception1)
protected void hardClose()
public ID getID()
IIdentifiablenull.getID in interface IIdentifiablenull.protected void fireTransferSendDoneEvent()
protected void fireTransferSendDataEvent()
public long getBytesSent()
IOutgoingFileTransfergetBytesSent in interface IOutgoingFileTransferpublic void cancel()
IFileTransferIFileTransferEvent being delivered to the
IFileTransferListener indicating that transfer is done (IFileTransfer.isDone()
returns true), and some exception will be made availablecancel in interface IFileTransferpublic Exception getException()
IFileTransferIFileTransfer.isDone() method returns true.
If the file transfer completed successfully, IFileTransfer.isDone() will
return true, and this method will return null. If the file transfer
completed unsuccessfully (some exception occurred), then
IFileTransfer.isDone() will return true, and this method will return a
non-null Exception instance that occurred.
If the the file transfer was canceled by the user, then the exception
returned will be an instance of UserCancelledException.
getException in interface IFileTransfernull
if transfer completed successfully, non-null if transfer
completed with some exception. Only valid after
IFileTransfer.isDone() returns true.public double getPercentComplete()
IFileTransferIFileTransfer.isDone() method should be consulted to determine if the file
transfer has completed (with or without error).getPercentComplete in interface IFileTransferpublic long getFileLength()
IFileTransferIFileRangeSpecification is provided that the returned
file length is the expected file length of just the range retrieved (and not the entire file).getFileLength in interface IFileTransferpublic boolean isDone()
IFileTransferIFileTransfer.getException() method.isDone in interface IFileTransferpublic Object getAdapter(Class adapter)
getAdapter in interface org.eclipse.core.runtime.IAdaptableprotected abstract void openStreams()
throws SendFileTransferException
remoteFileContents and localFileContent
must be non-null after successful completion of the
implementation of this method.SendFileTransferException - if some problempublic Namespace getOutgoingNamespace()
ISendFileTransferContainerAdaptergetOutgoingNamespace in interface ISendFileTransferContainerAdapternull.public IFileTransferListener getListener()
protected String createJobName()
protected void setupAndScheduleJob()
protected void fireSendStartEvent()
protected abstract void setupProxy(Proxy proxy)
protected void setupProxies()
protected org.eclipse.core.net.proxy.IProxyData selectProxyFromProxies(String protocol, org.eclipse.core.net.proxy.IProxyData[] proxies)
protocol - the target protocol (e.g. http, https, scp, etc). Will not be null.proxies - the proxies to select from. May be null or array of length 0.public void sendOutgoingRequest(IFileID targetReceiver, IFileTransferInfo localFileToSend, IFileTransferListener transferListener, Map ops) throws SendFileTransferException
ISendFileTransferContainerAdaptersendOutgoingRequest in interface ISendFileTransferContainerAdaptertargetReceiver - the ID of the remote to receive the file transfer request.
Must not be should not be null.localFileToSend - the IFileTransferInfo for the local file to send. Must
not be should not be null.transferListener - a IFileTransferListener for responding to file
transfer events. Must not be should not be null..
If the target receiver responds then an
IOutgoingFileTransferResponseEvent will be delivered
to the listenerops - a Map of options associated with sendOutgoingRequest. The
particular name/value pairs will be unique to the individual
providers. May be should not be null..SendFileTransferException - if the provider is not connected or is not in the correct
state for initiating file transferpublic void sendOutgoingRequest(IFileID targetReceiver, File localFileToSend, IFileTransferListener transferListener, Map ops) throws SendFileTransferException
ISendFileTransferContainerAdaptersendOutgoingRequest in interface ISendFileTransferContainerAdaptertargetReceiver - the ID of the remote to receive the file transfer request.
Must not be null.localFileToSend - the File for the local file to send. Must not be
null.transferListener - a IFileTransferListener for responding to file
transfer events. Must not be null. If the
target receiver responds then an IOutgoingFileTransfer will be
delivered to the listenerops - a Map of options associated with sendOutgoingRequest. The
particular name/value pairs will be unique to the individual
providers. May be null.SendFileTransferException - if the provider is not connected or is not in the correct
state for initiating file transferpublic void addListener(IIncomingFileTransferRequestListener l)
ISendFileTransferContainerAdapteraddListener in interface ISendFileTransferContainerAdapterl - to receive incoming file transfer request events. Must not be
null.public boolean removeListener(IIncomingFileTransferRequestListener l)
ISendFileTransferContainerAdapterremoveListener in interface ISendFileTransferContainerAdapterl - the listener to remove. Must not be null.public void setConnectContextForAuthentication(IConnectContext connectContext)
ISendFileTransferContainerAdapterISendFileTransferContainerAdapter.sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map). This
method should be called with a non-null connectContext in order to allow
authentication to occur during call to
ISendFileTransferContainerAdapter.sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map).setConnectContextForAuthentication in interface ISendFileTransferContainerAdapterconnectContext - the connect context to use for authenticating during
subsequent call to
ISendFileTransferContainerAdapter.sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map).
If null, then no authentication will be
attempted.public void setProxy(Proxy proxy)
ISendFileTransferContainerAdapterISendFileTransferContainerAdapter.sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map). This
method should be called with a non-null proxy to allow the given proxy to
be used in subsequent calls to
ISendFileTransferContainerAdapter.sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map).setProxy in interface ISendFileTransferContainerAdapterproxy - the proxy to use for subsequent calls to
ISendFileTransferContainerAdapter.sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map).
If null, then no proxy will be used.Copyright © 2004–2020 Eclipse Foundation. All rights reserved.