GridSim 5.0 beta

gridsim
Class AdvanceReservation

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

public class AdvanceReservation
extends GridSim

This class handles all Advanced Reservation (AR) functionalities, such as create, modify, cancel and query. There are two types of reservation:

The AR methods in this class automatically handle the communication to/from a destinated grid resource entity. To use AR functionalities, you need to create a subclass of this object, i.e. creating a new class that inherits this object. This approach is preferable because the subclass is responsible for collecting Gridlets back from a resource entity.

Important properties regarding to this entity are time and time zone. Time in this entity, GridResource entities and simulation clock are all relative to a given init time. In other words, future time should be greater than init time given during GridSim.init(int, Calendar, boolean) method.

Imagine the following scenarios:

Time can be represented as Calendar object or long in milli seconds.

User and GridResource entities might have different time zone. Therefore, when communicating between these two entities, upon arrival, the time will be converted by an individual entity into its local time.

Since:
GridSim Toolkit 3.0
Author:
Anthony Sulistio
See Also:
GridSim.init(int, Calendar, boolean, String[], String[], String), GridSim.init(int, Calendar, boolean)
Invariant:
$none

Nested Class Summary
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static int HOUR
          1 Hour representation in milliseconds, i.e.
 
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
AdvanceReservation(String name, double baudRate)
          Allocates a new AdvanceReservation object.
AdvanceReservation(String name, double baudRate, double timeZone)
          Allocates a new AdvanceReservation object with a given time zone
AdvanceReservation(String name, Link link)
          Allocates a new AdvanceReservation object.
AdvanceReservation(String name, Link link, double timeZone)
          Allocates a new AdvanceReservation object with a given time zone
 
Method Summary
 int cancelReservation(String bookingID)
          Cancels a given reservation.
 int cancelReservation(String bookingID, ArrayList list)
          Cancels a list of Gridlets for a given reservation.
 int cancelReservation(String bookingID, Gridlet gl)
          Cancels a Gridlet for a given reservation.
 int cancelReservation(String bookingID, int gridletID)
          Cancels a Gridlet for a given reservation.
 int commitReservation(String bookingID)
          Commits a reservation only without sending any Gridlet objects.
 int commitReservation(String bookingID, Gridlet obj)
          Commits a reservation together with a Gridlet object.
 int commitReservation(String bookingID, GridletList list)
          Commits a reservation together with a list of Gridlet objects.
static long convertTimeZone(long time, double fromZone, double toZone)
          Converts local time from one time zone to another
 String createReservation(Calendar startTime, Calendar endTime, int numPE, int resID)
          Creates a new reservation and sends the request to a resource.
 String createReservation(Calendar startTime, Calendar endTime, int numPE, String resName)
          Creates a new reservation and sends the request to a resource.
 String createReservation(Calendar startTime, int duration, int numPE, int resID)
          Creates a new reservation and sends the request to a resource.
 String createReservation(Calendar startTime, int duration, int numPE, String resName)
          Creates a new reservation and sends the request to a resource.
 String createReservation(long startTime, int duration, int numPE, int resID)
          Creates a new reservation and sends the request to a resource.
 String createReservation(long startTime, int duration, int numPE, String resName)
          Creates a new reservation and sends the request to a resource.
 String createReservation(long startTime, long endTime, int numPE, int resID)
          Creates a new reservation and sends the request to a resource.
 String createReservation(long startTime, long endTime, int numPE, String resName)
          Creates a new reservation and sends the request to a resource.
static String getCancelResult(int result)
          Converts a reservation result from integer into a String.
static String getCommitResult(int result)
          Converts a reservation result from integer into a String.
static String getCreateResult(int result)
          Converts a reservation result from integer into a String.
 long getExpiryTime(String bookingID)
          Gets an expiry time of a reservation
static String getModifyResult(int result)
          Converts a reservation result from integer into a String.
