Package org.eclipse.ecf.filetransfer
Interface ISendFileTransferContainerAdapter
- 
- All Superinterfaces:
- org.eclipse.core.runtime.IAdaptable
 - All Known Subinterfaces:
- ISendFileTransfer
 - All Known Implementing Classes:
- AbstractOutgoingFileTransfer,- AbstractUrlConnectionOutgoingFileTransfer,- LocalFileOutgoingFileTransfer,- MultiProtocolOutgoingAdapter
 
 public interface ISendFileTransferContainerAdapter extends org.eclipse.core.runtime.IAdaptableEntry 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 toIContainer.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
 IIncomingFileTransferRequestListenerevents delivered will be:
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddListener(IIncomingFileTransferRequestListener listener)Add incoming file transfer listener.NamespacegetOutgoingNamespace()Get namespace for outgoing file transfer.booleanremoveListener(IIncomingFileTransferRequestListener listener)Remove incoming file transfer listenervoidsendOutgoingRequest(IFileID targetReceiver, File localFileToSend, IFileTransferListener transferListener, Map options)Send request for outgoing file transfer.voidsendOutgoingRequest(IFileID targetReceiver, IFileTransferInfo localFileToSend, IFileTransferListener transferListener, Map options)Send request for outgoing file transfer.voidsetConnectContextForAuthentication(IConnectContext connectContext)Set connect context for authentication upon subsequentsendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map).voidsetProxy(Proxy proxy)Set proxy for use upon subsequentsendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map).
 
- 
- 
- 
Method Detail- 
sendOutgoingRequestvoid sendOutgoingRequest(IFileID targetReceiver, IFileTransferInfo localFileToSend, IFileTransferListener transferListener, Map options) throws SendFileTransferException Send request for outgoing file transfer. This method is used to initiate a file transfer to a targetReceiver (first parameter) of the localFileToSend (second parameter). File transfer events are asynchronously delivered to the file transferListener (third parameter)- Parameters:
- targetReceiver- the ID of the remote to receive the file transfer request. Must not be should not be- null.
- localFileToSend- the- IFileTransferInfofor the local file to send. Must not be should not be- null.
- transferListener- a- IFileTransferListenerfor responding to file transfer events. Must not be should not be- null.. If the target receiver responds then an- IOutgoingFileTransferResponseEventwill be delivered to the listener
- options- 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..
- Throws:
- SendFileTransferException- if the provider is not connected or is not in the correct state for initiating file transfer
 
 - 
sendOutgoingRequestvoid sendOutgoingRequest(IFileID targetReceiver, File localFileToSend, IFileTransferListener transferListener, Map options) throws SendFileTransferException Send request for outgoing file transfer. This method is used to initiate a file transfer to a targetReceiver (first parameter) of the localFileToSend (second parameter). File transfer events are asynchronously delivered to the file transferListener (third parameter)- Parameters:
- targetReceiver- the ID of the remote to receive the file transfer request. Must not be- null.
- localFileToSend- the- Filefor the local file to send. Must not be- null.
- transferListener- a- IFileTransferListenerfor responding to file transfer events. Must not be- null. If the target receiver responds then an IOutgoingFileTransfer will be delivered to the listener
- options- a Map of options associated with sendOutgoingRequest. The particular name/value pairs will be unique to the individual providers. May be- null.
- Throws:
- SendFileTransferException- if the provider is not connected or is not in the correct state for initiating file transfer
 
 - 
addListenervoid addListener(IIncomingFileTransferRequestListener listener) Add incoming file transfer listener. If the underlying provider supports receiving file transfer requests- Parameters:
- listener- to receive incoming file transfer request events. Must not be- null.
 
 - 
removeListenerboolean removeListener(IIncomingFileTransferRequestListener listener) Remove incoming file transfer listener- Parameters:
- listener- the listener to remove. Must not be- null.
- Returns:
- true if listener actually removed, false otherwise
 
 - 
getOutgoingNamespaceNamespace getOutgoingNamespace() Get namespace for outgoing file transfer.- Returns:
- Namespace for outgoing IFileID instances.  Will not return null.
 
 - 
setConnectContextForAuthenticationvoid setConnectContextForAuthentication(IConnectContext connectContext) Set connect context for authentication upon subsequentsendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map). This method should be called with a non-null connectContext in order to allow authentication to occur during call tosendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map).- Parameters:
- 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.
 
 - 
setProxyvoid setProxy(Proxy proxy) Set proxy for use upon subsequentsendOutgoingRequest(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 tosendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map).- Parameters:
- proxy- the proxy to use for subsequent calls to- sendOutgoingRequest(IFileID, IFileTransferInfo, IFileTransferListener, Map). If- null, then no proxy will be used.
 
 
- 
 
-