Class PegasusFile

  • All Implemented Interfaces:
    java.lang.Cloneable
    Direct Known Subclasses:
    FileTransfer

    public class PegasusFile
    extends Data
    The logical file object that contains the logical filename which is got from the DAX, and the associated set of flags specifying the transient characteristics. It ends up associating the following information with a lfn -type of the file (data or executable) -optionality of a file -transient attributes of a file (dontTransfer and dontRegister)
    Version:
    $Revision$
    Author:
    Gaurang Mehta, Karan Vahi
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  PegasusFile.LINKAGE
      Enumeration for denoting type of linkage
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CLEANUP_BIT_FLAG
      If set, means can be considered for cleanup
      static int DATA_FILE
      The type denoting that a logical file is a data file.
      static java.lang.String DATA_TYPE
      The string value of a file that is of type data.
      static int DO_NOT_REGISTER_BIT_FLAG
      The index of the flags field which when set indicates that the file is not to be registered in the RLS/ RC.
      static int EXECUTABLE_FILE
      The type denoting that a logical file is a executable file.
      static java.lang.String EXECUTABLE_TYPE
      The string value of a file that is of type executable.
      protected java.util.BitSet mFlags
      The transient flags field which is kept as a bit field.
      protected PegasusFile.LINKAGE mLink
      Linkage of the file.
      protected java.lang.String mLogicalFile
      The logical name of the file.
      protected double mSize
      The size of the file.
      protected int mTransferFlag
      The transfer flag associated with the file containing tristate of transfer,dontTransfer and optional.
      protected int mType
      The type associated with the file.
      static int NO_OF_TRANSIENT_FLAGS
      The number of transient flags.
      static int OPTIONAL_BIT_FLAG
      The index of the flags field which when set indicates that the file is to be considered optional.
      static int OTHER_FILE
      The type denoting that a logical file is an other file.
      static java.lang.String OTHER_TYPE
      The string value of a file that is of type other.
      static int TRANSFER_MANDATORY
      The mode where the transfer for this file to the pool is constructed and the transfer job fails if the transfer fails.
      static int TRANSFER_NOT
      The mode where the transfer for this file is not constructed.
      static int TRANSFER_OPTIONAL
      The mode where the transfer for this file to the pool is constructed, but the transfer job should not fail if the transfer fails.
    • Constructor Summary

      Constructors 
      Constructor Description
      PegasusFile()
      The default constructor.
      PegasusFile​(java.lang.String logName)
      The overloaded constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean canBeCleanedup()
      Returns cleanup denoting whether the file can be cleaned up or not
      java.lang.Object clone()
      Returns a copy of the existing data object.
      boolean equals​(java.lang.Object o)
      Checks if an object is similar to the one referred to by this class.
      boolean fileOptional()
      Returns optional flag denoting the file to be optional or not.
      java.util.BitSet getFlags()
      Returns the bit fields that contain the transient flags (dR and optional).
      java.lang.String getLFN()
      It returns the lfn of the file that is associated with this transfer.
      PegasusFile.LINKAGE getLinkage()
      Returns the linkage for the file during parsing.
      boolean getRegisterFlag()
      Returns the value of the register flag
      double getSize()
      Returns the size for the file.
      int getTransferFlag()
      Returns the tristate transfer mode that is associated with the file.
      boolean getTransientRegFlag()
      Returns the transient registration flag (the value of dontRegister).
      boolean getTransientTransferFlag()
      Returns whether the transfer is transient or not.
      int getType()
      Returns the tristate transfer mode that is associated with the file.
      int hashCode()
      Calculate a hash code value for the object to support hash tables.
      boolean isExecutable()
      Returns a boolean indicating if a file that is being staged is an executable or not (i.e is a data file).
      void setFileOptional()
      Sets the optional flag denoting the file to be optional to true.
      void setForCleanup()
      Sets the cleanup flag denoting the file can be cleaned up to true.
      void setForCleanup​(boolean value)
      Sets the cleanup flag to the value passed
      void setLFN​(java.lang.String lfn)
      It sets the logical filename of the file that is being transferred.
      void setLinkage​(PegasusFile.LINKAGE link)
      Sets the linkage for the file during parsing.
      void setRegisterFlag​(boolean value)
      Sets the transient registration flag to value specified.
      void setSize​(double size)
      Sets the size for the file.
      void setSize​(java.lang.String size)
      Sets the size for the file.
      void setTransferFlag​(int transfer)
      Sets the transient transfer flag to value passed.
      void setTransferFlag​(java.lang.String flag)
      Sets the transient transfer flag corresponding to the string value of transfer mode passed.
      void setTransferFlag​(java.lang.String flag, boolean doubleNegative)
      Sets the transient transfer flag corresponding to the string value of transfer mode passed.
      void setTransientRegFlag()
      Deprecated. 
      void setType​(int type)
      Sets the type flag to value passed.
      void setType​(java.lang.String type)
      Sets the transient transfer flag to value passed.
      java.lang.String toString()
      Returns the String version of the data object, which is in human readable form.
      boolean transferInRange​(int transfer)
      Returns whether the transfer value for the mode is in range or not.
      java.lang.String typeToString()
      Returns the type associated with the logical file.
      boolean typeValid​(int type)
      Returns whether the type of file value is valid or not.
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • OPTIONAL_BIT_FLAG

        public static final int OPTIONAL_BIT_FLAG
        The index of the flags field which when set indicates that the file is to be considered optional.
        See Also:
        Constant Field Values
      • DO_NOT_REGISTER_BIT_FLAG

        public static final int DO_NOT_REGISTER_BIT_FLAG
        The index of the flags field which when set indicates that the file is not to be registered in the RLS/ RC.
        See Also:
        Constant Field Values
      • CLEANUP_BIT_FLAG

        public static final int CLEANUP_BIT_FLAG
        If set, means can be considered for cleanup
        See Also:
        Constant Field Values
      • NO_OF_TRANSIENT_FLAGS

        public static final int NO_OF_TRANSIENT_FLAGS
        The number of transient flags. This is the length of the BitSet in the flags fields.
        See Also:
        Constant Field Values
      • TRANSFER_MANDATORY

        public static final int TRANSFER_MANDATORY
        The mode where the transfer for this file to the pool is constructed and the transfer job fails if the transfer fails. The corresponding dT (dontTransfer) value is false.
        See Also:
        Constant Field Values
      • TRANSFER_OPTIONAL

        public static final int TRANSFER_OPTIONAL
        The mode where the transfer for this file to the pool is constructed, but the transfer job should not fail if the transfer fails. The corresponding dT (dontTransfer) value is optional.
        See Also:
        Constant Field Values
      • TRANSFER_NOT

        public static final int TRANSFER_NOT
        The mode where the transfer for this file is not constructed. The corresponding dT (dontTransfer) value is true.
        See Also:
        Constant Field Values
      • DATA_TYPE

        public static final java.lang.String DATA_TYPE
        The string value of a file that is of type data.
        See Also:
        DATA_FILE, Constant Field Values
      • EXECUTABLE_TYPE

        public static final java.lang.String EXECUTABLE_TYPE
        The string value of a file that is of type executable.
        See Also:
        DATA_FILE, Constant Field Values
      • OTHER_TYPE

        public static final java.lang.String OTHER_TYPE
        The string value of a file that is of type other.
        See Also:
        OTHER_FILE, Constant Field Values
      • DATA_FILE

        public static final int DATA_FILE
        The type denoting that a logical file is a data file.
        See Also:
        Constant Field Values
      • EXECUTABLE_FILE

        public static final int EXECUTABLE_FILE
        The type denoting that a logical file is a executable file.
        See Also:
        Constant Field Values
      • OTHER_FILE

        public static final int OTHER_FILE
        The type denoting that a logical file is an other file.
        See Also:
        Constant Field Values
      • mLogicalFile

        protected java.lang.String mLogicalFile
        The logical name of the file.
      • mFlags

        protected java.util.BitSet mFlags
        The transient flags field which is kept as a bit field. It keeps track of the dontRegister and optional attributes associated with the filename in the dax.
      • mSize

        protected double mSize
        The size of the file.
    • Constructor Detail

      • PegasusFile

        public PegasusFile()
        The default constructor.
      • PegasusFile

        public PegasusFile​(java.lang.String logName)
        The overloaded constructor.
        Parameters:
        logName - the logical name of the file.
    • Method Detail

      • setLinkage

        public void setLinkage​(PegasusFile.LINKAGE link)
        Sets the linkage for the file during parsing.
        Parameters:
        link - linkage type
      • getLinkage

        public PegasusFile.LINKAGE getLinkage()
        Returns the linkage for the file during parsing.
        Returns:
        the linkage
      • getLFN

        public java.lang.String getLFN()
        It returns the lfn of the file that is associated with this transfer.
        Returns:
        the lfn associated with the transfer
      • setLFN

        public void setLFN​(java.lang.String lfn)
        It sets the logical filename of the file that is being transferred.
        Parameters:
        lfn - the logical name of the file that this transfer is associated with.
      • setSize

        public void setSize​(double size)
        Sets the size for the file.
        Parameters:
        size - the size of the file.
      • setSize

        public void setSize​(java.lang.String size)
        Sets the size for the file.
        Parameters:
        size - the size of the file.
      • getSize

        public double getSize()
        Returns the size for the file. Can be -1 if not set.
        Returns:
        size if set else -1.
      • typeValid

        public boolean typeValid​(int type)
        Returns whether the type of file value is valid or not.
        Parameters:
        type - the value for the type of file.
        Returns:
        true if the value is in range. false if the value is not in range.
      • transferInRange

        public boolean transferInRange​(int transfer)
        Returns whether the transfer value for the mode is in range or not.
        Parameters:
        transfer - the value for the transfer.
        Returns:
        true if the value is in range. false if the value is not in range.
      • setType

        public void setType​(int type)
                     throws java.lang.IllegalArgumentException
        Sets the type flag to value passed.
        Parameters:
        type - valid transfer value.
        Throws:
        java.lang.IllegalArgumentException - if the transfer mode is outside its legal range.
        See Also:
        DATA_FILE, EXECUTABLE_FILE
      • setType

        public void setType​(java.lang.String type)
                     throws java.lang.IllegalArgumentException
        Sets the transient transfer flag to value passed.
        Parameters:
        type - valid transfer value.
        Throws:
        java.lang.IllegalArgumentException - if the transfer mode is outside its legal range.
        See Also:
        DATA_FILE, EXECUTABLE_FILE
      • setTransferFlag

        public void setTransferFlag​(int transfer)
                             throws java.lang.IllegalArgumentException
        Sets the transient transfer flag to value passed.
        Parameters:
        transfer - valid transfer value.
        Throws:
        java.lang.IllegalArgumentException - if the transfer mode is outside its legal range.
        See Also:
        TRANSFER_MANDATORY, TRANSFER_NOT, TRANSFER_OPTIONAL
      • setTransferFlag

        public void setTransferFlag​(java.lang.String flag)
                             throws java.lang.IllegalArgumentException
        Sets the transient transfer flag corresponding to the string value of transfer mode passed. The legal range of transfer values is true|false|optional.
        Parameters:
        flag - tri-state transfer value as got from dontTransfer flag.
        Throws:
        java.lang.IllegalArgumentException - if the transfer mode is outside its legal range.
        See Also:
        TRANSFER_MANDATORY, TRANSFER_NOT, TRANSFER_OPTIONAL
      • setTransferFlag

        public void setTransferFlag​(java.lang.String flag,
                                    boolean doubleNegative)
                             throws java.lang.IllegalArgumentException
        Sets the transient transfer flag corresponding to the string value of transfer mode passed. The legal range of transfer values is true|false|optional.
        Parameters:
        flag - tri-state transfer value as got from dontTransfer flag.
        doubleNegative - indicates whether a double negative or not.
        Throws:
        java.lang.IllegalArgumentException - if the transfer mode is outside its legal range.
        See Also:
        TRANSFER_MANDATORY, TRANSFER_NOT, TRANSFER_OPTIONAL
      • getTransientTransferFlag

        public boolean getTransientTransferFlag()
        Returns whether the transfer is transient or not. By transient we mean no transfer.
        Returns:
        true if transfer mode is TRANSFER_NOT false if transfer mandatory or optional.
      • setTransientRegFlag

        public void setTransientRegFlag()
        Deprecated.
        Sets the transient registration flag to true.
        See Also:
        setRegisterFlag( boolean )
      • setRegisterFlag

        public void setRegisterFlag​(boolean value)
        Sets the transient registration flag to value specified.
        Parameters:
        value - the value to set to
      • setFileOptional

        public void setFileOptional()
        Sets the optional flag denoting the file to be optional to true.
      • fileOptional

        public boolean fileOptional()
        Returns optional flag denoting the file to be optional or not.
        Returns:
        true denoting the file is optional. false denoting that file is not optional.
      • setForCleanup

        public void setForCleanup()
        Sets the cleanup flag denoting the file can be cleaned up to true.
      • setForCleanup

        public void setForCleanup​(boolean value)
        Sets the cleanup flag to the value passed
        Parameters:
        value - the boolean value to which the flag should be set to.
      • canBeCleanedup

        public boolean canBeCleanedup()
        Returns cleanup denoting whether the file can be cleaned up or not
        Returns:
        true denoting the file can be cleaned up.
      • getType

        public int getType()
        Returns the tristate transfer mode that is associated with the file.
        Returns:
        the int value denoting the type.
        See Also:
        DATA_FILE, EXECUTABLE_FILE, OTHER_FILE
      • getRegisterFlag

        public boolean getRegisterFlag()
        Returns the value of the register flag
        Returns:
        true denoting the file needs be registered into the replica catalog. false denoting that file does not need to be registered.
      • getTransientRegFlag

        public boolean getTransientRegFlag()
        Returns the transient registration flag (the value of dontRegister).
        Returns:
        true denoting the file need not be registered into the replica catalog. false denoting that file needs to be registered.
      • equals

        public boolean equals​(java.lang.Object o)
        Checks if an object is similar to the one referred to by this class. We compare the primary key to determine if it is the same or not.
        Overrides:
        equals in class java.lang.Object
        Returns:
        true if the primary key (lfn) matches. else false.
      • hashCode

        public int hashCode()
        Calculate a hash code value for the object to support hash tables.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code value for the object.
      • isExecutable

        public boolean isExecutable()
        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.
      • clone

        public java.lang.Object clone()
        Returns a copy of the existing data object.
        Overrides:
        clone in class java.lang.Object
        Returns:
        clone of the object.
      • typeToString

        public java.lang.String typeToString()
        Returns the type associated with the logical file.
        Returns:
        type of the file.
      • toString

        public java.lang.String toString()
        Returns the String version of the data object, which is in human readable form.
        Specified by:
        toString in class Data
        Returns:
        the dump of the data object into a string.