orca.shirako.time.calendar
Class BrokerCalendar

java.lang.Object
  extended by orca.shirako.time.calendar.BaseCalendar
      extended by orca.shirako.time.calendar.ClientCalendar
          extended by orca.shirako.time.calendar.BrokerCalendar

public class BrokerCalendar
extends ClientCalendar

An AgentCalendaris used to organize reservation information for an agent. It builds on the functionality provided by ClientCalendar and extends it with the following features:

Policy plugins can store incoming client requests on the calendar and use the calendar when performing resource allocation. This is an optional feature, not a requirement: plugin code can maintain internal data structures to drive its allocation decisions. The requests collection of the calendar is provided as a convenience.
For each source reservation the calendar maintains an outlays collection of all client requests satisfied from this source reservation.


Field Summary
protected  ReservationList closing
          List of reservations grouped by closing time
protected  ReservationList requests
          Reservation requests grouped by start cycle
protected  java.util.HashMap<ReservationID,SourceCalendar> sources
          Source reservation calendars indexed by the source reservation identifier
 
Fields inherited from class orca.shirako.time.calendar.ClientCalendar
demand, holdings, pending, renewing
 
Fields inherited from class orca.shirako.time.calendar.BaseCalendar
clock
 
Constructor Summary
BrokerCalendar(ActorClock clock)
           
 
Method Summary
 void addClosing(ResourceReservation reservation, long cycle)
          Add a reservation to be closed on the given cycle
 void addOutlay(ResourceReservation source, ResourceReservation client, long start, long end)
          Add outlay reservation
 void addRequest(BrokerReservation reservation, long cycle)
          Add a client request
 void addRequest(ResourceReservation reservation, long cycle, ResourceReservation source)
          Add an extending reservation
 void addSource(ReservationClient source)
          Add a source reservation.
 ReservationSet getClosing(long cycle)
          Obtain all reservations that need to be closed on the given cycle
 ReservationSet getOutlays(ResourceReservation source)
          Obtain the client reservations satisfied from the given source reservation
 ReservationSet getOutlays(ResourceReservation source, long cycle)
          Obtain the client reservations satisfied from the given source that are active at the specified cycle.
 ReservationSet getRequests(long cycle)
          Obtain all client requests for the given cycle
 ReservationSet getRequests(ResourceReservation source, long cycle)
          Obtain the extending requests for the given source reservation
 void remove(ResourceReservation reservation)
          Removes the specified reservation from all internal calendar data structures.
 void removeClosing(ResourceReservation reservation)
          Remove the given reservation from the list of closing reservations.
 void removeClosing(ResourceReservation reservation, long cycle)
          Remove the given reservation from the list of closing reservations on the given cycle.
 void removeOutlay(ResourceReservation source, ResourceReservation client)
          Removes an outlay reservation
 void removeRequest(BrokerReservation reservation)
           
 void removeRequest(BrokerReservation reservation, long cycle)
           
 void removeRequest(ResourceReservation source, BrokerReservation request)
           
 void removeRequest(ResourceReservation source, ResourceReservation request, long cycle)
           
 void removeScheduledOrInProgress(ResourceReservation reservation)
          Removes the specified reservations from all internal calendar data structures that represent operations to be scheduled in the future or operations that are currently in progress.
 void removeSourceCalendar(ResourceReservation source)
          Removes any data structures associated with a source reservation.
 void tick(long cycle)
          Perform calendar cleanup
 
Methods inherited from class orca.shirako.time.calendar.ClientCalendar
addDemand, addHolding, addPending, addRenewing, getDemand, getHoldings, getHoldings, getHoldings, getPending, getRenewing, removeDemand, removeHolding, removePending, removeRenewing, removeRenewing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

closing

protected ReservationList closing
List of reservations grouped by closing time


requests

protected ReservationList requests
Reservation requests grouped by start cycle


sources

protected java.util.HashMap<ReservationID,SourceCalendar> sources
Source reservation calendars indexed by the source reservation identifier

