1 package org.apache.maven.continuum.release;
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.model.release.ReleaseListenerSummary;
23 import org.apache.continuum.model.repository.LocalRepository;
24 import org.apache.continuum.taskqueue.manager.TaskQueueManagerException;
25 import org.apache.maven.continuum.model.project.Project;
26 import org.apache.maven.shared.release.config.ReleaseDescriptor;
27 import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
28
29 import java.io.File;
30 import java.util.Map;
31 import java.util.Properties;
32
33 /**
34 * The Continuum Release Manager is responsible for performing releases based on a release descriptor
35 * that has been received by the Maven Release Plugin.
36 *
37 * @author Jason van Zyl
38 * @version $Id: ContinuumReleaseManager.java 1392390 2012-10-01 15:25:24Z brett $
39 */
40 public interface ContinuumReleaseManager
41 {
42 String ROLE = ContinuumReleaseManager.class.getName();
43
44 /**
45 * Prepare a project for release
46 *
47 * @param project
48 * @param releaseProperties
49 * @param releaseVersions
50 * @param developmentVersions
51 * @param listener
52 * @param workingDirectory
53 * @return
54 * @throws ContinuumReleaseException
55 */
56 String prepare( Project project, Properties releaseProperties, Map<String, String> releaseVersions,
57 Map<String, String> developmentVersions, ContinuumReleaseManagerListener listener,
58 String workingDirectory )
59 throws ContinuumReleaseException;
60
61 /**
62 * Prepare a project for release
63 *
64 * @param project
65 * @param releaseProperties
66 * @param releaseVersions
67 * @param developmentVersions
68 * @param listener
69 * @param workingDirectory
70 * @param environments
71 * @param executable
72 * @return
73 * @throws ContinuumReleaseException
74 */
75 String prepare( Project project, Properties releaseProperties, Map<String, String> releaseVersions,
76 Map<String, String> developmentVersions, ContinuumReleaseManagerListener listener,
77 String workingDirectory, Map<String, String> environments, String executable )
78 throws ContinuumReleaseException;
79
80 /**
81 * Perform a release based on a given releaseId
82 *
83 * @param releaseId
84 * @param buildDirectory
85 * @param goals
86 * @param useReleaseProfile
87 * @param listener
88 * @throws ContinuumReleaseException
89 * @deprecated to remove as not used anymore
90 */
91 void perform( String releaseId, File buildDirectory, String goals, String arguments, boolean useReleaseProfile,
92 ContinuumReleaseManagerListener listener )
93 throws ContinuumReleaseException;
94
95 /**
96 * Perform a release based on a release descriptor received by the Maven Release Plugin.
97 *
98 * @param releaseId
99 * @param workingDirectory
100 * @param buildDirectory
101 * @param goals
102 * @param useReleaseProfile
103 * @param listener
104 * @throws ContinuumReleaseException
105 * @deprecated to remove as not used anymore
106 */
107 void perform( String releaseId, String workingDirectory, File buildDirectory, String goals, String arguments,
108 boolean useReleaseProfile, ContinuumReleaseManagerListener listener )
109 throws ContinuumReleaseException;
110
111
112 /**
113 * FIXME use a bean to replace such very huge parameter number (ContinuumReleaseRequest)
114 *
115 * @param releaseId
116 * @param buildDirectory
117 * @param goals
118 * @param arguments
119 * @param useReleaseProfile
120 * @param listener
121 * @param repository
122 * @throws ContinuumReleaseException
123 */
124 void perform( String releaseId, File buildDirectory, String goals, String arguments, boolean useReleaseProfile,
125 ContinuumReleaseManagerListener listener, LocalRepository repository )
126 throws ContinuumReleaseException;
127
128 /**
129 * Rollback changes made by a previous release.
130 *
131 * @param releaseId
132 * @param workingDirectory
133 * @param listener
134 * @throws ContinuumReleaseException
135 */
136 void rollback( String releaseId, String workingDirectory, ContinuumReleaseManagerListener listener )
137 throws ContinuumReleaseException;
138
139 Map<String, ReleaseDescriptor> getPreparedReleases();
140
141 Map<String, String> getPreparedReleasesForProject( String groupId, String artifactId );
142
143 Map getReleaseResults();
144
145 Map getListeners();
146
147
148 /**
149 * Clean up the tagname to respect the scm provider policy.
150 *
151 * @param scmUrl The scm url
152 * @param tagName The tag name
153 * @return The cleaned tag name
154 */
155 String sanitizeTagName( String scmUrl, String tagName )
156 throws Exception;
157
158 /**
159 * @param releaseId
160 * @return
161 */
162 ReleaseListenerSummary getListener( String releaseId );
163
164 /**
165 * Determines if there is an ongoing release
166 *
167 * @return true if there is an ongoing release; false otherwise
168 * @throws Exception if unable to determine if release is ongoing
169 */
170 boolean isExecutingRelease()
171 throws Exception;
172
173 /**
174 * Retrieve the Release TaskQueueExecutor instance
175 *
176 * @return Release TaskQueueExecutor instance
177 * @throws TaskQueueManagerException if unable to retrieve the Release TaskQueueExecutor instance
178 */
179 TaskQueueExecutor getPerformReleaseTaskQueueExecutor()
180 throws TaskQueueManagerException;
181
182 /**
183 * Retrieve the PrepareRelease TaskQueueExecutor instance
184 *
185 * @return PrepareRelease TaskQueueExecutor instance
186 * @throws TaskQueueManagerException if unable to retrieve the PrepareRelease TaskQueueExecutor instance
187 */
188 TaskQueueExecutor getPrepareReleaseTaskQueueExecutor()
189 throws TaskQueueManagerException;
190
191 /**
192 * Retrieve the RollbackRelease TaskQueueExecutor instance
193 *
194 * @return RollbackRelease TaskQueueExecutor instance
195 * @throws TaskQueueManagerException if unable to retrieve the RollbackRelease TaskQueueExecutor instance
196 */
197 TaskQueueExecutor getRollbackReleaseTaskQueueExecutor()
198 throws TaskQueueManagerException;
199 }