Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
BuildBase |
|
| 1.75;1.75 |
1 | /* | |
2 | * $Id$ | |
3 | */ | |
4 | ||
5 | package org.apache.maven.model; | |
6 | ||
7 | //---------------------------------/ | |
8 | //- Imported classes and packages -/ | |
9 | //---------------------------------/ | |
10 | ||
11 | import java.util.Date; | |
12 | ||
13 | /** | |
14 | * Generic informations for a build. | |
15 | * | |
16 | * @version $Revision$ $Date$ | |
17 | */ | |
18 | 0 | public class BuildBase extends PluginConfiguration |
19 | implements java.io.Serializable | |
20 | { | |
21 | ||
22 | ||
23 | //--------------------------/ | |
24 | //- Class/Member Variables -/ | |
25 | //--------------------------/ | |
26 | ||
27 | /** | |
28 | * The default goal (or phase in Maven 2) to execute when none | |
29 | * is specified for | |
30 | * the project. | |
31 | */ | |
32 | private String defaultGoal; | |
33 | ||
34 | /** | |
35 | * Field resources. | |
36 | */ | |
37 | private java.util.List resources; | |
38 | ||
39 | /** | |
40 | * Field testResources. | |
41 | */ | |
42 | private java.util.List testResources; | |
43 | ||
44 | /** | |
45 | * The directory where all files generated by the build are | |
46 | * placed. | |
47 | */ | |
48 | private String directory; | |
49 | ||
50 | /** | |
51 | * | |
52 | * | |
53 | * The filename (excluding the extension, and with | |
54 | * no path information) that | |
55 | * the produced artifact will be called. | |
56 | * The default value is | |
57 | * <code>${artifactId}-${version}</code>. | |
58 | * | |
59 | * | |
60 | */ | |
61 | private String finalName; | |
62 | ||
63 | /** | |
64 | * Field filters. | |
65 | */ | |
66 | private java.util.List filters; | |
67 | ||
68 | ||
69 | //-----------/ | |
70 | //- Methods -/ | |
71 | //-----------/ | |
72 | ||
73 | /** | |
74 | * Method addFilter. | |
75 | * | |
76 | * @param string | |
77 | */ | |
78 | public void addFilter( String string ) | |
79 | { | |
80 | 0 | if ( !(string instanceof String) ) |
81 | { | |
82 | 0 | throw new ClassCastException( "BuildBase.addFilters(string) parameter must be instanceof " + String.class.getName() ); |
83 | } | |
84 | 0 | getFilters().add( string ); |
85 | 0 | } //-- void addFilter( String ) |
86 | ||
87 | /** | |
88 | * Method addResource. | |
89 | * | |
90 | * @param resource | |
91 | */ | |
92 | public void addResource( Resource resource ) | |
93 | { | |
94 | 0 | if ( !(resource instanceof Resource) ) |
95 | { | |
96 | 0 | throw new ClassCastException( "BuildBase.addResources(resource) parameter must be instanceof " + Resource.class.getName() ); |
97 | } | |
98 | 0 | getResources().add( resource ); |
99 | 0 | } //-- void addResource( Resource ) |
100 | ||
101 | /** | |
102 | * Method addTestResource. | |
103 | * | |
104 | * @param resource | |
105 | */ | |
106 | public void addTestResource( Resource resource ) | |
107 | { | |
108 | 0 | if ( !(resource instanceof Resource) ) |
109 | { | |
110 | 0 | throw new ClassCastException( "BuildBase.addTestResources(resource) parameter must be instanceof " + Resource.class.getName() ); |
111 | } | |
112 | 0 | getTestResources().add( resource ); |
113 | 0 | } //-- void addTestResource( Resource ) |
114 | ||
115 | /** | |
116 | * Get the default goal (or phase in Maven 2) to execute when | |
117 | * none is specified for | |
118 | * the project. | |
119 | * | |
120 | * @return String | |
121 | */ | |
122 | public String getDefaultGoal() | |
123 | { | |
124 | 0 | return this.defaultGoal; |
125 | } //-- String getDefaultGoal() | |
126 | ||
127 | /** | |
128 | * Get the directory where all files generated by the build are | |
129 | * placed. | |
130 | * | |
131 | * @return String | |
132 | */ | |
133 | public String getDirectory() | |
134 | { | |
135 | 0 | return this.directory; |
136 | } //-- String getDirectory() | |
137 | ||
138 | /** | |
139 | * Method getFilters. | |
140 | * | |
141 | * @return java.util.List | |
142 | */ | |
143 | public java.util.List getFilters() | |
144 | { | |
145 | 0 | if ( this.filters == null ) |
146 | { | |
147 | 0 | this.filters = new java.util.ArrayList(); |
148 | } | |
149 | ||
150 | 0 | return this.filters; |
151 | } //-- java.util.List getFilters() | |
152 | ||
153 | /** | |
154 | * Get | |
155 | * | |
156 | * The filename (excluding the extension, and with | |
157 | * no path information) that | |
158 | * the produced artifact will be called. | |
159 | * The default value is | |
160 | * <code>${artifactId}-${version}</code>. | |
161 | * | |
162 | * | |
163 | * | |
164 | * @return String | |
165 | */ | |
166 | public String getFinalName() | |
167 | { | |
168 | 0 | return this.finalName; |
169 | } //-- String getFinalName() | |
170 | ||
171 | /** | |
172 | * Method getResources. | |
173 | * | |
174 | * @return java.util.List | |
175 | */ | |
176 | public java.util.List getResources() | |
177 | { | |
178 | 0 | if ( this.resources == null ) |
179 | { | |
180 | 0 | this.resources = new java.util.ArrayList(); |
181 | } | |
182 | ||
183 | 0 | return this.resources; |
184 | } //-- java.util.List getResources() | |
185 | ||
186 | /** | |
187 | * Method getTestResources. | |
188 | * | |
189 | * @return java.util.List | |
190 | */ | |
191 | public java.util.List getTestResources() | |
192 | { | |
193 | 0 | if ( this.testResources == null ) |
194 | { | |
195 | 0 | this.testResources = new java.util.ArrayList(); |
196 | } | |
197 | ||
198 | 0 | return this.testResources; |
199 | } //-- java.util.List getTestResources() | |
200 | ||
201 | /** | |
202 | * Method removeFilter. | |
203 | * | |
204 | * @param string | |
205 | */ | |
206 | public void removeFilter( String string ) | |
207 | { | |
208 | 0 | if ( !(string instanceof String) ) |
209 | { | |
210 | 0 | throw new ClassCastException( "BuildBase.removeFilters(string) parameter must be instanceof " + String.class.getName() ); |
211 | } | |
212 | 0 | getFilters().remove( string ); |
213 | 0 | } //-- void removeFilter( String ) |
214 | ||
215 | /** | |
216 | * Method removeResource. | |
217 | * | |
218 | * @param resource | |
219 | */ | |
220 | public void removeResource( Resource resource ) | |
221 | { | |
222 | 0 | if ( !(resource instanceof Resource) ) |
223 | { | |
224 | 0 | throw new ClassCastException( "BuildBase.removeResources(resource) parameter must be instanceof " + Resource.class.getName() ); |
225 | } | |
226 | 0 | getResources().remove( resource ); |
227 | 0 | } //-- void removeResource( Resource ) |
228 | ||
229 | /** | |
230 | * Method removeTestResource. | |
231 | * | |
232 | * @param resource | |
233 | */ | |
234 | public void removeTestResource( Resource resource ) | |
235 | { | |
236 | 0 | if ( !(resource instanceof Resource) ) |
237 | { | |
238 | 0 | throw new ClassCastException( "BuildBase.removeTestResources(resource) parameter must be instanceof " + Resource.class.getName() ); |
239 | } | |
240 | 0 | getTestResources().remove( resource ); |
241 | 0 | } //-- void removeTestResource( Resource ) |
242 | ||
243 | /** | |
244 | * Set the default goal (or phase in Maven 2) to execute when | |
245 | * none is specified for | |
246 | * the project. | |
247 | * | |
248 | * @param defaultGoal | |
249 | */ | |
250 | public void setDefaultGoal( String defaultGoal ) | |
251 | { | |
252 | 0 | this.defaultGoal = defaultGoal; |
253 | 0 | } //-- void setDefaultGoal( String ) |
254 | ||
255 | /** | |
256 | * Set the directory where all files generated by the build are | |
257 | * placed. | |
258 | * | |
259 | * @param directory | |
260 | */ | |
261 | public void setDirectory( String directory ) | |
262 | { | |
263 | 0 | this.directory = directory; |
264 | 0 | } //-- void setDirectory( String ) |
265 | ||
266 | /** | |
267 | * Set the list of filter properties files that are used when | |
268 | * filtering is enabled. | |
269 | * | |
270 | * @param filters | |
271 | */ | |
272 | public void setFilters( java.util.List filters ) | |
273 | { | |
274 | 0 | this.filters = filters; |
275 | 0 | } //-- void setFilters( java.util.List ) |
276 | ||
277 | /** | |
278 | * Set | |
279 | * | |
280 | * The filename (excluding the extension, and with | |
281 | * no path information) that | |
282 | * the produced artifact will be called. | |
283 | * The default value is | |
284 | * <code>${artifactId}-${version}</code>. | |
285 | * | |
286 | * | |
287 | * | |
288 | * @param finalName | |
289 | */ | |
290 | public void setFinalName( String finalName ) | |
291 | { | |
292 | 0 | this.finalName = finalName; |
293 | 0 | } //-- void setFinalName( String ) |
294 | ||
295 | /** | |
296 | * Set this element describes all of the classpath resources | |
297 | * such as properties | |
298 | * files associated with a project. These resources | |
299 | * are often included in the final | |
300 | * package. | |
301 | * | |
302 | * @param resources | |
303 | */ | |
304 | public void setResources( java.util.List resources ) | |
305 | { | |
306 | 0 | this.resources = resources; |
307 | 0 | } //-- void setResources( java.util.List ) |
308 | ||
309 | /** | |
310 | * Set this element describes all of the classpath resources | |
311 | * such as properties | |
312 | * files associated with a project's unit tests. | |
313 | * | |
314 | * @param testResources | |
315 | */ | |
316 | public void setTestResources( java.util.List testResources ) | |
317 | { | |
318 | 0 | this.testResources = testResources; |
319 | 0 | } //-- void setTestResources( java.util.List ) |
320 | ||
321 | ||
322 | 0 | private String modelEncoding = "UTF-8"; |
323 | ||
324 | /** | |
325 | * Set an encoding used for reading/writing the model. | |
326 | * | |
327 | * @param modelEncoding the encoding used when reading/writing the model. | |
328 | */ | |
329 | public void setModelEncoding( String modelEncoding ) | |
330 | { | |
331 | 0 | this.modelEncoding = modelEncoding; |
332 | 0 | } |
333 | ||
334 | /** | |
335 | * @return the current encoding used when reading/writing this model. | |
336 | */ | |
337 | public String getModelEncoding() | |
338 | { | |
339 | 0 | return modelEncoding; |
340 | } | |
341 | } |