eu.xtreemos.xati.API
Class XResAllocator

java.lang.Object
  extended by eu.xtreemos.xati.API.XResAllocator

public class XResAllocator
extends java.lang.Object

Author:
gregor.pipan@xlab.si

Field Summary
static java.lang.String servicename
           
 
Constructor Summary
XResAllocator()
           
 
Method Summary
static java.lang.Integer addResourceProperty(java.lang.String __resID, IResourceProperty __property)
          dummy method that allows "on-hand" addition of properties.
static java.lang.Boolean attachToJob(java.lang.String __jobID, java.lang.String __reservationID)
           
static Request createRequestsPurgeReservationsBefore(java.util.GregorianCalendar __date)
          creates a request for purging all elements that finish before the given date.
static java.lang.String createReservation(Request __info)
          creates a reservation with a given request.
static 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.
static java.lang.Boolean detachFromJob(java.lang.String __jobID, java.lang.String __reservationID)
           
static FreeSlots getAllFreeSlotsFor(java.lang.String __resourceID)
          returns all free slots in a timetable for some resource.
static java.lang.Object getAllResources()
           
static FreeSlots getFreeSlotsFor(java.lang.String __resourceID, java.util.GregorianCalendar __from, java.util.GregorianCalendar __to)
          returns all free slots for a given time frame.
static java.util.ArrayList<java.lang.String> getInitializedResources()
          returns all initialized resources
static java.util.ArrayList<java.lang.String> getReservationResources(java.lang.String __reservationID)
           
static java.util.ArrayList<ReservationSlot> getReservationsInfo(java.util.ArrayList<java.lang.String> __ids)
          For a list of the IDs obtained from the createReservation(Request), the method builds a list of reservation slots descriptors, effectively returning the timetable entries usable for the reservations.
static java.util.ArrayList<TTElm> getSelection(java.lang.String __resID, java.util.Hashtable __constraints)
          get all time table elements with selected attributes for a resource
static java.lang.Integer initializeResource(java.lang.String __id)
           
static java.lang.Boolean releaseReservation(java.lang.String __reservationID)
           
static java.lang.Boolean removeJob(java.lang.String __jobID)
           
static java.util.ArrayList<java.lang.String> reservationsForJob(java.lang.String __jobID)
           
static java.lang.Boolean restoreForCheckpointBefore(java.util.ArrayList<java.lang.String> __reservationIDs)
          restores the state of all timetables just before the creation of the given reservation.
static java.util.ArrayList<TTElm> selectAvailable(java.lang.String __resourceID, java.lang.Integer __amount)
          selects available from all elements (see selectAvailable(resourceId, amount, from, to) description!)
static java.util.ArrayList<TTElm> selectAvailableDT(java.lang.String __resourceID, java.lang.Integer __amount, java.util.GregorianCalendar __from, java.util.GregorianCalendar __to)
          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".
static java.lang.Boolean updateReservation(java.lang.String __reservationID, Request __info)
           
static java.lang.Boolean updateReservations(java.util.ArrayList<UpdateRequest> __requests)
          Creates a series of reservation updates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servicename

public static java.lang.String servicename
Constructor Detail

XResAllocator

public XResAllocator()
Method Detail

getAllResources

public static java.lang.Object getAllResources()
                                        throws java.lang.Exception
Throws:
java.lang.Exception

createReservation

public static java.lang.String createReservation(Request __info)
                                          throws java.lang.Exception
creates a reservation with a given request.

Parameters:
info -
Returns:
Throws:
java.lang.Exception

updateReservation

public static java.lang.Boolean updateReservation(java.lang.String __reservationID,
                                                  Request __info)
                                           throws java.lang.Exception
Parameters:
reservationID -
info -
Returns:
Throws:
java.lang.Exception

updateReservations

public static java.lang.Boolean updateReservations(java.util.ArrayList<UpdateRequest> __requests)
                                            throws java.lang.Exception
Creates a series of reservation updates. Note that if one fails, all other are nullified also and the state of all TimeTables is returned to the original state before the call.

Parameters:
requests -
Returns:
Throws:
AttributeConformanceException
java.lang.Exception

releaseReservation

