GridSim 5.0 beta

gridsim.datagrid
Class DataGridUser

Object
  extended by Thread
      extended by Sim_entity
          extended by GridSimCore
              extended by GridSim
                  extended by GridUser
                      extended by DataGridUser
All Implemented Interfaces:
Cloneable, Runnable

public class DataGridUser
extends GridUser

A class for representing a user in a Data Grid environment

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
 
Fields inherited from class GridUser
gisID_
 
Fields inherited from class GridSim
GRIDSIM_VERSION_STRING, PAUSE
 
Fields inherited from class GridSimCore
input, NETWORK_TYPE, output
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DataGridUser(String name, Link link)
          Creates a new DataGrid user.
NOTE: When using this constructor, do not forget to set the regional GIS name and the Replica Catalogue name for this entity.
DataGridUser(String name, Link link, String regionalGIS)
          Creates a new DataGrid user.
NOTE: When using this constructor, do not forget to set the Replica Catalogue name for this entity.
DataGridUser(String name, Link link, String rcName, String regionalGIS)
          Creates a new DataGrid user
 
Method Summary
 boolean addMaster(File file, int resID)
          Adds a master file to a designated resource
 boolean deleteFile(String filename, int resID)
          Deletes a given file stored in a resource
 boolean deleteMaster(String filename, int resID)
          Deletes a master file stored in a resource
 ArrayList getAttributeList(Filter filter)
          Gets a list of file attributes from a given filter
 File getFile(String lfn, int resID)
          Gets a file from a specific resource
 FileAttribute getFileAttribute(String lfn)
          Gets an attribute file for a given logical file name (lfn)
 String getFullFilename(String filename)
          Gets a full name of the given file.
 Object[] getGlobalRCList()
          Gets a list of global Replica Catalogue (RC) IDs.
 Object[] getLocalRCList()
          Gets a list of local Replica Catalogue (RC) IDs from a regional GIS entity
 int getReplicaCatalogueID()
          Gets a Replica Catalogue id
 String getReplicaCatalogueName()
          Gets a Replica Catalogue name
 int getReplicaLocation(String lfn)
          Gets the first resource ID that has the given logical file name (lfn).
 List getReplicaLocationList(String lfn)
          Gets a list of resource IDs that store the given logical file name (lfn).
 List getReplicaLocationList(String lfn, int rcID)
          Gets a list of resource IDs that store the given logical file name (lfn).
 boolean replicateFile(File master, int resID)
          Makes a replica of the given master file to another resource
 boolean setReplicaCatalogue(AbstractRC rc)
          Sets a Replica Catalogue name for this user (the old name will be overwritten).
 boolean setReplicaCatalogue(String rcName)
          Sets a Replica Catalogue name for this user (the old name will be overwritten).
 
Methods inherited from class GridUser
finishSimulation, finishSimulation, getGlobalResourceARList, getGlobalResourceList, getList, getList, getLocalResourceARList, getLocalResourceList, getRegionalGISId, getRegionalGISList, getRegionalGISName, setRegionalGIS, setRegionalGIS
 
Methods inherited from class GridSim
clock, disableDebugMode, enableDebugMode, getAdvancedReservationList, getEntityId, getEntityName, getEntityName, getEntityName, getGISId, getGridInfoServiceEntityId, getGridResourceList, getGridSimShutdownEntityId, getGridStatisticsEntityId, getNetworkType, getNumFreePE, getNumFreePE, getNumPE, getNumPE, getResourceCharacteristics, getResourceDynamicInfo, getSimulationCalendar, getSimulationStartDate, getVisualizer, gridletCancel, gridletCancel, gridletMove, gridletMove, gridletPause, gridletPause, gridletReceive, gridletReceive, gridletReceive, gridletResume, gridletResume, gridletStatus, gridletStatus, gridletSubmit, gridletSubmit, gridletSubmit, gridSimHold, init, init, init, initNetworkType, isDebugModeEnabled, isResourceExist, isResourceExist, isTraceEnabled, pauseSimulation, pauseSimulation, receiveEventObject, receiveEventObject, recordStatistics, recordStatistics, recordStatistics, recordStatistics, resourceSupportAR, resourceSupportAR, resumeSimulation, setGIS, shutdownGridStatisticsEntity, shutdownUserEntity, startGridSimulation, startGridSimulation, stopGridSimulation
 
Methods inherited from class GridSimCore
finalizeGridSimulation, getLink, getPingResult, isNetworked, ping, ping, ping, ping, pingBlockingCall, pingBlockingCall, pingBlockingCall, pingBlockingCall, send, send, send, send, send, send, setBackgroundTraffic, setBackgroundTraffic, terminateIOEntities
 
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
 

Constructor Detail

DataGridUser

public DataGridUser(String name,
                    Link link)
             throws Exception
Creates a new DataGrid user.
NOTE: When using this constructor, do not forget to set the regional GIS name and the Replica Catalogue name for this entity.

Parameters:
name - the user name
link - a network link to connect this user to a network
Throws:
Exception - happens if one of the inputs is empty or null
See Also:
GridUser.setRegionalGIS(String), GridUser.setRegionalGIS(AbstractGIS), setReplicaCatalogue(String), setReplicaCatalogue(AbstractRC)

