View Javadoc

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.maven.shared.release.ReleaseManagerListener;
23  
24  import java.util.ArrayList;
25  import java.util.Collections;
26  import java.util.List;
27  
28  /**
29   * @author Edwin Punzalan
30   * @version $Id: DefaultReleaseManagerListener.java 1372260 2012-08-13 04:29:09Z brett $
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      private String username;
48  
49      public void goalStart( String name, List phases )
50      {
51          state = LISTENING;
52          goalName = name;
53          this.phases = phases;
54          completedPhases = Collections.synchronizedList( new ArrayList<String>() );
55          inProgress = null;
56      }
57  
58      public void phaseStart( String name )
59      {
60          inProgress = name;
61      }
62  
63      public void phaseEnd()
64      {
65          completedPhases.add( inProgress );
66  
67          inProgress = null;
68      }
69  
70      public void phaseSkip( String name )
71      {
72          completedPhases.add( name );
73      }
74  
75      public void goalEnd()
76      {
77          state = FINISHED;
78      }
79  
80      public void error( String message )
81      {
82          error = message;
83          goalEnd();
84      }
85  
86      public List<String> getCompletedPhases()
87      {
88          return completedPhases;
89      }
90  
91      public String getInProgress()
92      {
93          return inProgress;
94      }
95  
96      public List<String> getPhases()
97      {
98          return phases;
99      }
100 
101     public String getGoalName()
102     {
103         return goalName;
104     }
105 
106     public String getError()
107     {
108         return error;
109     }
110 
111     public int getState()
112     {
113         return state;
114     }
115 
116     public void setUsername( String username )
117     {
118         this.username = username;
119     }
120 
121     public String getUsername()
122     {
123         return username;
124     }
125 }