View Javadoc

1   package org.apache.continuum.buildagent;
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  import java.util.Map;
24  import java.util.Properties;
25  
26  public interface ContinuumBuildAgentService
27  {
28      void buildProjects( List<Map<String, Object>> projectsBuildContext )
29          throws ContinuumBuildAgentException;
30  
31      List<Map<String, String>> getAvailableInstallations()
32          throws ContinuumBuildAgentException;
33  
34      Map<String, Object> getBuildResult( int projectId )
35          throws ContinuumBuildAgentException;
36  
37      Map<String, Object> getProjectCurrentlyBuilding()
38          throws ContinuumBuildAgentException;
39  
40      void cancelBuild()
41          throws ContinuumBuildAgentException;
42  
43      String generateWorkingCopyContent( int projectId, String userDirectory, String baseUrl, String imagesBaseUrl )
44          throws ContinuumBuildAgentException;
45  
46      Map<String, Object> getProjectFile( int projectId, String directory, String filename )
47          throws ContinuumBuildAgentException;
48  
49      Map<String, Object> getReleasePluginParameters( int projectId, String pomFilename )
50          throws ContinuumBuildAgentException;
51  
52      List<Map<String, String>> processProject( int projectId, String pomFilename, boolean autoVersionSubmodules )
53          throws ContinuumBuildAgentException;
54  
55      String releasePrepare( Map project, Properties properties, Map releaseVersion, Map developmentVersion,
56                             Map<String, String> environments, String username )
57          throws ContinuumBuildAgentException;
58  
59      Map<String, Object> getReleaseResult( String releaseId )
60          throws ContinuumBuildAgentException;
61  
62      Map<String, Object> getListener( String releaseId )
63          throws ContinuumBuildAgentException;
64  
65      void removeListener( String releaseId )
66          throws ContinuumBuildAgentException;
67  
68      String getPreparedReleaseName( String releaseId )
69          throws ContinuumBuildAgentException;
70  
71      void releasePerform( String releaseId, String goals, String arguments, boolean useReleaseProfile, Map repository,
72                           String username )
73          throws ContinuumBuildAgentException;
74  
75      String releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile, Map repository,
76                                    String scmUrl, String scmUsername, String scmPassword, String scmTag,
77                                    String scmTagBase, Map<String, String> environments, String username )
78          throws ContinuumBuildAgentException;
79  
80      String releaseCleanup( String releaseId )
81          throws ContinuumBuildAgentException;
82  
83      void releaseRollback( String releaseId, int projectId )
84          throws ContinuumBuildAgentException;
85  
86      List<Map<String, Object>> getProjectsInPrepareBuildQueue()
87          throws ContinuumBuildAgentException;
88  
89      List<Map<String, Object>> getProjectsAndBuildDefinitionsInPrepareBuildQueue()
90          throws ContinuumBuildAgentException;
91  
92      List<Map<String, Object>> getProjectsInBuildQueue()
93          throws ContinuumBuildAgentException;
94  
95      int getBuildSizeOfAgent()
96          throws ContinuumBuildAgentException;
97  
98      Map<String, Object> getProjectCurrentlyPreparingBuild()
99          throws ContinuumBuildAgentException;
100 
101     List<Map<String, Object>> getProjectsAndBuildDefinitionsCurrentlyPreparingBuild()
102         throws ContinuumBuildAgentException;
103 
104     boolean isProjectGroupInQueue( int projectGroupId );
105 
106     boolean isProjectScmRootInQueue( int projectScmRootId, List<Integer> projectIds );
107 
108     boolean isProjectCurrentlyBuilding( int projectId, int buildDefinitionId );
109 
110     boolean isProjectInBuildQueue( int projectId, int buildDefinitionId );
111 
112     boolean isProjectGroupInPrepareBuildQueue( int projectGroupId );
113 
114     boolean isProjectGroupCurrentlyPreparingBuild( int projectGroupId );
115 
116     boolean isProjectInPrepareBuildQueue( int projectId, int buildDefinitionId );
117 
118     boolean isProjectCurrentlyPreparingBuild( int projectId, int buildDefinitionId );
119 
120     boolean removeFromPrepareBuildQueue( int projectGroupId, int scmRootId )
121         throws ContinuumBuildAgentException;
122 
123     void removeFromPrepareBuildQueue( List<String> hashCodes )
124         throws ContinuumBuildAgentException;
125 
126     boolean removeFromBuildQueue( int projectId, int builddefinitonId )
127         throws ContinuumBuildAgentException;
128 
129     void removeFromBuildQueue( List<String> hashCodes )
130         throws ContinuumBuildAgentException;
131 
132     boolean ping()
133         throws ContinuumBuildAgentException;
134 
135     /**
136      * Get build agent's platform.
137      *
138      * @return The operating system name of the build agent
139      * @throws Exception
140      */
141     String getBuildAgentPlatform()
142         throws ContinuumBuildAgentException;
143 
144     /**
145      * Determines if build agent is currently executing a build
146      *
147      * @return true if executing build; false otherwise
148      */
149     boolean isExecutingBuild();
150 
151     /**
152      * Determines if build agent is currently executing a release
153      *
154      * @return true if executing release; false otherwise
155      * @throws ContinuumBuildAgentException if unable to determine if buildagent is executing a release
156      */
157     boolean isExecutingRelease()
158         throws ContinuumBuildAgentException;
159 
160     /**
161      * Execute a directory purge on the build agent
162      *
163      * @param directoryType  valid types are <i>working</i> and <i>releases</i>
164      * @param daysOlder      days older
165      * @param retentionCount retention count
166      * @param deleteAll      delete all flag
167      * @return true if purge is successful; false otherwise
168      * @throws ContinuumBuildAgentException error that will occur during the purge
169      */
170     void executeDirectoryPurge( String directoryType, int daysOlder, int retentionCount, boolean deleteAll )
171         throws ContinuumBuildAgentException;
172 
173 }