FileAttribute

public class FileAttribute

Stores related information regarding to a org.cloudbus.cloudsim.resources.File entity.

Author:Uros Cibej, Anthony Sulistio

Constructors

FileAttribute

public FileAttribute(File file, int fileSize)

Creates a new FileAttribute object.

Parameters:
  • file – the file that this attribute object is related to
  • fileSize – the size for the File

Methods

copyValue

public void copyValue(FileAttribute destinationAttr)

Copy the values of the object into a given FileAttribute instance.

Parameters:
  • destinationAttr – the destination FileAttribute object to copy the current object to

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)

getChecksum

public int getChecksum()

Gets the file checksum.

Returns:file checksum

getCost

public double getCost()

Gets the cost associated with the file.

Returns:the cost of this file

getCreationTime

public long getCreationTime()

Gets the file creation time (in millisecond).

Returns:the file creation time (in millisecond)

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)

getLastUpdateTime

public double getLastUpdateTime()

Gets the last update time (in seconds).

Returns:the last update time (in seconds)

getOwnerName

public String getOwnerName()

Gets the owner name of the file.

Returns:the owner name or null if empty

getRegistrationID

public long getRegistrationID()

Gets the file registration ID.

Returns:registration ID

getType

public int getType()

Gets the file type.

Returns:file type

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

isRegistered

public boolean isRegistered()

Checks if the file is already registered to a Replica Catalogue.

Returns:true if it is registered, false otherwise

isValid

public static boolean isValid(String fileName)

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

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

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

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

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

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

setOwnerName

public boolean setOwnerName(String name)

Sets the owner name of the file.

Parameters:
  • name – the owner name
Returns:

true if successful, false otherwise

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

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

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 use org.cloudbus.cloudsim.core.CloudSim.clock() method.

Parameters:
  • time – the last update time (in seconds)
Returns:

true if successful, false otherwise