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