org.griphyn.cPlanner.classes
Class PegasusFile

java.lang.Object
  extended by org.griphyn.cPlanner.classes.Data
      extended by org.griphyn.cPlanner.classes.PegasusFile
All Implemented Interfaces:
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: 373 $
Author:
Gaurang Mehta, Karan Vahi

Field Summary
static int DATA_FILE
          The type denoting that a logical file is a data file.
static String DATA_TYPE
          The string value of a file that is of type data.
static int EXECUTABLE_FILE
          The type denoting that a logical file is a executable file.
static String EXECUTABLE_TYPE
          The string value of a file that is of type executable.
protected  BitSet mFlags
          The transient flags field which is kept as a bit field.
protected  String mLogicalFile
          The logical name 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 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.
static int TRANSIENT_OPTIONAL_FLAG
          The index of the flags field which when set indicates that the file is to be considered optional.
static int TRANSIENT_REGISTRATION_FLAG
          The index of the flags field which when set indicates that the file is not to be registered in the RLS/ RC.
 
Fields inherited from class org.griphyn.cPlanner.classes.Data
mLogger, mLogMsg
 
Constructor Summary
PegasusFile()
          The default constructor.
PegasusFile(String logName)
          The overloaded constructor.
 
Method Summary
 Object clone()
          Returns a copy of the existing data object.
 boolean equals(Object o)
          Checks if an object is similar to the one referred to by this class.
 boolean fileOptional()
          Returns optionalflag denoting the file to be optional or not.
 BitSet getFlags()
          Returns the bit fields that contain the transient flags (dR and optional).
 String getLFN()
          It returns the lfn of the file that is associated with this transfer.
 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.
 void setFileOptional()
          Sets the optionalflag denoting the file to be optional to true.
 void setLFN(String lfn)
          It sets the logical filename of the file that is being transferred.
 void setTransferFlag(int transfer)
          Sets the transient transfer flag to value passed.
 void setTransferFlag(String flag, boolean doubleNegative)
          Sets the transient transfer flag corresponding to the string value of transfer mode passed.
 void setTransientRegFlag()
          Sets the transient registration flag to true.
 void setType(int type)
          Sets the type flag to value passed.
 void setType(String type)
          Sets the transient transfer flag to value passed.
 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.
 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 org.griphyn.cPlanner.classes.Data
setToString, vectorToString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TRANSIENT_OPTIONAL_FLAG

public static final int TRANSIENT_OPTIONAL_FLAG
The index of the flags field which when set indicates that the file is to be considered optional.

See Also:
Constant Field Values

TRANSIENT_REGISTRATION_FLAG

public static final int TRANSIENT_REGISTRATION_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

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 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 String EXECUTABLE_TYPE
The string value of a file that is of type executable.

See Also:
DATA_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

mLogicalFile

protected 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

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 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.

Constructor Detail

PegasusFile

public PegasusFile()
The default constructor.


PegasusFile

public PegasusFile(String logName)
The overloaded constructor.

Parameters:
logName - the logical name of the file.
Method Detail

getLFN

public 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(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.

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 IllegalArgumentException
Sets the type flag to value passed.

Parameters:
type - valid transfer value.
Throws:
IllegalArgumentException - if the transfer mode is outside its legal range.
See Also:
DATA_FILE, EXECUTABLE_FILE

setType

public void setType(String type)
             throws IllegalArgumentException
Sets the transient transfer flag to value passed.

Parameters:
type - valid transfer value.
Throws:
IllegalArgumentException - if the transfer mode is outside its legal range.
See Also:
DATA_FILE, EXECUTABLE_FILE

setTransferFlag

public void setTransferFlag(int transfer)
                     throws IllegalArgumentException
Sets the transient transfer flag to value passed.

Parameters:
transfer - valid transfer value.
Throws:
IllegalArgumentException - if the transfer mode is outside its legal range.
See Also:
TRANSFER_MANDATORY, TRANSFER_NOT, TRANSFER_OPTIONAL

setTransferFlag

public void setTransferFlag(String flag,
                            boolean doubleNegative)
                     throws 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:
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()
Sets the transient registration flag to true.


setFileOptional

public void setFileOptional()
Sets the optionalflag denoting the file to be optional to true.


fileOptional

public boolean fileOptional()
Returns optionalflag denoting the file to be optional or not.

Returns:
true denoting the file is optional. false denoting that file is not optional.

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

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

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 BitSet getFlags()
Returns the bit fields that contain the transient flags (dR and optional).

See Also:
NO_OF_TRANSIENT_FLAGS, TRANSIENT_OPTIONAL_FLAG, TRANSIENT_REGISTRATION_FLAG

equals

public boolean equals(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 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 Object
Returns:
a hash code value for the object.

clone

public Object clone()
Returns a copy of the existing data object.

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

typeToString

public String typeToString()
Returns the type associated with the logical file.

Returns:
type of the file.

toString

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


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