static String getQueryResult(int result)
          Converts a reservation result from integer into a String.
 ARObject getReservation(String bookingID)
          Gets a reservation object based on the given booking ID
 int modifyReservation(String bookingID, ARObject obj)
          Modifies an existing reservation.
 ArrayList queryBusyTime(Integer resourceID, long from, long to)
          Querys to a resource regarding to list of busy time during a period of time.
 ArrayList queryBusyTime(int resourceID, long from, long to)
          Querys to a resource regarding to list of busy time during a period of time.
 ArrayList queryFreeTime(Integer resourceID, long from, long to)
          Querys to a resource regarding to list of free time during a period of time.
 ArrayList queryFreeTime(int resourceID, long from, long to)
          Querys to a resource regarding to list of free time during a period of time.
 int queryReservation(String bookingID)
          Queries the overall status of a reservation.
static boolean validateTimeZone(double timeZone)
          Checks whether a given time zone is valid or not
 
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
 

Field Detail

HOUR

public static final int HOUR
1 Hour representation in milliseconds, i.e. 1 hour = 1000*60*60

See Also:
Constant Field Values
Constructor Detail

AdvanceReservation

public AdvanceReservation(String name,
                          double baudRate)
                   throws Exception
Allocates a new AdvanceReservation object. Time zone of this object will be a default Calendar object given during GridSim.init() method. If Calendar object is null, then time zone is GMT+0

Parameters:
name - this entity name
baudRate - the bandwidth of this entity
Throws:
Exception - This happens when one of the following scenarios occur:
  • creating this entity before initializing GridSim package
  • this entity name is null or empty
See Also:
GridSim.init(int, Calendar, boolean, String[], String[], String), GridSim.init(int, Calendar, boolean)
Pre Condition:
name != null, baudRate > 0
Post Condition:
$none

AdvanceReservation

public AdvanceReservation(String name,
                          double baudRate,
                          double timeZone)
                   throws Exception
Allocates a new AdvanceReservation object with a given time zone

Parameters:
name - this entity name
baudRate - the bandwidth of this entity
timeZone - the time zone of this entity
Throws:
Exception - This happens when one of the following scenarios occur:
  • creating this entity before initializing GridSim package
  • this entity name is null or empty
  • invalid time zone
Pre Condition:
name != null, baudRate > 0
Post Condition:
$none

AdvanceReservation

public AdvanceReservation(String name,
                          Link link)
                   throws Exception
Allocates a new AdvanceReservation object. Time zone of this object will be a default Calendar object given during GridSim.init() method. If Calendar object is null, then time zone is GMT+0

Parameters:
name - this entity name
link - the link that this GridSim entity will use to communicate with other GridSim or Network entities.
Throws:
Exception - This happens when one of the following scenarios occur:
  • creating this entity before initializing GridSim package
  • this entity name is null or empty
See Also:
GridSim.init(int, Calendar, boolean, String[], String[], String), GridSim.init(int, Calendar, boolean)
Pre Condition:
name != null, link != null
Post Condition:
$none

AdvanceReservation

public AdvanceReservation(String name,
                          Link link,
                          double timeZone)
                   throws Exception
Allocates a new AdvanceReservation object with a given time zone

Parameters:
name - this entity name
link - the link that this GridSim entity will use to communicate with other GridSim or Network entities.
timeZone - the time zone of this entity
Throws:
Exception - This happens when one of the following scenarios occur:
  • creating this entity before initializing GridSim package
  • this entity name is null or empty
  • invalid time zone
Pre Condition:
name != null, link != null
Post Condition:
$none
Method Detail

convertTimeZone

public static long convertTimeZone(long time,
                                   double fromZone,
                                   double toZone)
Converts local time from one time zone to another

Parameters:
time - local current time in milliseconds
fromZone - local time zone of range [GMT-12 ... GMT+13]
toZone - destination time zone of range [GMT-12 ... GMT+13]
Returns:
a converted time in milliseconds or -1 if a time zone is not within [GMT-12 ... GMT+13]
Pre Condition:
$none
Post Condition:
$none

validateTimeZone

public static boolean validateTimeZone(double timeZone)
Checks whether a given time zone is valid or not

Parameters:
timeZone - a time zone
Returns:
true if a time zone is valid, or false otherwise
Pre Condition:
$none
Post Condition:
$none

getCreateResult

public static String getCreateResult(int result)
Converts a reservation result from integer into a String. The result is one of GridSimTags.AR_CREATE_XXXX tags, where XXXX = specific tag name.