public static java.lang.Boolean releaseReservation(java.lang.String __reservationID)
                                            throws java.lang.Exception
Parameters:
reservationID -
Returns:
Throws:
java.lang.Exception

getReservationResources

public static java.util.ArrayList<java.lang.String> getReservationResources(java.lang.String __reservationID)
                                                                     throws java.lang.Exception
Parameters:
reservationID -
Returns:
Throws:
java.lang.Exception

attachToJob

public static java.lang.Boolean attachToJob(java.lang.String __jobID,
                                            java.lang.String __reservationID)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

detachFromJob

public static java.lang.Boolean detachFromJob(java.lang.String __jobID,
                                              java.lang.String __reservationID)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

removeJob

public static java.lang.Boolean removeJob(java.lang.String __jobID)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

reservationsForJob

public static java.util.ArrayList<java.lang.String> reservationsForJob(java.lang.String __jobID)
                                                                throws java.lang.Exception
Throws:
java.lang.Exception

getAllFreeSlotsFor

public static FreeSlots getAllFreeSlotsFor(java.lang.String __resourceID)
                                    throws java.lang.Exception
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.
Throws:
java.lang.Exception

getFreeSlotsFor

public static FreeSlots getFreeSlotsFor(java.lang.String __resourceID,
                                        java.util.GregorianCalendar __from,
                                        java.util.GregorianCalendar __to)
                                 throws java.lang.Exception
returns all free slots for a given time frame.

Parameters:
resourceID -
from -
to -
Returns:
Throws:
java.lang.Exception

selectAvailable

public static java.util.ArrayList<TTElm> selectAvailable(java.lang.String __resourceID,
                                                         java.lang.Integer __amount)
                                                  throws java.lang.Exception
selects available from all elements (see selectAvailable(resourceId, amount, from, to) description!)

Parameters:
resourceID -
amount -
Returns:
Throws:
java.lang.Exception

selectAvailableDT

public static java.util.ArrayList<TTElm> selectAvailableDT(java.lang.String __resourceID,
                                                           java.lang.Integer __amount,
                                                           java.util.GregorianCalendar __from,
                                                           java.util.GregorianCalendar __to)
                                                    throws java.lang.Exception
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:
Throws:
java.lang.Exception

initializeResource

public static java.lang.Integer initializeResource(java.lang.String __id)
                                            throws java.lang.Exception
Throws:
java.lang.Exception

getInitializedResources

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

Returns:
Throws:
java.lang.Exception

createRequestsPurgeReservationsBefore

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

Parameters:
date -
Returns:
Throws:
java.lang.Exception

addResourceProperty

public static java.lang.Integer addResourceProperty(java.lang.String __resID,
                                                    IResourceProperty __property)
                                             throws java.lang.Exception
dummy method that allows "on-hand" addition of properties. Should be replaced by proper initialization system ...

Parameters:
resID -
property -
Throws:
java.lang.Exception

getSelection

public static java.util.ArrayList<TTElm> getSelection(java.lang.String __resID,
                                                      java.util.Hashtable __constraints)
                                               throws java.lang.Exception
get all time table elements with selected attributes for a resource

Parameters:
resID -
constraints -
Returns:
Throws:
java.lang.Exception

getReservationsInfo

public static java.util.ArrayList<ReservationSlot> getReservationsInfo(java.util.ArrayList<java.lang.String> __ids)
                                                                throws java.lang.Exception
For a list of the IDs obtained from the createReservation(Request), the method builds a list of reservation slots descriptors, effectively returning the timetable entries usable for the reservations. Get required information for the ReservationManager about all reservations slots in the time table regarding some reservation id.

Parameters:
reservationIDs - A collection of the IDs obtained from createReservation(Request).
Returns:
A collection of timetable entry descriptors.
Throws:
java.lang.Exception

createReservations

public static java.util.ArrayList<java.lang.String> createReservations(java.util.ArrayList<Request> __reservations)
                                                                throws java.lang.Exception
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:
Throws:
java.lang.Exception

restoreForCheckpointBefore

public static java.lang.Boolean restoreForCheckpointBefore(java.util.ArrayList<java.lang.String> __reservationIDs)
                                                    throws java.lang.Exception
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
java.lang.Exception