View Javadoc

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   * The conditions within the build runtime environment which will
15   * trigger the
16   *         automatic inclusion of the build profile.
17   * 
18   * @version $Revision$ $Date$
19   */
20  public class Activation implements java.io.Serializable {
21  
22  
23        //--------------------------/
24       //- Class/Member Variables -/
25      //--------------------------/
26  
27      /**
28       * If set to true, this profile will be active unless another
29       * profile in this
30       *             pom is activated using the command line -P
31       * option or by one of that profile's
32       *             activators.
33       */
34      private boolean activeByDefault = false;
35  
36      /**
37       * 
38       *             
39       *             Specifies that this profile will be activated
40       * when a matching JDK is detected.
41       *             For example, <code>1.4</code> only activates on
42       * JDKs versioned 1.4,
43       *             while <code>!1.4</code> matches any JDK that is
44       * not version 1.4.
45       *             
46       *           
47       */
48      private String jdk;
49  
50      /**
51       * Specifies that this profile will be activated when matching
52       * operating system
53       *             attributes are detected.
54       */
55      private ActivationOS os;
56  
57      /**
58       * Specifies that this profile will be activated when this
59       * system property is
60       *             specified.
61       */
62      private ActivationProperty property;
63  
64      /**
65       * Specifies that this profile will be activated based on
66       * existence of a file.
67       */
68      private ActivationFile file;
69  
70  
71        //-----------/
72       //- Methods -/
73      //-----------/
74  
75      /**
76       * Get specifies that this profile will be activated based on
77       * existence of a file.
78       * 
79       * @return ActivationFile
80       */
81      public ActivationFile getFile()
82      {
83          return this.file;
84      } //-- ActivationFile getFile() 
85  
86      /**
87       * Get 
88       *             
89       *             Specifies that this profile will be activated
90       * when a matching JDK is detected.
91       *             For example, <code>1.4</code> only activates on
92       * JDKs versioned 1.4,
93       *             while <code>!1.4</code> matches any JDK that is
94       * not version 1.4.
95       *             
96       *           
97       * 
98       * @return String
99       */
100     public String getJdk()
101     {
102         return this.jdk;
103     } //-- String getJdk() 
104 
105     /**
106      * Get specifies that this profile will be activated when
107      * matching operating system
108      *             attributes are detected.
109      * 
110      * @return ActivationOS
111      */
112     public ActivationOS getOs()
113     {
114         return this.os;
115     } //-- ActivationOS getOs() 
116 
117     /**
118      * Get specifies that this profile will be activated when this
119      * system property is
120      *             specified.
121      * 
122      * @return ActivationProperty
123      */
124     public ActivationProperty getProperty()
125     {
126         return this.property;
127     } //-- ActivationProperty getProperty() 
128 
129     /**
130      * Get if set to true, this profile will be active unless
131      * another profile in this
132      *             pom is activated using the command line -P
133      * option or by one of that profile's
134      *             activators.
135      * 
136      * @return boolean
137      */
138     public boolean isActiveByDefault()
139     {
140         return this.activeByDefault;
141     } //-- boolean isActiveByDefault() 
142 
143     /**
144      * Set if set to true, this profile will be active unless
145      * another profile in this
146      *             pom is activated using the command line -P
147      * option or by one of that profile's
148      *             activators.
149      * 
150      * @param activeByDefault
151      */
152     public void setActiveByDefault( boolean activeByDefault )
153     {
154         this.activeByDefault = activeByDefault;
155     } //-- void setActiveByDefault( boolean ) 
156 
157     /**
158      * Set specifies that this profile will be activated based on
159      * existence of a file.
160      * 
161      * @param file
162      */
163     public void setFile( ActivationFile file )
164     {
165         this.file = file;
166     } //-- void setFile( ActivationFile ) 
167 
168     /**
169      * Set 
170      *             
171      *             Specifies that this profile will be activated
172      * when a matching JDK is detected.
173      *             For example, <code>1.4</code> only activates on
174      * JDKs versioned 1.4,
175      *             while <code>!1.4</code> matches any JDK that is
176      * not version 1.4.
177      *             
178      *           
179      * 
180      * @param jdk
181      */
182     public void setJdk( String jdk )
183     {
184         this.jdk = jdk;
185     } //-- void setJdk( String ) 
186 
187     /**
188      * Set specifies that this profile will be activated when
189      * matching operating system
190      *             attributes are detected.
191      * 
192      * @param os
193      */
194     public void setOs( ActivationOS os )
195     {
196         this.os = os;
197     } //-- void setOs( ActivationOS ) 
198 
199     /**
200      * Set specifies that this profile will be activated when this
201      * system property is
202      *             specified.
203      * 
204      * @param property
205      */
206     public void setProperty( ActivationProperty property )
207     {
208         this.property = property;
209     } //-- void setProperty( ActivationProperty ) 
210 
211 
212     private String modelEncoding = "UTF-8";
213 
214     /**
215      * Set an encoding used for reading/writing the model.
216      *
217      * @param modelEncoding the encoding used when reading/writing the model.
218      */
219     public void setModelEncoding( String modelEncoding )
220     {
221         this.modelEncoding = modelEncoding;
222     }
223 
224     /**
225      * @return the current encoding used when reading/writing this model.
226      */
227     public String getModelEncoding()
228     {
229         return modelEncoding;
230     }
231 }