edu.isi.pegasus.planner.classes
Class FileTransfer

java.lang.Object
  extended by edu.isi.pegasus.planner.classes.Data
      extended by edu.isi.pegasus.planner.classes.PegasusFile
          extended by edu.isi.pegasus.planner.classes.FileTransfer
All Implemented Interfaces:
Cloneable

public class FileTransfer
extends PegasusFile

This is a container for the storing the transfers that are required in between sites. It refers to one lfn, but can contains more than one source and destination urls. All the source url's are presumed to be identical. The destination urls, can in effect be used to refer to TFN's for a lfn on different pools.

Version:
$Revision: 4258 $
Author:
Karan Vahi, Gaurang Mehta

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.isi.pegasus.planner.classes.PegasusFile
PegasusFile.LINKAGE
 
Field Summary
private  Map mDestMap
          The map containing all the destination urls keyed by the pool id/name.
private  String mJob
          The logical name of the asssociated VDS super node, with which the file is associated.
private  Map mSourceMap
          The map containing all the source urls keyed by the pool id/name.
 
Fields inherited from class edu.isi.pegasus.planner.classes.PegasusFile
DATA_FILE, DATA_TYPE, EXECUTABLE_FILE, EXECUTABLE_TYPE, mFlags, mLink, mLogicalFile, mSize, mTransferFlag, mType, NO_OF_TRANSIENT_FLAGS, OTHER_FILE, OTHER_TYPE, TRANSFER_MANDATORY, TRANSFER_NOT, TRANSFER_OPTIONAL, TRANSIENT_OPTIONAL_FLAG, TRANSIENT_REGISTRATION_FLAG
 
Fields inherited from class edu.isi.pegasus.planner.classes.Data
mLogger, mLogMsg
 
Constructor Summary
FileTransfer()
          Default constructor.
FileTransfer(PegasusFile pf)
          The overloaded constructor.
FileTransfer(String lfn, String job)
          The overloaded constructor.
FileTransfer(String lfn, String job, BitSet flags)
          The overloaded constructor.
 
Method Summary
 void addDestination(NameValue nv)
          Adds a destination URL for the transfer.
 void addDestination(String pool, String url)
          Adds a destination URL for the transfer.
 void addSource(NameValue nv)
          Adds a source URL for the transfer.
 void addSource(String pool, String url)
          Adds a source URL for the transfer.
 Object clone()
          Returns a clone of the object.
private  String constructURL(String site, String directory, String filename)
          Constructs a URL with the prefix as the poolname enclosed in #.
 NameValue getDestURL()
          Returns a single destination url associated with the transfer.
 NameValue getDestURL(boolean random)
          Returns a single destination url associated with the transfer.
 String getJobName()
          It returns the name of the main/compute job making up the VDS supernode with which this transfer is related.
 NameValue getSourceURL()
          Returns a single source url associated with the transfer.
 NameValue getSourceURL(boolean random)
          Returns a single source url associated with the transfer.
private  NameValue getURL(Map m, boolean random)
          Returns a single url from the map passed.
 boolean isTransferringExecutableFile()
          Returns a boolean indicating if a file that is being staged is an executable or not (i.e is a data file).
 boolean isValid()
          Determines whether the transfer contained in this container is valid or not.
 NameValue removeDestURL()
          Removes a single destination url associated with the transfer.
 NameValue removeSourceURL()
          Removes a single source url associated with the transfer.
private  NameValue removeURL(Map m)
          Removes a single url from the map passed.
 String toString()
          Returns a textual interpretation of the object.
 
Methods inherited from class edu.isi.pegasus.planner.classes.PegasusFile
equals, fileOptional, getFlags, getLFN, getLinkage, getRegisterFlag, getSize, getTransferFlag, getTransientRegFlag, getTransientTransferFlag, getType, hashCode, setFileOptional, setLFN, setLinkage, setRegisterFlag, setSize, setSize, setTransferFlag, setTransferFlag, setTransferFlag, setTransientRegFlag, setType, setType, transferInRange, typeToString, typeValid
 
Methods inherited from class edu.isi.pegasus.planner.classes.Data
setToString, vectorToString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

mJob

private String mJob
The logical name of the asssociated VDS super node, with which the file is associated. The name of the job can be of the job that generates that file(while doing interpool or transferring output files to output pool) or of a job for which the file is an input(getting an input file from the Replica Services).


mSourceMap

private Map mSourceMap
The map containing all the source urls keyed by the pool id/name. Corresponding to each pool, a list of url's is stored that contain the URL's for that pool. All url's not associated with a pool, are associated with a undefined pool.


mDestMap

private Map mDestMap
The map containing all the destination urls keyed by the pool id/name. Corresponding to each pool, a list of url's is stored that contain the URL's for that pool. All url's not associated with a pool, are associated with a undefined pool.

Constructor Detail

FileTransfer

public FileTransfer()
Default constructor.


