de.fzj.unicore.uas.client
Class FileTransferClient

java.lang.Object
  extended by de.fzj.unicore.wsrflite.xmlbeans.client.BaseWSRFClient
      extended by de.fzj.unicore.uas.client.BaseUASClient
          extended by de.fzj.unicore.uas.client.FileTransferClient
Direct Known Subclasses:
ByteIOBaseClient, HttpFileTransferClient

public abstract class FileTransferClient
extends BaseUASClient

Base client class for managing file transfers Concrete subclasses may add methods specific to the actual file transfer protocol

Author:
schuller

Nested Class Summary
static interface FileTransferClient.IChunked
          file transfers that use chunks can implement this interface to allow setting the chunksize
static interface FileTransferClient.IMonitorable
          file transfers can implement this interface to allow progress monitoring
 
Field Summary
protected  boolean append
          Some protocol implementations require knowledge about how to deal with existing remote files.
 
Fields inherited from class de.fzj.unicore.wsrflite.xmlbeans.client.BaseWSRFClient
epr, proxyMaker, retryDecider, securityProperties, url
 
Constructor Summary
FileTransferClient(org.w3.x2005.x08.addressing.EndpointReferenceType epr)
           
FileTransferClient(org.w3.x2005.x08.addressing.EndpointReferenceType epr, IUASSecurityProperties sec)
           
FileTransferClient(java.lang.String url, org.w3.x2005.x08.addressing.EndpointReferenceType epr)
           
FileTransferClient(java.lang.String url, org.w3.x2005.x08.addressing.EndpointReferenceType epr, IUASSecurityProperties sec)
          Main constructor.
 
Method Summary
 org.w3.x2005.x08.addressing.EndpointReferenceType getParentStorage()
          get the address of the Storage resource on which the current file resides
 org.unigrids.services.atomic.types.ProtocolType.Enum getProtocol()
          get the protocol used by this transfer
 org.unigrids.x2006.x04.services.fts.FileTransferPropertiesDocument getResourcePropertiesDocument()
          get the resource properties document of this file transfer
abstract  long getSize()
          get the size of the remote (source) file
 java.lang.String getSource()
          get the source URI of this transfer
 java.lang.String getStatus()
          get the (human-readable) status of this transfer
 org.unigrids.x2006.x04.services.fts.SummaryType.Enum getStatusSummary()
          get the file transfer status
 java.lang.String getTarget()
          get the target URI of this transfer
 long getTransferredBytes()
          get the number of bytes that have been already transferred
abstract  void readAllData(java.io.OutputStream os)
          convenience method that reads all data from the remote location and writes it to an output stream
 void setAppend(boolean append)
          set the "append" flag that is used when importing data to a remote location.
abstract  void writeAllData(java.io.InputStream source)
          Writes all data from source to the remote location
In case the remote file exists, it is overwritten.
 
Methods inherited from class de.fzj.unicore.uas.client.BaseUASClient
extractReceiver, getSecurityProperties, getServerVersion, setRetryDefaults
 
Methods inherited from class de.fzj.unicore.wsrflite.xmlbeans.client.BaseWSRFClient
checkConnection, checkConnection, destroy, getConnectionStatus, getCurrentTime, getEPR, getLT, getMultipleResourceProperties, getResourceProperty, getResourcePropertyDocument, GetResourcePropertyDocument, getRP, getTerminationTime, getUpdateInterval, getUrl, makeProxy, queryResourceProperties, setConnectionTimeout, setConnectionTimeout, setRetryHandler, setTerminationTime, setUpdateInterval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

append

protected boolean append
Some protocol implementations require knowledge about how to deal with existing remote files. When importing data to a remote location, this flag controls whether data is appended to an existing file, or whether the remote file is overwritten. If true data is appended. The default value is false.

Constructor Detail

FileTransferClient

public FileTransferClient(java.lang.String url,
                          org.w3.x2005.x08.addressing.EndpointReferenceType epr,
                          IUASSecurityProperties sec)
                   throws java.lang.Exception
Main constructor. NOTE: concrete subclasses MUST implement at least this constructor, as it is called from the StorageClient using reflection

Parameters:
url - - the url of the target file transfer service
epr - - the EPR of the target file transfer service
sec - - security settings
append - - (used for imports) whether the transfer will overwrite the remote file
Throws:
java.lang.Exception

FileTransferClient

public FileTransferClient(org.w3.x2005.x08.addressing.EndpointReferenceType epr,
                          IUASSecurityProperties sec)
                   throws java.lang.Exception
Throws:
java.lang.Exception

FileTransferClient

public FileTransferClient(java.lang.String url,
                          org.w3.x2005.x08.addressing.EndpointReferenceType epr)
                   throws java.lang.Exception
Parameters:
url -
epr -
Throws:
java.lang.Exception

FileTransferClient

public FileTransferClient(org.w3.x2005.x08.addressing.EndpointReferenceType epr)
                   throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

readAllData

public abstract void readAllData(java.io.OutputStream os)
                          throws java.lang.Exception
convenience method that reads all data from the remote location and writes it to an output stream

Parameters:
os - - a local OutputStream to write the data to
Throws:
java.lang.Exception

writeAllData

public abstract void writeAllData(java.io.InputStream source)
                           throws java.lang.Exception
Writes all data from source to the remote location
In case the remote file exists, it is overwritten.

Parameters:
source - - an InputStream supplying local data
Throws:
java.lang.Exception

getTransferredBytes

public long getTransferredBytes()
get the number of bytes that have been already transferred

Returns:
the number of transferred bytes or -1 if not available

getParentStorage

public org.w3.x2005.x08.addressing.EndpointReferenceType getParentStorage()
                                                                   throws java.lang.Exception
get the address of the Storage resource on which the current file resides

Returns:
an EndpointReferenceType to the parent storage
Throws:
java.lang.Exception

getProtocol

public org.unigrids.services.atomic.types.ProtocolType.Enum getProtocol()
                                                                 throws java.lang.Exception
get the protocol used by this transfer

Returns:
the protocol as ProtocolType.Enum
Throws:
java.lang.Exception

getSource

public java.lang.String getSource()
                           throws java.lang.Exception
get the source URI of this transfer

Returns:
Throws:
java.lang.Exception

getTarget

public java.lang.String getTarget()
                           throws java.lang.Exception
get the target URI of this transfer

Returns:
Throws:
java.lang.Exception

getStatus

public java.lang.String getStatus()
                           throws java.lang.Exception
get the (human-readable) status of this transfer

Throws:
java.lang.Exception

getStatusSummary

public org.unigrids.x2006.x04.services.fts.SummaryType.Enum getStatusSummary()
                                                                      throws java.lang.Exception
get the file transfer status

Throws:
java.lang.Exception

getSize

public abstract long getSize()
get the size of the remote (source) file

Returns:
the size of the source file or -1 if not available or an error occurs)

getResourcePropertiesDocument

public org.unigrids.x2006.x04.services.fts.FileTransferPropertiesDocument getResourcePropertiesDocument()
                                                                                                 throws java.lang.Exception
get the resource properties document of this file transfer

Returns:
Throws:
java.lang.Exception

setAppend

public void setAppend(boolean append)
set the "append" flag that is used when importing data to a remote location. If true, data is appended to the remote file, if it exists. By default, remote files are overwritten.

Parameters:
append - - set to to true to append data


Copyright © 2006-2010 Research Center Juelich. All Rights Reserved.