GridSim 5.0 beta

gridsim.datagrid
Class ReplicaManager

Object
  extended by Thread
      extended by Sim_entity
          extended by ReplicaManager
All Implemented Interfaces:
Cloneable, Runnable
Direct Known Subclasses:
SimpleReplicaManager

public abstract class ReplicaManager
extends Sim_entity

This is an abstract class which describes the basic functionality of a Replica Manager in a Data Grid. This class is responsible for all data manipulation on a DataGridResource.

Since:
GridSim Toolkit 4.0
Author:
Uros Cibej and Anthony Sulistio

Nested Class Summary
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  Sim_port outputPort_
          The output port of the DataGridResource
protected  AllocPolicy policy_
          The policy of the DataGridResource
protected  int rcID_
          ID of the Replica Catalogue entity
protected  Integer resIdObj_
          ID of the DataGridResource entity (in Integer object)
protected  int resourceID_
          ID of the DataGridResource entity
protected  List storageList_
          List of all storage elements
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected ReplicaManager(String name, String resourceName)
          Creates a new Replica Manager object
 
Method Summary
protected abstract  int addFile(File file)
          Adds a file to the local storage.
abstract  boolean addStorage(List storageList)
          Adds a list of storage elements to the DataGrid resource
abstract  boolean addStorage(Storage storage)
          Adds a storage element to the DataGrid resource
protected  boolean contains(File file)
          Checks whether the resource has the given file
protected  boolean contains(String fileName)
          Checks whether the resource has the given file
protected abstract  int deleteFile(String fileName)
          Deletes a file from the local storage, and registers the change to the designated Replica Catalogue.
protected  int deregisterDeletedFile(String fileName, int tag)
          Notifies a deleted file to the designated Replica Catalogue (RC)
protected abstract  File getFile(String fileName)
          Gets a physical file based on its name
 double getTotalStorageCapacity()
          Gets the total storage capacity (in MByte) for this DataGrid resource
 boolean init(Sim_port output, AllocPolicy policy, int resourceID)
          Initializes the Replica Manager details.
 void processEndSimulation()
          Notifies internal entities regarding to the end of simulation signal.
abstract  boolean processEvent(Sim_event ev)
          Processes an incoming event
abstract  void registerAllMasterFiles()
          Registers all master files that are currently stored in the storage at the beginning of the simulatin
protected  boolean registerFile(File file)
          Registers a given file to the designated Replica Catalogue
protected  boolean registerFile(String fileName)
          Registers a given file to the designated Replica Catalogue
 boolean setReplicaCatalogue(int rcID)
          Sets the ID of the ReplicaCatalogue, to which all the requests for adding and deleting files will be sent.
 boolean setReplicaCatalogue(String rcName)
          Sets the ReplicaCatalogue for this DataGridResource
 
Methods inherited from class Sim_entity
add_generator, add_param, add_port, body, clone, get_id, get_name, get_port, get_port, get_stat, run, send_on, set_invisible, set_stat, sim_cancel, sim_completed, sim_current, sim_get_next, sim_get_next, sim_hold_for, sim_hold, sim_pause_for, sim_pause_for, sim_pause_until, sim_pause_until, sim_pause, sim_process_for, sim_process_for, sim_process_until, sim_process_until, sim_process, sim_putback, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_select, sim_trace, sim_wait_for, sim_wait_for, sim_wait_for, sim_wait, sim_waiting, sim_waiting
 
Methods inherited from class Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

policy_

protected AllocPolicy policy_
The policy of the DataGridResource


outputPort_

protected Sim_port outputPort_
The output port of the DataGridResource


resourceID_

protected int resourceID_
ID of the DataGridResource entity


resIdObj_

protected Integer resIdObj_
ID of the DataGridResource entity (in Integer object)


rcID_

protected int rcID_
ID of the Replica Catalogue entity


storageList_

protected List storageList_
List of all storage elements

Constructor Detail

ReplicaManager

protected ReplicaManager(String name,
                         String resourceName)
                  throws ParameterException
Creates a new Replica Manager object

Parameters:
name - the name to be associated with this entity
resourceName - the name of the DataGrid resource
Throws:
ParameterException - This happens when one of the following scenarios occur:
  • creating this entity before initializing GridSim package
  • the given name is null or empty
