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