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 java.util.List;
23  
24  import org.codehaus.plexus.taskqueue.TaskQueue;
25  import org.codehaus.plexus.taskqueue.TaskQueueException;
26  import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
27  
28  /**
29   * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
30   */
31  public interface OverallBuildQueue
32  {
33      /**
34       * Returns the id of the "overall" build queue
35       *
36       * @return
37       */
38      int getId();
39  
40      void setId( int id );
41  
42      /**
43       * Returns the name of the "overall" build queue
44       *
45       * @return
46       */
47      String getName();
48  
49      void setName( String name );
50  
51      /* Checkout Queue */
52  
53      /**
54       * Returns the checkout queue.
55       *
56       * @return
57       */
58      TaskQueue getCheckoutQueue();
59  
60      /**
61       * Add checkout task to checkout queue.
62       *
63       * @param checkoutTask
64       * @throws TaskQueueException TODO
65       */
66      void addToCheckoutQueue( CheckOutTask checkoutTask )
67          throws TaskQueueException;
68  
69      /**
70       * Add checkout tasks to checkout queue.
71       *
72       * @param checkoutTasks
73       * @throws TaskQueueException TODO
74       */
75      void addToCheckoutQueue( List<CheckOutTask> checkoutTasks )
76          throws TaskQueueException;
77  
78      /**
79       * Get all checkout tasks in checkout queue.
80       *
81       * @return
82       * @throws TaskQueueException TODO
83       */
84      List<CheckOutTask> getProjectsInCheckoutQueue()
85          throws TaskQueueException;
86  
87      /**
88       * Check if the project is in the checkout queue.
89       *
90       * @param projectId
91       * @return
92       * @throws TaskQueueException TODO
93       */
94      boolean isInCheckoutQueue( int projectId )
95          throws TaskQueueException;
96  
97      /**
98       * Cancel checkout of project.
99       *
100      * @param projectId
101      * @throws TaskQueueException
102      */
103     void cancelCheckoutTask( int projectId )
104         throws TaskQueueException;
105 
106     /**
107      * Cancel current checkout.
108      *
109      * @return TODO
110      */
111     boolean cancelCurrentCheckout();
112 
113     /**
114      * Remove project from checkout queue.
115      *
116      * @param projectId
117      * @return
118      * @throws TaskQueueException TODO
119      */
120     boolean removeProjectFromCheckoutQueue( int projectId )
121         throws TaskQueueException;
122 
123     /**
124      * Remove the specified projects in the checkout queue.
125      *
126      * @param projectId
127      * @return
128      * @throws TaskQueueException TODO
129      */
130     boolean removeProjectsFromCheckoutQueue( int[] projectId )
131         throws TaskQueueException;
132 
133     /**
134      * @param hashCodes
135      * @throws TaskQueueException TODO
136      */
137     void removeTasksFromCheckoutQueueWithHashCodes( int[] hashCodes )
138         throws TaskQueueException;
139 
140     /* Build Queue */
141 
142     /**
143      * Returns the build queue.
144      *
145      * @return
146      */
147     TaskQueue getBuildQueue();
148 
149     /**
150      * Add the build task to the build queue.
151      *
152      * @param buildTask
153      * @throws Exception
154      */
155     void addToBuildQueue( BuildProjectTask buildTask )
156         throws TaskQueueException;
157 
158     /**
159      * Add the build tasks to the build queue.
160      *
161      * @param buildTasks
162      * @throws TaskQueueException TODO
163      */
164     void addToBuildQueue( List<BuildProjectTask> buildTasks )
165         throws TaskQueueException;
166 
167     /**
168      * Returns the build tasks in the build queue.
169      *
170      * @return
171      * @throws TaskQueueException TODO
172      */
173     List<BuildProjectTask> getProjectsInBuildQueue()
174         throws TaskQueueException;
175 
176     /**
177      * Checks if the specified project is in the build queue.
178      *
179      * @param projectId
180      * @return
181      * @throws TaskQueueException TODO
182      */
183     boolean isInBuildQueue( int projectId )
184         throws TaskQueueException;
185 
186     /**
187      * Checks if the specified project with the specified build definition is in the build queue.
188      *
189      * @param projectId
190      * @param buildDefinitionId
191      * @return
192      * @throws TaskQueueException TODO
193      */
194     boolean isInBuildQueue( int projectId, int buildDefinitionId )
195         throws TaskQueueException;
196 
197     /**
198      * Cancel the build task of the corresponding project.
199      *
200      * @param projectId
201      */
202     void cancelBuildTask( int projectId );
203 
204     /**
205      * Cancel the current build.
206      *
207      * @return
208      */
209     boolean cancelCurrentBuild();
210 
211     /**
212      * Remove the project matching the specified id, name, build definition and trigger from the build queue.
213      *
214      * @param projectId
215      * @param buildDefinitionId
216      * @param trigger
217      * @param projectName
218      * @param projectGroupId
219      * @return
220      * @throws TaskQueueException TODO
221      */
222     boolean removeProjectFromBuildQueue( int projectId, int buildDefinitionId, int trigger, String projectName,
223                                          int projectGroupId )
224         throws TaskQueueException;
225 
226     /**
227      * Remove the specified project from the build queue.
228      *
229      * @param projectId
230      * @return
231      * @throws TaskQueueException TODO
232      */
233     boolean removeProjectFromBuildQueue( int projectId )
234         throws TaskQueueException;
235 
236     /**
237      * Remove the specified projects from the build queue.
238      *
239      * @param projectIds
240      * @return
241      * @throws TaskQueueException TODO
242      */
243     boolean removeProjectsFromBuildQueue( int[] projectIds )
244         throws TaskQueueException;
245 
246     /**
247      * Remove the projects matching the specified hashcodes from the build queue.
248      *
249      * @param hashCodes
250      * @throws TaskQueueException TODO
251      */
252     void removeProjectsFromBuildQueueWithHashCodes( int[] hashCodes )
253         throws TaskQueueException;
254 
255     /**
256      * Returns the build task queue executor used.
257      *
258      * @return
259      */
260     TaskQueueExecutor getBuildTaskQueueExecutor();
261 
262     /**
263      * Returns the checkout task queue executor used.
264      *
265      * @return
266      */
267     TaskQueueExecutor getCheckoutTaskQueueExecutor();
268 }