1 /*
2 * $Id$
3 */
4
5 package org.apache.maven.plugin.lifecycle;
6
7 //---------------------------------/
8 //- Imported classes and packages -/
9 //---------------------------------/
10
11 import java.util.Date;
12
13 /**
14 * A phase mapping definition.
15 *
16 * @version $Revision$ $Date$
17 */
18 public class Phase implements java.io.Serializable {
19
20
21 //--------------------------/
22 //- Class/Member Variables -/
23 //--------------------------/
24
25 /**
26 * The ID of this phase, eg <code>generate-sources</code>.
27 */
28 private String id;
29
30 /**
31 * Field executions.
32 */
33 private java.util.List executions;
34
35 /**
36 * Configuration to pass to all goals run in this phase.
37 */
38 private Object configuration;
39
40
41 //-----------/
42 //- Methods -/
43 //-----------/
44
45 /**
46 * Method addExecution.
47 *
48 * @param execution
49 */
50 public void addExecution( Execution execution )
51 {
52 if ( !(execution instanceof Execution) )
53 {
54 throw new ClassCastException( "Phase.addExecutions(execution) parameter must be instanceof " + Execution.class.getName() );
55 }
56 getExecutions().add( execution );
57 } //-- void addExecution( Execution )
58
59 /**
60 * Get configuration to pass to all goals run in this phase.
61 *
62 * @return Object
63 */
64 public Object getConfiguration()
65 {
66 return this.configuration;
67 } //-- Object getConfiguration()
68
69 /**
70 * Method getExecutions.
71 *
72 * @return java.util.List
73 */
74 public java.util.List getExecutions()
75 {
76 if ( this.executions == null )
77 {
78 this.executions = new java.util.ArrayList();
79 }
80
81 return this.executions;
82 } //-- java.util.List getExecutions()
83
84 /**
85 * Get the ID of this phase, eg <code>generate-sources</code>.
86 *
87 * @return String
88 */
89 public String getId()
90 {
91 return this.id;
92 } //-- String getId()
93
94 /**
95 * Method removeExecution.
96 *
97 * @param execution
98 */
99 public void removeExecution( Execution execution )
100 {
101 if ( !(execution instanceof Execution) )
102 {
103 throw new ClassCastException( "Phase.removeExecutions(execution) parameter must be instanceof " + Execution.class.getName() );
104 }
105 getExecutions().remove( execution );
106 } //-- void removeExecution( Execution )
107
108 /**
109 * Set configuration to pass to all goals run in this phase.
110 *
111 * @param configuration
112 */
113 public void setConfiguration( Object configuration )
114 {
115 this.configuration = configuration;
116 } //-- void setConfiguration( Object )
117
118 /**
119 * Set the goals to execute within the phase.
120 *
121 * @param executions
122 */
123 public void setExecutions( java.util.List executions )
124 {
125 this.executions = executions;
126 } //-- void setExecutions( java.util.List )
127
128 /**
129 * Set the ID of this phase, eg <code>generate-sources</code>.
130 *
131 * @param id
132 */
133 public void setId( String id )
134 {
135 this.id = id;
136 } //-- void setId( String )
137
138
139 private String modelEncoding = "UTF-8";
140
141 /**
142 * Set an encoding used for reading/writing the model.
143 *
144 * @param modelEncoding the encoding used when reading/writing the model.
145 */
146 public void setModelEncoding( String modelEncoding )
147 {
148 this.modelEncoding = modelEncoding;
149 }
150
151 /**
152 * @return the current encoding used when reading/writing this model.
153 */
154 public String getModelEncoding()
155 {
156 return modelEncoding;
157 }
158 }