View Javadoc

1   package org.apache.maven.continuum;
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.io.File;
23  import java.util.Collection;
24  import java.util.List;
25  import java.util.Map;
26  
27  import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
28  import org.apache.continuum.buildmanager.BuildsManager;
29  import org.apache.continuum.model.project.ProjectGroupSummary;
30  import org.apache.continuum.model.project.ProjectScmRoot;
31  import org.apache.continuum.model.release.ContinuumReleaseResult;
32  import org.apache.continuum.purge.ContinuumPurgeManager;
33  import org.apache.continuum.purge.PurgeConfigurationService;
34  import org.apache.continuum.release.distributed.manager.DistributedReleaseManager;
35  import org.apache.continuum.repository.RepositoryService;
36  import org.apache.continuum.taskqueue.manager.TaskQueueManager;
37  import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
38  import org.apache.maven.continuum.configuration.ConfigurationService;
39  import org.apache.maven.continuum.installation.InstallationService;
40  import org.apache.maven.continuum.model.project.BuildDefinition;
41  import org.apache.maven.continuum.model.project.BuildQueue;
42  import org.apache.maven.continuum.model.project.BuildResult;
43  import org.apache.maven.continuum.model.project.Project;
44  import org.apache.maven.continuum.model.project.ProjectGroup;
45  import org.apache.maven.continuum.model.project.ProjectNotifier;
46  import org.apache.maven.continuum.model.project.Schedule;
47  import org.apache.maven.continuum.model.scm.ChangeSet;
48  import org.apache.maven.continuum.profile.ProfileService;
49  import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
50  import org.apache.maven.continuum.release.ContinuumReleaseManager;
51  
52  /**
53   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
54   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
55   * @version $Id: Continuum.java 790386 2009-07-01 21:27:25Z evenisse $
56   */
57  public interface Continuum
58  {
59      String ROLE = Continuum.class.getName();
60  
61      // ----------------------------------------------------------------------
62      // Project Groups
63      // ----------------------------------------------------------------------
64  
65      public ProjectGroup getProjectGroup( int projectGroupId )
66          throws ContinuumException;
67  
68      public List<ProjectGroup> getAllProjectGroupsWithBuildDetails();
69  
70      public List<ProjectGroup> getAllProjectGroups();
71  
72      public ProjectGroup getProjectGroupByProjectId( int projectId )
73          throws ContinuumException;
74  
75      public Collection<Project> getProjectsInGroup( int projectGroupId )
76          throws ContinuumException;
77  
78      public Collection<Project> getProjectsInGroupWithDependencies( int projectGroupId )
79          throws ContinuumException;
80  
81      public void removeProjectGroup( int projectGroupId )
82          throws ContinuumException;
83  
84      public void addProjectGroup( ProjectGroup projectGroup )
85          throws ContinuumException;
86  
87      public ProjectGroup getProjectGroupWithProjects( int projectGroupId )
88          throws ContinuumException;
89  
90      public ProjectGroup getProjectGroupWithBuildDetails( int projectGroupId )
91          throws ContinuumException;
92  
93      public ProjectGroup getProjectGroupByGroupId( String groupId )
94          throws ContinuumException;
95  
96      public ProjectGroup getProjectGroupByGroupIdWithBuildDetails( String groupId )
97          throws ContinuumException;
98  
99      public List<ProjectGroup> getAllProjectGroupsWithRepository( int repositoryId );
100 
101     // ----------------------------------------------------------------------
102     // Project
103     // ----------------------------------------------------------------------
104 
105     void removeProject( int projectId )
106         throws ContinuumException;
107 
108 
109     /**
110      * @param projectId
111      * @throws ContinuumException
112      * @deprecated
113      */
114     @Deprecated
115     void checkoutProject( int projectId )
116         throws ContinuumException;
117 
118     Project getProject( int projectId )
119         throws ContinuumException;
120 
121     Project getProjectWithBuildDetails( int projectId )
122         throws ContinuumException;
123 
124     Collection<Project> getProjects()
125         throws ContinuumException;
126 
127     Collection<Project> getProjectsWithDependencies()
128         throws ContinuumException;
129 
130     BuildResult getLatestBuildResultForProject( int projectId );
131 
132     Map<Integer, BuildResult> getLatestBuildResults( int projectGroupId );
133 
134     Map<Integer, BuildResult> getBuildResultsInSuccess( int projectGroupId );
135 
136     Map<Integer, ProjectGroupSummary> getProjectsSummaryByGroups();
137 
138     // ----------------------------------------------------------------------
139     // Building
140     // ----------------------------------------------------------------------
141 
142     /**
143      * take a collection of projects and sort for order
144      *
145      * @param projects
146      * @return
147      */
148     List<Project> getProjectsInBuildOrder( Collection<Project> projects );
149 
150     void buildProjects()
151         throws ContinuumException;
152 
153     void buildProjectsWithBuildDefinition( List<Project> projects, List<BuildDefinition> bds )
154         throws ContinuumException;
155 
156     void buildProjectsWithBuildDefinition( List<Project> projects, int buildDefinitionId )
157         throws ContinuumException;
158 
159     void buildProjects( int trigger )
160         throws ContinuumException;
161 
162     void buildProjects( Schedule schedule )
163         throws ContinuumException;
164 
165     void buildProject( int projectId )
166         throws ContinuumException;
167 
168     void buildProject( int projectId, int trigger )
169         throws ContinuumException;
170 
171     void buildProjectWithBuildDefinition( int projectId, int buildDefinitionId )
172         throws ContinuumException;
173 
174     void buildProject( int projectId, int buildDefinitionId, int trigger )
175         throws ContinuumException;
176 
177     public void buildProjectGroup( int projectGroupId )
178         throws ContinuumException;
179 
180     public void buildProjectGroupWithBuildDefinition( int projectGroupId, int buildDefinitionId )
181         throws ContinuumException;
182 
183     // ----------------------------------------------------------------------
184     // Build information
185     // ----------------------------------------------------------------------
186 
187     BuildResult getBuildResult( int buildId )
188         throws ContinuumException;
189 
190     BuildResult getBuildResultByBuildNumber( int projectId, int buildNumber )
191         throws ContinuumException;
192 
193     String getBuildOutput( int projectId, int buildId )
194         throws ContinuumException;
195 
196     long getNbBuildResultsForProject( int projectId );
197 
198     Collection<BuildResult> getBuildResultsForProject( int projectId )
199         throws ContinuumException;
200 
201     List<ChangeSet> getChangesSinceLastSuccess( int projectId, int buildResultId )
202         throws ContinuumException;
203 
204     void removeBuildResult( int buildId )
205         throws ContinuumException;
206 
207     // ----------------------------------------------------------------------
208     // Projects
209     // ----------------------------------------------------------------------
210 
211     /**
212      * Add a project to the list of building projects (ant, shell,...)
213      *
214      * @param project        the project to add
215      * @param executorId     the id of an {@link org.apache.maven.continuum.execution.ContinuumBuildExecutor}, eg. <code>ant</code> or <code>shell</code>
216      * @param projectGroupId
217      * @return id of the project
218      * @throws ContinuumException
219      */
220     int addProject( Project project, String executorId, int projectGroupId )
221         throws ContinuumException;
222 
223     /**
224      * Add a project to the list of building projects (ant, shell,...)
225      *
226      * @param project        the project to add
227      * @param executorId     the id of an {@link org.apache.maven.continuum.execution.ContinuumBuildExecutor}, eg. <code>ant</code> or <code>shell</code>
228      * @param projectGroupId
229      * @return id of the project
230      * @throws ContinuumException
231      */
232     int addProject( Project project, String executorId, int projectGroupId, int buildDefintionTemplateId )
233         throws ContinuumException;
234 
235     /**
236      * Add a Maven 2 project to the list of projects.
237      *
238      * @param metadataUrl url of the pom.xml
239      * @return a holder with the projects, project groups and errors occurred during the project adding
240      * @throws ContinuumException
241      */
242     ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl )
243         throws ContinuumException;
244 
245     /**
246      * Add a Maven 2 project to the list of projects.
247      *
248      * @param metadataUrl   url of the pom.xml
249      * @param checkProtocol check if the protocol is allowed, use false if the pom is uploaded
250      * @return a holder with the projects, project groups and errors occurred during the project adding
251      * @throws ContinuumException
252      */
253     ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl, boolean checkProtocol )
254         throws ContinuumException;
255 
256     /**
257      * Add a Maven 2 project to the list of projects.
258      *
259      * @param metadataUrl    url of the pom.xml
260      * @param projectGroupId id of the project group to use
261      * @return a holder with the projects, project groups and errors occurred during the project adding
262      * @throws ContinuumException
263      */
264     ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl, int projectGroupId )
265         throws ContinuumException;
266 
267     /**
268      * Add a Maven 2 project to the list of projects.
269      *
270      * @param metadataUrl    url of the pom.xml
271      * @param projectGroupId id of the project group to use
272      * @param checkProtocol  check if the protocol is allowed, use false if the pom is uploaded
273      * @return a holder with the projects, project groups and errors occurred during the project adding
274      * @throws ContinuumException
275      */
276     ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl, int projectGroupId, boolean checkProtocol )
277         throws ContinuumException;
278 
279     /**
280      * Add a Maven 2 project to the list of projects.
281      *
282      * @param metadataUrl         url of the pom.xml
283      * @param projectGroupId      id of the project group to use
284      * @param checkProtocol       check if the protocol is allowed, use false if the pom is uploaded
285      * @param useCredentialsCache whether to use cached scm account credentials or not
286      * @return a holder with the projects, project groups and errors occurred during the project adding
287      * @throws ContinuumException
288      */
289     ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl, int projectGroupId, boolean checkProtocol,
290                                                        boolean useCredentialsCache )
291         throws ContinuumException;
292 
293 
294     /**
295      * Add a Maven 2 project to the list of projects.
296      *
297      * @param metadataUrl           url of the pom.xml
298      * @param projectGroupId        id of the project group to use
299      * @param checkProtocol         check if the protocol is allowed, use false if the pom is uploaded
300      * @param useCredentialsCache   whether to use cached scm account credentials or not
301      * @param loadRecursiveProjects if multi modules project record all projects (if false only root project added)
302      * @return a holder with the projects, project groups and errors occurred during the project adding
303      * @throws ContinuumException
304      */
305     public ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl, int projectGroupId,
306                                                               boolean checkProtocol, boolean useCredentialsCache,
307                                                               boolean loadRecursiveProjects )
308         throws ContinuumException;
309 
310     /**
311      * Add a Maven 2 project to the list of projects.
312      *
313      * @param metadataUrl              url of the pom.xml
314      * @param projectGroupId           id of the project group to use
315      * @param checkProtocol            check if the protocol is allowed, use false if the pom is uploaded
316      * @param useCredentialsCache      whether to use cached scm account credentials or not
317      * @param loadRecursiveProjects    if multi modules project record all projects (if false only root project added)
318      * @param buildDefintionTemplateId buildDefintionTemplateId
319      * @return a holder with the projects, project groups and errors occurred during the project adding
320      * @throws ContinuumException
321      */
322     public ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl, int projectGroupId,
323                                                               boolean checkProtocol, boolean useCredentialsCache,
324                                                               boolean loadRecursiveProjects,
325                                                               int buildDefintionTemplateId )
326         throws ContinuumException;
327 
328     /**
329      * Add a Maven 1 project to the list of projects.
330      *
331      * @param metadataUrl    url of the project.xml
332      * @param projectGroupId id of the project group to use
333      * @return a holder with the projects, project groups and errors occurred during the project adding
334      * @throws ContinuumException
335      */
336     ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl, int projectGroupId )
337         throws ContinuumException;
338 
339     /**
340      * Add a Maven 1 project to the list of projects.
341      *
342      * @param metadataUrl    url of the project.xml
343      * @param projectGroupId id of the project group to use
344      * @param checkProtocol  check if the protocol is allowed, use false if the pom is uploaded
345      * @return a holder with the projects, project groups and errors occurred during the project adding
346      * @throws ContinuumException
347      */
348     ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl, int projectGroupId, boolean checkProtocol )
349         throws ContinuumException;
350 
351     /**
352      * Add a Maven 2 project to the list of projects.
353      *
354      * @param metadataUrl         url of the pom.xml
355      * @param projectGroupId      id of the project group to use
356      * @param checkProtocol       check if the protocol is allowed, use false if the pom is uploaded
357      * @param useCredentialsCache whether to use cached scm account credentials or not
358      * @return a holder with the projects, project groups and errors occurred during the project adding
359      * @throws ContinuumException
360      */
361     ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl, int projectGroupId, boolean checkProtocol,
362                                                        boolean useCredentialsCache )
363         throws ContinuumException;
364 
365     ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl, int projectGroupId, boolean checkProtocol,
366                                                        boolean useCredentialsCache, int buildDefintionTemplateId )
367         throws ContinuumException;
368 
369     void updateProject( Project project )
370         throws ContinuumException;
371 
372     void updateProjectGroup( ProjectGroup projectGroup )
373         throws ContinuumException;
374 
375     Project getProjectWithCheckoutResult( int projectId )
376         throws ContinuumException;
377 
378     Project getProjectWithAllDetails( int projectId )
379         throws ContinuumException;
380 
381     Project getProjectWithBuilds( int projectId )
382         throws ContinuumException;
383 
384     // ----------------------------------------------------------------------
385     // Notification
386     // ----------------------------------------------------------------------
387 
388     ProjectNotifier getNotifier( int projectId, int notifierId )
389         throws ContinuumException;
390 
391     ProjectNotifier updateNotifier( int projectId, ProjectNotifier notifier )
392         throws ContinuumException;
393 
394     ProjectNotifier addNotifier( int projectId, ProjectNotifier notifier )
395         throws ContinuumException;
396 
397     void removeNotifier( int projectId, int notifierId )
398         throws ContinuumException;
399 
400     ProjectNotifier getGroupNotifier( int projectGroupId, int notifierId )
401         throws ContinuumException;
402 
403     ProjectNotifier updateGroupNotifier( int projectGroupId, ProjectNotifier notifier )
404         throws ContinuumException;
405 
406     ProjectNotifier addGroupNotifier( int projectGroupId, ProjectNotifier notifier )
407         throws ContinuumException;
408 
409     void removeGroupNotifier( int projectGroupId, int notifierId )
410         throws ContinuumException;
411 
412     // ----------------------------------------------------------------------
413     // Build Definition
414     // ----------------------------------------------------------------------
415 
416     /**
417      * @deprecated
418      */
419     @Deprecated
420     List<BuildDefinition> getBuildDefinitions( int projectId )
421         throws ContinuumException;
422 
423     /**
424      * @deprecated
425      */
426     @Deprecated
427     BuildDefinition getBuildDefinition( int projectId, int buildDefinitionId )
428         throws ContinuumException;
429 
430     /**
431      * @deprecated
432      */
433     @Deprecated
434     void removeBuildDefinition( int projectId, int buildDefinitionId )
435         throws ContinuumException;
436 
437     /**
438      * returns the build definition from either the project or the project group it is a part of
439      *
440      * @param buildDefinitionId
441      * @return
442      */
443     BuildDefinition getBuildDefinition( int buildDefinitionId )
444         throws ContinuumException;
445 
446     /**
447      * returns the default build definition for the project
448      * <p/>
449      * 1) if project has default build definition, return that
450      * 2) otherwise return default build definition for parent project group
451      *
452      * @param projectId
453      * @return
454      * @throws ContinuumException
455      */
456     BuildDefinition getDefaultBuildDefinition( int projectId )
457         throws ContinuumException;
458 
459     public List<BuildDefinition> getDefaultBuildDefinitionsForProjectGroup( int projectGroupId )
460         throws ContinuumException;
461 
462     BuildDefinition addBuildDefinitionToProject( int projectId, BuildDefinition buildDefinition )
463         throws ContinuumException;
464 
465     BuildDefinition addBuildDefinitionToProjectGroup( int projectGroupId, BuildDefinition buildDefinition )
466         throws ContinuumException;
467 
468     List<BuildDefinition> getBuildDefinitionsForProject( int projectId )
469         throws ContinuumException;
470 
471     List<BuildDefinition> getBuildDefinitionsForProjectGroup( int projectGroupId )
472         throws ContinuumException;
473 
474     void removeBuildDefinitionFromProject( int projectId, int buildDefinitionId )
475         throws ContinuumException;
476 
477     void removeBuildDefinitionFromProjectGroup( int projectGroupId, int buildDefinitionId )
478         throws ContinuumException;
479 
480     BuildDefinition updateBuildDefinitionForProject( int projectId, BuildDefinition buildDefinition )
481         throws ContinuumException;
482 
483     BuildDefinition updateBuildDefinitionForProjectGroup( int projectGroupId, BuildDefinition buildDefinition )
484         throws ContinuumException;
485 
486     // ----------------------------------------------------------------------
487     // Schedule
488     // ----------------------------------------------------------------------
489 
490     Schedule getScheduleByName( String scheduleName )
491         throws ContinuumException;
492 
493     Schedule getSchedule( int id )
494         throws ContinuumException;
495 
496     Collection<Schedule> getSchedules()
497         throws ContinuumException;
498 
499     void addSchedule( Schedule schedule )
500         throws ContinuumException;
501 
502     void updateSchedule( Schedule schedule )
503         throws ContinuumException;
504 
505     void updateSchedule( int scheduleId, Map<String, String> configuration )
506         throws ContinuumException;
507 
508     void removeSchedule( int scheduleId )
509         throws ContinuumException;
510 
511     void activePurgeSchedule( Schedule schedule );
512 
513     void activeBuildDefinitionSchedule( Schedule schedule );
514 
515     // ----------------------------------------------------------------------
516     // Working copy
517     // ----------------------------------------------------------------------
518 
519     File getWorkingDirectory( int projectId )
520         throws ContinuumException;
521 
522     String getFileContent( int projectId, String directory, String filename )
523         throws ContinuumException;
524 
525     List<File> getFiles( int projectId, String currentDirectory )
526         throws ContinuumException;
527 
528     // ----------------------------------------------------------------------
529     // Configuration
530     // ----------------------------------------------------------------------
531 
532     ConfigurationService getConfiguration();
533 
534     void reloadConfiguration()
535         throws ContinuumException;
536 
537     // ----------------------------------------------------------------------
538     // Continuum Release
539     // ----------------------------------------------------------------------
540     ContinuumReleaseManager getReleaseManager();
541 
542     // ----------------------------------------------------------------------
543     // Installation
544     // ----------------------------------------------------------------------    
545 
546     InstallationService getInstallationService();
547 
548     ProfileService getProfileService();
549 
550     BuildDefinitionService getBuildDefinitionService();
551 
552     // ----------------------------------------------------------------------
553     // Continuum Purge
554     // ----------------------------------------------------------------------
555     ContinuumPurgeManager getPurgeManager();
556 
557     PurgeConfigurationService getPurgeConfigurationService();
558 
559     // ----------------------------------------------------------------------
560     // Repository Service
561     // ----------------------------------------------------------------------
562     RepositoryService getRepositoryService();
563 
564     // ----------------------------------------------------------------------
565     //
566     // ----------------------------------------------------------------------
567     List<ProjectScmRoot> getProjectScmRootByProjectGroup( int projectGroupId );
568 
569     ProjectScmRoot getProjectScmRoot( int projectScmRootId )
570         throws ContinuumException;
571 
572     ProjectScmRoot getProjectScmRootByProject( int projectId )
573         throws ContinuumException;
574 
575     ProjectScmRoot getProjectScmRootByProjectGroupAndScmRootAddress( int projectGroupId, String scmRootAddress )
576         throws ContinuumException;
577 
578     // ----------------------------------------------------------------------
579     // Task Queue Manager
580     // ----------------------------------------------------------------------
581     TaskQueueManager getTaskQueueManager();
582 
583     // ----------------------------------------------------------------------
584     // Builds Manager
585     // ----------------------------------------------------------------------
586     BuildsManager getBuildsManager();
587 
588     // ----------------------------------------------------------------------
589     // Build Queue
590     // ----------------------------------------------------------------------
591 
592     BuildQueue addBuildQueue( BuildQueue buildQueue )
593         throws ContinuumException;
594 
595     BuildQueue getBuildQueue( int buildQueueId )
596         throws ContinuumException;
597 
598     BuildQueue getBuildQueueByName( String buildQueueName )
599         throws ContinuumException;
600 
601     void removeBuildQueue( BuildQueue buildQueue )
602         throws ContinuumException;
603 
604     BuildQueue storeBuildQueue( BuildQueue buildQueue )
605         throws ContinuumException;
606 
607     List<BuildQueue> getAllBuildQueues()
608         throws ContinuumException;
609 
610     public void startup()
611         throws ContinuumException;
612 
613     ContinuumReleaseResult addContinuumReleaseResult( ContinuumReleaseResult releaseResult )
614         throws ContinuumException;
615 
616     void removeContinuumReleaseResult( int releaseResultId )
617         throws ContinuumException;
618 
619     ContinuumReleaseResult getContinuumReleaseResult( int releaseResultId )
620         throws ContinuumException;
621 
622     List<ContinuumReleaseResult> getContinuumReleaseResultsByProjectGroup( int projectGroupId );
623 
624     List<ContinuumReleaseResult> getAllContinuumReleaseResults();
625 
626     ContinuumReleaseResult getContinuumReleaseResult( int projectId, String releaseGoal, long startTime, long endTime )
627         throws ContinuumException;
628 
629     String getReleaseOutput( int releaseResultId )
630         throws ContinuumException;
631 
632     DistributedBuildManager getDistributedBuildManager();
633 
634     DistributedReleaseManager getDistributedReleaseManager();
635 }