Parameters:
result - a result for a new reservation request
Returns:
a String representation of the reservation result or null if invalid result.
See Also:
GridSimTags
Pre Condition:
$none
Post Condition:
$none

getCancelResult

public static String getCancelResult(int result)
Converts a reservation result from integer into a String. The result is one of GridSimTags.AR_CANCEL_XXXX tags, where XXXX = specific tag name.

Parameters:
result - a result for cancel a reservation
Returns:
a String representation of the reservation result or null if invalid result.
See Also:
GridSimTags
Pre Condition:
$none
Post Condition:
$none

getQueryResult

public static String getQueryResult(int result)
Converts a reservation result from integer into a String. The result is one of GridSimTags.AR_STATUS_XXXX tags, where XXXX = specific tag name.

Parameters:
result - a result for query a reservation
Returns:
a String representation of the reservation result or null if invalid result.
See Also:
GridSimTags
Pre Condition:
$none
Post Condition:
$none

getCommitResult

public static String getCommitResult(int result)
Converts a reservation result from integer into a String. The result is one of GridSimTags.AR_COMMIT_XXXX tags, where XXXX = specific tag name.

Parameters:
result - a result for commit a reservation
Returns:
a String representation of the reservation result or null if invalid result.
See Also:
GridSimTags
Pre Condition:
$none
Post Condition:
$none

getModifyResult

public static String getModifyResult(int result)
Converts a reservation result from integer into a String. The result is one of GridSimTags.AR_MODIFY_XXXX tags, where XXXX = specific tag name.

Parameters:
result - a result for modify a reservation
Returns:
a String representation of the reservation result or null if invalid result.
See Also:
GridSimTags
Pre Condition:
$none
Post Condition:
$none

getExpiryTime

public long getExpiryTime(String bookingID)
Gets an expiry time of a reservation

Parameters:
bookingID - a reservation booking ID
Returns:
an expiry time or -1 if not found
Pre Condition:
bookingID != null
Post Condition:
$result > 0

createReservation

public String createReservation(Calendar startTime,
                                Calendar endTime,
                                int numPE,
                                int resID)
Creates a new reservation and sends the request to a resource. If the new reservation has been accepted by a resource, an unique booking ID is generated in the format of "resourceID_reservationID". Otherwise, an error message or an approximate busy time is returned by using GridSimTags.AR_CREATE_XXXX tags, where XXXX = specific tag name.

Immediate reservation can be used by this method by specifying one or both properties:

Parameters:
startTime - reservation start time
endTime - reservation end time
numPE - number of PEs required for this reservation
resID - a resource ID
Returns:
an unique booking id if successful, otherwise an error message
See Also:
GridSimTags
Pre Condition:
numPE > 0, resID > 0
Post Condition:
$result != null

createReservation

public String createReservation(Calendar startTime,
                                Calendar endTime,
                                int numPE,
                                String resName)
Creates a new reservation and sends the request to a resource. If the new reservation has been accepted by a resource, an unique booking ID is generated in the format of "resourceID_reservationID". Otherwise, an error message or an approximate busy time is returned by using GridSimTags.AR_CREATE_XXXX tags, where XXXX = specific tag name.

Immediate reservation can be used by this method by specifying one or both properties:

Parameters:
startTime - reservation start time
endTime - reservation end time
numPE - number of PEs required for this reservation
resName - a resource name
Returns:
an unique booking id if successful, otherwise an error message
See Also:
GridSimTags
Pre Condition:
numPE > 0, resName != null
Post Condition:
$result != null

createReservation

public String createReservation(Calendar startTime,
                                int duration,
                                int numPE,
                                int resID)
Creates a new reservation and sends the request to a resource. If the new reservation has been accepted by a resource, an unique booking ID is generated in the format of "resourceID_reservationID". Otherwise, an error message or an approximate busy time is returned by using GridSimTags.AR_CREATE_XXXX tags, where XXXX = specific tag name.

Immediate reservation can be used by this method by specifying one or both properties:

