|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer
public abstract class AbstractOutgoingFileTransfer
Field Summary | |
---|---|
protected int |
buff_length
|
protected long |
bytesSent
|
protected IConnectContext |
connectContext
|
static int |
DEFAULT_BUF_LENGTH
|
protected boolean |
done
|
protected java.lang.Exception |
exception
|
protected IFileTransferInfo |
fileTransferInfo
|
protected org.eclipse.core.runtime.jobs.Job |
job
|
protected IFileTransferListener |
listener
|
protected java.io.InputStream |
localFileContents
|
protected java.util.Map |
options
|
protected Proxy |
proxy
|
protected java.io.OutputStream |
remoteFileContents
|
protected IFileID |
remoteFileID
|
protected java.net.URL |
remoteFileURL
|
Constructor Summary | |
---|---|
AbstractOutgoingFileTransfer()
|
Method Summary | |
---|---|
void |
addListener(IIncomingFileTransferRequestListener l)
Add incoming file transfer listener. |
void |
cancel()
Cancel this file transfer. |
protected java.lang.String |
createJobName()
|
protected void |
fireSendStartEvent()
|
protected void |
fireTransferSendDataEvent()
|
protected void |
fireTransferSendDoneEvent()
|
java.lang.Object |
getAdapter(java.lang.Class adapter)
|
long |
getBytesSent()
Get the number of bytes sent for this outgoing file transfer. |
java.lang.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(java.lang.Throwable exception1)
|
ID |
getID()
Return the ID for this 'identifiable' object. |
IFileTransferListener |
getListener()
|
protected java.util.Map |
getOptions()
|
Namespace |
getOutgoingNamespace()
Get namespace for outgoing file transfer. |
double |
getPercentComplete()
Get the percent complete for this file transfer. |
protected java.net.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(java.lang.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,
java.io.File localFileToSend,
IFileTransferListener transferListener,
java.util.Map ops)
Send request for outgoing file transfer. |
void |
sendOutgoingRequest(IFileID targetReceiver,
IFileTransferInfo localFileToSend,
IFileTransferListener transferListener,
java.util.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(java.io.InputStream ins)
|
protected void |
setOutputStream(java.io.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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BUF_LENGTH
protected org.eclipse.core.runtime.jobs.Job job
protected java.net.URL remoteFileURL
protected IFileID remoteFileID
protected IFileTransferListener listener
protected int buff_length
protected boolean done
protected long bytesSent
protected java.io.InputStream localFileContents
protected java.io.OutputStream remoteFileContents
protected java.lang.Exception exception
protected IFileTransferInfo fileTransferInfo
protected java.util.Map options
protected IConnectContext connectContext
protected Proxy proxy
Constructor Detail |
---|
public AbstractOutgoingFileTransfer()
Method Detail |
---|
protected java.net.URL getRemoteFileURL()
protected void setInputStream(java.io.InputStream ins)
protected void setOutputStream(java.io.OutputStream outs)
protected IFileTransferInfo getFileTransferInfo()
protected java.util.Map getOptions()
protected org.eclipse.core.runtime.IStatus getFinalStatus(java.lang.Throwable exception1)
protected void hardClose()
public ID getID()
IIdentifiable
null
.
getID
in interface IIdentifiable
null
.protected void fireTransferSendDoneEvent()
protected void fireTransferSendDataEvent()
public long getBytesSent()
IOutgoingFileTransfer
getBytesSent
in interface IOutgoingFileTransfer
public void cancel()
IFileTransfer
IFileTransferEvent
being delivered to the
IFileTransferListener
indicating that transfer is done (IFileTransfer.isDone()
returns true), and some exception will be made available
cancel
in interface IFileTransfer
public java.lang.Exception getException()
IFileTransfer
IFileTransfer.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 IFileTransfer
null
if transfer completed successfully, non-null if transfer
completed with some exception. Only valid after
IFileTransfer.isDone()
returns true.public double getPercentComplete()
IFileTransfer
IFileTransfer.isDone()
method should be consulted to determine if the file
transfer has completed (with or without error).
getPercentComplete
in interface IFileTransfer
public long getFileLength()
IFileTransfer
IFileRangeSpecification
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 IFileTransfer
public boolean isDone()
IFileTransfer
IFileTransfer.getException()
method.
isDone
in interface IFileTransfer
public java.lang.Object getAdapter(java.lang.Class adapter)
getAdapter
in interface org.eclipse.core.runtime.IAdaptable
protected abstract void openStreams() throws SendFileTransferException
remoteFileContents
and localFileContent
must be non-null
after successful completion of the
implementation of this method.
SendFileTransferException
public Namespace getOutgoingNamespace()
ISendFileTransferContainerAdapter
getOutgoingNamespace
in interface ISendFileTransferContainerAdapter
null
.public IFileTransferListener getListener()
protected java.lang.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(java.lang.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, java.util.Map ops) throws SendFileTransferException
ISendFileTransferContainerAdapter
sendOutgoingRequest
in interface ISendFileTransferContainerAdapter
targetReceiver
- 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, java.io.File localFileToSend, IFileTransferListener transferListener, java.util.Map ops) throws SendFileTransferException
ISendFileTransferContainerAdapter
sendOutgoingRequest
in interface ISendFileTransferContainerAdapter
targetReceiver
- 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)
ISendFileTransferContainerAdapter
addListener
in interface ISendFileTransferContainerAdapter
l
- to receive incoming file transfer request events. Must not be
null
.public boolean removeListener(IIncomingFileTransferRequestListener l)
ISendFileTransferContainerAdapter
removeListener
in interface ISendFileTransferContainerAdapter
l
- the listener to remove. Must not be null
.
public void setConnectContextForAuthentication(IConnectContext connectContext)
ISendFileTransferContainerAdapter
ISendFileTransferContainerAdapter.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 ISendFileTransferContainerAdapter
connectContext
- 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)
ISendFileTransferContainerAdapter
ISendFileTransferContainerAdapter.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 ISendFileTransferContainerAdapter
proxy
- the proxy to use for subsequent calls to
ISendFileTransferContainerAdapter.sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map)
.
If null
, then no proxy will be used.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |