Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
Mojo |
|
| 1.2777777777777777;1.278 |
1 | /* |
|
2 | * $Id$ |
|
3 | */ |
|
4 | ||
5 | package org.apache.maven.plugin.tools.model; |
|
6 | ||
7 | //---------------------------------/ |
|
8 | //- Imported classes and packages -/ |
|
9 | //---------------------------------/ |
|
10 | ||
11 | import java.util.Date; |
|
12 | ||
13 | /** |
|
14 | * Mojo descriptor definition. |
|
15 | * |
|
16 | * @version $Revision$ $Date$ |
|
17 | */ |
|
18 | 0 | public class Mojo implements java.io.Serializable { |
19 | ||
20 | ||
21 | //--------------------------/ |
|
22 | //- Class/Member Variables -/ |
|
23 | //--------------------------/ |
|
24 | ||
25 | /** |
|
26 | * Field goal |
|
27 | */ |
|
28 | private String goal; |
|
29 | ||
30 | /** |
|
31 | * Field phase |
|
32 | */ |
|
33 | private String phase; |
|
34 | ||
35 | /** |
|
36 | * Field aggregator |
|
37 | */ |
|
38 | 0 | private boolean aggregator = false; |
39 | ||
40 | /** |
|
41 | * Field requiresDependencyResolution |
|
42 | */ |
|
43 | private String requiresDependencyResolution; |
|
44 | ||
45 | /** |
|
46 | * Field requiresProject |
|
47 | */ |
|
48 | 0 | private boolean requiresProject = false; |
49 | ||
50 | /** |
|
51 | * Field requiresReports |
|
52 | */ |
|
53 | 0 | private boolean requiresReports = false; |
54 | ||
55 | /** |
|
56 | * Field requiresOnline |
|
57 | */ |
|
58 | 0 | private boolean requiresOnline = false; |
59 | ||
60 | /** |
|
61 | * Field inheritByDefault |
|
62 | */ |
|
63 | 0 | private boolean inheritByDefault = false; |
64 | ||
65 | /** |
|
66 | * Field requiresDirectInvocation |
|
67 | */ |
|
68 | 0 | private boolean requiresDirectInvocation = false; |
69 | ||
70 | /** |
|
71 | * Field execution |
|
72 | */ |
|
73 | private LifecycleExecution execution; |
|
74 | ||
75 | /** |
|
76 | * Field components |
|
77 | */ |
|
78 | private java.util.List components; |
|
79 | ||
80 | /** |
|
81 | * Field parameters |
|
82 | */ |
|
83 | private java.util.List parameters; |
|
84 | ||
85 | /** |
|
86 | * Field description |
|
87 | */ |
|
88 | private String description; |
|
89 | ||
90 | /** |
|
91 | * Field deprecation |
|
92 | */ |
|
93 | private String deprecation; |
|
94 | ||
95 | /** |
|
96 | * Field call |
|
97 | */ |
|
98 | private String call; |
|
99 | ||
100 | ||
101 | //-----------/ |
|
102 | //- Methods -/ |
|
103 | //-----------/ |
|
104 | ||
105 | /** |
|
106 | * Method addComponent |
|
107 | * |
|
108 | * @param component |
|
109 | */ |
|
110 | public void addComponent(Component component) |
|
111 | { |
|
112 | 0 | if ( !(component instanceof Component) ) |
113 | { |
|
114 | 0 | throw new ClassCastException( "Mojo.addComponents(component) parameter must be instanceof " + Component.class.getName() ); |
115 | } |
|
116 | 0 | getComponents().add( component ); |
117 | 0 | } //-- void addComponent(Component) |
118 | ||
119 | /** |
|
120 | * Method addParameter |
|
121 | * |
|
122 | * @param parameter |
|
123 | */ |
|
124 | public void addParameter(Parameter parameter) |
|
125 | { |
|
126 | 0 | if ( !(parameter instanceof Parameter) ) |
127 | { |
|
128 | 0 | throw new ClassCastException( "Mojo.addParameters(parameter) parameter must be instanceof " + Parameter.class.getName() ); |
129 | } |
|
130 | 0 | getParameters().add( parameter ); |
131 | 0 | } //-- void addParameter(Parameter) |
132 | ||
133 | /** |
|
134 | * Get The target/method within the script to call when this |
|
135 | * mojo executes. |
|
136 | */ |
|
137 | public String getCall() |
|
138 | { |
|
139 | 0 | return this.call; |
140 | } //-- String getCall() |
|
141 | ||
142 | /** |
|
143 | * Method getComponents |
|
144 | */ |
|
145 | public java.util.List getComponents() |
|
146 | { |
|
147 | 0 | if ( this.components == null ) |
148 | { |
|
149 | 0 | this.components = new java.util.ArrayList(); |
150 | } |
|
151 | ||
152 | 0 | return this.components; |
153 | } //-- java.util.List getComponents() |
|
154 | ||
155 | /** |
|
156 | * Get A deprecation message for this mojo parameter. |
|
157 | */ |
|
158 | public String getDeprecation() |
|
159 | { |
|
160 | 0 | return this.deprecation; |
161 | } //-- String getDeprecation() |
|
162 | ||
163 | /** |
|
164 | * Get The description for this parameter. |
|
165 | */ |
|
166 | public String getDescription() |
|
167 | { |
|
168 | 0 | return this.description; |
169 | } //-- String getDescription() |
|
170 | ||
171 | /** |
|
172 | * Get Information about a sub-execution of the Maven lifecycle |
|
173 | * which should be processed. |
|
174 | */ |
|
175 | public LifecycleExecution getExecution() |
|
176 | { |
|
177 | 0 | return this.execution; |
178 | } //-- LifecycleExecution getExecution() |
|
179 | ||
180 | /** |
|
181 | * Get The name of the goal used to invoke this mojo. |
|
182 | */ |
|
183 | public String getGoal() |
|
184 | { |
|
185 | 0 | return this.goal; |
186 | } //-- String getGoal() |
|
187 | ||
188 | /** |
|
189 | * Method getParameters |
|
190 | */ |
|
191 | public java.util.List getParameters() |
|
192 | { |
|
193 | 0 | if ( this.parameters == null ) |
194 | { |
|
195 | 0 | this.parameters = new java.util.ArrayList(); |
196 | } |
|
197 | ||
198 | 0 | return this.parameters; |
199 | } //-- java.util.List getParameters() |
|
200 | ||
201 | /** |
|
202 | * Get The phase to which this mojo should be bound by default. |
|
203 | */ |
|
204 | public String getPhase() |
|
205 | { |
|
206 | 0 | return this.phase; |
207 | } //-- String getPhase() |
|
208 | ||
209 | /** |
|
210 | * Get The scope of dependencies that this mojo requires to |
|
211 | * have resolved. |
|
212 | */ |
|
213 | public String getRequiresDependencyResolution() |
|
214 | { |
|
215 | 0 | return this.requiresDependencyResolution; |
216 | } //-- String getRequiresDependencyResolution() |
|
217 | ||
218 | /** |
|
219 | * Get Whether this mojo operates as an aggregator when the |
|
220 | * reactor is run. That is, only runs once. |
|
221 | * |
|
222 | */ |
|
223 | public boolean isAggregator() |
|
224 | { |
|
225 | 0 | return this.aggregator; |
226 | } //-- boolean isAggregator() |
|
227 | ||
228 | /** |
|
229 | * Get Whether this mojo's configuration should propagate down |
|
230 | * the POM inheritance chain by default. |
|
231 | * |
|
232 | */ |
|
233 | public boolean isInheritByDefault() |
|
234 | { |
|
235 | 0 | return this.inheritByDefault; |
236 | } //-- boolean isInheritByDefault() |
|
237 | ||
238 | /** |
|
239 | * Get If true, this mojo can only be directly invoked (eg. |
|
240 | * specified directly on the command line). |
|
241 | * |
|
242 | */ |
|
243 | public boolean isRequiresDirectInvocation() |
|
244 | { |
|
245 | 0 | return this.requiresDirectInvocation; |
246 | } //-- boolean isRequiresDirectInvocation() |
|
247 | ||
248 | /** |
|
249 | * Get Whether this mojo requires online mode to operate |
|
250 | * normally. |
|
251 | */ |
|
252 | public boolean isRequiresOnline() |
|
253 | { |
|
254 | 0 | return this.requiresOnline; |
255 | } //-- boolean isRequiresOnline() |
|
256 | ||
257 | /** |
|
258 | * Get Whether this mojo requires a project instance in order |
|
259 | * to execute. |
|
260 | */ |
|
261 | public boolean isRequiresProject() |
|
262 | { |
|
263 | 0 | return this.requiresProject; |
264 | } //-- boolean isRequiresProject() |
|
265 | ||
266 | /** |
|
267 | * Get Whether this mojo requires a reports section in the POM. |
|
268 | */ |
|
269 | public boolean isRequiresReports() |
|
270 | { |
|
271 | 0 | return this.requiresReports; |
272 | } //-- boolean isRequiresReports() |
|
273 | ||
274 | /** |
|
275 | * Method removeComponent |
|
276 | * |
|
277 | * @param component |
|
278 | */ |
|
279 | public void removeComponent(Component component) |
|
280 | { |
|
281 | 0 | if ( !(component instanceof Component) ) |
282 | { |
|
283 | 0 | throw new ClassCastException( "Mojo.removeComponents(component) parameter must be instanceof " + Component.class.getName() ); |
284 | } |
|
285 | 0 | getComponents().remove( component ); |
286 | 0 | } //-- void removeComponent(Component) |
287 | ||
288 | /** |
|
289 | * Method removeParameter |
|
290 | * |
|
291 | * @param parameter |
|
292 | */ |
|
293 | public void removeParameter(Parameter parameter) |
|
294 | { |
|
295 | 0 | if ( !(parameter instanceof Parameter) ) |
296 | { |
|
297 | 0 | throw new ClassCastException( "Mojo.removeParameters(parameter) parameter must be instanceof " + Parameter.class.getName() ); |
298 | } |
|
299 | 0 | getParameters().remove( parameter ); |
300 | 0 | } //-- void removeParameter(Parameter) |
301 | ||
302 | /** |
|
303 | * Set Whether this mojo operates as an aggregator when the |
|
304 | * reactor is run. That is, only runs once. |
|
305 | * |
|
306 | * |
|
307 | * @param aggregator |
|
308 | */ |
|
309 | public void setAggregator(boolean aggregator) |
|
310 | { |
|
311 | 0 | this.aggregator = aggregator; |
312 | 0 | } //-- void setAggregator(boolean) |
313 | ||
314 | /** |
|
315 | * Set The target/method within the script to call when this |
|
316 | * mojo executes. |
|
317 | * |
|
318 | * @param call |
|
319 | */ |
|
320 | public void setCall(String call) |
|
321 | { |
|
322 | 0 | this.call = call; |
323 | 0 | } //-- void setCall(String) |
324 | ||
325 | /** |
|
326 | * Set List of plexus components required by this mojo. |
|
327 | * |
|
328 | * @param components |
|
329 | */ |
|
330 | public void setComponents(java.util.List components) |
|
331 | { |
|
332 | 0 | this.components = components; |
333 | 0 | } //-- void setComponents(java.util.List) |
334 | ||
335 | /** |
|
336 | * Set A deprecation message for this mojo parameter. |
|
337 | * |
|
338 | * @param deprecation |
|
339 | */ |
|
340 | public void setDeprecation(String deprecation) |
|
341 | { |
|
342 | 0 | this.deprecation = deprecation; |
343 | 0 | } //-- void setDeprecation(String) |
344 | ||
345 | /** |
|
346 | * Set The description for this parameter. |
|
347 | * |
|
348 | * @param description |
|
349 | */ |
|
350 | public void setDescription(String description) |
|
351 | { |
|
352 | 0 | this.description = description; |
353 | 0 | } //-- void setDescription(String) |
354 | ||
355 | /** |
|
356 | * Set Information about a sub-execution of the Maven lifecycle |
|
357 | * which should be processed. |
|
358 | * |
|
359 | * @param execution |
|
360 | */ |
|
361 | public void setExecution(LifecycleExecution execution) |
|
362 | { |
|
363 | 0 | this.execution = execution; |
364 | 0 | } //-- void setExecution(LifecycleExecution) |
365 | ||
366 | /** |
|
367 | * Set The name of the goal used to invoke this mojo. |
|
368 | * |
|
369 | * @param goal |
|
370 | */ |
|
371 | public void setGoal(String goal) |
|
372 | { |
|
373 | 0 | this.goal = goal; |
374 | 0 | } //-- void setGoal(String) |
375 | ||
376 | /** |
|
377 | * Set Whether this mojo's configuration should propagate down |
|
378 | * the POM inheritance chain by default. |
|
379 | * |
|
380 | * |
|
381 | * @param inheritByDefault |
|
382 | */ |
|
383 | public void setInheritByDefault(boolean inheritByDefault) |
|
384 | { |
|
385 | 0 | this.inheritByDefault = inheritByDefault; |
386 | 0 | } //-- void setInheritByDefault(boolean) |
387 | ||
388 | /** |
|
389 | * Set List of parameters used by this mojo. |
|
390 | * |
|
391 | * @param parameters |
|
392 | */ |
|
393 | public void setParameters(java.util.List parameters) |
|
394 | { |
|
395 | 0 | this.parameters = parameters; |
396 | 0 | } //-- void setParameters(java.util.List) |
397 | ||
398 | /** |
|
399 | * Set The phase to which this mojo should be bound by default. |
|
400 | * |
|
401 | * @param phase |
|
402 | */ |
|
403 | public void setPhase(String phase) |
|
404 | { |
|
405 | 0 | this.phase = phase; |
406 | 0 | } //-- void setPhase(String) |
407 | ||
408 | /** |
|
409 | * Set The scope of dependencies that this mojo requires to |
|
410 | * have resolved. |
|
411 | * |
|
412 | * @param requiresDependencyResolution |
|
413 | */ |
|
414 | public void setRequiresDependencyResolution(String requiresDependencyResolution) |
|
415 | { |
|
416 | 0 | this.requiresDependencyResolution = requiresDependencyResolution; |
417 | 0 | } //-- void setRequiresDependencyResolution(String) |
418 | ||
419 | /** |
|
420 | * Set If true, this mojo can only be directly invoked (eg. |
|
421 | * specified directly on the command line). |
|
422 | * |
|
423 | * |
|
424 | * @param requiresDirectInvocation |
|
425 | */ |
|
426 | public void setRequiresDirectInvocation(boolean requiresDirectInvocation) |
|
427 | { |
|
428 | 0 | this.requiresDirectInvocation = requiresDirectInvocation; |
429 | 0 | } //-- void setRequiresDirectInvocation(boolean) |
430 | ||
431 | /** |
|
432 | * Set Whether this mojo requires online mode to operate |
|
433 | * normally. |
|
434 | * |
|
435 | * @param requiresOnline |
|
436 | */ |
|
437 | public void setRequiresOnline(boolean requiresOnline) |
|
438 | { |
|
439 | 0 | this.requiresOnline = requiresOnline; |
440 | 0 | } //-- void setRequiresOnline(boolean) |
441 | ||
442 | /** |
|
443 | * Set Whether this mojo requires a project instance in order |
|
444 | * to execute. |
|
445 | * |
|
446 | * @param requiresProject |
|
447 | */ |
|
448 | public void setRequiresProject(boolean requiresProject) |
|
449 | { |
|
450 | 0 | this.requiresProject = requiresProject; |
451 | 0 | } //-- void setRequiresProject(boolean) |
452 | ||
453 | /** |
|
454 | * Set Whether this mojo requires a reports section in the POM. |
|
455 | * |
|
456 | * @param requiresReports |
|
457 | */ |
|
458 | public void setRequiresReports(boolean requiresReports) |
|
459 | { |
|
460 | 0 | this.requiresReports = requiresReports; |
461 | 0 | } //-- void setRequiresReports(boolean) |
462 | ||
463 | ||
464 | 0 | private String modelEncoding = "UTF-8"; |
465 | ||
466 | public void setModelEncoding( String modelEncoding ) |
|
467 | { |
|
468 | 0 | this.modelEncoding = modelEncoding; |
469 | 0 | } |
470 | ||
471 | public String getModelEncoding() |
|
472 | { |
|
473 | 0 | return modelEncoding; |
474 | }} |