Package edu.isi.pegasus.planner.classes
Class PegasusFile
- java.lang.Object
-
- edu.isi.pegasus.planner.classes.Data
-
- edu.isi.pegasus.planner.classes.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 classPegasusFile.LINKAGEEnumeration for denoting type of linkage
-
Field Summary
Fields Modifier and Type Field Description static intCLEANUP_BIT_FLAGIf set, means can be considered for cleanupstatic intDATA_FILEThe type denoting that a logical file is a data file.static java.lang.StringDATA_TYPEThe string value of a file that is of type data.static intDO_NOT_REGISTER_BIT_FLAGThe index of the flags field which when set indicates that the file is not to be registered in the RLS/ RC.static intEXECUTABLE_FILEThe type denoting that a logical file is a executable file.static java.lang.StringEXECUTABLE_TYPEThe string value of a file that is of type executable.protected java.util.BitSetmFlagsThe transient flags field which is kept as a bit field.protected PegasusFile.LINKAGEmLinkLinkage of the file.protected java.lang.StringmLogicalFileThe logical name of the file.protected doublemSizeThe size of the file.protected intmTransferFlagThe transfer flag associated with the file containing tristate of transfer,dontTransfer and optional.protected intmTypeThe type associated with the file.static intNO_OF_TRANSIENT_FLAGSThe number of transient flags.static intOPTIONAL_BIT_FLAGThe index of the flags field which when set indicates that the file is to be considered optional.static intOTHER_FILEThe type denoting that a logical file is an other file.static java.lang.StringOTHER_TYPEThe string value of a file that is of type other.static intTRANSFER_MANDATORYThe mode where the transfer for this file to the pool is constructed and the transfer job fails if the transfer fails.static intTRANSFER_NOTThe mode where the transfer for this file is not constructed.static intTRANSFER_OPTIONALThe 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 booleancanBeCleanedup()Returns cleanup denoting whether the file can be cleaned up or notjava.lang.Objectclone()Returns a copy of the existing data object.booleanequals(java.lang.Object o)Checks if an object is similar to the one referred to by this class.booleanfileOptional()Returns optional flag denoting the file to be optional or not.java.util.BitSetgetFlags()Returns the bit fields that contain the transient flags (dR and optional).java.lang.StringgetLFN()It returns the lfn of the file that is associated with this transfer.PegasusFile.LINKAGEgetLinkage()Returns the linkage for the file during parsing.booleangetRegisterFlag()Returns the value of the register flagdoublegetSize()Returns the size for the file.intgetTransferFlag()Returns the tristate transfer mode that is associated with the file.booleangetTransientRegFlag()Returns the transient registration flag (the value of dontRegister).booleangetTransientTransferFlag()Returns whether the transfer is transient or not.intgetType()Returns the tristate transfer mode that is associated with the file.inthashCode()Calculate a hash code value for the object to support hash tables.booleanisExecutable()Returns a boolean indicating if a file that is being staged is an executable or not (i.e is a data file).voidsetFileOptional()Sets the optional flag denoting the file to be optional to true.voidsetForCleanup()Sets the cleanup flag denoting the file can be cleaned up to true.voidsetForCleanup(boolean value)Sets the cleanup flag to the value passedvoidsetLFN(java.lang.String lfn)It sets the logical filename of the file that is being transferred.voidsetLinkage(PegasusFile.LINKAGE link)Sets the linkage for the file during parsing.voidsetRegisterFlag(boolean value)Sets the transient registration flag to value specified.voidsetSize(double size)Sets the size for the file.voidsetSize(java.lang.String size)Sets the size for the file.voidsetTransferFlag(int transfer)Sets the transient transfer flag to value passed.voidsetTransferFlag(java.lang.String flag)Sets the transient transfer flag corresponding to the string value of transfer mode passed.voidsetTransferFlag(java.lang.String flag, boolean doubleNegative)Sets the transient transfer flag corresponding to the string value of transfer mode passed.voidsetTransientRegFlag()Deprecated.voidsetType(int type)Sets the type flag to value passed.voidsetType(java.lang.String type)Sets the transient transfer flag to value passed.java.lang.StringtoString()Returns the String version of the data object, which is in human readable form.booleantransferInRange(int transfer)Returns whether the transfer value for the mode is in range or not.java.lang.StringtypeToString()Returns the type associated with the logical file.booleantypeValid(int type)Returns whether the type of file value is valid or not.-
Methods inherited from class edu.isi.pegasus.planner.classes.Data
setToString, vectorToString
-
-
-
-
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.
-
mType
protected int mType
The type associated with the file. It can either be a data file or an executable file.- See Also:
DATA_FILE,EXECUTABLE_FILE,OTHER_FILE
-
mLink
protected PegasusFile.LINKAGE mLink
Linkage of the file. Only used for parsers
-
mTransferFlag
protected int mTransferFlag
The transfer flag associated with the file containing tristate of transfer,dontTransfer and optional.- See Also:
TRANSFER_MANDATORY,TRANSFER_OPTIONAL,TRANSFER_NOT
-
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.
-
-
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.IllegalArgumentExceptionSets 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.IllegalArgumentExceptionSets 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.IllegalArgumentExceptionSets 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.IllegalArgumentExceptionSets 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.IllegalArgumentExceptionSets 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
-
getTransferFlag
public int getTransferFlag()
Returns the tristate transfer mode that is associated with the file.- Returns:
- the int value denoting the tristate.
- See Also:
TRANSFER_MANDATORY,TRANSFER_NOT,TRANSFER_OPTIONAL
-
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.
-
getFlags
public java.util.BitSet getFlags()
Returns the bit fields that contain the transient flags (dR and optional).
-
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:
equalsin classjava.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:
hashCodein classjava.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:
clonein classjava.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.
-
-