eu.xtreemos.xati.API
Class XReservationManager

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

public class XReservationManager
extends java.lang.Object

Author:
gregor.pipan@xlab.si

Field Summary
static java.lang.String servicename
           
 
Constructor Summary
XReservationManager()
           
 
Method Summary
static java.lang.Integer attachJob(java.lang.String __reservationId, java.lang.String __jobId, java.security.cert.X509Certificate __userCertificate)
          Attach a job to the reservation.
static java.lang.String createEmptyReservation(java.security.cert.X509Certificate __userCertificate)
          Creates an empty reservation and returns its reservation ID.
static java.lang.String createReservation(java.lang.String __query, java.security.cert.X509Certificate __userCertificate)
          Creates a reservation based on the JSDL query.
static java.lang.String createReservationExplicit(java.util.ArrayList<ReservationRequest> __requests, java.security.cert.X509Certificate __userCertificate)
          Creates a reservation based on the list of local allocation requests.
static java.lang.Integer detachJob(java.lang.String __reservationId, java.lang.String __jobId, java.security.cert.X509Certificate __userCertificate)
          Detach the job from the reservation.
static FreeSlots getAllFreeSlotsFor(CommunicationAddress __nodeAddress, java.lang.String __resourceID, java.security.cert.X509Certificate __userCert)
          Returns all free slots in a timetable for some metric on the node.
static FreeSlots getFreeSlotsFor(CommunicationAddress __nodeAddress, java.lang.String __resourceID, java.util.GregorianCalendar __from, java.util.GregorianCalendar __to, java.security.cert.X509Certificate __userCert)
          Returns all free slots for a given resource and time frame on the node.
static java.lang.String getReservationFromJob(java.lang.String __jobId, java.security.cert.X509Certificate __userCertificate)
          Query the reservation ID that a job is attached to.
static java.util.ArrayList<ReservationSlot> getReservationResources(java.lang.String __reservationId, java.security.cert.X509Certificate __userCertificate)
          Get the list of the resources and the related time constraints related to the reservation.
static java.lang.Boolean releaseReservation(java.lang.String __reservationId, java.security.cert.X509Certificate __userCertificate)
          Drop the reservation.
static java.lang.Boolean updateReservation(java.lang.String __reservationId, java.lang.String __query, java.security.cert.X509Certificate __userCertificate)
          Updates the reservation by adding the local reservations as discovered according to the JSDL query.
static java.lang.Boolean updateReservationExplicit(java.lang.String __reservationId, java.util.ArrayList<UpdateRequest> __requests, java.security.cert.X509Certificate __userCertificate)
          Update previously created reservations.
 
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

XReservationManager

public XReservationManager()
Method Detail

createEmptyReservation

public static java.lang.String createEmptyReservation(java.security.cert.X509Certificate __userCertificate)
                                               throws java.lang.Exception
Creates an empty reservation and returns its reservation ID.

Returns:
the new reservation ID.
Throws:
java.lang.Exception

createReservation

public static java.lang.String createReservation(java.lang.String __query,
                                                 java.security.cert.X509Certificate __userCertificate)
                                          throws java.lang.Exception
Creates a reservation based on the JSDL query.

Parameters:
query - The content of the JSDL document containing the job description and resource requirements.
userCertificate - The user that is making the reservation.
Returns:
The ID of the newly created reservation.
Throws:
java.lang.Exception - if the resource selection fails, if the resource selection yields a lower number of candidates than requested in the JSDL, if the selected nodes have no free slots

createReservationExplicit

public static java.lang.String createReservationExplicit(java.util.ArrayList<ReservationRequest> __requests,
                                                         java.security.cert.X509Certificate __userCertificate)
                                                  throws java.lang.Exception
Creates a reservation based on the list of local allocation requests. If any of the requests fail, the whole reservation fails.

Parameters:
requests - The collection of reservation requests directed at individual local requests.
userCertificate - The certificate of the user creating the reservation.
Returns:
The ID of the newly created reservation, or null if the reservation has failed.
Throws:
java.lang.Exception

updateReservation

public static java.lang.Boolean updateReservation(java.lang.String __reservationId,
                                                  java.lang.String __query,
                                                  java.security.cert.X509Certificate __userCertificate)
                                           throws java.lang.Exception
