View Javadoc

1   package org.apache.maven;
2   
3   /* ====================================================================
4    *   Licensed to the Apache Software Foundation (ASF) under one or more
5    *   contributor license agreements.  See the NOTICE file distributed with
6    *   this work for additional information regarding copyright ownership.
7    *   The ASF licenses this file to You under the Apache License, Version 2.0
8    *   (the "License"); you may not use this file except in compliance with
9    *   the License.  You may obtain a copy of the License at
10   *
11   *       http://www.apache.org/licenses/LICENSE-2.0
12   *
13   *   Unless required by applicable law or agreed to in writing, software
14   *   distributed under the License is distributed on an "AS IS" BASIS,
15   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   *   See the License for the specific language governing permissions and
17   *   limitations under the License.
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  }