View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 1.11,
3   // any modifications will be overwritten.
4   // ==============================================================
5   
6   package org.apache.maven.model;
7   
8   /**
9    * Download policy.
10   * 
11   * @version $Revision$ $Date$
12   */
13  @SuppressWarnings( "all" )
14  public class RepositoryPolicy
15      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
16  {
17  
18        //--------------------------/
19       //- Class/Member Variables -/
20      //--------------------------/
21  
22      /**
23       * 
24       *             
25       *             Whether to use this repository for downloading
26       * this type of artifact. Note: While the type
27       *             of this field is <code>String</code> for
28       * technical reasons, the semantic type is actually
29       *             <code>Boolean</code>. Default value is
30       * <code>true</code>.
31       *             
32       *           
33       */
34      private String enabled;
35  
36      /**
37       * 
38       *             
39       *             The frequency for downloading updates - can be
40       *             <code>always,</code>
41       *             <code>daily</code>
42       *             (default),
43       *             <code>interval:XXX</code>
44       *             (in minutes) or
45       *             <code>never</code>
46       *             (only if it doesn't exist locally).
47       *             
48       *           
49       */
50      private String updatePolicy;
51  
52      /**
53       * 
54       *             
55       *             What to do when verification of an artifact
56       * checksum fails. Valid values are
57       *             <code>ignore</code>
58       *             ,
59       *             <code>fail</code>
60       *             or
61       *             <code>warn</code>
62       *             (the default).
63       *             
64       *           
65       */
66      private String checksumPolicy;
67  
68      /**
69       * Field locations.
70       */
71      private java.util.Map<Object, InputLocation> locations;
72  
73      /**
74       * Field location.
75       */
76      private InputLocation location;
77  
78      /**
79       * Field enabledLocation.
80       */
81      private InputLocation enabledLocation;
82  
83      /**
84       * Field updatePolicyLocation.
85       */
86      private InputLocation updatePolicyLocation;
87  
88      /**
89       * Field checksumPolicyLocation.
90       */
91      private InputLocation checksumPolicyLocation;
92  
93  
94        //-----------/
95       //- Methods -/
96      //-----------/
97  
98      /**
99       * Method clone.
100      * 
101      * @return RepositoryPolicy
102      */
103     public RepositoryPolicy clone()
104     {
105         try
106         {
107             RepositoryPolicy copy = (RepositoryPolicy) super.clone();
108 
109             if ( copy.locations != null )
110             {
111                 copy.locations = new java.util.LinkedHashMap( copy.locations );
112             }
113 
114             return copy;
115         }
116         catch ( java.lang.Exception ex )
117         {
118             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
119                 + " does not support clone()" ).initCause( ex );
120         }
121     } //-- RepositoryPolicy clone()
122 
123     /**
124      * Get what to do when verification of an artifact checksum
125      * fails. Valid values are
126      *             <code>ignore</code>
127      *             ,
128      *             <code>fail</code>
129      *             or
130      *             <code>warn</code>
131      *             (the default).
132      * 
133      * @return String
134      */
135     public String getChecksumPolicy()
136     {
137         return this.checksumPolicy;
138     } //-- String getChecksumPolicy()
139 
140     /**
141      * Get whether to use this repository for downloading this type
142      * of artifact. Note: While the type
143      *             of this field is <code>String</code> for
144      * technical reasons, the semantic type is actually
145      *             <code>Boolean</code>. Default value is
146      * <code>true</code>.
147      * 
148      * @return String
149      */
150     public String getEnabled()
151     {
152         return this.enabled;
153     } //-- String getEnabled()
154 
155     /**
156      * 
157      * 
158      * @param key
159      * @return InputLocation
160      */
161     public InputLocation getLocation( Object key )
162     {
163         if ( key instanceof String )
164         {
165             switch ( ( String ) key )
166             {
167                 case "" :
168                 {
169                     return this.location;
170                 }
171                 case "enabled" :
172                 {
173                     return enabledLocation;
174                 }
175                 case "updatePolicy" :
176                 {
177                     return updatePolicyLocation;
178                 }
179                 case "checksumPolicy" :
180                 {
181                     return checksumPolicyLocation;
182                 }
183                 default :
184                 {
185                     return getOtherLocation( key );
186                 }
187                 }
188             }
189             else
190             {
191                 return getOtherLocation( key );
192             }
193     } //-- InputLocation getLocation( Object )
194 
195     /**
196      * 
197      * 
198      * @param key
199      * @param location
200      */
201     public void setLocation( Object key, InputLocation location )
202     {
203         if ( key instanceof String )
204         {
205             switch ( ( String ) key )
206             {
207                 case "" :
208                 {
209                     this.location = location;
210                     return;
211                 }
212                 case "enabled" :
213                 {
214                     enabledLocation = location;
215                     return;
216                 }
217                 case "updatePolicy" :
218                 {
219                     updatePolicyLocation = location;
220                     return;
221                 }
222                 case "checksumPolicy" :
223                 {
224                     checksumPolicyLocation = location;
225                     return;
226                 }
227                 default :
228                 {
229                     setOtherLocation( key, location );
230                     return;
231                 }
232                 }
233             }
234             else
235             {
236                 setOtherLocation( key, location );
237             }
238     } //-- void setLocation( Object, InputLocation )
239 
240     /**
241      * 
242      * 
243      * @param key
244      * @param location
245      */
246     public void setOtherLocation( Object key, InputLocation location )
247     {
248         if ( location != null )
249         {
250             if ( this.locations == null )
251             {
252                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
253             }
254             this.locations.put( key, location );
255         }
256     } //-- void setOtherLocation( Object, InputLocation )
257 
258     /**
259      * 
260      * 
261      * @param key
262      * @return InputLocation
263      */
264     private InputLocation getOtherLocation( Object key )
265     {
266         return ( locations != null ) ? locations.get( key ) : null;
267     } //-- InputLocation getOtherLocation( Object )
268 
269     /**
270      * Get the frequency for downloading updates - can be
271      *             <code>always,</code>
272      *             <code>daily</code>
273      *             (default),
274      *             <code>interval:XXX</code>
275      *             (in minutes) or
276      *             <code>never</code>
277      *             (only if it doesn't exist locally).
278      * 
279      * @return String
280      */
281     public String getUpdatePolicy()
282     {
283         return this.updatePolicy;
284     } //-- String getUpdatePolicy()
285 
286     /**
287      * Set what to do when verification of an artifact checksum
288      * fails. Valid values are
289      *             <code>ignore</code>
290      *             ,
291      *             <code>fail</code>
292      *             or
293      *             <code>warn</code>
294      *             (the default).
295      * 
296      * @param checksumPolicy
297      */
298     public void setChecksumPolicy( String checksumPolicy )
299     {
300         this.checksumPolicy = checksumPolicy;
301     } //-- void setChecksumPolicy( String )
302 
303     /**
304      * Set whether to use this repository for downloading this type
305      * of artifact. Note: While the type
306      *             of this field is <code>String</code> for
307      * technical reasons, the semantic type is actually
308      *             <code>Boolean</code>. Default value is
309      * <code>true</code>.
310      * 
311      * @param enabled
312      */
313     public void setEnabled( String enabled )
314     {
315         this.enabled = enabled;
316     } //-- void setEnabled( String )
317 
318     /**
319      * Set the frequency for downloading updates - can be
320      *             <code>always,</code>
321      *             <code>daily</code>
322      *             (default),
323      *             <code>interval:XXX</code>
324      *             (in minutes) or
325      *             <code>never</code>
326      *             (only if it doesn't exist locally).
327      * 
328      * @param updatePolicy
329      */
330     public void setUpdatePolicy( String updatePolicy )
331     {
332         this.updatePolicy = updatePolicy;
333     } //-- void setUpdatePolicy( String )
334 
335     
336             
337 
338     public boolean isEnabled()
339     {
340         return ( enabled != null ) ? Boolean.parseBoolean( enabled ) : true;
341     }
342 
343     public void setEnabled( boolean enabled )
344     {
345         this.enabled = String.valueOf( enabled );
346     }
347 
348             
349           
350 }