View Javadoc
1   /*
2    Licensed to the Apache Software Foundation (ASF) under one
3    or more contributor license agreements.  See the NOTICE file
4    distributed with this work for additional information
5    regarding copyright ownership.  The ASF licenses this file
6    to you under the Apache License, Version 2.0 (the
7    "License"); you may not use this file except in compliance
8    with the License.  You may obtain a copy of the License at
9    
10       http://www.apache.org/licenses/LICENSE-2.0
11   
12   Unless required by applicable law or agreed to in writing,
13   software distributed under the License is distributed on an
14   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   KIND, either express or implied.  See the License for the
16   specific language governing permissions and limitations
17   under the License.
18   =================== DO NOT EDIT THIS FILE ====================
19   Generated by Modello 2.4.0,
20   any modifications will be overwritten.
21   ==============================================================
22   */
23  
24  package org.apache.maven.model;
25  
26  /**
27   * The conditions within the build runtime environment which will
28   * trigger the
29   *         automatic inclusion of the build profile. Multiple
30   * conditions can be defined, which must
31   *         be all satisfied to activate the profile.
32   *       
33   * 
34   * @version $Revision$ $Date$
35   */
36  @SuppressWarnings( "all" )
37  public class Activation
38      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
39  {
40  
41        //--------------------------/
42       //- Class/Member Variables -/
43      //--------------------------/
44  
45      /**
46       * If set to true, this profile will be active unless another
47       * profile in this
48       *             pom is activated using the command line -P
49       * option or by one of that profile's
50       *             activators.
51       */
52      private boolean activeByDefault = false;
53  
54      /**
55       * 
56       *             
57       *             Specifies that this profile will be activated
58       * when a matching JDK is detected.
59       *             For example, <code>1.4</code> only activates on
60       * JDKs versioned 1.4,
61       *             while <code>!1.4</code> matches any JDK that is
62       * not version 1.4. Ranges are supported too:
63       *             <code>[1.5,)</code> activates when the JDK is
64       * 1.5 minimum.
65       *             
66       *           
67       */
68      private String jdk;
69  
70      /**
71       * Specifies that this profile will be activated when matching
72       * operating system
73       *             attributes are detected.
74       */
75      private ActivationOS os;
76  
77      /**
78       * Specifies that this profile will be activated when this
79       * property is
80       *             specified.
81       */
82      private ActivationProperty property;
83  
84      /**
85       * Specifies that this profile will be activated based on
86       * existence of a file.
87       */
88      private ActivationFile file;
89  
90      /**
91       * Field locations.
92       */
93      private java.util.Map<Object, InputLocation> locations;
94  
95      /**
96       * Field location.
97       */
98      private InputLocation location;
99  
100     /**
101      * Field activeByDefaultLocation.
102      */
103     private InputLocation activeByDefaultLocation;
104 
105     /**
106      * Field jdkLocation.
107      */
108     private InputLocation jdkLocation;
109 
110     /**
111      * Field osLocation.
112      */
113     private InputLocation osLocation;
114 
115     /**
116      * Field propertyLocation.
117      */
118     private InputLocation propertyLocation;
119 
120     /**
121      * Field fileLocation.
122      */
123     private InputLocation fileLocation;
124 
125 
126       //-----------/
127      //- Methods -/
128     //-----------/
129 
130     /**
131      * Method clone.
132      * 
133      * @return Activation
134      */
135     public Activation clone()
136     {
137         try
138         {
139             Activation copy = (Activation) super.clone();
140 
141             if ( this.os != null )
142             {
143                 copy.os = (ActivationOS) this.os.clone();
144             }
145 
146             if ( this.property != null )
147             {
148                 copy.property = (ActivationProperty) this.property.clone();
149             }
150 
151             if ( this.file != null )
152             {
153                 copy.file = (ActivationFile) this.file.clone();
154             }
155 
156             if ( copy.locations != null )
157             {
158                 copy.locations = new java.util.LinkedHashMap( copy.locations );
159             }
160 
161             return copy;
162         }
163         catch ( java.lang.Exception ex )
164         {
165             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
166                 + " does not support clone()" ).initCause( ex );
167         }
168     } //-- Activation clone()
169 
170     /**
171      * Get specifies that this profile will be activated based on
172      * existence of a file.
173      * 
174      * @return ActivationFile
175      */
176     public ActivationFile getFile()
177     {
178         return this.file;
179     } //-- ActivationFile getFile()
180 
181     /**
182      * Get specifies that this profile will be activated when a
183      * matching JDK is detected.
184      *             For example, <code>1.4</code> only activates on
185      * JDKs versioned 1.4,
186      *             while <code>!1.4</code> matches any JDK that is
187      * not version 1.4. Ranges are supported too:
188      *             <code>[1.5,)</code> activates when the JDK is
189      * 1.5 minimum.
190      * 
191      * @return String
192      */
193     public String getJdk()
194     {
195         return this.jdk;
196     } //-- String getJdk()
197 
198     /**
199      * 
200      * 
201      * @param key a key object.
202      * @return InputLocation
203      */
204     public InputLocation getLocation( Object key )
205     {
206         if ( key instanceof String )
207         {
208             switch ( ( String ) key )
209             {
210                 case "" :
211                 {
212                     return this.location;
213                 }
214                 case "activeByDefault" :
215                 {
216                     return activeByDefaultLocation;
217                 }
218                 case "jdk" :
219                 {
220                     return jdkLocation;
221                 }
222                 case "os" :
223                 {
224                     return osLocation;
225                 }
226                 case "property" :
227                 {
228                     return propertyLocation;
229                 }
230                 case "file" :
231                 {
232                     return fileLocation;
233                 }
234                 default :
235                 {
236                     return getOtherLocation( key );
237                 }
238                 }
239             }
240             else
241             {
242                 return getOtherLocation( key );
243             }
244     } //-- InputLocation getLocation( Object )
245 
246     /**
247      * Get specifies that this profile will be activated when
248      * matching operating system
249      *             attributes are detected.
250      * 
251      * @return ActivationOS
252      */
253     public ActivationOS getOs()
254     {
255         return this.os;
256     } //-- ActivationOS getOs()
257 
258     /**
259      * 
260      * 
261      * @param key a key object.
262      * @param location a location object.
263      */
264     public void setLocation( Object key, InputLocation location )
265     {
266         if ( key instanceof String )
267         {
268             switch ( ( String ) key )
269             {
270                 case "" :
271                 {
272                     this.location = location;
273                     return;
274                 }
275                 case "activeByDefault" :
276                 {
277                     activeByDefaultLocation = location;
278                     return;
279                 }
280                 case "jdk" :
281                 {
282                     jdkLocation = location;
283                     return;
284                 }
285                 case "os" :
286                 {
287                     osLocation = location;
288                     return;
289                 }
290                 case "property" :
291                 {
292                     propertyLocation = location;
293                     return;
294                 }
295                 case "file" :
296                 {
297                     fileLocation = location;
298                     return;
299                 }
300                 default :
301                 {
302                     setOtherLocation( key, location );
303                     return;
304                 }
305             }
306         }
307         else
308         {
309             setOtherLocation( key, location );
310         }
311     } //-- void setLocation( Object, InputLocation )
312 
313     /**
314      * 
315      * 
316      * @param key a key object.
317      * @param location a location object.
318      */
319     public void setOtherLocation( Object key, InputLocation location )
320     {
321         if ( location != null )
322         {
323             if ( this.locations == null )
324             {
325                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
326             }
327             this.locations.put( key, location );
328         }
329     } //-- void setOtherLocation( Object, InputLocation )
330 
331     /**
332      * 
333      * 
334      * @param key a key object.
335      * @return InputLocation
336      */
337     private InputLocation getOtherLocation( Object key )
338     {
339         return ( locations != null ) ? locations.get( key ) : null;
340     } //-- InputLocation getOtherLocation( Object )
341 
342     /**
343      * Get specifies that this profile will be activated when this
344      * property is
345      *             specified.
346      * 
347      * @return ActivationProperty
348      */
349     public ActivationProperty getProperty()
350     {
351         return this.property;
352     } //-- ActivationProperty getProperty()
353 
354     /**
355      * Get if set to true, this profile will be active unless
356      * another profile in this
357      *             pom is activated using the command line -P
358      * option or by one of that profile's
359      *             activators.
360      * 
361      * @return boolean
362      */
363     public boolean isActiveByDefault()
364     {
365         return this.activeByDefault;
366     } //-- boolean isActiveByDefault()
367 
368     /**
369      * Set if set to true, this profile will be active unless
370      * another profile in this
371      *             pom is activated using the command line -P
372      * option or by one of that profile's
373      *             activators.
374      * 
375      * @param activeByDefault a activeByDefault object.
376      */
377     public void setActiveByDefault( boolean activeByDefault )
378     {
379         this.activeByDefault = activeByDefault;
380     } //-- void setActiveByDefault( boolean )
381 
382     /**
383      * Set specifies that this profile will be activated based on
384      * existence of a file.
385      * 
386      * @param file a file object.
387      */
388     public void setFile( ActivationFile file )
389     {
390         this.file = file;
391     } //-- void setFile( ActivationFile )
392 
393     /**
394      * Set specifies that this profile will be activated when a
395      * matching JDK is detected.
396      *             For example, <code>1.4</code> only activates on
397      * JDKs versioned 1.4,
398      *             while <code>!1.4</code> matches any JDK that is
399      * not version 1.4. Ranges are supported too:
400      *             <code>[1.5,)</code> activates when the JDK is
401      * 1.5 minimum.
402      * 
403      * @param jdk a jdk object.
404      */
405     public void setJdk( String jdk )
406     {
407         this.jdk = jdk;
408     } //-- void setJdk( String )
409 
410     /**
411      * Set specifies that this profile will be activated when
412      * matching operating system
413      *             attributes are detected.
414      * 
415      * @param os a os object.
416      */
417     public void setOs( ActivationOS os )
418     {
419         this.os = os;
420     } //-- void setOs( ActivationOS )
421 
422     /**
423      * Set specifies that this profile will be activated when this
424      * property is
425      *             specified.
426      * 
427      * @param property a property object.
428      */
429     public void setProperty( ActivationProperty property )
430     {
431         this.property = property;
432     } //-- void setProperty( ActivationProperty )
433 
434 }