Class UrlConnectionRetrieveFileTransfer
java.lang.Object
org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer
org.eclipse.ecf.provider.filetransfer.retrieve.UrlConnectionRetrieveFileTransfer
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable
,IIdentifiable
,IFileTransfer
,IFileTransferPausable
,IIncomingFileTransfer
,IRetrieveFileTransferContainerAdapter
,IRetrieveFileTransfer
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected String
protected int
protected String
protected URLConnection
protected String
Fields inherited from class org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer
buff_length, bytesReceived, CLOSE_TIMEOUT, closeOutputStream, connectContext, DEFAULT_BUF_LENGTH, done, downloadRateBytesPerSecond, exception, fileLength, job, jobLock, lastModifiedTime, listener, localFileContents, options, paused, POLLING_RETRY_ATTEMPTS, proxy, rangeSpecification, READ_TIMEOUT, remoteFileContents, remoteFileID, remoteFileURL, responseHeaders, TIMEOUT_INPUTSTREAM_BUFFER_SIZE, transferStartTime
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
connect()
protected boolean
doPause()
Subclass overridable version ofAbstractRetrieveFileTransfer.pause()
.protected boolean
doResume()
Subclass overridable version ofAbstractRetrieveFileTransfer.resume()
.<T> T
getAdapter
(Class<T> adapter) protected String
Obtains the name of the remote file if possible.int
protected void
protected void
protected void
protected boolean
protected void
Open incoming and outgoing streams associated with this file transfer.void
setConnectContextForAuthentication
(IConnectContext connectContext) Set connect context for authentication upon subsequentIRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map)
.protected void
protected void
protected void
protected void
setupProxy
(Proxy proxy2) Setup ECF proxy.Methods inherited from class org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer
cancel, createJobName, createRangeName, fireReceiveResumedEvent, fireReceiveStartEvent, fireTransferReceiveDataEvent, fireTransferReceiveDoneEvent, fireTransferReceivePausedEvent, getBytesReceived, getException, getFileLength, getFileRangeSpecification, getFinalStatus, getID, getListener, getOptions, getPercentComplete, getRemoteFileURL, getRemoteLastModified, getRetrieveNamespace, getSocketCloseTimeout, getSocketReadTimeout, handleReceivedData, isCanceled, isDone, isPaused, newUserCancelledException, pause, resetDoneAndException, resume, selectProxyFromProxies, sendRetrieveRequest, sendRetrieveRequest, setCloseOutputStream, setDone, setDoneCanceled, setDoneCanceled, setDoneException, setFileLength, setInputStream, setLastModifiedTime, setOutputStream, setProxy, setupAndScheduleJob, setupProxies, targetHasGzSuffix, toHumanReadableBytes, wrapTransferReadInputStream
-
Field Details
-
urlConnection
-
httpVersion
protected int httpVersion -
responseCode
protected int responseCode -
responseMessage
-
username
-
password
-
-
Constructor Details
-
UrlConnectionRetrieveFileTransfer
public UrlConnectionRetrieveFileTransfer()
-
-
Method Details
-
getRemoteFileName
Description copied from interface:IIncomingFileTransfer
Obtains the name of the remote file if possible. The name will typically but not necessarily be the same as the leaf part of the path to the remote file.- Specified by:
getRemoteFileName
in interfaceIIncomingFileTransfer
- Overrides:
getRemoteFileName
in classAbstractRetrieveFileTransfer
- Returns:
- The name of the remote file or
null
if no such name can be determined.
-
connect
- Throws:
IOException
-
isConnected
protected boolean isConnected() -
setResumeRequestHeaderValues
- Throws:
IOException
-
setRequestHeaderValues
-
getResponseCode
public int getResponseCode() -
getResponseHeaderValues
- Throws:
IOException
-
getResumeResponseHeaderValues
- Throws:
IOException
-
setupProxy
Description copied from class:AbstractRetrieveFileTransfer
Setup ECF proxy. Subclasses must override this method to do appropriate proxy setup. This method will be called from withinAbstractRetrieveFileTransfer.sendRetrieveRequest(IFileID, IFileTransferListener, Map)
andAbstractRetrieveFileTransfer.sendRetrieveRequest(IFileID, IFileRangeSpecification, IFileTransferListener, Map)
, prior to the actual call toAbstractRetrieveFileTransfer.openStreams()
.- Specified by:
setupProxy
in classAbstractRetrieveFileTransfer
- Parameters:
proxy2
- the ECF proxy to setup
-
setupAuthentication
-
setConnectContextForAuthentication
Description copied from interface:IRetrieveFileTransferContainerAdapter
Set connect context for authentication upon subsequentIRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map)
. This method should be called with a non-null connectContext in order to allow authentication to occur during call toIRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map)
.- Specified by:
setConnectContextForAuthentication
in interfaceIRetrieveFileTransferContainerAdapter
- Overrides:
setConnectContextForAuthentication
in classAbstractRetrieveFileTransfer
- Parameters:
connectContext
- the connect context to use for authenticating during subsequent call toIRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map)
. Ifnull
, then no authentication will be attempted.
-
openStreams
Description copied from class:AbstractRetrieveFileTransfer
Open incoming and outgoing streams associated with this file transfer. Subclasses must implement this method to open input and output streams. TheremoteFileContents
andlocalFileContent
must be non-null
after successful completion of the implementation of this method.- Specified by:
openStreams
in classAbstractRetrieveFileTransfer
- Throws:
IncomingFileTransferException
- if some problem
-
hardClose
protected void hardClose()- Overrides:
hardClose
in classAbstractRetrieveFileTransfer
-
doPause
protected boolean doPause()Description copied from class:AbstractRetrieveFileTransfer
Subclass overridable version ofAbstractRetrieveFileTransfer.pause()
. Subclasses must provide an implementation of this method to supportIFileTransferPausable
.- Specified by:
doPause
in classAbstractRetrieveFileTransfer
- Returns:
- true if the pause is successful.
false
otherwise.
-
doResume
protected boolean doResume()Description copied from class:AbstractRetrieveFileTransfer
Subclass overridable version ofAbstractRetrieveFileTransfer.resume()
. Subclasses must provide an implementation of this method to supportIFileTransferPausable
.- Specified by:
doResume
in classAbstractRetrieveFileTransfer
- Returns:
- true if the resume is successful.
false
otherwise.
-
getAdapter
- Specified by:
getAdapter
in interfaceorg.eclipse.core.runtime.IAdaptable
- Overrides:
getAdapter
in classAbstractRetrieveFileTransfer
-
getConnectTimeout
-