View Javadoc

1   package org.apache.continuum.taskqueue;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.continuum.utils.build.BuildTrigger;
23  import org.codehaus.plexus.taskqueue.TaskQueue;
24  import org.codehaus.plexus.taskqueue.TaskQueueException;
25  import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
26  
27  import java.util.List;
28  
29  /**
30   * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
31   */
32  public interface OverallBuildQueue
33  {
34      /**
35       * Returns the id of the "overall" build queue
36       *
37       * @return
38       */
39      int getId();
40  
41      void setId( int id );
42  
43      /**
44       * Returns the name of the "overall" build queue
45       *
46       * @return
47       */
48      String getName();
49  
50      void setName( String name );
51  
52      /* Checkout Queue */
53  
54      /**
55       * Returns the checkout queue.
56       *
57       * @return
58       */
59      TaskQueue getCheckoutQueue();
60  
61      /**
62       * Add checkout task to checkout queue.
63       *
64       * @param checkoutTask
65       * @throws TaskQueueException TODO
66       */
67      void addToCheckoutQueue( CheckOutTask checkoutTask )
68          throws TaskQueueException;
69  
70      /**
71       * Add checkout tasks to checkout queue.
72       *
73       * @param checkoutTasks
74       * @throws TaskQueueException TODO
75       */
76      void addToCheckoutQueue( List<CheckOutTask> checkoutTasks )
77          throws TaskQueueException;
78  
79      /**
80       * Get all checkout tasks in checkout queue.
81       *
82       * @return
83       * @throws TaskQueueException TODO
84       */
85      List<CheckOutTask> getProjectsInCheckoutQueue()
86          throws TaskQueueException;
87  
88      /**
89       * Check if the project is in the checkout queue.
90       *
91       * @param projectId
92       * @return
93       * @throws TaskQueueException TODO
94       */
95      boolean isInCheckoutQueue( int projectId )
96          throws TaskQueueException;
97  
98      /**
99       * Cancel checkout of project.
100      *
101      * @param projectId
102      * @throws TaskQueueException
103      */
104     void cancelCheckoutTask( int projectId )
105         throws TaskQueueException;
106 
107     /**
108      * Cancel current checkout.
109      *
110      * @return TODO
111      */
112     boolean cancelCurrentCheckout();
113 
114     /**
115      * Remove project from checkout queue.
116      *
117      * @param projectId
118      * @return
119      * @throws TaskQueueException TODO
120      */
121     boolean removeProjectFromCheckoutQueue( int projectId )
122         throws TaskQueueException;
123 
124     /**
125      * Remove the specified projects in the checkout queue.
126      *
127      * @param projectId
128      * @return
129      * @throws TaskQueueException TODO
130      */
131     boolean removeProjectsFromCheckoutQueue( int[] projectId )
132         throws TaskQueueException;
133 
134     /**
135      * @param hashCodes
136      * @throws TaskQueueException TODO
137      */
138     void removeTasksFromCheckoutQueueWithHashCodes( int[] hashCodes )
139         throws TaskQueueException;
140 
141     /* Prepare Build Queue */
142 
143     /**
144      * Returns the prepare build queue.
145      *
146      * @return
147      */
148     TaskQueue getPrepareBuildQueue();
149 
150     /**
151      * Add the prepare build task to the prepare build queue.
152      *
153      * @param prepareBuildTask
154      * @throws Exception
155      */
156     void addToPrepareBuildQueue( PrepareBuildProjectsTask prepareBuildTask )
157         throws TaskQueueException;
158 
159     /**
160      * Add the prepare build tasks to the prepare build queue.
161      *
162      * @param prepareBuildTasks
163      * @throws TaskQueueException TODO
164      */
165     void addToPrepareBuildQueue( List<PrepareBuildProjectsTask> prepareBuildTasks )
166         throws TaskQueueException;
167 
168     /**
169      * Returns the prepare build tasks in the prepare build queue.
170      *
171      * @return
172      * @throws TaskQueueException TODO
173      */
174     List<PrepareBuildProjectsTask> getProjectsInPrepareBuildQueue()
175         throws TaskQueueException;
176 
177     /**
178      * Checks if the specified project is in the prepare build queue.
179      *
180      * @param projectId
181      * @return
182      * @throws TaskQueueException TODO
183      */
184     boolean isInPrepareBuildQueue( int projectId )
185         throws TaskQueueException;
186 
187     /**
188      * Checks if the specified project group and scm root is in the prepare build queue.
189      *
190      * @param projectGroupId
191      * @param scmRootId
192      * @return
193      * @throws TaskQueueException
194      */
195     boolean isInPrepareBuildQueue( int projectGroupId, int scmRootId )
196         throws TaskQueueException;
197 
198     /**
199      * Checks if the specified project group and scm root is in the prepare build queue.
200      *
201      * @param projectGroupId
202      * @param scmRootAddress
203      * @return
204      * @throws TaskQueueException
205      */
206     boolean isInPrepareBuildQueue( int projectGroupId, String scmRootAddress )
207         throws TaskQueueException;
208 
209     /**
210      * Cancel the prepare build task of the corresponding project group and scm root.
211      *
212      * @param projectId
213      * @param scmRootId
214      */
215     void cancelPrepareBuildTask( int projectGroupId, int scmRootId );
216 
217     /**
218      * Cancel the prepare build task of the corresponding project
219      *
220      * @param projectId
221      */
222     void cancelPrepareBuildTask( int projectId );
223 
224     /**
225      * Cancel the current prepare build.
226      *
227      * @return
228      */
229     boolean cancelCurrentPrepareBuild();
230 
231     /**
232      * Remove the project group matching the specified id, and scm root id from the prepare build queue.
233      *
234      * @param projectGroupId
235      * @param scmRootId
236      * @return
237      * @throws TaskQueueException TODO
238      */
239     boolean removeProjectFromPrepareBuildQueue( int projectGroupId, int scmRootId )
240         throws TaskQueueException;
241 
242     /**
243      * Remove the project group matching the specified id and scm root address from the prepare build queue.
244      *
245      * @param projectId
246      * @param scmRootAddress
247      * @return
248      * @throws TaskQueueException TODO
249      */
250     boolean removeProjectFromPrepareBuildQueue( int projectGroupId, String scmRootAddress )
251         throws TaskQueueException;
252 
253     /**
254      * Remove the projects matching the specified hashcodes from the prepare build queue.
255      *
256      * @param hashCodes
257      * @throws TaskQueueException TODO
258      */
259     void removeProjectsFromPrepareBuildQueueWithHashCodes( int[] hashCodes )
260         throws TaskQueueException;
261 
262     /* Build Queue */
263 
264     /**
265      * Returns the build queue.
266      *
267      * @return
268      */
269     TaskQueue getBuildQueue();
270 
271     /**
272      * Add the build task to the build queue.
273      *
274      * @param buildTask
275      * @throws Exception
276      */
277     void addToBuildQueue( BuildProjectTask buildTask )
278         throws TaskQueueException;
279 
280     /**
281      * Add the build tasks to the build queue.
282      *
283      * @param buildTasks
284      * @throws TaskQueueException TODO
285      */
286     void addToBuildQueue( List<BuildProjectTask> buildTasks )
287         throws TaskQueueException;
288 
289     /**
290      * Returns the build tasks in the build queue.
291      *
292      * @return
293      * @throws TaskQueueException TODO
294      */
295     List<BuildProjectTask> getProjectsInBuildQueue()
296         throws TaskQueueException;
297 
298     /**
299      * Checks if the specified project is in the build queue.
300      *
301      * @param projectId
302      * @return
303      * @throws TaskQueueException TODO
304      */
305     boolean isInBuildQueue( int projectId )
306         throws TaskQueueException;
307 
308     /**
309      * Checks if the specified project with the specified build definition is in the build queue.
310      *
311      * @param projectId
312      * @param buildDefinitionId
313      * @return
314      * @throws TaskQueueException TODO
315      */
316     boolean isInBuildQueue( int projectId, int buildDefinitionId )
317         throws TaskQueueException;
318 
319     /**
320      * Cancel the build task of the corresponding project.
321      *
322      * @param projectId
323      */
324     void cancelBuildTask( int projectId );
325 
326     /**
327      * Cancel the current build.
328      *
329      * @return
330      */
331     boolean cancelCurrentBuild();
332 
333     /**
334      * Remove the project matching the specified id, name, build definition and trigger from the build queue.
335      *
336      * @param projectId
337      * @param buildDefinitionId
338      * @param buildTrigger
339      * @param projectName
340      * @param projectGroupId
341      * @return
342      * @throws TaskQueueException TODO
343      */
344     boolean removeProjectFromBuildQueue( int projectId, int buildDefinitionId, BuildTrigger buildTrigger,
345                                          String projectName, int projectGroupId )
346         throws TaskQueueException;
347 
348     /**
349      * Remove the specified project from the build queue.
350      *
351      * @param projectId
352      * @return
353      * @throws TaskQueueException TODO
354      */
355     boolean removeProjectFromBuildQueue( int projectId )
356         throws TaskQueueException;
357 
358     /**
359      * Remove the specified projects from the build queue.
360      *
361      * @param projectIds
362      * @return
363      * @throws TaskQueueException TODO
364      */
365     boolean removeProjectsFromBuildQueue( int[] projectIds )
366         throws TaskQueueException;
367 
368     /**
369      * Remove the projects matching the specified hashcodes from the build queue.
370      *
371      * @param hashCodes
372      * @throws TaskQueueException TODO
373      */
374     void removeProjectsFromBuildQueueWithHashCodes( int[] hashCodes )
375         throws TaskQueueException;
376 
377     /**
378      * Returns the build task queue executor used.
379      *
380      * @return
381      */
382     TaskQueueExecutor getBuildTaskQueueExecutor();
383 
384     /**
385      * Returns the checkout task queue executor used.
386      *
387      * @return
388      */
389     TaskQueueExecutor getCheckoutTaskQueueExecutor();
390 
391     /**
392      * Returns the prepare build task queue executor used.
393      *
394      * @return
395      */
396     TaskQueueExecutor getPrepareBuildTaskQueueExecutor();
397 }