See Also:
GridSim.init(int, Calendar, boolean, String[], String[], String)
Method Detail

processEndSimulation

public void processEndSimulation()
Notifies internal entities regarding to the end of simulation signal. This method should be overridden by the child class.


init

public boolean init(Sim_port output,
                    AllocPolicy policy,
                    int resourceID)
Initializes the Replica Manager details. This method is called by a DataGrid resource entity.

Parameters:
output - the output port of a resource which is used to sent events to other entities
policy - the resource scheduling policy for executing incoming Gridlets
resourceID - the resource ID on which the ResourceManager is located
Returns:
true if successful, false otherwise
See Also:
DataGridResource

setReplicaCatalogue

public boolean setReplicaCatalogue(String rcName)
Sets the ReplicaCatalogue for this DataGridResource

Parameters:
rcName - the name of the ReplicaCatalogue
Returns:
true if successful, false otherwise

setReplicaCatalogue

public boolean setReplicaCatalogue(int rcID)
Sets the ID of the ReplicaCatalogue, to which all the requests for adding and deleting files will be sent.

Parameters:
rcID - the ReplicaCtalogue ID
Returns:
true if successful, false otherwise

registerFile

protected boolean registerFile(File file)
Registers a given file to the designated Replica Catalogue

Parameters:
file - a file to be registered
Returns:
true if successful, false otherwise

registerFile

protected boolean registerFile(String fileName)
Registers a given file to the designated Replica Catalogue

Parameters:
fileName - a file name to be registered
Returns:
true if successful, false otherwise

deregisterDeletedFile

protected int deregisterDeletedFile(String fileName,
                                    int tag)
Notifies a deleted file to the designated Replica Catalogue (RC)

Parameters:
fileName - a file name to be de-registered in RC
tag - a tag to denote the specific instruction to the RC
Returns:
an integer number denoting whether this operation is successful or not
See Also:
DataGridTags.CTLG_DELETE_REPLICA, DataGridTags.CTLG_DELETE_MASTER, DataGridTags.FILE_DELETE_ERROR, DataGridTags.FILE_DELETE_SUCCESSFUL

contains

protected boolean contains(File file)
Checks whether the resource has the given file

Parameters:
file - a file to be searched
Returns:
true if successful, false otherwise

contains

protected boolean contains(String fileName)
Checks whether the resource has the given file

Parameters:
fileName - a file name to be searched
Returns:
true if successful, false otherwise

getTotalStorageCapacity

public double getTotalStorageCapacity()
Gets the total storage capacity (in MByte) for this DataGrid resource

Returns:
total storage capacity (in MB)

addStorage

public abstract boolean addStorage(Storage storage)
Adds a storage element to the DataGrid resource

Parameters:
storage - the storage element to be added
Returns:
true if successful, false otherwise

addStorage

public abstract boolean addStorage(List storageList)
Adds a list of storage elements to the DataGrid resource

Parameters:
storageList - a list of storage elements to be added
Returns:
true if successful, false otherwise

addFile

protected abstract int addFile(File file)
Adds a file to the local storage. However, the file is not registered to the Replica Catalogue.

Parameters:
file - a file to be placed on the local resource
Returns:
an integer number denoting whether this operation is successful or not
See Also:
DataGridTags.FILE_ADD_SUCCESSFUL, DataGridTags.FILE_ADD_ERROR_STORAGE_FULL

getFile

protected abstract File getFile(String fileName)
Gets a physical file based on its name

Parameters:
fileName - the file name to be retrieved
Returns:
the physical file or null if not found

deleteFile

protected abstract int deleteFile(String fileName)
Deletes a file from the local storage, and registers the change to the designated Replica Catalogue.

Parameters:
fileName - the filename of the file to be deleted.
Returns:
an integer number denoting whether this operation is successful or not
See Also:
DataGridTags.FILE_DELETE_SUCCESSFUL, DataGridTags.FILE_DELETE_ERROR_READ_ONLY

processEvent

public abstract boolean processEvent(Sim_event ev)
Processes an incoming event

Returns:
true if successful, false otherwise

registerAllMasterFiles

public abstract void registerAllMasterFiles()
Registers all master files that are currently stored in the storage at the beginning of the simulatin


GridSim 5.0 beta

The University of Melbourne, Australia, 2009