Parameters:
startTime - reservation start time
duration - reservation duration time in seconds
numPE - number of PEs required for this reservation
resID - a resource ID
Returns:
an unique booking id if successful, otherwise an error message
See Also:
GridSimTags
Pre Condition:
duration >= 0, numPE > 0, resID > 0
Post Condition:
$result != null

createReservation

public String createReservation(Calendar startTime,
                                int duration,
                                int numPE,
                                String resName)
Creates a new reservation and sends the request to a resource. If the new reservation has been accepted by a resource, an unique booking ID is generated in the format of "resourceID_reservationID". Otherwise, an error message or an approximate busy time is returned by using GridSimTags.AR_CREATE_XXXX tags, where XXXX = specific tag name.

Immediate reservation can be used by this method by specifying one or both properties:

Parameters:
startTime - reservation start time
duration - reservation duration time in seconds
numPE - number of PEs required for this reservation
resName - a resource name
Returns:
an unique booking id if successful, otherwise an error message
See Also:
GridSimTags
Pre Condition:
duration >= 0, numPE > 0, resName != null
Post Condition:
$result != null

createReservation

public String createReservation(long startTime,
                                long endTime,
                                int numPE,
                                int resID)
Creates a new reservation and sends the request to a resource. If the new reservation has been accepted by a resource, an unique booking ID is generated in the format of "resourceID_reservationID". Otherwise, an error message or an approximate busy time is returned by using GridSimTags.AR_CREATE_XXXX tags, where XXXX = specific tag name.

Immediate reservation can be used by this method by specifying one or both properties:

Parameters:
startTime - reservation start time in milliseconds
endTime - reservation end time in milliseconds
numPE - number of PEs required for this reservation
resID - a resource ID
Returns:
an unique booking id if successful, otherwise an error message
See Also:
GridSimTags
Pre Condition:
startTime >= 0, endTime >= 0, numPE > 0, resID > 0
Post Condition:
$result != null

createReservation

public String createReservation(long startTime,
                                long endTime,
                                int numPE,
                                String resName)
Creates a new reservation and sends the request to a resource. If the new reservation has been accepted by a resource, an unique booking ID is generated in the format of "resourceID_reservationID". Otherwise, an error message or an approximate busy time is returned by using GridSimTags.AR_CREATE_XXXX tags, where XXXX = specific tag name.

Immediate reservation can be used by this method by specifying one or both properties:

Parameters:
startTime - reservation start time in milliseconds
endTime - reservation end time in milliseconds
numPE - number of PEs required for this reservation
resName - a resource name
Returns:
an unique booking id if successful, otherwise an error message
See Also:
GridSimTags
Pre Condition:
startTime > 0, endTime > 0, numPE > 0, resName != null
Post Condition:
$result != null

createReservation

public String createReservation(long startTime,
                                int duration,
                                int numPE,
                                int resID)
Creates a new reservation and sends the request to a resource. If the new reservation has been accepted by a resource, an unique booking ID is generated in the format of "resourceID_reservationID". Otherwise, an error message or an approximate busy time is returned by using GridSimTags.AR_CREATE_XXXX tags, where XXXX = specific tag name.

Immediate reservation can be used by this method by specifying one or both properties:

Parameters:
startTime - reservation start time in milliseconds
duration - reservation end time in seconds
numPE - number of PEs required for this reservation
resID - a resource ID
Returns:
an unique booking id if successful, otherwise an error message
See Also:
GridSimTags
Pre Condition:
startTime > 0, duration > 0, numPE > 0, resID > 0
Post Condition:
$result != null

createReservation

public String createReservation(long startTime,
                                int duration,
                                int numPE,
                                String resName)
Creates a new reservation and sends the request to a resource. If the new reservation has been accepted by a resource, an unique booking ID is generated in the format of "resourceID_reservationID". Otherwise, an error message or an approximate busy time is returned by using GridSimTags.AR_CREATE_XXXX tags, where XXXX = specific tag name.

Immediate reservation can be used by this method by specifying one or both properties:

Parameters:
startTime - reservation start time in milliseconds
duration - reservation end time in seconds
numPE - number of PEs required for this reservation
resName - a resource name
Returns:
an unique booking id if successful, otherwise an error message
See Also:
GridSimTags
Pre Condition:
startTime > 0, duration > 0, numPE > 0, resName != null
Post Condition:
$result != null