Updates the reservation by adding the local reservations as discovered according to the JSDL query. The reservation that is to be updated has to be empty.

Parameters:
reservationId - The ID of the reservation to update.
query - The JSDL query.
userCertificate - The certificate of the user performing the action.
Returns:
True if the reservation succeeds.
Throws:
java.lang.Exception - If the reservation doesn't exist, if the user cannot update the reservation (ownership), or if the reservation is not empty, if the resource selection fails, if the resource selection yields a lower number of candidates than requested in the JSDL, if the selected nodes have no free slots.

updateReservationExplicit

public static java.lang.Boolean updateReservationExplicit(java.lang.String __reservationId,
                                                          java.util.ArrayList<UpdateRequest> __requests,
                                                          java.security.cert.X509Certificate __userCertificate)
                                                   throws java.lang.Exception
Update previously created reservations.

Parameters:
reservationId -
requests -
userCertificate -
Returns:
Throws:
java.lang.Exception

releaseReservation

public static java.lang.Boolean releaseReservation(java.lang.String __reservationId,
                                                   java.security.cert.X509Certificate __userCertificate)
                                            throws java.lang.Exception
Drop the reservation. The method releases all the local allocations, then removes the reservation from the directory. If any of the allocations cannot be released, it keeps them in the directory, as well as the reservation Id, so that they can be released later.

Parameters:
reservationId - The ID of the reservation to be released.
userCertificate - The certificate of the user performing the action. If the parameter is null, the method will assert that the call came from a trusted service.
Returns:
True if the reservation has been fully released and the reservation ID removed from the directory. False if any of the local allocations could not be released.
Throws:
java.lang.Exception

attachJob

public static java.lang.Integer attachJob(java.lang.String __reservationId,
                                          java.lang.String __jobId,
                                          java.security.cert.X509Certificate __userCertificate)
                                   throws java.lang.Exception
Attach a job to the reservation.

Parameters:
reservationId - The ID of the reservation to attach the job to.
jobId - The ID of the job to be attached to the job.
userCertificate - The certificate of the user attempting the operation.
Returns:
Throws:
java.lang.Exception

detachJob

public static java.lang.Integer detachJob(java.lang.String __reservationId,
                                          java.lang.String __jobId,
                                          java.security.cert.X509Certificate __userCertificate)
                                   throws java.lang.Exception
Detach the job from the reservation.

Parameters:
reservationId - The ID of the reservation the job is to be detached from.
jobId - The ID of the job to be detached from the reservation.
userCertificate - The certificate of the user attempting the operation.
Returns:
Throws:
java.lang.Exception

getReservationFromJob

public static java.lang.String getReservationFromJob(java.lang.String __jobId,
                                                     java.security.cert.X509Certificate __userCertificate)
                                              throws java.lang.Exception
Query the reservation ID that a job is attached to.

Parameters:
jobId - The job ID we are querying the reservation of.
userCertificate - The certificate of the user attempting the action.
Returns:
Throws:
java.lang.Exception - if the user does not have access to the reservation.

getReservationResources

public static java.util.ArrayList<ReservationSlot> getReservationResources(java.lang.String __reservationId,
                                                                           java.security.cert.X509Certificate __userCertificate)
                                                                    throws java.lang.Exception
Get the list of the resources and the related time constraints related to the reservation.

Parameters:
reservationId - The ID of the reservation we are querying.
userCertificate - The certificate of the user attempting the operation.
Returns:
Throws:
java.lang.Exception

getAllFreeSlotsFor

public static FreeSlots getAllFreeSlotsFor(CommunicationAddress __nodeAddress,
                                           java.lang.String __resourceID,
                                           java.security.cert.X509Certificate __userCert)
                                    throws java.lang.Exception
Returns all free slots in a timetable for some metric on the node. The call performs the access rights check.

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(CommunicationAddress __nodeAddress,
                                        java.lang.String __resourceID,
                                        java.util.GregorianCalendar __from,
                                        java.util.GregorianCalendar __to,
                                        java.security.cert.X509Certificate __userCert)
                                 throws java.lang.Exception
Returns all free slots for a given resource and time frame on the node. The call performs the access rights check.

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