Constructor Detail

BrokerCalendar

public BrokerCalendar(ActorClock clock)
Method Detail

remove

public void remove(ResourceReservation reservation)
Description copied from class: ClientCalendar
Removes the specified reservation from all internal calendar data structures.

Overrides:
remove in class ClientCalendar
Parameters:
reservation - reservation to remove

removeScheduledOrInProgress

public void removeScheduledOrInProgress(ResourceReservation reservation)
Description copied from class: ClientCalendar
Removes the specified reservations from all internal calendar data structures that represent operations to be scheduled in the future or operations that are currently in progress. Does not remove the reservation from the holdings list.

Overrides:
removeScheduledOrInProgress in class ClientCalendar

getRequests

public ReservationSet getRequests(long cycle)
Obtain all client requests for the given cycle

Parameters:
cycle -
Returns:
reservations for specified cycle

addRequest

public void addRequest(BrokerReservation reservation,
                       long cycle)
Add a client request

Parameters:
reservation -
cycle -

addRequest

public void addRequest(ResourceReservation reservation,
                       long cycle,
                       ResourceReservation source)
Add an extending reservation

Parameters:
reservation - The reservation
cycle - The desired start cycle
source - The source reservation

getRequests

public ReservationSet getRequests(ResourceReservation source,
                                  long cycle)
Obtain the extending requests for the given source reservation

Parameters:
source -
cycle -
Returns:
requests for source on a particular cycle

removeRequest

public void removeRequest(BrokerReservation reservation)

removeRequest

public void removeRequest(BrokerReservation reservation,
                          long cycle)

removeRequest

public void removeRequest(ResourceReservation source,
                          ResourceReservation request,
                          long cycle)

removeRequest

public void removeRequest(ResourceReservation source,
                          BrokerReservation request)

addOutlay

public void addOutlay(ResourceReservation source,
                      ResourceReservation client,
                      long start,
                      long end)
Add outlay reservation

Parameters:
source - The source reservation
client - The client reservation satisfied from the given source reservation
start -
end -

removeOutlay

public void removeOutlay(ResourceReservation source,
                         ResourceReservation client)
Removes an outlay reservation

Parameters:
source - The source reservation
client - The client reservation satisfied from the given source

addSource

public void addSource(ReservationClient source)
Add a source reservation. Creates a placeholder if necessary and adds the reservation to the holdings list.

Parameters:
source -

removeSourceCalendar

public void removeSourceCalendar(ResourceReservation source)
Removes any data structures associated with a source reservation.

Parameters:
source - source reservation

getOutlays

public ReservationSet getOutlays(ResourceReservation source)
Obtain the client reservations satisfied from the given source reservation

Parameters:
source - The source reservation
Returns:
the outlays calendar for a specified source

getOutlays

public ReservationSet getOutlays(ResourceReservation source,
                                 long cycle)
Obtain the client reservations satisfied from the given source that are active at the specified cycle.

Parameters:
source - The source reservation
cycle -
Returns:
the outlays calendar for a source at a specified cycle

getClosing

public ReservationSet getClosing(long cycle)
Obtain all reservations that need to be closed on the given cycle

Parameters:
cycle - The cycle
Returns:
null if no reservations are present

addClosing

public void addClosing(ResourceReservation reservation,
                       long cycle)
Add a reservation to be closed on the given cycle

Parameters:
reservation - The reservation
cycle - The cycle

removeClosing

public void removeClosing(ResourceReservation reservation,
                          long cycle)
Remove the given reservation from the list of closing reservations on the given cycle.

Parameters:
reservation - The reservation
cycle - The cycle

removeClosing

public void removeClosing(ResourceReservation reservation)
Remove the given reservation from the list of closing reservations.

Parameters:
reservation - The reservation

tick

public void tick(long cycle)
Description copied from class: BaseCalendar
Perform calendar cleanup

Overrides:
tick in class ClientCalendar


Copyright © 2007 Network/Internet Computing Lab. All Rights Reserved.