DataGridUser

public DataGridUser(String name,
                    Link link,
                    String regionalGIS)
             throws Exception
Creates a new DataGrid user.
NOTE: When using this constructor, do not forget to set the Replica Catalogue name for this entity.

Parameters:
name - the user name
link - a network link to connect this user to a network
regionalGIS - a Regional GIS name
Throws:
Exception - happens if one of the inputs is empty or null
See Also:
setReplicaCatalogue(String), setReplicaCatalogue(AbstractRC)

DataGridUser

public DataGridUser(String name,
                    Link link,
                    String rcName,
                    String regionalGIS)
             throws Exception
Creates a new DataGrid user

Parameters:
name - the user name
link - a network link to connect this user to a network
rcName - a Replica Catalogue name
regionalGIS - a Regional GIS name
Throws:
Exception - happens if one of the inputs is empty or null
Method Detail

setReplicaCatalogue

public boolean setReplicaCatalogue(String rcName)
Sets a Replica Catalogue name for this user (the old name will be overwritten).

Parameters:
rcName - a Replica Catalogue name
Returns:
true if successful, false otherwise

setReplicaCatalogue

public boolean setReplicaCatalogue(AbstractRC rc)
Sets a Replica Catalogue name for this user (the old name will be overwritten).

Parameters:
rc - a Replica Catalogue object
Returns:
true if successful, false otherwise

getReplicaCatalogueName

public String getReplicaCatalogueName()
Gets a Replica Catalogue name

Returns:
a Replica Catalogue name or null if it does not exist

getReplicaCatalogueID

public int getReplicaCatalogueID()
Gets a Replica Catalogue id

Returns:
a Replica Catalogue id or -1 if it does not exist

getLocalRCList

public Object[] getLocalRCList()
Gets a list of local Replica Catalogue (RC) IDs from a regional GIS entity

Returns:
a list of local RC IDs in Integer object or null if RCs do not exist.

getGlobalRCList

public Object[] getGlobalRCList()
Gets a list of global Replica Catalogue (RC) IDs. Global RC means a RC that is registered to other regional GIS entities.

Returns:
a list of global RC IDs in Integer object or null if RCs do not exist.

getReplicaLocation

public int getReplicaLocation(String lfn)
Gets the first resource ID that has the given logical file name (lfn).
NOTE: The rest of resource IDs are ignored. If you want to know all the resource IDs, then use getReplicaLocationList(String) method instead. In addition, this method only contacts the given/chosen RC entity, not all RCs.

Parameters:
lfn - a logical file name
Returns:
a resource ID or -1 if not found

getReplicaLocationList

public List getReplicaLocationList(String lfn)
Gets a list of resource IDs that store the given logical file name (lfn).
NOTE: This method only contacts the given/chosen RC entity, not all RCs.

Parameters:
lfn - a logical file name
Returns:
a list of resource IDs or null if not found

getReplicaLocationList

public List getReplicaLocationList(String lfn,
                                   int rcID)
Gets a list of resource IDs that store the given logical file name (lfn).
NOTE: This method only contacts the given/chosen RC entity, not all RCs.

Parameters:
lfn - a logical file name
rcID - a RC entity ID
Returns:
a list of resource IDs or null if not found

getFileAttribute

public FileAttribute getFileAttribute(String lfn)
Gets an attribute file for a given logical file name (lfn)

Parameters:
lfn - a logical file name
Returns:
a FileAttribute object or null if not found

addMaster

public boolean addMaster(File file,
                         int resID)
Adds a master file to a designated resource

Parameters:
file - a master file
resID - a resource ID
Returns:
true if successful, false otherwise

replicateFile

public boolean replicateFile(File master,
                             int resID)
Makes a replica of the given master file to another resource

Parameters:
master - a master file
resID - a resource ID that will be storing the replica file
Returns:
true if successful, false otherwise

deleteFile

public boolean deleteFile(String filename,
                          int resID)
Deletes a given file stored in a resource

Parameters:
filename - a file name
resID - a resource ID stores the file
Returns:
true if successful, false otherwise

deleteMaster

public boolean deleteMaster(String filename,
                            int resID)
Deletes a master file stored in a resource

Parameters:
filename - a file name
resID - a resource ID stores the file
Returns:
true if successful, false otherwise

getAttributeList

public ArrayList getAttributeList(Filter filter)
Gets a list of file attributes from a given filter

Parameters:
filter - a filtering function
Returns:
a list of results or null if not found

getFile

public File getFile(String lfn,
                    int resID)
Gets a file from a specific resource

Parameters:
lfn - a logical file name
resID - a resource ID that contains the file
Returns:
a File object or null if not found

getFullFilename

public String getFullFilename(String filename)
Gets a full name of the given file. When a user requests an operation with a filename, it usually means a common name. But in the grid this file is known as "common name+uniqueID", e.g. test4 (common name is "test" and uniqueID is "4"). This function returns the name upon which the file is known in the grid.

Parameters:
filename - a file name
Returns:
the full filename of the file (i.e. filename+uniqueID) or null if empty

GridSim 5.0 beta

The University of Melbourne, Australia, 2009