org.eclipse.ecf.provider.filetransfer.retrieve
Class UrlConnectionRetrieveFileTransfer

java.lang.Object
  extended by org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer
      extended by org.eclipse.ecf.provider.filetransfer.retrieve.UrlConnectionRetrieveFileTransfer
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IIdentifiable, IFileTransfer, IFileTransferPausable, IIncomingFileTransfer, IRetrieveFileTransferContainerAdapter, IRetrieveFileTransfer

public class UrlConnectionRetrieveFileTransfer
extends AbstractRetrieveFileTransfer


Field Summary
protected  int httpVersion
           
protected  java.lang.String password
           
protected  int responseCode
           
protected  java.lang.String responseMessage
           
protected  java.net.URLConnection urlConnection
           
protected  java.lang.String username
           
 
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
UrlConnectionRetrieveFileTransfer()
           
 
Method Summary
protected  void connect()
           
protected  boolean doPause()
          Subclass overridable version of AbstractRetrieveFileTransfer.pause().
protected  boolean doResume()
          Subclass overridable version of AbstractRetrieveFileTransfer.resume().
 java.lang.Object getAdapter(java.lang.Class adapter)
           
protected  java.lang.String getConnectTimeout()
           
 java.lang.String getRemoteFileName()
          Obtains the name of the remote file if possible.
 int getResponseCode()
           
protected  void getResponseHeaderValues()
           
protected  void getResumeResponseHeaderValues()
           
protected  void hardClose()
           
protected  boolean isConnected()
           
protected  void openStreams()
          Open incoming and outgoing streams associated with this file transfer.
 void setConnectContextForAuthentication(IConnectContext connectContext)
          Set connect context for authentication upon subsequent IRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map).
protected  void setRequestHeaderValues()
           
protected  void setResumeRequestHeaderValues()
           
protected  void setupAuthentication()
           
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

urlConnection

protected java.net.URLConnection urlConnection

httpVersion

protected int httpVersion

responseCode

protected int responseCode

responseMessage

protected java.lang.String responseMessage

username

protected java.lang.String username

password

protected java.lang.String password
Constructor Detail

UrlConnectionRetrieveFileTransfer

public UrlConnectionRetrieveFileTransfer()
Method Detail

getRemoteFileName

public java.lang.String 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 interface IIncomingFileTransfer
Overrides:
getRemoteFileName in class AbstractRetrieveFileTransfer
Returns:
The name of the remote file or null if no such name can be determined.

connect

protected void connect()
                throws java.io.IOException
Throws:
java.io.IOException

isConnected

protected boolean isConnected()

setResumeRequestHeaderValues

protected void setResumeRequestHeaderValues()
                                     throws java.io.IOException
Throws:
java.io.IOException

setRequestHeaderValues

protected void setRequestHeaderValues()
                               throws InvalidFileRangeSpecificationException
Throws:
InvalidFileRangeSpecificationException

getResponseCode

public int getResponseCode()

getResponseHeaderValues

protected void getResponseHeaderValues()
                                throws java.io.IOException
Throws:
java.io.IOException

getResumeResponseHeaderValues

protected void getResumeResponseHeaderValues()
                                      throws java.io.IOException
Throws:
java.io.IOException

setupProxy

protected void setupProxy(Proxy proxy2)
Description copied from class: AbstractRetrieveFileTransfer
Setup ECF proxy. Subclasses must override this method to do appropriate proxy setup. This method will be called from within AbstractRetrieveFileTransfer.sendRetrieveRequest(IFileID, IFileTransferListener, Map) and AbstractRetrieveFileTransfer.sendRetrieveRequest(IFileID, IFileRangeSpecification, IFileTransferListener, Map) , prior to the actual call to AbstractRetrieveFileTransfer.openStreams().

Specified by:
setupProxy in class AbstractRetrieveFileTransfer
Parameters:
proxy2 - the ECF proxy to setup

setupAuthentication

protected void setupAuthentication()
                            throws java.io.IOException,
                                   UnsupportedCallbackException
Throws:
java.io.IOException
UnsupportedCallbackException

setConnectContextForAuthentication

public void setConnectContextForAuthentication(IConnectContext connectContext)
Description copied from interface: IRetrieveFileTransferContainerAdapter
Set connect context for authentication upon subsequent IRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map). This method should be called with a non-null connectContext in order to allow authentication to occur during call to IRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map).

Specified by:
setConnectContextForAuthentication in interface IRetrieveFileTransferContainerAdapter
Overrides:
setConnectContextForAuthentication in class AbstractRetrieveFileTransfer
Parameters:
connectContext - the connect context to use for authenticating during subsequent call to IRetrieveFileTransferContainerAdapter.sendRetrieveRequest(IFileID, IFileTransferListener, Map). If null, then no authentication will be attempted.

openStreams

protected void openStreams()
                    throws IncomingFileTransferException
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. The remoteFileContents and localFileContent must be non-null after successful completion of the implementation of this method.

Specified by:
openStreams in class AbstractRetrieveFileTransfer
Throws:
IncomingFileTransferException

hardClose

protected void hardClose()
Overrides:
hardClose in class AbstractRetrieveFileTransfer

doPause

protected boolean doPause()
Description copied from class: AbstractRetrieveFileTransfer
Subclass overridable version of AbstractRetrieveFileTransfer.pause(). Subclasses must provide an implementation of this method to support IFileTransferPausable .

Specified by:
doPause in class AbstractRetrieveFileTransfer
Returns:
true if the pause is successful. false otherwise.

doResume

protected boolean doResume()
Description copied from class: AbstractRetrieveFileTransfer
Subclass overridable version of AbstractRetrieveFileTransfer.resume(). Subclasses must provide an implementation of this method to support IFileTransferPausable.

Specified by:
doResume in class AbstractRetrieveFileTransfer
Returns:
true if the resume is successful. false otherwise.

getAdapter

public java.lang.Object getAdapter(java.lang.Class adapter)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
Overrides:
getAdapter in class AbstractRetrieveFileTransfer

getConnectTimeout

protected java.lang.String getConnectTimeout()