Coverage Report - org.apache.maven.settings.Settings
 
Classes in this File Line Coverage Branch Coverage Complexity
Settings
31 %
44/144
28 %
19/68
0
 
 1  
 /*
 2  
  =================== DO NOT EDIT THIS FILE ====================
 3  
  Generated by Modello 1.0.1 on 2009-09-09 03:05:33,
 4  
  any modifications will be overwritten.
 5  
  ==============================================================
 6  
  */
 7  
 
 8  
 package org.apache.maven.settings;
 9  
 
 10  
 /**
 11  
  * 
 12  
  *         Root element of the user configuration file.
 13  
  *       
 14  
  * 
 15  
  * @version $Revision$ $Date$
 16  
  */
 17  8
 public class Settings
 18  
     extends TrackableBase
 19  
     implements java.io.Serializable
 20  
 {
 21  
 
 22  
       //--------------------------/
 23  
      //- Class/Member Variables -/
 24  
     //--------------------------/
 25  
 
 26  
     /**
 27  
      * 
 28  
      *             
 29  
      *             The local repository.
 30  
      *             
 31  
      *           
 32  
      */
 33  
     private String localRepository;
 34  
 
 35  
     /**
 36  
      * 
 37  
      *             
 38  
      *             Whether Maven should attempt to interact with
 39  
      * the user for input.
 40  
      *             
 41  
      *           
 42  
      */
 43  8
     private boolean interactiveMode = true;
 44  
 
 45  
     /**
 46  
      * 
 47  
      *             
 48  
      *             Whether Maven should use the plugin-registry.xml
 49  
      * file to manage plugin versions.
 50  
      *             
 51  
      *           
 52  
      */
 53  8
     private boolean usePluginRegistry = false;
 54  
 
 55  
     /**
 56  
      * 
 57  
      *             
 58  
      *             Indicate whether maven should operate in offline
 59  
      * mode full-time.
 60  
      *             
 61  
      *           
 62  
      */
 63  8
     private boolean offline = false;
 64  
 
 65  
     /**
 66  
      * Field proxies.
 67  
      */
 68  
     private java.util.List<Proxy> proxies;
 69  
 
 70  
     /**
 71  
      * Field servers.
 72  
      */
 73  
     private java.util.List<Server> servers;
 74  
 
 75  
     /**
 76  
      * Field mirrors.
 77  
      */
 78  
     private java.util.List<Mirror> mirrors;
 79  
 
 80  
     /**
 81  
      * Field profiles.
 82  
      */
 83  
     private java.util.List<Profile> profiles;
 84  
 
 85  
     /**
 86  
      * Field activeProfiles.
 87  
      */
 88  
     private java.util.List<String> activeProfiles;
 89  
 
 90  
     /**
 91  
      * Field pluginGroups.
 92  
      */
 93  
     private java.util.List<String> pluginGroups;
 94  
 
 95  
     /**
 96  
      * Field modelEncoding.
 97  
      */
 98  8
     private String modelEncoding = "UTF-8";
 99  
 
 100  
 
 101  
       //-----------/
 102  
      //- Methods -/
 103  
     //-----------/
 104  
 
 105  
     /**
 106  
      * Method addActiveProfile.
 107  
      * 
 108  
      * @param string
 109  
      */
 110  
     public void addActiveProfile( String string )
 111  
     {
 112  0
         if ( !(string instanceof String) )
 113  
         {
 114  0
             throw new ClassCastException( "Settings.addActiveProfiles(string) parameter must be instanceof " + String.class.getName() );
 115  
         }
 116  0
         getActiveProfiles().add( string );
 117  0
     } //-- void addActiveProfile( String )
 118  
 
 119  
     /**
 120  
      * Method addMirror.
 121  
      * 
 122  
      * @param mirror
 123  
      */
 124  
     public void addMirror( Mirror mirror )
 125  
     {
 126  0
         if ( !(mirror instanceof Mirror) )
 127  
         {
 128  0
             throw new ClassCastException( "Settings.addMirrors(mirror) parameter must be instanceof " + Mirror.class.getName() );
 129  
         }
 130  0
         getMirrors().add( mirror );
 131  0
     } //-- void addMirror( Mirror )
 132  
 
 133  
     /**
 134  
      * Method addPluginGroup.
 135  
      * 
 136  
      * @param string
 137  
      */
 138  
     public void addPluginGroup( String string )
 139  
     {
 140  3
         if ( !(string instanceof String) )
 141  
         {
 142  0
             throw new ClassCastException( "Settings.addPluginGroups(string) parameter must be instanceof " + String.class.getName() );
 143  
         }
 144  3
         getPluginGroups().add( string );
 145  3
     } //-- void addPluginGroup( String )
 146  
 
 147  
     /**
 148  
      * Method addProfile.
 149  
      * 
 150  
      * @param profile
 151  
      */
 152  
     public void addProfile( Profile profile )
 153  
     {
 154  0
         if ( !(profile instanceof Profile) )
 155  
         {
 156  0
             throw new ClassCastException( "Settings.addProfiles(profile) parameter must be instanceof " + Profile.class.getName() );
 157  
         }
 158  0
         getProfiles().add( profile );
 159  0
     } //-- void addProfile( Profile )
 160  
 
 161  
     /**
 162  
      * Method addProxy.
 163  
      * 
 164  
      * @param proxy
 165  
      */
 166  
     public void addProxy( Proxy proxy )
 167  
     {
 168  0
         if ( !(proxy instanceof Proxy) )
 169  
         {
 170  0
             throw new ClassCastException( "Settings.addProxies(proxy) parameter must be instanceof " + Proxy.class.getName() );
 171  
         }
 172  0
         getProxies().add( proxy );
 173  0
     } //-- void addProxy( Proxy )
 174  
 
 175  
     /**
 176  
      * Method addServer.
 177  
      * 
 178  
      * @param server
 179  
      */
 180  
     public void addServer( Server server )
 181  
     {
 182  0
         if ( !(server instanceof Server) )
 183  
         {
 184  0
             throw new ClassCastException( "Settings.addServers(server) parameter must be instanceof " + Server.class.getName() );
 185  
         }
 186  0
         getServers().add( server );
 187  0
     } //-- void addServer( Server )
 188  
 
 189  
     /**
 190  
      * Method getActiveProfiles.
 191  
      * 
 192  
      * @return List
 193  
      */
 194  
     public java.util.List<String> getActiveProfiles()
 195  
     {
 196  11
         if ( this.activeProfiles == null )
 197  
         {
 198  8
             this.activeProfiles = new java.util.ArrayList<String>();
 199  
         }
 200  
 
 201  11
         return this.activeProfiles;
 202  
     } //-- java.util.List<String> getActiveProfiles()
 203  
 
 204  
     /**
 205  
      * Get the local repository.
 206  
      * 
 207  
      * @return String
 208  
      */
 209  
     public String getLocalRepository()
 210  
     {
 211  11
         return this.localRepository;
 212  
     } //-- String getLocalRepository()
 213  
 
 214  
     /**
 215  
      * Method getMirrors.
 216  
      * 
 217  
      * @return List
 218  
      */
 219  
     public java.util.List<Mirror> getMirrors()
 220  
     {
 221  8
         if ( this.mirrors == null )
 222  
         {
 223  8
             this.mirrors = new java.util.ArrayList<Mirror>();
 224  
         }
 225  
 
 226  8
         return this.mirrors;
 227  
     } //-- java.util.List<Mirror> getMirrors()
 228  
 
 229  
     /**
 230  
      * Method getModelEncoding.
 231  
      * 
 232  
      * @return the current encoding used when reading/writing this
 233  
      * model
 234  
      */
 235  
     public String getModelEncoding()
 236  
     {
 237  0
         return modelEncoding;
 238  
     } //-- String getModelEncoding()
 239  
 
 240  
     /**
 241  
      * Method getPluginGroups.
 242  
      * 
 243  
      * @return List
 244  
      */
 245  
     public java.util.List<String> getPluginGroups()
 246  
     {
 247  12
         if ( this.pluginGroups == null )
 248  
         {
 249  8
             this.pluginGroups = new java.util.ArrayList<String>();
 250  
         }
 251  
 
 252  12
         return this.pluginGroups;
 253  
     } //-- java.util.List<String> getPluginGroups()
 254  
 
 255  
     /**
 256  
      * Method getProfiles.
 257  
      * 
 258  
      * @return List
 259  
      */
 260  
     public java.util.List<Profile> getProfiles()
 261  
     {
 262  11
         if ( this.profiles == null )
 263  
         {
 264  8
             this.profiles = new java.util.ArrayList<Profile>();
 265  
         }
 266  
 
 267  11
         return this.profiles;
 268  
     } //-- java.util.List<Profile> getProfiles()
 269  
 
 270  
     /**
 271  
      * Method getProxies.
 272  
      * 
 273  
      * @return List
 274  
      */
 275  
     public java.util.List<Proxy> getProxies()
 276  
     {
 277  11
         if ( this.proxies == null )
 278  
         {
 279  5
             this.proxies = new java.util.ArrayList<Proxy>();
 280  
         }
 281  
 
 282  11
         return this.proxies;
 283  
     } //-- java.util.List<Proxy> getProxies()
 284  
 
 285  
     /**
 286  
      * Method getServers.
 287  
      * 
 288  
      * @return List
 289  
      */
 290  
     public java.util.List<Server> getServers()
 291  
     {
 292  8
         if ( this.servers == null )
 293  
         {
 294  8
             this.servers = new java.util.ArrayList<Server>();
 295  
         }
 296  
 
 297  8
         return this.servers;
 298  
     } //-- java.util.List<Server> getServers()
 299  
 
 300  
     /**
 301  
      * Get whether Maven should attempt to interact with the user
 302  
      * for input.
 303  
      * 
 304  
      * @return boolean
 305  
      */
 306  
     public boolean isInteractiveMode()
 307  
     {
 308  0
         return this.interactiveMode;
 309  
     } //-- boolean isInteractiveMode()
 310  
 
 311  
     /**
 312  
      * Get indicate whether maven should operate in offline mode
 313  
      * full-time.
 314  
      * 
 315  
      * @return boolean
 316  
      */
 317  
     public boolean isOffline()
 318  
     {
 319  0
         return this.offline;
 320  
     } //-- boolean isOffline()
 321  
 
 322  
     /**
 323  
      * Get whether Maven should use the plugin-registry.xml file to
 324  
      * manage plugin versions.
 325  
      * 
 326  
      * @return boolean
 327  
      */
 328  
     public boolean isUsePluginRegistry()
 329  
     {
 330  0
         return this.usePluginRegistry;
 331  
     } //-- boolean isUsePluginRegistry()
 332  
 
 333  
     /**
 334  
      * Method removeActiveProfile.
 335  
      * 
 336  
      * @param string
 337  
      */
 338  
     public void removeActiveProfile( String string )
 339  
     {
 340  0
         if ( !(string instanceof String) )
 341  
         {
 342  0
             throw new ClassCastException( "Settings.removeActiveProfiles(string) parameter must be instanceof " + String.class.getName() );
 343  
         }
 344  0
         getActiveProfiles().remove( string );
 345  0
     } //-- void removeActiveProfile( String )
 346  
 
 347  
     /**
 348  
      * Method removeMirror.
 349  
      * 
 350  
      * @param mirror
 351  
      */
 352  
     public void removeMirror( Mirror mirror )
 353  
     {
 354  0
         if ( !(mirror instanceof Mirror) )
 355  
         {
 356  0
             throw new ClassCastException( "Settings.removeMirrors(mirror) parameter must be instanceof " + Mirror.class.getName() );
 357  
         }
 358  0
         getMirrors().remove( mirror );
 359  0
     } //-- void removeMirror( Mirror )
 360  
 
 361  
     /**
 362  
      * Method removePluginGroup.
 363  
      * 
 364  
      * @param string
 365  
      */
 366  
     public void removePluginGroup( String string )
 367  
     {
 368  0
         if ( !(string instanceof String) )
 369  
         {
 370  0
             throw new ClassCastException( "Settings.removePluginGroups(string) parameter must be instanceof " + String.class.getName() );
 371  
         }
 372  0
         getPluginGroups().remove( string );
 373  0
     } //-- void removePluginGroup( String )
 374  
 
 375  
     /**
 376  
      * Method removeProfile.
 377  
      * 
 378  
      * @param profile
 379  
      */
 380  
     public void removeProfile( Profile profile )
 381  
     {
 382  0
         if ( !(profile instanceof Profile) )
 383  
         {
 384  0
             throw new ClassCastException( "Settings.removeProfiles(profile) parameter must be instanceof " + Profile.class.getName() );
 385  
         }
 386  0
         getProfiles().remove( profile );
 387  0
     } //-- void removeProfile( Profile )
 388  
 
 389  
     /**
 390  
      * Method removeProxy.
 391  
      * 
 392  
      * @param proxy
 393  
      */
 394  
     public void removeProxy( Proxy proxy )
 395  
     {
 396  0
         if ( !(proxy instanceof Proxy) )
 397  
         {
 398  0
             throw new ClassCastException( "Settings.removeProxies(proxy) parameter must be instanceof " + Proxy.class.getName() );
 399  
         }
 400  0
         getProxies().remove( proxy );
 401  0
     } //-- void removeProxy( Proxy )
 402  
 
 403  
     /**
 404  
      * Method removeServer.
 405  
      * 
 406  
      * @param server
 407  
      */
 408  
     public void removeServer( Server server )
 409  
     {
 410  0
         if ( !(server instanceof Server) )
 411  
         {
 412  0
             throw new ClassCastException( "Settings.removeServers(server) parameter must be instanceof " + Server.class.getName() );
 413  
         }
 414  0
         getServers().remove( server );
 415  0
     } //-- void removeServer( Server )
 416  
 
 417  
     /**
 418  
      * Set list of manually-activated build profiles, specified in
 419  
      * the order in which
 420  
      *             they should be applied.
 421  
      * 
 422  
      * @param activeProfiles
 423  
      */
 424  
     public void setActiveProfiles( java.util.List<String> activeProfiles )
 425  
     {
 426  0
         this.activeProfiles = activeProfiles;
 427  0
     } //-- void setActiveProfiles( java.util.List )
 428  
 
 429  
     /**
 430  
      * Set whether Maven should attempt to interact with the user
 431  
      * for input.
 432  
      * 
 433  
      * @param interactiveMode
 434  
      */
 435  
     public void setInteractiveMode( boolean interactiveMode )
 436  
     {
 437  0
         this.interactiveMode = interactiveMode;
 438  0
     } //-- void setInteractiveMode( boolean )
 439  
 
 440  
     /**
 441  
      * Set the local repository.
 442  
      * 
 443  
      * @param localRepository
 444  
      */
 445  
     public void setLocalRepository( String localRepository )
 446  
     {
 447  7
         this.localRepository = localRepository;
 448  7
     } //-- void setLocalRepository( String )
 449  
 
 450  
     /**
 451  
      * Set configuration of download mirrors for repositories.
 452  
      * 
 453  
      * @param mirrors
 454  
      */
 455  
     public void setMirrors( java.util.List<Mirror> mirrors )
 456  
     {
 457  0
         this.mirrors = mirrors;
 458  0
     } //-- void setMirrors( java.util.List )
 459  
 
 460  
     /**
 461  
      * Set an encoding used for reading/writing the model.
 462  
      * 
 463  
      * @param modelEncoding
 464  
      */
 465  
     public void setModelEncoding( String modelEncoding )
 466  
     {
 467  0
         this.modelEncoding = modelEncoding;
 468  0
     } //-- void setModelEncoding( String )
 469  
 
 470  
     /**
 471  
      * Set indicate whether maven should operate in offline mode
 472  
      * full-time.
 473  
      * 
 474  
      * @param offline
 475  
      */
 476  
     public void setOffline( boolean offline )
 477  
     {
 478  0
         this.offline = offline;
 479  0
     } //-- void setOffline( boolean )
 480  
 
 481  
     /**
 482  
      * Set list of groupIds to search for a plugin when that plugin
 483  
      *             groupId is not explicitly provided.
 484  
      * 
 485  
      * @param pluginGroups
 486  
      */
 487  
     public void setPluginGroups( java.util.List<String> pluginGroups )
 488  
     {
 489  0
         this.pluginGroups = pluginGroups;
 490  0
     } //-- void setPluginGroups( java.util.List )
 491  
 
 492  
     /**
 493  
      * Set configuration of build profiles for adjusting the build
 494  
      *             according to environmental parameters.
 495  
      * 
 496  
      * @param profiles
 497  
      */
 498  
     public void setProfiles( java.util.List<Profile> profiles )
 499  
     {
 500  0
         this.profiles = profiles;
 501  0
     } //-- void setProfiles( java.util.List )
 502  
 
 503  
     /**
 504  
      * Set configuration for different proxy profiles. Multiple
 505  
      * proxy profiles
 506  
      *             might come in handy for anyone working from a
 507  
      * notebook or other
 508  
      *             mobile platform, to enable easy switching of
 509  
      * entire proxy
 510  
      *             configurations by simply specifying the profile
 511  
      * id, again either from
 512  
      *             the command line or from the defaults section
 513  
      * below.
 514  
      * 
 515  
      * @param proxies
 516  
      */
 517  
     public void setProxies( java.util.List<Proxy> proxies )
 518  
     {
 519  3
         this.proxies = proxies;
 520  3
     } //-- void setProxies( java.util.List )
 521  
 
 522  
     /**
 523  
      * Set configuration of server-specific settings, mainly
 524  
      * authentication
 525  
      *             method. This allows configuration of
 526  
      * authentication on a per-server
 527  
      *             basis.
 528  
      * 
 529  
      * @param servers
 530  
      */
 531  
     public void setServers( java.util.List<Server> servers )
 532  
     {
 533  0
         this.servers = servers;
 534  0
     } //-- void setServers( java.util.List )
 535  
 
 536  
     /**
 537  
      * Set whether Maven should use the plugin-registry.xml file to
 538  
      * manage plugin versions.
 539  
      * 
 540  
      * @param usePluginRegistry
 541  
      */
 542  
     public void setUsePluginRegistry( boolean usePluginRegistry )
 543  
     {
 544  0
         this.usePluginRegistry = usePluginRegistry;
 545  0
     } //-- void setUsePluginRegistry( boolean )
 546  
 
 547  
 
 548  
             
 549  
     public Boolean getInteractiveMode()
 550  
     {
 551  0
         return Boolean.valueOf( isInteractiveMode() );
 552  
     }
 553  
 
 554  
     private Proxy activeProxy;
 555  
 
 556  
     /**
 557  
      * Reset the <code>activeProxy</code> field to <code>null</code>
 558  
      */
 559  
     public void flushActiveProxy()
 560  
     {
 561  0
         this.activeProxy = null;
 562  0
     }
 563  
 
 564  
     /**
 565  
      * @return the first active proxy
 566  
      */
 567  
     public synchronized Proxy getActiveProxy()
 568  
     {
 569  3
         if(activeProxy == null)
 570  
         {
 571  3
             java.util.List proxies = getProxies();
 572  3
             if ( proxies != null && !proxies.isEmpty() )
 573  
             {
 574  2
                 for ( java.util.Iterator it = proxies.iterator(); it.hasNext(); )
 575  
                 {
 576  2
                     Proxy proxy = (Proxy) it.next();
 577  2
                     if ( proxy.isActive() )
 578  
                     {
 579  1
                         activeProxy = proxy;
 580  1
                         break;
 581  
                     }
 582  1
                 }
 583  
             }
 584  
         }
 585  
 
 586  3
         return activeProxy;
 587  
     }
 588  
 
 589  
     public Server getServer( String serverId )
 590  
     {
 591  0
         Server match = null;
 592  
 
 593  0
         java.util.List servers = getServers();
 594  0
         if ( servers != null && serverId != null )
 595  
         {
 596  0
             for ( java.util.Iterator it = servers.iterator(); it.hasNext(); )
 597  
             {
 598  0
                 Server server = (Server) it.next();
 599  0
                 if ( serverId.equals( server.getId() ) )
 600  
                 {
 601  0
                     match = server;
 602  0
                     break;
 603  
                 }
 604  0
             }
 605  
         }
 606  
 
 607  0
         return match;
 608  
     }
 609  
 
 610  
     @Deprecated
 611  
     public Mirror getMirrorOf( String repositoryId )
 612  
     {
 613  0
         Mirror match = null;
 614  
 
 615  0
         java.util.List mirrors = getMirrors();
 616  0
         if ( mirrors != null && repositoryId != null )
 617  
         {
 618  0
             for ( java.util.Iterator it = mirrors.iterator(); it.hasNext(); )
 619  
             {
 620  0
                 Mirror mirror = (Mirror) it.next();
 621  0
                 if ( repositoryId.equals( mirror.getMirrorOf() ) )
 622  
                 {
 623  0
                     match = mirror;
 624  0
                     break;
 625  
                 }
 626  0
             }
 627  
         }
 628  
 
 629  0
         return match;
 630  
     }
 631  
 
 632  
     private java.util.Map profileMap;
 633  
 
 634  
     /**
 635  
      * Reset the <code>profileMap</code> field to <code>null</code>
 636  
      */
 637  
     public void flushProfileMap()
 638  
     {
 639  0
         this.profileMap = null;
 640  0
     }
 641  
 
 642  
     /**
 643  
      * @return a Map of profiles field with <code>Profile#getId()</code> as key
 644  
      * @see org.apache.maven.settings.Profile#getId()
 645  
      */
 646  
     public java.util.Map getProfilesAsMap()
 647  
     {
 648  0
         if ( profileMap == null )
 649  
         {
 650  0
             profileMap = new java.util.LinkedHashMap();
 651  
 
 652  0
             if ( getProfiles() != null )
 653  
             {
 654  0
                 for ( java.util.Iterator it = getProfiles().iterator(); it.hasNext(); )
 655  
                 {
 656  0
                     Profile profile = (Profile) it.next();
 657  
 
 658  0
                     profileMap.put( profile.getId(), profile );
 659  0
                 }
 660  
             }
 661  
         }
 662  
 
 663  0
         return profileMap;
 664  
     }
 665  
 
 666  
     private RuntimeInfo runtimeInfo;
 667  
 
 668  
     public void setRuntimeInfo( RuntimeInfo runtimeInfo )
 669  
     {
 670  5
         this.runtimeInfo = runtimeInfo;
 671  5
     }
 672  
 
 673  
     public RuntimeInfo getRuntimeInfo()
 674  
     {
 675  5
         return runtimeInfo;
 676  
     }
 677  
             
 678  
           
 679  
 }