1 package org.apache.maven;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import org.apache.maven.project.Project;
22
23 /**
24 * Base class from which all components in maven are derived.
25 *
26 * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
27 *
28 * @version $Id: AbstractMavenComponent.java 517014 2007-03-11 21:15:50Z ltheussl $
29 */
30 public abstract class AbstractMavenComponent
31 {
32 /** Maven project. */
33 private Project project;
34
35 /** Default Constructor. */
36 public AbstractMavenComponent()
37 {
38 }
39
40 /**
41 * Create a component that uses a project
42 * @param aProject a Maven project
43 */
44 public AbstractMavenComponent( final Project aProject )
45 {
46 project = aProject;
47 }
48
49 /**
50 * set the project property
51 * @param aProject a Maven project
52 */
53 public void setProject( final Project aProject )
54 {
55 project = aProject;
56 }
57
58 /**
59 * @return the project property
60 */
61 public Project getProject()
62 {
63 return project;
64 }
65
66 /**
67 * Retrieve a user message.
68 *
69 * @param messageId Id of message type to use.
70 * @return Message for the user's locale.
71 * @see MavenUtils#getMessage
72 */
73 public String getMessage( final String messageId )
74 {
75 return MavenUtils.getMessage( messageId );
76 }
77
78 /**
79 * Retrieve a user message.
80 *
81 * @param messageId Id of message type to use.
82 * @param variable Value to substitute for ${1} in the given message.
83 * @return Message for the user's locale.
84 * @see MavenUtils#getMessage
85 */
86 public String getMessage( final String messageId, final Object variable )
87 {
88 return MavenUtils.getMessage( messageId, variable );
89 }
90 }