FileTransfer

public FileTransfer(PegasusFile pf)
The overloaded constructor.

Parameters:
pf - PegasusFile object containing the transiency attributes, and the logical name of the file.

FileTransfer

public FileTransfer(String lfn,
                    String job)
The overloaded constructor.

Parameters:
lfn - The logical name of the file that has to be transferred.
job - The name of the job with which the transfer is associated with.

FileTransfer

public FileTransfer(String lfn,
                    String job,
                    BitSet flags)
The overloaded constructor.

Parameters:
lfn - The logical name of the file that has to be transferred.
job - The name of the job with which the transfer is associated with.
flags - the BitSet flags.
Method Detail

getJobName

public String getJobName()
It returns the name of the main/compute job making up the VDS supernode with which this transfer is related.

Returns:
the name of associated job

addSource

public void addSource(NameValue nv)
Adds a source URL for the transfer.

Parameters:
nv - the NameValue object containing the name of the site as the key and URL as the value.

addSource

public void addSource(String pool,
                      String url)
Adds a source URL for the transfer.

Parameters:
pool - the pool from which the source file is being transferred.
url - the source url.

addDestination

public void addDestination(NameValue nv)
Adds a destination URL for the transfer.

Parameters:
nv - the NameValue object containing the name of the site as the key and URL as the value.

addDestination

public void addDestination(String pool,
                           String url)
Adds a destination URL for the transfer.

Parameters:
pool - the pool to which the destination file is being transferred.
url - the destination url.

getSourceURL

public NameValue getSourceURL()
Returns a single source url associated with the transfer. The source url returned is first entry from the key set of the underlying map.

Returns:
NameValue where the name would be the pool on which the URL is and value the URL. null if no urls are assoiciated with the object.

getSourceURL

public NameValue getSourceURL(boolean random)
Returns a single source url associated with the transfer. If random is set to false, thensource url returned is first entry from the key set of the underlying map.

Parameters:
random - boolean indicating if a random entry needs to be picked.
Returns:
NameValue where the name would be the pool on which the URL is and value the URL. null if no urls are assoiciated with the object.

getDestURL

public NameValue getDestURL()
Returns a single destination url associated with the transfer. The destination url returned is first entry from the key set of the underlying map.

Returns:
NameValue where the name would be the pool on which the URL is and value the URL. null if no urls are assoiciated with the object.

getDestURL

public NameValue getDestURL(boolean random)
Returns a single destination url associated with the transfer. If random is set to false, then dest url returned is first entry from the key set of the underlying map.

Parameters:
random - boolean indicating if a random entry needs to be picked.
Returns:
NameValue where the name would be the pool on which the URL is and value the URL. null if no urls are assoiciated with the object.

removeSourceURL

public NameValue removeSourceURL()
Removes a single source url associated with the transfer. The source url removed is first entry from the key set of the underlying map.

Returns:
NameValue where the name would be the pool on which the URL is and value the URL. null if no urls are assoiciated with the object.

removeDestURL

public NameValue removeDestURL()
Removes a single destination url associated with the transfer. The destination url removed is first entry from the key set of the underlying map.

Returns:
NameValue where the name would be the pool on which the URL is and value the URL. null if no urls are assoiciated with the object.

isTransferringExecutableFile

public boolean isTransferringExecutableFile()
Returns a boolean indicating if a file that is being staged is an executable or not (i.e is a data file).

Returns:
boolean indicating whether a file is executable or not.

getURL

private NameValue getURL(Map m,
                         boolean random)
Returns a single url from the map passed. If the random parameter is set, then a random url is returned from the values for the first site. Fix Me: Random set to true, shud also lead to randomness on the sites.

Parameters:
m - the map containing the url's
random - boolean indicating that a random url to be picked up.
Returns:
NameValue where the name would be the pool on which the URL is and value the URL. null if no urls are assoiciated with the object.

removeURL

private NameValue removeURL(Map m)
Removes a single url from the map passed.

Parameters:
m - the map containing the url's
Returns:
NameValue where the name would be the pool on which the URL is and value the URL. null if no urls are assoiciated with the object.

constructURL

private String constructURL(String site,
                            String directory,
                            String filename)
Constructs a URL with the prefix as the poolname enclosed in #.

Parameters:
site - the site
directory - the directory
filename - the filename
Returns:
String

clone

public Object clone()
Returns a clone of the object.

Overrides:
clone in class PegasusFile
Returns:
clone of the object.

isValid

public boolean isValid()
Determines whether the transfer contained in this container is valid or not. It is deemed valid if there is at least one source url and one destination url.

Returns:
true if valid, else false.

toString

public String toString()
Returns a textual interpretation of the object. The method outputs in a T2 compatible format. Each FileTransfer object can refer to one section in the T2 format.

Overrides:
toString in class PegasusFile
Returns:
the textual description.


Copyright © 2011 The University of Southern California. All Rights Reserved.