[104] | 1 | package test.rewolucja.reservation; |
---|
| 2 | |
---|
| 3 | import java.util.List; |
---|
| 4 | |
---|
| 5 | import schedframe.exceptions.ModuleException; |
---|
| 6 | import schedframe.exceptions.NotAuthorizedException; |
---|
| 7 | import schedframe.exceptions.PermanentException; |
---|
| 8 | import schedframe.exceptions.ReservationException; |
---|
| 9 | import schedframe.resources.ResourceProvider; |
---|
| 10 | import schedframe.scheduling.AbstractResourceRequirements; |
---|
| 11 | import schedframe.scheduling.AbstractTimeRequirements; |
---|
| 12 | import schedframe.scheduling.Offer; |
---|
| 13 | import schedframe.scheduling.Reservation; |
---|
| 14 | import schedframe.scheduling.ResourceUsage; |
---|
| 15 | import schedframe.scheduling.SecurityContextInterface; |
---|
| 16 | import schedframe.scheduling.TimeResourceAllocation; |
---|
| 17 | import schedframe.scheduling.plugin.grid.Module; |
---|
| 18 | |
---|
| 19 | public interface ReservationManagerNew extends Module { |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | /* Methods related to getting information about available resources and negotiating offers of resource providers */ |
---|
| 23 | |
---|
| 24 | /** |
---|
| 25 | * @throws PermanentException TODO |
---|
| 26 | * @throws NotAuthorizedException TODO |
---|
| 27 | * Gets offers from all resource providers according to the time and resource requirements |
---|
| 28 | * @param timeRequirements |
---|
| 29 | * @param resourceRequirements |
---|
| 30 | * @return list of offers from all resource providers |
---|
| 31 | * @throws |
---|
| 32 | */ |
---|
| 33 | public List<Offer> getOffer(AbstractTimeRequirements<?> timeRequirements, |
---|
| 34 | AbstractResourceRequirements<?> resourceRequirements, |
---|
| 35 | SecurityContextInterface securityContext) |
---|
| 36 | throws ReservationException, NotAuthorizedException, PermanentException; |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | /** |
---|
| 40 | * @throws PermanentException TODO |
---|
| 41 | * @throws NotAuthorizedException TODO |
---|
| 42 | * Gets offer from a given resource provider according to the time and resource requirements |
---|
| 43 | * @param provider description of the specific provider |
---|
| 44 | * @param timeRequirements time constraints |
---|
| 45 | * @param resourceRequirements resource requirements |
---|
| 46 | * @return Offer proposed by provider |
---|
| 47 | * @throws |
---|
| 48 | */ |
---|
| 49 | public Offer getOffer(String resourceName, |
---|
| 50 | AbstractTimeRequirements<?> timeRequirements, |
---|
| 51 | AbstractResourceRequirements<?> resourceRequirements, |
---|
| 52 | SecurityContextInterface securityContext) |
---|
| 53 | throws ReservationException, NotAuthorizedException, PermanentException; |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | /* Methods related to managing reservations */ |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | /** |
---|
| 60 | * @throws PermanentException TODO |
---|
| 61 | * @throws NotAuthorizedException TODO |
---|
| 62 | * Creates reservation according to the time and resource requirements for all providers |
---|
| 63 | * @param timeRequirements time constraints |
---|
| 64 | * @param resourceRequirements resource requirements |
---|
| 65 | * @return Depends on the implementation of local system, this may be list of |
---|
| 66 | * final reservations which are ready to be used or list of initial reservations |
---|
| 67 | * which must by committed to reach final status. |
---|
| 68 | * @throws |
---|
| 69 | */ |
---|
| 70 | public List<ReservationNew> createReservation(AbstractTimeRequirements<?> timeRequirements, |
---|
| 71 | AbstractResourceRequirements<?> resourceRequirements, |
---|
| 72 | SecurityContextInterface securityContext) |
---|
| 73 | throws ReservationException, NotAuthorizedException, PermanentException; |
---|
| 74 | |
---|
| 75 | /** |
---|
| 76 | * @throws PermanentException TODO |
---|
| 77 | * @throws NotAuthorizedException TODO |
---|
| 78 | * Creates reservation according to the time and resource requirements |
---|
| 79 | * only for given resource provider |
---|
| 80 | * @param provider |
---|
| 81 | * @param timeRequirements time constraints |
---|
| 82 | * @param resourceRequirements resource requirements |
---|
| 83 | * @return Depends on the implementation of local system, this may be |
---|
| 84 | * final reservation which is ready to be used or initial reservation |
---|
| 85 | * which must by committed to reach final status. |
---|
| 86 | * @throws |
---|
| 87 | */ |
---|
| 88 | public ReservationNew createReservation(ResourceProvider provider, |
---|
| 89 | AbstractTimeRequirements<?> timeRequirements, |
---|
| 90 | AbstractResourceRequirements<?> resourceRequirements, |
---|
| 91 | List<String> hostCandidates, |
---|
| 92 | SecurityContextInterface securityContext) |
---|
| 93 | throws ReservationException, NotAuthorizedException, PermanentException; |
---|
| 94 | |
---|
| 95 | /** |
---|
| 96 | * @throws PermanentException TODO |
---|
| 97 | * @throws NotAuthorizedException TODO |
---|
| 98 | * Create reservation according to the resource usage description. Resource usage may contain |
---|
| 99 | * more then one time interval, so for each time interval different reservation must be created. |
---|
| 100 | * |
---|
| 101 | * @param resourceUsage description of resource units which should be reserved |
---|
| 102 | * The Offer returned by getOffers() method may be used as an argument. |
---|
| 103 | * @return Depends on implementation of local system, list of reservations may contain final reservations |
---|
| 104 | * which are ready to be used or initial reservations which must by committed to reach final status. |
---|
| 105 | * @throws |
---|
| 106 | */ |
---|
| 107 | public List<ReservationNew> createReservation(ResourceUsage resourceUsage, |
---|
| 108 | SecurityContextInterface securityContext) |
---|
| 109 | throws ReservationException, NotAuthorizedException, PermanentException; |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | /** |
---|
| 113 | * Requests a provider to commit a reservation. |
---|
| 114 | * @param reservation |
---|
| 115 | * @return reservation if the reservation has been accepted |
---|
| 116 | * @throws NotAuthorizedException TODO |
---|
| 117 | * @throws PermanentException TODO |
---|
| 118 | * @throws Exception if the reservation can not be committed. The exception should |
---|
| 119 | * explain detail cause of commit failure. |
---|
| 120 | */ |
---|
| 121 | public ReservationNew commitReservation(ReservationNew reservation, |
---|
| 122 | SecurityContextInterface securityContext) |
---|
| 123 | throws ReservationException, NotAuthorizedException, PermanentException; |
---|
| 124 | |
---|
| 125 | /** |
---|
| 126 | * Requests a provider to commit a reservation for a part of initially reserved resources. |
---|
| 127 | * @param reservation - initial reservation |
---|
| 128 | * @param resourceUsage - resources and time interval. This express modification of the |
---|
| 129 | * reservation which must be performed before reservation commit. |
---|
| 130 | * @return reservation if the reservation has been accepted by a provider |
---|
| 131 | * @throws NotAuthorizedException TODO |
---|
| 132 | * @throws PermanentException TODO |
---|
| 133 | * @throws Execption if the reservation can not be committed. The exception should |
---|
| 134 | * explain detail cause of commit failure. |
---|
| 135 | */ |
---|
| 136 | public ReservationNew commitReservation(ReservationNew reservation, |
---|
| 137 | TimeResourceAllocation resourceUsage, |
---|
| 138 | SecurityContextInterface securityContext) |
---|
| 139 | throws ReservationException, NotAuthorizedException, PermanentException; |
---|
| 140 | |
---|
| 141 | /** |
---|
| 142 | * Requests a provider to modify a reservation |
---|
| 143 | * @param reservation |
---|
| 144 | * @param resourceUsage - resource and time interval to be reserved. This express |
---|
| 145 | * expected modifications of the reserved resource. |
---|
| 146 | * @throws NotAuthorizedException TODO |
---|
| 147 | * @throws PermanentException TODO |
---|
| 148 | * @throws Exception if modification of the reservation was not possible. The exception |
---|
| 149 | * should describe detail cause of the modification failure. |
---|
| 150 | */ |
---|
| 151 | public void modifyReservation(ReservationNew reservation, |
---|
| 152 | TimeResourceAllocation resourceUsage, |
---|
| 153 | SecurityContextInterface securityContext) |
---|
| 154 | throws ReservationException, NotAuthorizedException, PermanentException; |
---|
| 155 | |
---|
| 156 | /** |
---|
| 157 | * @throws PermanentException TODO |
---|
| 158 | * @throws NotAuthorizedException TODO |
---|
| 159 | * Cancels reservation |
---|
| 160 | * @param provider - provider which holds the reservation |
---|
| 161 | * @param reservID - reservation identifier |
---|
| 162 | * @throws |
---|
| 163 | */ |
---|
| 164 | public void cancelReservation(ReservationNew reservation, |
---|
| 165 | SecurityContextInterface securityContext) |
---|
| 166 | throws ReservationException, NotAuthorizedException, PermanentException; |
---|
| 167 | |
---|
| 168 | /** |
---|
| 169 | * @throws PermanentException TODO |
---|
| 170 | * @throws NotAuthorizedException TODO |
---|
| 171 | * Returns status of reservation |
---|
| 172 | * @param reservation |
---|
| 173 | * @return a reservation status ({@link schedframe.implementation.Reservation}) |
---|
| 174 | * @throws |
---|
| 175 | */ |
---|
| 176 | public int checkStatus(ReservationNew reservation, |
---|
| 177 | SecurityContextInterface securityContext) |
---|
| 178 | throws ReservationException, NotAuthorizedException, PermanentException; |
---|
| 179 | |
---|
| 180 | /** |
---|
| 181 | * Verifies if this reservation manager can accomplish its functionality |
---|
| 182 | * with resource provider. |
---|
| 183 | * @param provider to be verified |
---|
| 184 | * @return true if reservation manager support this provider, false otherwise |
---|
| 185 | */ |
---|
| 186 | public boolean supportProvider(ResourceProvider provider) throws ModuleException; |
---|
| 187 | |
---|
| 188 | } |
---|