This project has retired. For details please refer to its Attic page.
Configuration xref
View Javadoc
1   package org.apache.archiva.configuration;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /**
23   * Class Configuration.
24   * 
25   * @version $Revision$ $Date$
26   */
27  @SuppressWarnings( "all" )
28  public class Configuration
29      implements java.io.Serializable
30  {
31  
32        //--------------------------/
33       //- Class/Member Variables -/
34      //--------------------------/
35  
36      /**
37       * This is the version of the configuration format.
38       */
39      private String version = "3.0.0";
40  
41      /**
42       * The type of the metadata storage. Allowed values: jcr, file,
43       * cassandra.
44       */
45      private String metadataStore = "jcr";
46  
47      /**
48       * Field repositoryGroups.
49       */
50      private java.util.List<RepositoryGroupConfiguration> repositoryGroups;
51  
52      /**
53       * Field managedRepositories.
54       */
55      private java.util.List<ManagedRepositoryConfiguration> managedRepositories;
56  
57      /**
58       * Field remoteRepositories.
59       */
60      private java.util.List<RemoteRepositoryConfiguration> remoteRepositories;
61  
62      /**
63       * Field proxyConnectors.
64       */
65      private java.util.List<ProxyConnectorConfiguration> proxyConnectors;
66  
67      /**
68       * Field networkProxies.
69       */
70      private java.util.List<NetworkProxyConfiguration> networkProxies;
71  
72      /**
73       * Field legacyArtifactPaths.
74       */
75      private java.util.List<LegacyArtifactPath> legacyArtifactPaths;
76  
77      /**
78       * 
79       *             The repository scanning configuration.
80       *           
81       */
82      private RepositoryScanningConfiguration repositoryScanning;
83  
84      /**
85       * 
86       *             The webapp configuration.
87       *           
88       */
89      private WebappConfiguration webapp;
90  
91      /**
92       * 
93       *             The organisation info.
94       *           
95       */
96      private OrganisationInformation organisationInfo;
97  
98      /**
99       * 
100      *             The NetworkConfiguration .
101      *           
102      */
103     private NetworkConfiguration networkConfiguration;
104 
105     /**
106      * The RedbackRuntimeConfiguration.
107      */
108     private RedbackRuntimeConfiguration redbackRuntimeConfiguration;
109 
110     /**
111      * The ArchivaRuntimeConfiguration.
112      */
113     private ArchivaRuntimeConfiguration archivaRuntimeConfiguration;
114 
115     /**
116      * Field proxyConnectorRuleConfigurations.
117      */
118     private java.util.List<ProxyConnectorRuleConfiguration> proxyConnectorRuleConfigurations;
119 
120     /**
121      * Archiva default settings.
122      */
123     private ArchivaDefaultConfiguration archivaDefaultConfiguration;
124 
125     /**
126      * Field modelEncoding.
127      */
128     private String modelEncoding = "UTF-8";
129 
130 
131       //-----------/
132      //- Methods -/
133     //-----------/
134 
135     /**
136      * Method addLegacyArtifactPath.
137      * 
138      * @param legacyArtifactPath
139      */
140     public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath )
141     {
142         getLegacyArtifactPaths().add( legacyArtifactPath );
143     } //-- void addLegacyArtifactPath( LegacyArtifactPath )
144 
145     /**
146      * Method addManagedRepository.
147      * 
148      * @param managedRepositoryConfiguration
149      */
150     public void addManagedRepository( ManagedRepositoryConfiguration managedRepositoryConfiguration )
151     {
152         getManagedRepositories().add( managedRepositoryConfiguration );
153     } //-- void addManagedRepository( ManagedRepositoryConfiguration )
154 
155     /**
156      * Method addNetworkProxy.
157      * 
158      * @param networkProxyConfiguration
159      */
160     public void addNetworkProxy( NetworkProxyConfiguration networkProxyConfiguration )
161     {
162         getNetworkProxies().add( networkProxyConfiguration );
163     } //-- void addNetworkProxy( NetworkProxyConfiguration )
164 
165     /**
166      * Method addProxyConnector.
167      * 
168      * @param proxyConnectorConfiguration
169      */
170     public void addProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration )
171     {
172         getProxyConnectors().add( proxyConnectorConfiguration );
173     } //-- void addProxyConnector( ProxyConnectorConfiguration )
174 
175     /**
176      * Method addProxyConnectorRuleConfiguration.
177      * 
178      * @param proxyConnectorRuleConfiguration
179      */
180     public void addProxyConnectorRuleConfiguration( ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration )
181     {
182         getProxyConnectorRuleConfigurations().add( proxyConnectorRuleConfiguration );
183     } //-- void addProxyConnectorRuleConfiguration( ProxyConnectorRuleConfiguration )
184 
185     /**
186      * Method addRemoteRepository.
187      * 
188      * @param remoteRepositoryConfiguration
189      */
190     public void addRemoteRepository( RemoteRepositoryConfiguration remoteRepositoryConfiguration )
191     {
192         getRemoteRepositories().add( remoteRepositoryConfiguration );
193     } //-- void addRemoteRepository( RemoteRepositoryConfiguration )
194 
195     /**
196      * Method addRepositoryGroup.
197      * 
198      * @param repositoryGroupConfiguration
199      */
200     public void addRepositoryGroup( RepositoryGroupConfiguration repositoryGroupConfiguration )
201     {
202         getRepositoryGroups().add( repositoryGroupConfiguration );
203     } //-- void addRepositoryGroup( RepositoryGroupConfiguration )
204 
205     /**
206      * Get archiva default settings.
207      * 
208      * @return ArchivaDefaultConfiguration
209      */
210     public ArchivaDefaultConfiguration getArchivaDefaultConfiguration()
211     {
212         return this.archivaDefaultConfiguration;
213     } //-- ArchivaDefaultConfiguration getArchivaDefaultConfiguration()
214 
215     /**
216      * Get the ArchivaRuntimeConfiguration.
217      * 
218      * @return ArchivaRuntimeConfiguration
219      */
220     public ArchivaRuntimeConfiguration getArchivaRuntimeConfiguration()
221     {
222         return this.archivaRuntimeConfiguration;
223     } //-- ArchivaRuntimeConfiguration getArchivaRuntimeConfiguration()
224 
225     /**
226      * Method getLegacyArtifactPaths.
227      * 
228      * @return List
229      */
230     public java.util.List<LegacyArtifactPath> getLegacyArtifactPaths()
231     {
232         if ( this.legacyArtifactPaths == null )
233         {
234             this.legacyArtifactPaths = new java.util.ArrayList<LegacyArtifactPath>();
235         }
236 
237         return this.legacyArtifactPaths;
238     } //-- java.util.List<LegacyArtifactPath> getLegacyArtifactPaths()
239 
240     /**
241      * Method getManagedRepositories.
242      * 
243      * @return List
244      */
245     public java.util.List<ManagedRepositoryConfiguration> getManagedRepositories()
246     {
247         if ( this.managedRepositories == null )
248         {
249             this.managedRepositories = new java.util.ArrayList<ManagedRepositoryConfiguration>();
250         }
251 
252         return this.managedRepositories;
253     } //-- java.util.List<ManagedRepositoryConfiguration> getManagedRepositories()
254 
255     /**
256      * Get the type of the metadata storage. Allowed values: jcr,
257      * file, cassandra.
258      * 
259      * @return String
260      */
261     public String getMetadataStore()
262     {
263         return this.metadataStore;
264     } //-- String getMetadataStore()
265 
266     /**
267      * Get the modelEncoding field.
268      * 
269      * @return String
270      */
271     public String getModelEncoding()
272     {
273         return this.modelEncoding;
274     } //-- String getModelEncoding()
275 
276     /**
277      * Get the NetworkConfiguration .
278      * 
279      * @return NetworkConfiguration
280      */
281     public NetworkConfiguration getNetworkConfiguration()
282     {
283         return this.networkConfiguration;
284     } //-- NetworkConfiguration getNetworkConfiguration()
285 
286     /**
287      * Method getNetworkProxies.
288      * 
289      * @return List
290      */
291     public java.util.List<NetworkProxyConfiguration> getNetworkProxies()
292     {
293         if ( this.networkProxies == null )
294         {
295             this.networkProxies = new java.util.ArrayList<NetworkProxyConfiguration>();
296         }
297 
298         return this.networkProxies;
299     } //-- java.util.List<NetworkProxyConfiguration> getNetworkProxies()
300 
301     /**
302      * Get the organisation info.
303      * 
304      * @return OrganisationInformation
305      */
306     public OrganisationInformation getOrganisationInfo()
307     {
308         return this.organisationInfo;
309     } //-- OrganisationInformation getOrganisationInfo()
310 
311     /**
312      * Method getProxyConnectorRuleConfigurations.
313      * 
314      * @return List
315      */
316     public java.util.List<ProxyConnectorRuleConfiguration> getProxyConnectorRuleConfigurations()
317     {
318         if ( this.proxyConnectorRuleConfigurations == null )
319         {
320             this.proxyConnectorRuleConfigurations = new java.util.ArrayList<ProxyConnectorRuleConfiguration>();
321         }
322 
323         return this.proxyConnectorRuleConfigurations;
324     } //-- java.util.List<ProxyConnectorRuleConfiguration> getProxyConnectorRuleConfigurations()
325 
326     /**
327      * Method getProxyConnectors.
328      * 
329      * @return List
330      */
331     public java.util.List<ProxyConnectorConfiguration> getProxyConnectors()
332     {
333         if ( this.proxyConnectors == null )
334         {
335             this.proxyConnectors = new java.util.ArrayList<ProxyConnectorConfiguration>();
336         }
337 
338         return this.proxyConnectors;
339     } //-- java.util.List<ProxyConnectorConfiguration> getProxyConnectors()
340 
341     /**
342      * Get the RedbackRuntimeConfiguration.
343      * 
344      * @return RedbackRuntimeConfiguration
345      */
346     public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
347     {
348         return this.redbackRuntimeConfiguration;
349     } //-- RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
350 
351     /**
352      * Method getRemoteRepositories.
353      * 
354      * @return List
355      */
356     public java.util.List<RemoteRepositoryConfiguration> getRemoteRepositories()
357     {
358         if ( this.remoteRepositories == null )
359         {
360             this.remoteRepositories = new java.util.ArrayList<RemoteRepositoryConfiguration>();
361         }
362 
363         return this.remoteRepositories;
364     } //-- java.util.List<RemoteRepositoryConfiguration> getRemoteRepositories()
365 
366     /**
367      * Method getRepositoryGroups.
368      * 
369      * @return List
370      */
371     public java.util.List<RepositoryGroupConfiguration> getRepositoryGroups()
372     {
373         if ( this.repositoryGroups == null )
374         {
375             this.repositoryGroups = new java.util.ArrayList<RepositoryGroupConfiguration>();
376         }
377 
378         return this.repositoryGroups;
379     } //-- java.util.List<RepositoryGroupConfiguration> getRepositoryGroups()
380 
381     /**
382      * Get the repository scanning configuration.
383      * 
384      * @return RepositoryScanningConfiguration
385      */
386     public RepositoryScanningConfiguration getRepositoryScanning()
387     {
388         return this.repositoryScanning;
389     } //-- RepositoryScanningConfiguration getRepositoryScanning()
390 
391     /**
392      * Get this is the version of the configuration format.
393      * 
394      * @return String
395      */
396     public String getVersion()
397     {
398         return this.version;
399     } //-- String getVersion()
400 
401     /**
402      * Get the webapp configuration.
403      * 
404      * @return WebappConfiguration
405      */
406     public WebappConfiguration getWebapp()
407     {
408         return this.webapp;
409     } //-- WebappConfiguration getWebapp()
410 
411     /**
412      * Method removeLegacyArtifactPath.
413      * 
414      * @param legacyArtifactPath
415      */
416     public void removeLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath )
417     {
418         getLegacyArtifactPaths().remove( legacyArtifactPath );
419     } //-- void removeLegacyArtifactPath( LegacyArtifactPath )
420 
421     /**
422      * Method removeManagedRepository.
423      * 
424      * @param managedRepositoryConfiguration
425      */
426     public void removeManagedRepository( ManagedRepositoryConfiguration managedRepositoryConfiguration )
427     {
428         getManagedRepositories().remove( managedRepositoryConfiguration );
429     } //-- void removeManagedRepository( ManagedRepositoryConfiguration )
430 
431     /**
432      * Method removeNetworkProxy.
433      * 
434      * @param networkProxyConfiguration
435      */
436     public void removeNetworkProxy( NetworkProxyConfiguration networkProxyConfiguration )
437     {
438         getNetworkProxies().remove( networkProxyConfiguration );
439     } //-- void removeNetworkProxy( NetworkProxyConfiguration )
440 
441     /**
442      * Method removeProxyConnector.
443      * 
444      * @param proxyConnectorConfiguration
445      */
446     public void removeProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration )
447     {
448         getProxyConnectors().remove( proxyConnectorConfiguration );
449     } //-- void removeProxyConnector( ProxyConnectorConfiguration )
450 
451     /**
452      * Method removeProxyConnectorRuleConfiguration.
453      * 
454      * @param proxyConnectorRuleConfiguration
455      */
456     public void removeProxyConnectorRuleConfiguration( ProxyConnectorRuleConfiguration proxyConnectorRuleConfiguration )
457     {
458         getProxyConnectorRuleConfigurations().remove( proxyConnectorRuleConfiguration );
459     } //-- void removeProxyConnectorRuleConfiguration( ProxyConnectorRuleConfiguration )
460 
461     /**
462      * Method removeRemoteRepository.
463      * 
464      * @param remoteRepositoryConfiguration
465      */
466     public void removeRemoteRepository( RemoteRepositoryConfiguration remoteRepositoryConfiguration )
467     {
468         getRemoteRepositories().remove( remoteRepositoryConfiguration );
469     } //-- void removeRemoteRepository( RemoteRepositoryConfiguration )
470 
471     /**
472      * Method removeRepositoryGroup.
473      * 
474      * @param repositoryGroupConfiguration
475      */
476     public void removeRepositoryGroup( RepositoryGroupConfiguration repositoryGroupConfiguration )
477     {
478         getRepositoryGroups().remove( repositoryGroupConfiguration );
479     } //-- void removeRepositoryGroup( RepositoryGroupConfiguration )
480 
481     /**
482      * Set archiva default settings.
483      * 
484      * @param archivaDefaultConfiguration
485      */
486     public void setArchivaDefaultConfiguration( ArchivaDefaultConfiguration archivaDefaultConfiguration )
487     {
488         this.archivaDefaultConfiguration = archivaDefaultConfiguration;
489     } //-- void setArchivaDefaultConfiguration( ArchivaDefaultConfiguration )
490 
491     /**
492      * Set the ArchivaRuntimeConfiguration.
493      * 
494      * @param archivaRuntimeConfiguration
495      */
496     public void setArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
497     {
498         this.archivaRuntimeConfiguration = archivaRuntimeConfiguration;
499     } //-- void setArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration )
500 
501     /**
502      * Set the list of custom legacy path to artifact.
503      * 
504      * @param legacyArtifactPaths
505      */
506     public void setLegacyArtifactPaths( java.util.List<LegacyArtifactPath> legacyArtifactPaths )
507     {
508         this.legacyArtifactPaths = legacyArtifactPaths;
509     } //-- void setLegacyArtifactPaths( java.util.List )
510 
511     /**
512      * Set the list of repositories that this archiva instance
513      * uses.
514      * 
515      * @param managedRepositories
516      */
517     public void setManagedRepositories( java.util.List<ManagedRepositoryConfiguration> managedRepositories )
518     {
519         this.managedRepositories = managedRepositories;
520     } //-- void setManagedRepositories( java.util.List )
521 
522     /**
523      * Set the type of the metadata storage. Allowed values: jcr,
524      * file, cassandra.
525      * 
526      * @param metadataStore
527      */
528     public void setMetadataStore( String metadataStore )
529     {
530         this.metadataStore = metadataStore;
531     } //-- void setMetadataStore( String )
532 
533     /**
534      * Set the modelEncoding field.
535      * 
536      * @param modelEncoding
537      */
538     public void setModelEncoding( String modelEncoding )
539     {
540         this.modelEncoding = modelEncoding;
541     } //-- void setModelEncoding( String )
542 
543     /**
544      * Set the NetworkConfiguration .
545      * 
546      * @param networkConfiguration
547      */
548     public void setNetworkConfiguration( NetworkConfiguration networkConfiguration )
549     {
550         this.networkConfiguration = networkConfiguration;
551     } //-- void setNetworkConfiguration( NetworkConfiguration )
552 
553     /**
554      * Set the list of network proxies to use for outgoing
555      * requests.
556      * 
557      * @param networkProxies
558      */
559     public void setNetworkProxies( java.util.List<NetworkProxyConfiguration> networkProxies )
560     {
561         this.networkProxies = networkProxies;
562     } //-- void setNetworkProxies( java.util.List )
563 
564     /**
565      * Set the organisation info.
566      * 
567      * @param organisationInfo
568      */
569     public void setOrganisationInfo( OrganisationInformation organisationInfo )
570     {
571         this.organisationInfo = organisationInfo;
572     } //-- void setOrganisationInfo( OrganisationInformation )
573 
574     /**
575      * Set the list of ProxyConnectorRuleConfigurations.
576      * 
577      * @param proxyConnectorRuleConfigurations
578      */
579     public void setProxyConnectorRuleConfigurations( java.util.List<ProxyConnectorRuleConfiguration> proxyConnectorRuleConfigurations )
580     {
581         this.proxyConnectorRuleConfigurations = proxyConnectorRuleConfigurations;
582     } //-- void setProxyConnectorRuleConfigurations( java.util.List )
583 
584     /**
585      * Set the list of proxy connectors for this archiva instance.
586      * 
587      * @param proxyConnectors
588      */
589     public void setProxyConnectors( java.util.List<ProxyConnectorConfiguration> proxyConnectors )
590     {
591         this.proxyConnectors = proxyConnectors;
592     } //-- void setProxyConnectors( java.util.List )
593 
594     /**
595      * Set the RedbackRuntimeConfiguration.
596      * 
597      * @param redbackRuntimeConfiguration
598      */
599     public void setRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
600     {
601         this.redbackRuntimeConfiguration = redbackRuntimeConfiguration;
602     } //-- void setRedbackRuntimeConfiguration( RedbackRuntimeConfiguration )
603 
604     /**
605      * Set the list of repositories that this archiva can retrieve
606      * from or publish to.
607      * 
608      * @param remoteRepositories
609      */
610     public void setRemoteRepositories( java.util.List<RemoteRepositoryConfiguration> remoteRepositories )
611     {
612         this.remoteRepositories = remoteRepositories;
613     } //-- void setRemoteRepositories( java.util.List )
614 
615     /**
616      * Set the list of repository groups.
617      * 
618      * @param repositoryGroups
619      */
620     public void setRepositoryGroups( java.util.List<RepositoryGroupConfiguration> repositoryGroups )
621     {
622         this.repositoryGroups = repositoryGroups;
623     } //-- void setRepositoryGroups( java.util.List )
624 
625     /**
626      * Set the repository scanning configuration.
627      * 
628      * @param repositoryScanning
629      */
630     public void setRepositoryScanning( RepositoryScanningConfiguration repositoryScanning )
631     {
632         this.repositoryScanning = repositoryScanning;
633     } //-- void setRepositoryScanning( RepositoryScanningConfiguration )
634 
635     /**
636      * Set this is the version of the configuration format.
637      * 
638      * @param version
639      */
640     public void setVersion( String version )
641     {
642         this.version = version;
643     } //-- void setVersion( String )
644 
645     /**
646      * Set the webapp configuration.
647      * 
648      * @param webapp
649      */
650     public void setWebapp( WebappConfiguration webapp )
651     {
652         this.webapp = webapp;
653     } //-- void setWebapp( WebappConfiguration )
654 
655     
656     private java.util.Map<String, java.util.List<String>> repositoryToGroupMap; 
657     
658     public java.util.Map<String, java.util.List<String>> getRepositoryToGroupMap()
659     {
660         if ( repositoryGroups != null )
661         {
662             java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
663             
664             for ( RepositoryGroupConfiguration group : (java.util.List<RepositoryGroupConfiguration>) repositoryGroups )
665             {
666                 for ( String repositoryId : (java.util.List<String>) group.getRepositories() )
667                 {
668                     java.util.List<String> groups = map.get( repositoryId );
669                     if ( groups == null )
670                     {
671                         groups = new java.util.ArrayList<String>();
672                         map.put( repositoryId, groups );
673                     }
674                     groups.add( group.getId() );
675                 }
676             }
677             
678             repositoryToGroupMap = map;
679         }
680         return repositoryToGroupMap;
681     }
682     
683     public java.util.Map<String, RepositoryGroupConfiguration> getRepositoryGroupsAsMap()
684     {
685         java.util.Map<String, RepositoryGroupConfiguration> map = new java.util.HashMap<String, RepositoryGroupConfiguration>();
686         if ( repositoryGroups != null )
687         {
688             for ( RepositoryGroupConfiguration group : (java.util.List<RepositoryGroupConfiguration>) repositoryGroups )
689             {
690                 map.put( group.getId(), group );
691             }
692         }
693         return map;
694     }
695     
696     public RepositoryGroupConfiguration findRepositoryGroupById( String id )
697     {
698         if ( repositoryGroups != null )
699         {
700             for ( RepositoryGroupConfiguration group : (java.util.List<RepositoryGroupConfiguration>) repositoryGroups )
701             {
702                 if ( group.getId().equals( id ) )
703                 {
704                     return group;
705                 }
706             }
707         }
708         return null;
709     }
710 
711     private java.util.Map<String, java.util.List<String>> groupToRepositoryMap;
712 
713     public java.util.Map<String, java.util.List<String>> getGroupToRepositoryMap()
714     {
715         if ( repositoryGroups != null && managedRepositories != null )
716         {
717             java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
718             
719             for ( ManagedRepositoryConfiguration repo : (java.util.List<ManagedRepositoryConfiguration>) managedRepositories )
720             {
721                 for ( RepositoryGroupConfiguration group : (java.util.List<RepositoryGroupConfiguration>) repositoryGroups )
722                 {
723                     if ( !group.getRepositories().contains( repo.getId() ) )
724                     {
725                         String groupId = group.getId();
726                         java.util.List<String> repos = map.get( groupId );
727                         if ( repos == null )
728                         {
729                             repos = new java.util.ArrayList<String>();
730                             map.put( groupId, repos );
731                         }
732                         repos.add( repo.getId() );
733                     }
734                 }
735             }
736             groupToRepositoryMap = map;
737         }
738         return groupToRepositoryMap;
739     }
740           
741     
742     public java.util.Map<String, NetworkProxyConfiguration> getNetworkProxiesAsMap()
743     {
744         java.util.Map<String, NetworkProxyConfiguration> map = new java.util.HashMap<String, NetworkProxyConfiguration>();
745         if ( networkProxies != null )
746         {
747             for ( java.util.Iterator<NetworkProxyConfiguration> i = networkProxies.iterator(); i.hasNext(); )
748             {
749                 NetworkProxyConfiguration proxy = i.next();
750                 map.put( proxy.getId(), proxy );
751             }
752         }
753         return map;
754     }
755 
756     public java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> getProxyConnectorAsMap()
757     {
758         java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap =
759             new java.util.HashMap<String, java.util.List<ProxyConnectorConfiguration>>();
760 
761         if( proxyConnectors != null )
762         {
763             java.util.Iterator<ProxyConnectorConfiguration> it = proxyConnectors.iterator();
764             while ( it.hasNext() )
765             {
766                 ProxyConnectorConfiguration proxyConfig = it.next();
767                 String key = proxyConfig.getSourceRepoId();
768 
769                 java.util.List<ProxyConnectorConfiguration> connectors = proxyConnectorMap.get( key );
770                 if ( connectors == null )
771                 {
772                     connectors = new java.util.ArrayList<ProxyConnectorConfiguration>();
773                     proxyConnectorMap.put( key, connectors );
774                 }
775 
776                 connectors.add( proxyConfig );
777                 java.util.Collections.sort( connectors,
778                     org.apache.archiva.configuration.functors.ProxyConnectorConfigurationOrderComparator.getInstance() );
779             }
780         }
781 
782         return proxyConnectorMap;
783     }
784 
785     public java.util.Map<String, RemoteRepositoryConfiguration> getRemoteRepositoriesAsMap()
786     {
787         java.util.Map<String, RemoteRepositoryConfiguration> map = new java.util.HashMap<String, RemoteRepositoryConfiguration>();
788         if ( remoteRepositories != null )
789         {
790             for ( java.util.Iterator<RemoteRepositoryConfiguration> i = remoteRepositories.iterator(); i.hasNext(); )
791             {
792                 RemoteRepositoryConfiguration repo = i.next();
793                 map.put( repo.getId(), repo );
794             }
795         }
796         return map;
797     }
798 
799     public RemoteRepositoryConfiguration findRemoteRepositoryById( String id )
800     {
801         if ( remoteRepositories != null )
802         {
803             for ( java.util.Iterator<RemoteRepositoryConfiguration> i = remoteRepositories.iterator(); i.hasNext(); )
804             {
805                 RemoteRepositoryConfiguration repo = i.next();
806                 if ( repo.getId().equals( id ) )
807                 {
808                     return repo;
809                 }
810             }
811         }
812         return null;
813     }
814 
815     public java.util.Map<String, ManagedRepositoryConfiguration> getManagedRepositoriesAsMap()
816     {
817         java.util.Map<String, ManagedRepositoryConfiguration> map = new java.util.HashMap<String, ManagedRepositoryConfiguration>();
818         if ( managedRepositories != null )
819         {
820             for ( java.util.Iterator<ManagedRepositoryConfiguration> i = managedRepositories.iterator(); i.hasNext(); )
821             {
822                 ManagedRepositoryConfiguration repo = i.next();
823                 map.put( repo.getId(), repo );
824             }
825         }
826         return map;
827     }
828 
829     public ManagedRepositoryConfiguration findManagedRepositoryById( String id )
830     {
831         if ( managedRepositories != null )
832         {
833             for ( java.util.Iterator<ManagedRepositoryConfiguration> i = managedRepositories.iterator(); i.hasNext(); )
834             {
835                 ManagedRepositoryConfiguration repo = i.next();
836                 if ( repo.getId().equals( id ) )
837                 {
838                     return repo;
839                 }
840             }
841         }
842         return null;
843     }
844           
845 }