Class FileTransfer

  • All Implemented Interfaces:
    java.lang.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$
    Author:
    Karan Vahi, Gaurang Mehta
    • Field Detail

      • mJob

        private java.lang.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 java.util.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 java.util.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.
      • mURLForRegistrationOnDestination

        private java.lang.String mURLForRegistrationOnDestination
        The registration URL for the file
      • mPriority

        private int mPriority
        A priority associated with the FileTransfer
    • 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​(java.lang.String lfn,
                            java.lang.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​(java.lang.String lfn,
                            java.lang.String job,
                            java.util.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 java.lang.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​(java.lang.String pool,
                              java.lang.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​(java.lang.String pool,
                                   java.lang.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.
      • setURLForRegistrationOnDestination

        public void setURLForRegistrationOnDestination​(java.lang.String url)
        Sets the registration url for the destination.
        Parameters:
        url - the url
      • getURLForRegistrationOnDestination

        public java.lang.String getURLForRegistrationOnDestination()
        Sets the registration url for the destination.
        Returns:
        the destination url
      • setPriority

        public void setPriority​(int priority)
        Sets the priority for the File Transfer
        Parameters:
        priority - the priority associated with the FileTransfer
      • getPriority

        public int getPriority()
        Sets the priority for the File Transfer
        Parameters:
        priority - the priority associated with the FileTransfer
      • 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​(java.util.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​(java.util.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.
      • clone

        public java.lang.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 java.lang.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.