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