GNDMS 0.6.0
RESTful verison of GNDMS
Static Public Member Functions | Static Protected Attributes | Static Package Functions | Static Private Attributes

de.zib.gndms.taskflows.filetransfer.server.network.NetworkAuxiliariesProvider Class Reference

List of all members.

Static Public Member Functions

static GridFTPClientFactory getGridFTPClientFactory ()
static BandWidthEstimater getBandWidthEstimater ()
static GNDMSFileTransfer newGNDMSFileTransfer ()
static long calculateTransferTime (long size, float bandWidth, int min)
 Calculated the transfer-time in milli-seconds.
static Integer getBufferSize ()
static void setBufferSize (Integer bufferSize)

Static Protected Attributes

static Logger logger = LoggerFactory.getLogger( NetworkAuxiliariesProvider.class )

Static Package Functions

 [static initializer]

Static Private Attributes

static final Class
< NonblockingClientFactory
gridFTPClientFactoryClass = NonblockingClientFactory.class
static final GridFTPClientFactory gridFTPClientFactory
static final BandWidthEstimater bandWidthEstimater = new StaticBandWidthEstimater()
static Integer bufferSize = null

Detailed Description

Author:
try ma ik jo rr a zib
Version:
$Id$

User: mjorra, Date: 01.10.2008, Time: 10:51:58

Usage of the network package for a file transfer:

Use the GridFTPClientFactory provided by this class to create an GridFTPClient. Given that this class is correctly set up and returns the desired factory, the GridFTPClient, should be configured to your needs, e.g. with the correct security setup.

Then create a GNDMSFileTransfer, and add a map with the files which should be transferred, the source and destination directory and client to the instance.

If it is of interest how big the download is, you can uses the GNDMSFileTransfer.estimateSize method to acquire the size of the files in byte. Together with a descent implementation of the BandWidthEstimater interface this can be used to predict the duration of a transfer, using the calculateTransferTime method of this class.

To make your transfer reliable you should instantiate the persistentMarkerListener, supply it with a fresh instance of a FTPTransferState, which must have a unique transferId. Then use the performPersistentFileTransfer method of your GNDMSFileTransfer instance to trigger the transfer.

An aborted transfer can be easily resumed, by setting the same GNDMSFileTransfer up again, Loading the transfer state object from the database, setting it into a new persistentMarkerListener and calling performPersistenFileTransfer with this listener again.

See TransferStatTest.testIt for an code example of the described procedure.


Member Function Documentation

static long de.zib.gndms.taskflows.filetransfer.server.network.NetworkAuxiliariesProvider.calculateTransferTime ( long  size,
float  bandWidth,
int  min 
) [static]

Calculated the transfer-time in milli-seconds.

To catch possible rounding errors, which may occur when the transfer size is to small and the connection is very fast. A minimal value for the transfer time can be provided (see the min parameter).

Parameters:
sizeThe transfer file size in byte.
bandWidthThe bandwidth in byte/s
minThe minimum time which is returned if the calculated time is smaller. If min is < 1 it will be ignored.
Returns:
The transfer-time in ms.
                                                                                   {

        long tt = Float.valueOf( size * 1000 / bandWidth ).longValue( );

        if ( min > 0 && tt < min )
            tt = min;

        return tt;
    }

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables