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 java.util.ArrayList; |
23 | import java.util.Collections; |
24 | import java.util.List; |
25 | |
26 | import org.apache.maven.shared.release.ReleaseManagerListener; |
27 | |
28 | /** |
29 | * @author Edwin Punzalan |
30 | * @version $Id: DefaultReleaseManagerListener.java 766895 2009-04-20 22:02:13Z evenisse $ |
31 | */ |
32 | public class DefaultReleaseManagerListener |
33 | implements ReleaseManagerListener, ContinuumReleaseManagerListener |
34 | { |
35 | private String goalName; |
36 | |
37 | private List<String> completedPhases; |
38 | |
39 | private String inProgress; |
40 | |
41 | private List<String> phases; |
42 | |
43 | private String error; |
44 | |
45 | private int state; |
46 | |
47 | public void goalStart( String name, List phases ) |
48 | { |
49 | state = LISTENING; |
50 | goalName = name; |
51 | this.phases = phases; |
52 | completedPhases = Collections.synchronizedList( new ArrayList<String>() ); |
53 | inProgress = null; |
54 | } |
55 | |
56 | public void phaseStart( String name ) |
57 | { |
58 | inProgress = name; |
59 | } |
60 | |
61 | public void phaseEnd() |
62 | { |
63 | completedPhases.add( inProgress ); |
64 | |
65 | inProgress = null; |
66 | } |
67 | |
68 | public void phaseSkip( String name ) |
69 | { |
70 | completedPhases.add( name ); |
71 | } |
72 | |
73 | public void goalEnd() |
74 | { |
75 | state = FINISHED; |
76 | } |
77 | |
78 | public void error( String message ) |
79 | { |
80 | error = message; |
81 | goalEnd(); |
82 | } |
83 | |
84 | public List<String> getCompletedPhases() |
85 | { |
86 | return completedPhases; |
87 | } |
88 | |
89 | public String getInProgress() |
90 | { |
91 | return inProgress; |
92 | } |
93 | |
94 | public List<String> getPhases() |
95 | { |
96 | return phases; |
97 | } |
98 | |
99 | public String getGoalName() |
100 | { |
101 | return goalName; |
102 | } |
103 | |
104 | public String getError() |
105 | { |
106 | return error; |
107 | } |
108 | |
109 | public int getState() |
110 | { |
111 | return state; |
112 | } |
113 | } |