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