Package org.cloudbus.cloudsim.resources
Class FileAttribute
java.lang.Object
org.cloudbus.cloudsim.resources.FileAttribute
public class FileAttribute extends Object
Stores related information regarding to a
File
entity.- Since:
- CloudSim Toolkit 1.0
- Author:
- Uros Cibej, Anthony Sulistio
-
Constructor Summary
Constructors Constructor Description FileAttribute(File file, int fileSize)
Creates a new FileAttribute object. -
Method Summary
Modifier and Type Method Description void
copyValue(FileAttribute destinationAttr)
Copy the values of the object into a given FileAttribute instance.int
getAttributeSize()
Gets the size of the object (in byte).int
getChecksum()
Gets the file checksum.double
getCost()
Gets the cost associated with the file.long
getCreationTime()
Gets the file creation time (in millisecond).int
getFileSize()
Gets the file size (in MBytes).int
getFileSizeInByte()
Gets the file size (in bytes).double
getLastUpdateTime()
Gets the last update time (in seconds).String
getOwnerName()
Gets the owner name of the file.long
getRegistrationID()
Gets the file registration ID.int
getType()
Gets the file type.boolean
isMasterCopy()
Checks whether the file is a master copy or replica.boolean
isRegistered()
Checks if the file is already registered to a Replica Catalogue.static boolean
isValid(String fileName)
Check if the name of a file is valid or not.boolean
setChecksum(int checksum)
Sets the checksum of the file.boolean
setCost(double cost)
Sets the cost associated with the file.boolean
setCreationTime(long creationTime)
Sets the file creation time (in millisecond).boolean
setFileSize(int fileSize)
Sets the file size (in MBytes).void
setMasterCopy(boolean masterCopy)
Marks the file as a master copy or replica.boolean
setOwnerName(String name)
Sets the owner name of the file.boolean
setRegistrationId(long id)
Sets the file registration ID (published by a Replica Catalogue entity).boolean
setType(int type)
Sets the file type (for instance raw, tag, etc).boolean
setUpdateTime(double time)
Sets the last update time of the file (in seconds).
-
Constructor Details
-
FileAttribute
Creates a new FileAttribute object.- Parameters:
file
- the file that this attribute object is related tofileSize
- the size for the File
-
-
Method Details
-
copyValue
Copy the values of the object into a given FileAttribute instance.- Parameters:
destinationAttr
- the destination FileAttribute object to copy the current object to
-
setCreationTime
public boolean setCreationTime(long creationTime)Sets the file creation time (in millisecond).- Parameters:
creationTime
- the file creation time (in millisecond)- Returns:
- true if successful, false otherwise
-
getCreationTime
public long getCreationTime()Gets the file creation time (in millisecond).- Returns:
- the file creation time (in millisecond)
-
setOwnerName
Sets the owner name of the file.- Parameters:
name
- the owner name- Returns:
- true if successful, false otherwise
-
getOwnerName
Gets the owner name of the file.- Returns:
- the owner name or null if empty
-
getAttributeSize
public int getAttributeSize()Gets the size of the object (in byte).
NOTE: This object size is NOT the actual file size. Moreover, this size is used for transferring this object over a network.- Returns:
- the object size (in byte)
-
setFileSize
public final boolean setFileSize(int fileSize)Sets the file size (in MBytes).- Parameters:
fileSize
- the file size (in MBytes)- Returns:
- true if successful, false otherwise
-
getFileSize
public int getFileSize()Gets the file size (in MBytes).- Returns:
- the file size (in MBytes)
-
getFileSizeInByte
public int getFileSizeInByte()Gets the file size (in bytes).- Returns:
- the file size (in bytes)
-
setUpdateTime
public boolean setUpdateTime(double time)Sets the last update time of the file (in seconds).
NOTE: This time is relative to the start time. Preferably useCloudSim.clock()
method.- Parameters:
time
- the last update time (in seconds)- Returns:
- true if successful, false otherwise
-
getLastUpdateTime
public double getLastUpdateTime()Gets the last update time (in seconds).- Returns:
- the last update time (in seconds)
-
setRegistrationId
public boolean setRegistrationId(long id)Sets the file registration ID (published by a Replica Catalogue entity).- Parameters:
id
- registration ID- Returns:
- true if successful, false otherwise
-
getRegistrationID
public long getRegistrationID()Gets the file registration ID.- Returns:
- registration ID
-
setType
public boolean setType(int type)Sets the file type (for instance raw, tag, etc).- Parameters:
type
- a file type- Returns:
- true if successful, false otherwise
-
getType
public int getType()Gets the file type.- Returns:
- file type
-
setChecksum
public boolean setChecksum(int checksum)Sets the checksum of the file.- Parameters:
checksum
- the checksum of this file- Returns:
- true if successful, false otherwise
-
getChecksum
public int getChecksum()Gets the file checksum.- Returns:
- file checksum
-
setCost
public boolean setCost(double cost)Sets the cost associated with the file.- Parameters:
cost
- cost of this file- Returns:
- true if successful, false otherwise
-
getCost
public double getCost()Gets the cost associated with the file.- Returns:
- the cost of this file
-
isRegistered
public boolean isRegistered()Checks if the file is already registered to a Replica Catalogue.- Returns:
- true if it is registered, false otherwise
-
setMasterCopy
public void setMasterCopy(boolean masterCopy)Marks the file as a master copy or replica.- Parameters:
masterCopy
- a flag denotes true for master copy or false for a replica
-
isMasterCopy
public boolean isMasterCopy()Checks whether the file is a master copy or replica.- Returns:
- true if it is a master copy or false if it is a replica
-
isValid
Check if the name of a file is valid or not.- Parameters:
fileName
- the file name to be checked for validity- Returns:
- true if the file name is valid, false otherwise
-