modifyReservation

public int modifyReservation(String bookingID,
                             ARObject obj)
Modifies an existing reservation. Modification must be done before reservation's start time. A return value of this method uses one of GridSimTags.AR_MODIFY_XXXX tags, where XXXX = specific tag name.

Parameters:
bookingID - reservation booking ID
obj - reservation object that contains new modifications
Returns:
an integer tag that denotes success or failure.
See Also:
GridSimTags
Pre Condition:
bookingID != null, obj != null
Post Condition:
$none

cancelReservation

public int cancelReservation(String bookingID)
Cancels a given reservation. All Gridlets associated with this reservation will automatically be cancelled. Users need to retrieve the Gridlets manually, by using GridSim.gridletReceive(). A return value for this method uses one of of GridSimTags.AR_CANCEL_XXXX tags, where XXXX = specific tag name.

Parameters:
bookingID - this reservation booking ID
Returns:
an integer tag that denotes success or failure.
See Also:
GridSimTags, GridSim.gridletReceive(), GridSim.gridletReceive(int, int, int)
Pre Condition:
bookingID != null
Post Condition:
$none

cancelReservation

public int cancelReservation(String bookingID,
                             ArrayList list)
Cancels a list of Gridlets for a given reservation. Users need to retrieve the Gridlets manually, by using GridSim.gridletReceive(). If cancellation of a Gridlet fails, then it will ignore the rest of the list. A return value for this method uses one of of GridSimTags.AR_CANCEL_XXXX tags, where XXXX = specific tag name.
NOTE: This method is similar to GridSim.gridletCancel()

Parameters:
bookingID - this reservation booking ID
list - a list of Gridlet IDs (each ID is an Integer object). Each Gridlet ID should be unique and no duplicate.
Returns:
an integer tag that denotes success or failure.
See Also:
GridSimTags, GridSim.gridletReceive(), GridSim.gridletReceive(int, int, int), GridSim.gridletCancel(int, int, int, double), GridSim.gridletCancel(Gridlet, int, double)
Pre Condition:
bookingID != null, list != null
Post Condition:
$none

cancelReservation

public int cancelReservation(String bookingID,
                             Gridlet gl)
Cancels a Gridlet for a given reservation. Users need to retrieve the Gridlet manually, by using GridSim.gridletReceive(). A return value for this method uses one of of GridSimTags.AR_CANCEL_XXXX tags, where XXXX = specific tag name.
NOTE: This method is similar to GridSim.gridletCancel()

Parameters:
bookingID - this reservation booking ID
gl - a Gridlet object
Returns:
an integer tag that denotes success or failure.
See Also:
GridSimTags, GridSim.gridletReceive(), GridSim.gridletReceive(int, int, int), GridSim.gridletCancel(int, int, int, double), GridSim.gridletCancel(Gridlet, int, double)
Pre Condition:
bookingID != null, gl != null
Post Condition:
$none

cancelReservation

public int cancelReservation(String bookingID,
                             int gridletID)
Cancels a Gridlet for a given reservation. Users need to retrieve the Gridlet manually, by using GridSim.gridletReceive(). A return value for this method uses one of of GridSimTags.AR_CANCEL_XXXX tags, where XXXX = specific tag name.
NOTE: This method is similar to GridSim.gridletCancel()

Parameters:
bookingID - this reservation booking ID
gridletID - a Gridlet ID
Returns:
an integer tag that denotes success or failure.
See Also:
GridSimTags, GridSim.gridletReceive(), GridSim.gridletReceive(int, int, int), GridSim.gridletCancel(int, int, int, double), GridSim.gridletCancel(Gridlet, int, double)
Pre Condition:
bookingID != null, gridletID >= 0
Post Condition:
$none

queryFreeTime

public ArrayList queryFreeTime(Integer resourceID,
                               long from,
                               long to)
Querys to a resource regarding to list of free time during a period of time. Each object inside ArrayList is long array[3], with:

Parameters:
resourceID - a resource ID
from - starting time in milliseconds
to - ending time in milliseconds
Returns:
ArrayList object or null if error occurs
Pre Condition:
resourceID != null, from > 0, to > 0
Post Condition:
$none

queryFreeTime

public ArrayList queryFreeTime(int resourceID,
                               long from,
                               long to)
Querys to a resource regarding to list of free time during a period of time. Each object inside ArrayList is long array[3], with:

Parameters:
resourceID - a resource ID
from - starting time in milliseconds
to - ending time in milliseconds
Returns:
ArrayList object or null if error occurs
Pre Condition:
resourceID > 0, from > 0, to > 0
Post Condition:
$none

queryBusyTime

public ArrayList queryBusyTime(int resourceID,
                               long from,
                               long to)
Querys to a resource regarding to list of busy time during a period of time. Each object inside ArrayList is long array[3], with:

Parameters:
resourceID - a resource ID
from - starting time in milliseconds
to - ending time in milliseconds
Returns:
ArrayList object or null if error occurs
Pre Condition:
resourceID > 0, from > 0, to > 0
Post Condition:
$none

queryBusyTime

public ArrayList queryBusyTime(Integer resourceID,
                               long from,
                               long to)
Querys to a resource regarding to list of busy time during a period of time. Each object inside ArrayList is long array[3], with:

Parameters:
resourceID - a resource ID
from - starting time in milliseconds
to - ending time in milliseconds
Returns:
ArrayList object or null if error occurs
Pre Condition:
resourceID != null, from > 0, to > 0
Post Condition:
$none

getReservation

public ARObject getReservation(String bookingID)
Gets a reservation object based on the given booking ID

Parameters:
bookingID - a reservation booking ID
Returns:
ARObject object or null if an error occurs
Pre Condition:
bookingID != null
Post Condition:
$none

queryReservation

public int queryReservation(String bookingID)
Queries the overall status of a reservation. A return value for this method uses one of of GridSimTags.AR_STATUS_XXXX tags, where XXXX = specific tag name.

To find out the status for a specific Gridlet, use GridSim.gridletStatus(int, int, int) method instead.

Parameters:
bookingID - this reservation booking ID
Returns:
an integer tag that denotes success or failure.
See Also:
GridSimTags, GridSim.gridletStatus(int, int, int), GridSim.gridletStatus(Gridlet, int)
Pre Condition:
bookingID != null
Post Condition:
$none

commitReservation

public int commitReservation(String bookingID)
Commits a reservation only without sending any Gridlet objects. Once a commit has been successfull, sending the Gridlet objects must be done by using commitReservation(String, GridletList) or commitReservation(String, Gridlet). A return value for this method uses one of of GridSimTags.AR_COMMIT_XXXX tags, where XXXX = specific tag name.

Parameters:
bookingID - a reservation booking ID
Returns:
an integer tag that denotes success or failure.
See Also:
GridSimTags, commitReservation(String, Gridlet), commitReservation(String, GridletList)
Pre Condition:
bookingID != null
Post Condition:
$none

commitReservation

public int commitReservation(String bookingID,
                             GridletList list)
Commits a reservation together with a list of Gridlet objects. A return value for this method uses one of of GridSimTags.AR_COMMIT_XXXX tags, where XXXX = specific tag name.

Parameters:
bookingID - a reservation booking ID
list - a list of Gridlet objects. Each Gridlet's user ID, by default is set to this entity ID.
Returns:
an integer tag that denotes success or failure.
See Also:
Gridlet.setUserID(int), GridSimTags
Pre Condition:
bookingID != null, list != null
Post Condition:
$none

commitReservation

public int commitReservation(String bookingID,
                             Gridlet obj)
Commits a reservation together with a Gridlet object. A return value for this method uses one of of GridSimTags.AR_COMMIT_XXXX tags, where XXXX = specific tag name.

Parameters:
bookingID - a reservation booking ID
obj - a Gridlet object. A Gridlet's user ID, by default is set to this entity ID.
Returns:
an integer tag that denotes success or failure.
See Also:
Gridlet.setUserID(int), GridSimTags
Pre Condition:
bookingID != null, obj != null
Post Condition:
$none

GridSim 5.0 beta

The University of Melbourne, Australia, 2009