eu.xtreemos.xosd.localallocmgr.frontend.wrapper
Class FrontendWrapper

java.lang.Object
  extended by eu.xtreemos.xosd.localallocmgr.frontend.wrapper.FrontendWrapper

public class FrontendWrapper
extends java.lang.Object


Field Summary
private  Executor executor
           
private  JobReservationMap jobInfo
           
private  MigrationsHandler migrationsHandler
           
private  ResourceDirectory rdir
           
private  RequestQueue rq
           
 
Constructor Summary
FrontendWrapper(ResourceDirectory rdir, RequestQueue rq)
           
 
Method Summary
 void addResourceProperty(java.lang.String resID, IResourceProperty property)
          dummy method that allows "on-hand" addition of properties.
 boolean attachToJob(java.lang.String jobID, java.lang.String reservationID)
           
 Request createRequestsPurgeReservationsBefore(java.util.GregorianCalendar date)
          creates a request for purging all elements that finish before the given date.
 java.lang.String createReservation(Request info)
          creates a reservation with a given request.
 java.util.ArrayList<java.lang.String> createReservations(java.util.ArrayList<Request> reservations)
          creates a massive a sequence of reservations. returns the ids of reservatins with a 1:1 mapping regarding their place.
 boolean detachFromJob(java.lang.String jobID, java.lang.String reservationID)
           
 FreeSlots getAllFreeSlotsFor(java.lang.String resourceID)
          returns all free slots in a timetable for some resource.
 FreeSlots getFreeSlotsFor(java.lang.String resourceID, java.util.GregorianCalendar from, java.util.GregorianCalendar to)
          returns all free slots for a given time frame.
 java.util.ArrayList<java.lang.String> getInitializedResources()
          returns all initialized resources
 java.util.ArrayList<java.lang.String> getReservationResources(java.lang.String reservationID)
           
 java.util.ArrayList<TTElm> getSelection(java.lang.String resID, java.util.Hashtable<java.lang.Class<?>,java.lang.Object> constraints)
          get all time table elements with selected attributes for a resource. the constraints hashatable holds the class of the constraint and the value of that constraint.
 TimeTable getTTfor(java.lang.String resource)
          debug methods, not intended for XATI use
 void initializeResource(java.lang.String id)
          temp function for creating needed stuff for the dixi TODO:remove once initialization works.
 boolean releaseReservation(java.lang.String reservationID)
           
 boolean removeJob(java.lang.String jobID)
           
 java.util.ArrayList<java.lang.String> reservationsForJob(java.lang.String jobID)
           
 java.lang.Boolean restoreForCheckpointBefore(java.lang.String reservationID)
          restores the state of all timetables just before the creation of the given reservation.
 java.util.ArrayList<TTElm> selectAvailable(java.lang.String resourceID, int amount)
          selects available from all elements (see selectAvailable(resourceId, amount, from, to) description!)
 java.util.ArrayList<TTElm> selectAvailable(java.lang.String resourceID, int amount, java.util.GregorianCalendar from, java.util.GregorianCalendar to)
          TODO: add argument for the property selection!!!
 boolean updateReservation(java.lang.String reservationID, Request info)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jobInfo

private JobReservationMap jobInfo

rdir

private ResourceDirectory rdir

rq

private RequestQueue rq

executor

private Executor executor

migrationsHandler

private MigrationsHandler migrationsHandler
Constructor Detail

FrontendWrapper

public FrontendWrapper(ResourceDirectory rdir,
                       RequestQueue rq)
Method Detail

createReservation

public java.lang.String createReservation(Request info)
creates a reservation with a given request.

Parameters:
info -
Returns:

createReservations

public java.util.ArrayList<java.lang.String> createReservations(java.util.ArrayList<Request> reservations)
creates a massive a sequence of reservations. returns the ids of reservatins with a 1:1 mapping regarding their place. If one of the reservations fails, all of them must fail also. If reservation fails, but restoring succeeds, the empty array is returned, otherwise, if the restoring fails also, the null object is returned.

