|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ISendFileTransferContainerAdapter
Entry point outgoing file transfer container adapter. This adapter interface
allows providers to expose file sending semantics to clients in a transport
independent manner. To be used, a non-null adapter reference must be returned
from a call to IContainer.getAdapter(Class)
. Once a non-null
reference is retrieved, then it may be used to request to send a file to a
remote user. Events will then be asynchronously delivered to the provided
listener to complete file transfer.
To request and initiate sending a local file to a remote user:
// Get ISendFileTransferContainerAdapter adapter ISendFileTransferContainerAdapter ftc = (ISendFileTransferContainerAdapter) container.getAdapter(ISendFileTransferContainerAdapter.class); if (ftc != null) { // Create listener for receiving/responding to asynchronous file transfer events IFileTransferListener listener = new IFileTransferListener() { public void handleTransferEvent(IFileTransferEvent event) { // If this event is a response to the transfer request, check if file transfer rejected if (event instanceof IOutgoingFileTransferResponseEvent) { IOutgoingFileTransferResponseEvent oftr = (IOutgoingFileTransferResponseEvent) event; if (!oftr.requestAccepted()) { // request rejected...tell user } } } }; // Specify the target file ID // This following specifies the path: ~/path/filename.ext ID targetID = FileIDFactory.getDefault().createFileID(ftc.getOutgoingNamespace(),new URL("scp://user@host/path/filename.ext")); // This following specifies the path: /path/filename.ext // ID targetID = FileIDFactory.getDefault().createFileID(ftc.getOutgoingNamespace(),new URL("scp://user@host//path/filename.ext")); // Specify the local file to send File localFileToSend = new File("filename"); // Actually send outgoing file request to remote user. ftc.sendOutgoingRequest(targetID, localFileToSend, listener, null); }For the sender the delivered events will be:
IOutgoingFileTransferResponseEvent
IOutgoingFileTransferSendDataEvent
IOutgoingFileTransferSendDoneEvent
IIncomingFileTransferRequestListener
events
delivered will be:
IFileTransferRequestEvent
IIncomingFileTransferReceiveDataEvent
IIncomingFileTransferReceiveDoneEvent
Method Summary | |
---|---|
void |
addListener(IIncomingFileTransferRequestListener listener)
Add incoming file transfer listener. |
Namespace |
getOutgoingNamespace()
Get namespace for outgoing file transfer. |
boolean |
removeListener(IIncomingFileTransferRequestListener listener)
Remove incoming file transfer listener |
void |
sendOutgoingRequest(IFileID targetReceiver,
java.io.File localFileToSend,
IFileTransferListener transferListener,
java.util.Map options)
Send request for outgoing file transfer. |
void |
sendOutgoingRequest(IFileID targetReceiver,
IFileTransferInfo localFileToSend,
IFileTransferListener transferListener,
java.util.Map options)
Send request for outgoing file transfer. |
void |
setConnectContextForAuthentication(IConnectContext connectContext)
Set connect context for authentication upon subsequent sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map) . |
void |
setProxy(Proxy proxy)
Set proxy for use upon subsequent sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map) . |
Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
---|
getAdapter |
Method Detail |
---|
void sendOutgoingRequest(IFileID targetReceiver, IFileTransferInfo localFileToSend, IFileTransferListener transferListener, java.util.Map options) throws SendFileTransferException
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 listeneroptions
- 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 transfervoid sendOutgoingRequest(IFileID targetReceiver, java.io.File localFileToSend, IFileTransferListener transferListener, java.util.Map options) throws SendFileTransferException
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 listeneroptions
- 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 transfervoid addListener(IIncomingFileTransferRequestListener listener)
listener
- to receive incoming file transfer request events. Must not be
null
.boolean removeListener(IIncomingFileTransferRequestListener listener)
listener
- the listener to remove. Must not be null
.
Namespace getOutgoingNamespace()
null
.void setConnectContextForAuthentication(IConnectContext connectContext)
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
sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map)
.
connectContext
- the connect context to use for authenticating during
subsequent call to
sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map)
.
If null
, then no authentication will be
attempted.void setProxy(Proxy proxy)
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
sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map)
.
proxy
- the proxy to use for subsequent calls to
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 |