View Javadoc

1   /*
2    * Copyright 2006-2012 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.maven.plugin.buildmetadata.data;
17  
18  import java.util.Map;
19  
20  /**
21   * Configuration instance to create instances of
22   * {@link de.smartics.maven.plugin.buildmetadata.data.MetaDataProvider} by the
23   * {@link de.smartics.maven.plugin.buildmetadata.data.MetaDataProviderBuilder}.
24   *
25   * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
26   * @version $Revision:591 $
27   */
28  public class Provider
29  {
30    // ********************************* Fields *********************************
31  
32    // --- constants ------------------------------------------------------------
33  
34    /**
35     * The name of the property to indicate that a provider is to be run with the
36     * build point mojo. Usually this kind of provider export the build
37     * information to a backend system or measures time at a given point of the
38     * build.
39     * <p>
40     * The value of this constant is {@value}.
41     */
42    public static final String RUN_AT_BUILD_POINT = "runAtBuildPoint";
43  
44    // --- members --------------------------------------------------------------
45  
46    /**
47     * The class to instantiate.
48     */
49    private String type;
50  
51    /**
52     * Properties to set.
53     */
54    private Map<String, String> properties;
55  
56    // ****************************** Initializer *******************************
57  
58    // ****************************** Constructors ******************************
59  
60    // ****************************** Inner Classes *****************************
61  
62    // ********************************* Methods ********************************
63  
64    // --- init -----------------------------------------------------------------
65  
66    // --- get&set --------------------------------------------------------------
67  
68    /**
69     * Returns the class to instantiate.
70     *
71     * @return the class to instantiate.
72     */
73    public final String getType()
74    {
75      return type;
76    }
77  
78    /**
79     * Returns the value for properties.
80     * <p>
81     * Properties to set.
82     *
83     * @return the value for properties.
84     */
85    public final Map<String, String> getProperties()
86    {
87      return properties;
88    }
89  
90    /**
91     * Checks if the provider is configured to be run at the end of the build.
92     * Usually this kind of provider export the build information to a backend
93     * system.
94     *
95     * @return <code>true</code> if the provider runs at the end of the build,
96     *         <code>false</code> if it runs at the start.
97     */
98    public final boolean isRunAtEndOfBuild()
99    {
100     return ("true".equals(properties.get(RUN_AT_BUILD_POINT)));
101   }
102 
103   // --- business -------------------------------------------------------------
104 
105   // --- object basics --------------------------------------------------------
106 
107 }