Parameters:
reservations -
Returns:

updateReservation

public boolean updateReservation(java.lang.String reservationID,
                                 Request info)
Parameters:
reservationID -
info -
Returns:

releaseReservation

public boolean releaseReservation(java.lang.String reservationID)
Parameters:
reservationID -
Returns:

getReservationResources

public java.util.ArrayList<java.lang.String> getReservationResources(java.lang.String reservationID)
Parameters:
reservationID -
Returns:

attachToJob

public boolean attachToJob(java.lang.String jobID,
                           java.lang.String reservationID)

detachFromJob

public boolean detachFromJob(java.lang.String jobID,
                             java.lang.String reservationID)

removeJob

public boolean removeJob(java.lang.String jobID)

reservationsForJob

public java.util.ArrayList<java.lang.String> reservationsForJob(java.lang.String jobID)

getAllFreeSlotsFor

public FreeSlots getAllFreeSlotsFor(java.lang.String resourceID)
returns all free slots in a timetable for some resource.

Parameters:
resourceID -
Returns:
null if no such resource exists or there was error with attribute conformance.

getFreeSlotsFor

public FreeSlots getFreeSlotsFor(java.lang.String resourceID,
                                 java.util.GregorianCalendar from,
                                 java.util.GregorianCalendar to)
returns all free slots for a given time frame.

Parameters:
resourceID -
from -
to -
Returns:

selectAvailable

public java.util.ArrayList<TTElm> selectAvailable(java.lang.String resourceID,
                                                  int amount)
selects available from all elements (see selectAvailable(resourceId, amount, from, to) description!)

Parameters:
resourceID -
amount -
Returns:

selectAvailable

public java.util.ArrayList<TTElm> selectAvailable(java.lang.String resourceID,
                                                  int amount,
                                                  java.util.GregorianCalendar from,
                                                  java.util.GregorianCalendar to)
TODO: add argument for the property selection!!! selects all already reserved elements within a timetable for some resource (identified by resourceID), where the amount of available resource property CurrentAmount is smaller than MaxAmount by more than given parameter "amount". Also, the sharing value of such element must not be EXCLUSIVE.

Parameters:
resourceID -
amount -
from -
to -
Returns:

initializeResource

public void initializeResource(java.lang.String id)
temp function for creating needed stuff for the dixi TODO:remove once initialization works.

Parameters:
id -

getInitializedResources

public java.util.ArrayList<java.lang.String> getInitializedResources()
returns all initialized resources

Returns:

createRequestsPurgeReservationsBefore

public Request createRequestsPurgeReservationsBefore(java.util.GregorianCalendar date)
creates a request for purging all elements that finish before the given date.

Parameters:
date -
Returns:

addResourceProperty

public void addResourceProperty(java.lang.String resID,
                                IResourceProperty property)
dummy method that allows "on-hand" addition of properties. Should be replaced by proper initialization system ...

Parameters:
resID -
property -

getSelection

public java.util.ArrayList<TTElm> getSelection(java.lang.String resID,
                                               java.util.Hashtable<java.lang.Class<?>,java.lang.Object> constraints)
get all time table elements with selected attributes for a resource. the constraints hashatable holds the class of the constraint and the value of that constraint. The classes are the attribute classes, and the values, the values of that attributes.

Parameters:
resID -
constraints -
Returns:

restoreForCheckpointBefore

public java.lang.Boolean restoreForCheckpointBefore(java.lang.String reservationID)
                                             throws AttributeConformanceException
restores the state of all timetables just before the creation of the given reservation. If it was already restored or if there is no info about it, the call fails otherwise, it succeeds.

Parameters:
reservationID -
Returns:
Throws:
AttributeConformanceException

getTTfor

public TimeTable getTTfor(java.lang.String resource)
debug methods, not intended for XATI use