View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.config.impl.digester;
20  
21  import java.util.ArrayList;
22  import java.util.Collection;
23  import java.util.Collections;
24  import java.util.HashMap;
25  import java.util.LinkedHashMap;
26  import java.util.List;
27  import java.util.Map;
28  
29  import javax.faces.render.RenderKitFactory;
30  
31  import org.apache.myfaces.config.FacesConfigDispenser;
32  import org.apache.myfaces.config.element.Behavior;
33  import org.apache.myfaces.config.element.ClientBehaviorRenderer;
34  import org.apache.myfaces.config.element.FaceletsProcessing;
35  import org.apache.myfaces.config.element.FacesConfigExtension;
36  import org.apache.myfaces.config.element.ManagedBean;
37  import org.apache.myfaces.config.element.NavigationRule;
38  import org.apache.myfaces.config.element.Renderer;
39  import org.apache.myfaces.config.element.Application;
40  import org.apache.myfaces.config.element.ComponentTagDeclaration;
41  import org.apache.myfaces.config.element.ContractMapping;
42  import org.apache.myfaces.config.element.Converter;
43  import org.apache.myfaces.config.element.FacesConfig;
44  import org.apache.myfaces.config.element.FacesFlowDefinition;
45  import org.apache.myfaces.config.element.Factory;
46  import org.apache.myfaces.config.element.LocaleConfig;
47  import org.apache.myfaces.config.element.NamedEvent;
48  import org.apache.myfaces.config.element.RenderKit;
49  import org.apache.myfaces.config.element.ResourceBundle;
50  import org.apache.myfaces.config.element.SystemEventListener;
51  import org.apache.myfaces.config.element.ViewPoolMapping;
52  import org.apache.myfaces.config.element.facelets.FaceletTagLibrary;
53  import org.apache.myfaces.config.impl.digester.elements.RenderKitImpl;
54  
55  /**
56   * @author <a href="mailto:oliver@rossmueller.com">Oliver Rossmueller</a>
57   */
58  public class DigesterFacesConfigDispenserImpl extends FacesConfigDispenser
59  {
60      /**
61       * 
62       */
63      private static final long serialVersionUID = 3550379003287939559L;
64      // Factories
65      private List<String> applicationFactories = new ArrayList<String>();
66      private List<String> exceptionHandlerFactories = new ArrayList<String>();
67      private List<String> externalContextFactories = new ArrayList<String>();
68      private List<String> facesContextFactories = new ArrayList<String>();
69      private List<String> lifecycleFactories = new ArrayList<String>();
70      private List<String> viewDeclarationLanguageFactories = new ArrayList<String>();
71      private List<String> partialViewContextFactories = new ArrayList<String>();
72      private List<String> renderKitFactories = new ArrayList<String>();
73      private List<String> tagHandlerDelegateFactories = new ArrayList<String>();
74      private List<String> visitContextFactories = new ArrayList<String>();
75      private List<String> faceletCacheFactories = new ArrayList<String>();
76      private List<String> flashFactories = new ArrayList<String>();
77      private List<String> clientWindowFactories = new ArrayList<String>();
78      private List<String> flowHandlerFactories = new ArrayList<String>();
79      
80      private String defaultRenderKitId;
81      private String messageBundle;
82      private String partialTraversal;
83      private String facesVersion;
84      
85      private LocaleConfig localeConfig;
86  
87      private Map<String, String> components = new HashMap<String, String>();
88      private Map<String, String> converterByClass = new HashMap<String, String>();
89      private Map<String, String> converterById = new HashMap<String, String>();
90      private Map<String, String> validators = new HashMap<String, String>();
91      private List<Behavior> behaviors = new ArrayList<Behavior>();
92      
93      private Map<String, Converter> converterConfigurationByClassName = new HashMap<String, Converter>();
94      
95      private Map<String, RenderKit> renderKits
96              = new LinkedHashMap<String, RenderKit>();
97      
98      private List<String> actionListeners = new ArrayList<String>();
99      private List<String> elResolvers = new ArrayList<String>();
100     private List<String> lifecyclePhaseListeners = new ArrayList<String>();
101     private List<String> navigationHandlers = new ArrayList<String>();
102     private List<String> propertyResolver = new ArrayList<String>();
103     private List<String> resourceHandlers = new ArrayList<String>();
104     private List<String> stateManagers = new ArrayList<String>();
105     private List<String> variableResolver = new ArrayList<String>();
106     private List<String> viewHandlers = new ArrayList<String>();
107     private List<String> defaultValidatorIds = new ArrayList<String>();
108     private List<String> defaultAnnotatedValidatorIds = new ArrayList<String>();
109     
110     private List<ManagedBean> managedBeans = new ArrayList<ManagedBean>();
111     
112     private List<NavigationRule> navigationRules = new ArrayList<NavigationRule>();
113     private List<ResourceBundle> resourceBundles = new ArrayList<ResourceBundle>();
114 
115     private List<SystemEventListener> systemEventListeners = new ArrayList<SystemEventListener>();
116     
117     private List<NamedEvent> namedEvents = new ArrayList<NamedEvent>();
118     
119     private Map<String, FaceletsProcessing> faceletsProcessingByFileExtension
120             = new HashMap<String, FaceletsProcessing>();
121     
122     private List<FacesFlowDefinition> facesFlowDefinitions = new ArrayList<FacesFlowDefinition>();
123     
124     private List<String> protectedViewUrlPatterns = new ArrayList<String>();
125     private List<ContractMapping> resourceLibraryContractMappings = new ArrayList<ContractMapping>();
126     
127     private List<ComponentTagDeclaration> componentTagDeclarations = new ArrayList<ComponentTagDeclaration>();
128     private List<FaceletTagLibrary> faceletTagLibraries = new ArrayList<FaceletTagLibrary>();
129     
130     private List <String> resourceResolvers = new ArrayList<String>();
131     
132     private List<ViewPoolMapping> viewPoolMappings = new ArrayList<ViewPoolMapping>();
133     
134     // Unmodifiable list/maps to avoid modifications
135     private transient List<String> umapplicationFactories;
136     private transient List<String> umexceptionHandlerFactories;
137     private transient List<String> umexternalContextFactories;
138     private transient List<String> umfacesContextFactories;
139     private transient List<String> umlifecycleFactories;
140     private transient List<String> umviewDeclarationLanguageFactories;
141     private transient List<String> umpartialViewContextFactories;
142     private transient List<String> umrenderKitFactories;
143     private transient List<String> umtagHandlerDelegateFactories;
144     private transient List<String> umvisitContextFactories;
145     private transient List<String> umfaceletCacheFactories;
146     private transient List<String> umflashFactories;
147     private transient List<String> umclientWindowFactories;
148     private transient List<String> umflowHandlerFactories;
149     private transient List<Behavior> umbehaviors;
150     private transient List<String> umactionListeners;
151     private transient List<String> umelResolvers;
152     private transient List<String> umlifecyclePhaseListeners;
153     private transient List<String> umnavigationHandlers;
154     private transient List<String> umpropertyResolver;
155     private transient List<String> umresourceHandlers;
156     private transient List<String> umstateManagers;
157     private transient List<String> umvariableResolver;
158     private transient List<String> umviewHandlers;
159     private transient List<ManagedBean> ummanagedBeans;
160     private transient List<NavigationRule> umnavigationRules;
161     private transient List<ResourceBundle> umresourceBundles;
162     private transient List<SystemEventListener> umsystemEventListeners;
163     private transient List<NamedEvent> umnamedEvents;
164     private transient List<FacesFlowDefinition> umfacesFlowDefinitions;
165     private transient List<String> umprotectedViewUrlPatterns;
166     private transient List<ContractMapping> umresourceLibraryContractMappings;
167     private transient List<ComponentTagDeclaration> umcomponentTagDeclarations;
168     private transient List<FaceletTagLibrary> umfaceletTagLibraries;
169     private transient List <String> umresourceResolvers;
170     private transient List<ViewPoolMapping> umviewPoolMappings;
171     
172     /**
173      * Add another unmarshalled faces config object.
174      * 
175      * @param config
176      *            unmarshalled faces config object
177      */
178     public void feed(FacesConfig config)
179     {
180         for (Factory factory : config.getFactories())
181         {
182             applicationFactories.addAll(factory.getApplicationFactory());
183             exceptionHandlerFactories.addAll(factory.getExceptionHandlerFactory());
184             externalContextFactories.addAll(factory.getExternalContextFactory());
185             facesContextFactories.addAll(factory.getFacesContextFactory());
186             lifecycleFactories.addAll(factory.getLifecycleFactory());
187             viewDeclarationLanguageFactories.addAll(factory.getViewDeclarationLanguageFactory());
188             partialViewContextFactories.addAll(factory.getPartialViewContextFactory());
189             renderKitFactories.addAll(factory.getRenderkitFactory());
190             tagHandlerDelegateFactories.addAll(factory.getTagHandlerDelegateFactory());
191             visitContextFactories.addAll(factory.getVisitContextFactory());
192             faceletCacheFactories.addAll(factory.getFaceletCacheFactory());
193             flashFactories.addAll(factory.getFlashFactory());
194             clientWindowFactories.addAll(factory.getClientWindowFactory());
195             flowHandlerFactories.addAll(factory.getFlowHandlerFactory());
196         }
197 
198         components.putAll(config.getComponents());
199         validators.putAll(config.getValidators());
200         behaviors.addAll (config.getBehaviors());
201         
202         for (Application application : config.getApplications())
203         {
204             if (!application.getDefaultRenderkitId().isEmpty())
205             {
206                 defaultRenderKitId =
207                         application.getDefaultRenderkitId().get(application.getDefaultRenderkitId().size() - 1);
208             }
209 
210             if (!application.getMessageBundle().isEmpty())
211             {
212                 messageBundle = application.getMessageBundle().get(application.getMessageBundle().size() - 1);
213             }
214 
215             if (!application.getLocaleConfig().isEmpty())
216             {
217                 localeConfig = application.getLocaleConfig().get(application.getLocaleConfig().size() - 1);
218             }
219             
220             if (!application.getPartialTraversal().isEmpty())
221             {
222                 partialTraversal = application.getPartialTraversal().get (application.getPartialTraversal().size() - 1);
223             }
224             
225             actionListeners.addAll(application.getActionListener());
226             navigationHandlers.addAll(application.getNavigationHandler());
227             resourceHandlers.addAll(application.getResourceHandler());
228             viewHandlers.addAll(application.getViewHandler());
229             stateManagers.addAll(application.getStateManager());
230             propertyResolver.addAll(application.getPropertyResolver());
231             variableResolver.addAll(application.getVariableResolver());
232             resourceBundles.addAll(application.getResourceBundle());
233             elResolvers.addAll(application.getElResolver());
234             resourceLibraryContractMappings.addAll(application.getResourceLibraryContractMappings());
235 
236             // Jsf 2.0 spec section 3.5.3 says this: 
237             // ".... Any configuration resource that declares a list of default 
238             // validators overrides any list provided in a previously processed
239             // configuration resource. If an empty <default-validators/> element 
240             // is found in a configuration resource, the list
241             // of default validators must be cleared....."
242             if (application.isDefaultValidatorsPresent())
243             {
244                 // we have a <default-validators> element, so any existing
245                 // default validators should be removed
246                 defaultValidatorIds.clear();
247                 
248                 // now add all default-validator entries (could be zero)
249                 defaultValidatorIds.addAll(application.getDefaultValidatorIds());
250             }
251             else
252             {
253                 //If isDefaultValidatorsPresent() is false, and there are still 
254                 //default validators, it means they were added using annotations, so
255                 //they are not affected by the empty entry according to section 3.5.3
256                 defaultAnnotatedValidatorIds.addAll(application.getDefaultValidatorIds());
257             }
258             
259             systemEventListeners.addAll(application.getSystemEventListeners());
260         }
261 
262         for (Converter converter : config.getConverters())
263         {
264             if (converter.getConverterId() != null)
265             {
266                 converterById.put(converter.getConverterId(),converter
267                         .getConverterClass());
268             }
269             if (converter.getForClass() != null)
270             {
271                 converterByClass.put(converter.getForClass(),converter
272                         .getConverterClass());
273             }
274 
275             converterConfigurationByClassName.put(converter.getConverterClass(), converter);
276         }
277 
278         for (RenderKit renderKit : config.getRenderKits())
279         {
280             String renderKitId = renderKit.getId();
281 
282             if (renderKitId == null)
283             {
284                 renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
285             }
286 
287             RenderKit existing = renderKits.get(renderKitId);
288 
289             if (existing == null)
290             {
291                 existing = new RenderKitImpl();
292                 existing.merge(renderKit);
293                 renderKits.put(renderKitId, existing);
294             }
295             else
296             {
297                 existing.merge(renderKit);
298             }
299         }
300 
301         for (FacesConfigExtension extension : config.getFacesConfigExtensions())
302         {
303             for (FaceletsProcessing faceletsProcessing : extension.getFaceletsProcessingList())
304             {
305                 if (faceletsProcessing.getFileExtension() != null && faceletsProcessing.getFileExtension().length() > 0)
306                 {
307                     faceletsProcessingByFileExtension.put(faceletsProcessing.getFileExtension(), faceletsProcessing);
308                 }
309             }
310         }
311         
312         for (ComponentTagDeclaration declaration : config.getComponentTagDeclarations().values())
313         {
314             componentTagDeclarations.add(declaration);
315         }
316         
317         faceletTagLibraries.addAll(config.getFaceletTagLibraryList());
318 
319         lifecyclePhaseListeners.addAll(config.getLifecyclePhaseListener());
320         managedBeans.addAll(config.getManagedBeans());
321         navigationRules.addAll(config.getNavigationRules());
322         facesVersion = config.getVersion();
323         namedEvents.addAll(config.getNamedEvents());
324         facesFlowDefinitions.addAll(config.getFacesFlowDefinitions());
325         protectedViewUrlPatterns.addAll(config.getProtectedViewsUrlPatternList());
326         resourceResolvers.addAll(config.getResourceResolversList());
327         for (FacesConfigExtension extension : config.getFacesConfigExtensions())
328         {
329             viewPoolMappings.addAll(extension.getViewPoolMappings());
330         }
331     }
332 
333     /**
334      * Add another ApplicationFactory class name
335      * 
336      * @param factoryClassName
337      *            a class name
338      */
339     public void feedApplicationFactory(String factoryClassName)
340     {
341         applicationFactories.add(factoryClassName);
342     }
343 
344     public void feedExceptionHandlerFactory(String factoryClassName)
345     {
346         exceptionHandlerFactories.add(factoryClassName);
347     }
348 
349     public void feedExternalContextFactory(String factoryClassName)
350     {
351         externalContextFactories.add(factoryClassName);
352     }
353 
354     /**
355      * Add another FacesContextFactory class name
356      * 
357      * @param factoryClassName
358      *            a class name
359      */
360     public void feedFacesContextFactory(String factoryClassName)
361     {
362         facesContextFactories.add(factoryClassName);
363     }
364 
365     /**
366      * Add another LifecycleFactory class name
367      * 
368      * @param factoryClassName
369      *            a class name
370      */
371     public void feedLifecycleFactory(String factoryClassName)
372     {
373         lifecycleFactories.add(factoryClassName);
374     }
375 
376     public void feedViewDeclarationLanguageFactory(String factoryClassName)
377     {
378         viewDeclarationLanguageFactories.add(factoryClassName);
379     }
380 
381     public void feedPartialViewContextFactory(String factoryClassName)
382     {
383         partialViewContextFactories.add(factoryClassName);
384     }
385 
386     /**
387      * Add another RenderKitFactory class name
388      * 
389      * @param factoryClassName
390      *            a class name
391      */
392     public void feedRenderKitFactory(String factoryClassName)
393     {
394         renderKitFactories.add(factoryClassName);
395     }
396 
397     public void feedTagHandlerDelegateFactory(String factoryClassName)
398     {
399         tagHandlerDelegateFactories.add(factoryClassName);
400     }
401 
402     public void feedVisitContextFactory(String factoryClassName)
403     {
404         visitContextFactories.add(factoryClassName);
405     }
406 
407     /**
408      * @return Collection over ApplicationFactory class names
409      */
410     public Collection<String> getApplicationFactoryIterator()
411     {
412         if (umapplicationFactories == null)
413         {
414             umapplicationFactories = Collections.unmodifiableList(applicationFactories);
415         }
416         return umapplicationFactories;
417     }
418 
419     public Collection<String> getExceptionHandlerFactoryIterator()
420     {
421         if (umexceptionHandlerFactories == null)
422         {
423             umexceptionHandlerFactories = Collections.unmodifiableList(exceptionHandlerFactories);
424         }
425         return umexceptionHandlerFactories;
426     }
427 
428     public Collection<String> getExternalContextFactoryIterator()
429     {
430         if (umexternalContextFactories == null)
431         {
432             umexternalContextFactories = Collections.unmodifiableList(externalContextFactories);
433         }
434         return umexternalContextFactories;
435     }
436 
437     /**
438      * @return Collection over FacesContextFactory class names
439      */
440     public Collection<String> getFacesContextFactoryIterator()
441     {
442         if (umfacesContextFactories == null)
443         {
444             umfacesContextFactories = Collections.unmodifiableList(facesContextFactories);
445         }
446         return umfacesContextFactories;
447     }
448 
449     /**
450      * @return Collection over LifecycleFactory class names
451      */
452     public Collection<String> getLifecycleFactoryIterator()
453     {
454         if (umlifecycleFactories == null)
455         {
456             umlifecycleFactories = Collections.unmodifiableList(lifecycleFactories);
457         }
458         return umlifecycleFactories;
459     }
460 
461     public Collection<String> getViewDeclarationLanguageFactoryIterator()
462     {
463         if (umviewDeclarationLanguageFactories == null)
464         {
465             umviewDeclarationLanguageFactories = Collections.unmodifiableList(viewDeclarationLanguageFactories);
466         }
467         return umviewDeclarationLanguageFactories;
468     }
469 
470     public Collection<String> getPartialViewContextFactoryIterator()
471     {
472         if (umpartialViewContextFactories == null)
473         {
474             umpartialViewContextFactories = Collections.unmodifiableList(partialViewContextFactories);
475         }
476         return umpartialViewContextFactories;
477     }
478 
479     /**
480      * @return Collection over RenderKit factory class names
481      */
482     public Collection<String> getRenderKitFactoryIterator()
483     {
484         if (umrenderKitFactories == null)
485         {
486             umrenderKitFactories = Collections.unmodifiableList(renderKitFactories);
487         }
488         return umrenderKitFactories;
489     }
490 
491     public Collection<String> getTagHandlerDelegateFactoryIterator()
492     {
493         if (umtagHandlerDelegateFactories == null)
494         {
495             umtagHandlerDelegateFactories = Collections.unmodifiableList(tagHandlerDelegateFactories);
496         }
497         return umtagHandlerDelegateFactories;
498     }
499 
500     public Collection<String> getVisitContextFactoryIterator()
501     {
502         if (umvisitContextFactories == null)
503         {
504             umvisitContextFactories = Collections.unmodifiableList(visitContextFactories);
505         }
506         return umvisitContextFactories;
507     }
508 
509     /**
510      * @return Collection over ActionListener class names
511      */
512     public Collection<String> getActionListenerIterator()
513     {
514         if (umactionListeners == null)
515         {
516             umactionListeners = Collections.unmodifiableList(actionListeners);
517         }
518         return umactionListeners;
519     }
520 
521     /**
522      * @return the default render kit id
523      */
524     public String getDefaultRenderKitId()
525     {
526         return defaultRenderKitId;
527     }
528 
529     /**
530      * @return Collection over message bundle names
531      */
532     public String getMessageBundle()
533     {
534         return messageBundle;
535     }
536 
537     /**
538      * @return Collection over NavigationHandler class names
539      */
540     public Collection<String> getNavigationHandlerIterator()
541     {
542         if (umnavigationHandlers == null)
543         {
544             umnavigationHandlers = Collections.unmodifiableList(navigationHandlers);
545         }
546         return umnavigationHandlers;
547     }
548 
549     /**
550      * @return the partial traversal class name
551      */
552     public String getPartialTraversal ()
553     {
554         return partialTraversal;
555     }
556     
557     /**
558      * @return Collection over ResourceHandler class names
559      */
560     @Override
561     public Collection<String> getResourceHandlerIterator()
562     {
563         if (umresourceHandlers == null)
564         {
565             umresourceHandlers = Collections.unmodifiableList(resourceHandlers);
566         }
567         return umresourceHandlers;
568     }
569 
570     /**
571      * @return Collection over ViewHandler class names
572      */
573     @Override
574     public Collection<String> getViewHandlerIterator()
575     {
576         if (umviewHandlers == null)
577         {
578             umviewHandlers = Collections.unmodifiableList(viewHandlers);
579         }
580         return umviewHandlers;
581     }
582 
583     /**
584      * @return Collection over StateManager class names
585      */
586     @Override
587     public Collection<String> getStateManagerIterator()
588     {
589         if (umstateManagers == null)
590         {
591             umstateManagers = Collections.unmodifiableList(stateManagers);
592         }
593         return umstateManagers;
594     }
595 
596     /**
597      * @return Collection over PropertyResolver class names
598      */
599     @Override
600     public Collection<String> getPropertyResolverIterator()
601     {
602         if (umpropertyResolver == null)
603         {
604             umpropertyResolver = Collections.unmodifiableList(propertyResolver);
605         }
606         return umpropertyResolver;
607     }
608 
609     /**
610      * @return Collection over VariableResolver class names
611      */
612     @Override
613     public Collection<String> getVariableResolverIterator()
614     {
615         if (umvariableResolver == null)
616         {
617             umvariableResolver = Collections.unmodifiableList(variableResolver);
618         }
619         return umvariableResolver;
620     }
621 
622     /**
623      * @return the default locale name
624      */
625     @Override
626     public String getDefaultLocale()
627     {
628         if (localeConfig != null)
629         {
630             return localeConfig.getDefaultLocale();
631         }
632         return null;
633     }
634 
635     /**
636      * @return Collection over supported locale names
637      */
638     @Override
639     public Collection<String> getSupportedLocalesIterator()
640     {
641         Collection<String> locale;
642         if (localeConfig != null)
643         {
644             locale = Collections.unmodifiableCollection(localeConfig.getSupportedLocales());
645         }
646         else
647         {
648             locale = Collections.emptyList();
649         }
650 
651         return locale;
652     }
653 
654     /**
655      * @return Collection over all defined component types
656      */
657     @Override
658     public Collection<String> getComponentTypes()
659     {
660         return Collections.unmodifiableCollection(components.keySet());
661     }
662 
663     @Override
664     public Map<String, String> getComponentClassesByType()
665     {
666         return Collections.unmodifiableMap(components);
667     }
668         
669     /**
670      * @return component class that belongs to the given component type
671      */
672     @Override
673     public String getComponentClass(String componentType)
674     {
675         return components.get(componentType);
676     }
677 
678     /**
679      * @return Collection over all defined converter ids
680      */
681     @Override
682     public Collection<String> getConverterIds()
683     {
684         return Collections.unmodifiableCollection(converterById.keySet());
685     }
686 
687     @Override
688     public Map<String, String> getConverterClassesById()
689     {
690         return Collections.unmodifiableMap(converterById);
691     }
692 
693     /**
694      * @return Collection over all classes with an associated converter
695      */
696     @Override
697     public Collection<String> getConverterClasses()
698     {
699         return Collections.unmodifiableCollection(converterByClass.keySet());
700     }
701 
702     @Override
703     public Map<String, String> getConverterClassesByClass()
704     {
705         return Collections.unmodifiableMap(converterByClass);
706     }
707 
708     @Override
709     public Collection<String> getConverterConfigurationByClassName()
710     {
711         return Collections.unmodifiableCollection(converterConfigurationByClassName.keySet());
712     }
713 
714     @Override
715     public Converter getConverterConfiguration(String converterClassName)
716     {
717         return converterConfigurationByClassName.get(converterClassName);
718     }
719 
720     /**
721      * @return converter class that belongs to the given converter id
722      */
723     @Override
724     public String getConverterClassById(String converterId)
725     {
726         return converterById.get(converterId);
727     }
728 
729     /**
730      * @return converter class that is associated with the given class name
731      */
732     @Override
733     public String getConverterClassByClass(String className)
734     {
735         return converterByClass.get(className);
736     }
737 
738     /**
739      * @return Collection over all defined default validator ids
740      */
741     @Override
742     public Collection<String> getDefaultValidatorIds ()
743     {
744         List<String> allDefaultValidatorIds = new ArrayList<String>();
745         allDefaultValidatorIds.addAll(defaultAnnotatedValidatorIds);
746         allDefaultValidatorIds.addAll(defaultValidatorIds);
747         return Collections.unmodifiableCollection(allDefaultValidatorIds);
748     }
749     
750     /**
751      * @return Collection over all defined validator ids
752      */
753     @Override
754     public Collection<String> getValidatorIds()
755     {
756         return Collections.unmodifiableCollection(validators.keySet());
757     }
758 
759     @Override
760     public Map<String, String> getValidatorClassesById()
761     {
762         return Collections.unmodifiableMap(validators);
763     }
764 
765     /**
766      * @return validator class name that belongs to the given validator id
767      */
768     @Override
769     public String getValidatorClass(String validatorId)
770     {
771         return validators.get(validatorId);
772     }
773 
774     /**
775      * @return Collection over {@link org.apache.myfaces.config.element.ManagedBean ManagedBean}s
776      */
777     @Override
778     public Collection<ManagedBean> getManagedBeans()
779     {
780         if (ummanagedBeans == null)
781         {
782             ummanagedBeans = Collections.unmodifiableList(managedBeans);
783         }
784         return ummanagedBeans;
785     }
786 
787     /**
788      * @return Collection over {@link org.apache.myfaces.config.element.NavigationRule NavigationRule}s
789      */
790     @Override
791     public Collection<NavigationRule> getNavigationRules()
792     {
793         if (umnavigationRules == null)
794         {
795             umnavigationRules = Collections.unmodifiableList(navigationRules);
796         }
797         return umnavigationRules;
798     }
799 
800     /**
801      * @return Collection over all defined renderkit ids
802      */
803     @Override
804     public Collection<String> getRenderKitIds()
805     {
806         return Collections.unmodifiableCollection(renderKits.keySet());
807     }
808 
809     /**
810      * @return renderkit class name for given renderkit id
811      */
812     @Override
813     public Collection<String> getRenderKitClasses(String renderKitId)
814     {
815         return renderKits.get(renderKitId).getRenderKitClasses();
816     }
817 
818     /**
819      * @return Iterator over
820      * {@link org.apache.myfaces.config.element.ClientBehaviorRenderer ClientBehaviorRenderer}s
821      * for the given renderKitId
822      */
823     @Override
824     public Collection<ClientBehaviorRenderer> getClientBehaviorRenderers (String renderKitId)
825     {
826         return renderKits.get (renderKitId).getClientBehaviorRenderers();
827     }
828     
829     /**
830      * @return Collection over {@link org.apache.myfaces.config.element.Renderer Renderer}s for the given renderKitId
831      */
832     @Override
833     public Collection<Renderer> getRenderers(String renderKitId)
834     {
835         return renderKits.get(renderKitId).getRenderer();
836     }
837 
838     /**
839      * @return Collection over {@link javax.faces.event.PhaseListener} implementation class names
840      */
841     @Override
842     public Collection<String> getLifecyclePhaseListeners()
843     {
844         if (umlifecyclePhaseListeners == null)
845         {
846             umlifecyclePhaseListeners = Collections.unmodifiableList(lifecyclePhaseListeners);
847         }
848         return umlifecyclePhaseListeners;
849     }
850 
851     @Override
852     public Collection<ResourceBundle> getResourceBundles()
853     {
854         if (umresourceBundles == null)
855         {
856             umresourceBundles = Collections.unmodifiableList(resourceBundles);
857         }
858         return umresourceBundles;
859     }
860 
861     @Override
862     public Collection<String> getElResolvers()
863     {
864         if (umelResolvers == null)
865         {
866             umelResolvers = Collections.unmodifiableList(elResolvers);
867         }
868         return umelResolvers;
869     }
870 
871     @Override
872     public Collection<SystemEventListener> getSystemEventListeners()
873     {        
874         if (umsystemEventListeners == null)
875         {
876             umsystemEventListeners = Collections.unmodifiableList(systemEventListeners);
877         }
878         return umsystemEventListeners;
879     }
880     
881     @Override
882     public Collection<Behavior> getBehaviors ()
883     {
884         if (umbehaviors == null)
885         {
886             umbehaviors = Collections.unmodifiableList(behaviors);
887         }
888         return umbehaviors;
889     }
890     
891     @Override
892     public String getFacesVersion ()
893     {
894         return facesVersion;
895     }
896     
897     @Override
898     public Collection<NamedEvent> getNamedEvents()
899     {
900         if (umnamedEvents == null)
901         {
902             umnamedEvents = Collections.unmodifiableList(namedEvents);
903         }
904         return umnamedEvents;
905     }
906     
907     @Override
908     public Collection<FaceletsProcessing> getFaceletsProcessing()
909     {
910         return Collections.unmodifiableCollection(faceletsProcessingByFileExtension.values());
911     }
912 
913     @Override
914     public FaceletsProcessing getFaceletsProcessingConfiguration(String fileExtension)
915     {
916         return faceletsProcessingByFileExtension.get(fileExtension);
917     }
918 
919     @Override
920     public void feedFaceletCacheFactory(String factoryClassName)
921     {
922         faceletCacheFactories.add(factoryClassName);
923     }
924 
925     @Override
926     public Collection<String> getFaceletCacheFactoryIterator()
927     {
928         if (umfaceletCacheFactories == null)
929         {
930             umfaceletCacheFactories = Collections.unmodifiableList(faceletCacheFactories);
931         }
932         return umfaceletCacheFactories;
933     }
934 
935     @Override
936     public void feedFlashFactory(String factoryClassName)
937     {
938         flashFactories.add(factoryClassName);
939     }
940 
941     @Override
942     public Collection<String> getFlashFactoryIterator()
943     {
944         if (umflashFactories == null)
945         {
946             umflashFactories = Collections.unmodifiableList(flashFactories);
947         }
948         return umflashFactories;
949     }
950     
951     @Override
952     public Collection<String> getFlowHandlerFactoryIterator()
953     {
954         if (umflowHandlerFactories == null)
955         {
956             umflowHandlerFactories = Collections.unmodifiableList(flowHandlerFactories);
957         }
958         return umflowHandlerFactories;
959     }
960 
961     @Override
962     public void feedClientWindowFactory(String factoryClassName)
963     {
964         clientWindowFactories.add(factoryClassName);
965     }
966 
967     @Override
968     public Collection<String> getClientWindowFactoryIterator()
969     {
970         if (umclientWindowFactories == null)
971         {
972             umclientWindowFactories = Collections.unmodifiableList(clientWindowFactories);
973         }
974         return umclientWindowFactories;
975     }
976     
977     @Override
978     public Collection<FacesFlowDefinition> getFacesFlowDefinitions()
979     {
980         if (umfacesFlowDefinitions == null)
981         {
982             umfacesFlowDefinitions = Collections.unmodifiableList(facesFlowDefinitions);
983         }
984         return umfacesFlowDefinitions;
985     }
986 
987     @Override
988     public Collection<String> getProtectedViewUrlPatterns()
989     {
990         if (umprotectedViewUrlPatterns == null)
991         {
992             umprotectedViewUrlPatterns = Collections.unmodifiableList(protectedViewUrlPatterns);
993         }
994         return umprotectedViewUrlPatterns;
995     }
996 
997     @Override
998     public Collection<ContractMapping> getResourceLibraryContractMappings()
999     {
1000         if (umresourceLibraryContractMappings == null)
1001         {
1002             umresourceLibraryContractMappings = Collections.unmodifiableList(resourceLibraryContractMappings);
1003         }
1004         return umresourceLibraryContractMappings;
1005     }
1006 
1007     @Override
1008     public Collection<ComponentTagDeclaration> getComponentTagDeclarations()
1009     {
1010         if (umcomponentTagDeclarations == null)
1011         {
1012             umcomponentTagDeclarations = Collections.unmodifiableList(componentTagDeclarations);
1013         }
1014         return umcomponentTagDeclarations;
1015     }
1016 
1017     @Override
1018     public Collection<String> getResourceResolvers()
1019     {
1020         if (umresourceResolvers == null)
1021         {
1022             umresourceResolvers = Collections.unmodifiableList(resourceResolvers);
1023         }
1024         return umresourceResolvers;
1025     }
1026 
1027     @Override
1028     public Collection<FaceletTagLibrary> getTagLibraries()
1029     {
1030         if (umfaceletTagLibraries == null)
1031         {
1032             umfaceletTagLibraries = Collections.unmodifiableList(faceletTagLibraries);
1033         }
1034         return umfaceletTagLibraries;
1035     }
1036     
1037     @Override
1038     public Collection<ViewPoolMapping> getViewPoolMappings()
1039     {
1040         if (umviewPoolMappings == null)
1041         {
1042             umviewPoolMappings = Collections.unmodifiableList(viewPoolMappings);
1043         }
1044         return umviewPoolMappings;
1045     }
1046 }