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.elements;
20  
21  import java.io.Serializable;
22  import java.util.ArrayList;
23  import java.util.HashMap;
24  import java.util.List;
25  import java.util.Map;
26  
27  /**
28   * @author <a href="mailto:oliver@rossmueller.com">Oliver Rossmueller</a>
29   */
30  public class FacesConfig extends org.apache.myfaces.config.element.FacesConfig implements Serializable
31  {
32  
33      private List<org.apache.myfaces.config.element.Application> applications
34              = new ArrayList<org.apache.myfaces.config.element.Application>();
35      private List<org.apache.myfaces.config.element.Factory> factories
36              = new ArrayList<org.apache.myfaces.config.element.Factory>();
37      private Map<String, String> components = new HashMap<String, String>();
38      private List<org.apache.myfaces.config.element.Converter> converters
39              = new ArrayList<org.apache.myfaces.config.element.Converter>();
40      private List<org.apache.myfaces.config.element.ManagedBean> managedBeans
41              = new ArrayList<org.apache.myfaces.config.element.ManagedBean>();
42      private List<org.apache.myfaces.config.element.NavigationRule> navigationRules
43              = new ArrayList<org.apache.myfaces.config.element.NavigationRule>();
44      private List<org.apache.myfaces.config.element.RenderKit> renderKits
45              = new ArrayList<org.apache.myfaces.config.element.RenderKit>();
46      private List<String> lifecyclePhaseListener = new ArrayList<String>();
47      private Map<String, String> validators = new HashMap<String, String>();
48      private List<org.apache.myfaces.config.element.Behavior> behaviors
49              = new ArrayList<org.apache.myfaces.config.element.Behavior>();
50      private List<org.apache.myfaces.config.element.NamedEvent> namedEvents
51              = new ArrayList<org.apache.myfaces.config.element.NamedEvent>();
52      private List<org.apache.myfaces.config.element.FacesConfigExtension> facesConfigExtensions
53              = new ArrayList<org.apache.myfaces.config.element.FacesConfigExtension>();
54      
55      private String metadataComplete;
56      private String version;
57      //Ordering variables
58      //This information are not merged, and helps
59      //with preprocessing of faces-config files
60      private String name;
61      private org.apache.myfaces.config.element.AbsoluteOrdering absoluteOrdering;
62      private org.apache.myfaces.config.element.Ordering ordering;
63  
64      public void addApplication(org.apache.myfaces.config.element.Application application)
65      {
66          applications.add(application);
67      }
68  
69      public void addFactory(org.apache.myfaces.config.element.Factory factory)
70      {
71          factories.add(factory);
72      }
73  
74      public void addComponent(String componentType, String componentClass)
75      {
76          components.put(componentType, componentClass);
77      }
78  
79      public void addConverter(org.apache.myfaces.config.element.Converter converter)
80      {
81          converters.add(converter);
82      }
83  
84      public void addManagedBean(org.apache.myfaces.config.element.ManagedBean bean)
85      {
86          managedBeans.add(bean);
87      }
88  
89      public void addNavigationRule(org.apache.myfaces.config.element.NavigationRule rule)
90      {
91          navigationRules.add(rule);
92      }
93  
94      public void addRenderKit(org.apache.myfaces.config.element.RenderKit renderKit)
95      {
96          renderKits.add(renderKit);
97      }
98  
99      public void addLifecyclePhaseListener(String value)
100     {
101         lifecyclePhaseListener.add(value);
102     }
103 
104     public void addValidator(String id, String validatorClass)
105     {
106         validators.put(id, validatorClass);
107     }
108     
109     public void addBehavior (org.apache.myfaces.config.element.Behavior behavior)
110     {
111         behaviors.add (behavior);
112     }
113     
114     public void addNamedEvent (org.apache.myfaces.config.element.NamedEvent namedEvent)
115     {
116         namedEvents.add(namedEvent);
117     }
118     
119     public List<org.apache.myfaces.config.element.Application> getApplications()
120     {
121         return applications;
122     }
123 
124     public List<org.apache.myfaces.config.element.Factory> getFactories()
125     {
126         return factories;
127     }
128 
129     public Map<String, String> getComponents()
130     {
131         return components;
132     }
133 
134     public List<org.apache.myfaces.config.element.Converter> getConverters()
135     {
136         return converters;
137     }
138 
139     public List<org.apache.myfaces.config.element.ManagedBean> getManagedBeans()
140     {
141         return managedBeans;
142     }
143 
144     public List<org.apache.myfaces.config.element.NavigationRule> getNavigationRules()
145     {
146         return navigationRules;
147     }
148 
149     public List<org.apache.myfaces.config.element.RenderKit> getRenderKits()
150     {
151         return renderKits;
152     }
153 
154     public List<String> getLifecyclePhaseListener()
155     {
156         return lifecyclePhaseListener;
157     }
158 
159     public Map<String, String> getValidators()
160     {
161         return validators;
162     }
163     
164     public List<org.apache.myfaces.config.element.Behavior> getBehaviors ()
165     {
166         return behaviors;
167     }
168     
169     public List<org.apache.myfaces.config.element.NamedEvent> getNamedEvents ()
170     {
171         return namedEvents;
172     }
173     
174     public org.apache.myfaces.config.element.RenderKit getRenderKit(String renderKitId)
175     {
176         for (org.apache.myfaces.config.element.RenderKit rk : getRenderKits())
177         {
178             if (renderKitId != null && renderKitId.equals(rk.getId()))
179             {
180                 return rk;
181             }
182             else if (renderKitId == null && rk.getId() == null)
183             {
184                 return rk;
185             }
186         }
187         return null;
188     }
189     
190     public String getName()
191     {
192         return name;
193     }
194 
195     public void setName(String name)
196     {
197         this.name = name;
198     }
199     
200     public org.apache.myfaces.config.element.AbsoluteOrdering getAbsoluteOrdering()
201     {
202         return absoluteOrdering;
203     }
204 
205     public void setAbsoluteOrdering(org.apache.myfaces.config.element.AbsoluteOrdering absoluteOrdering)
206     {
207         this.absoluteOrdering = absoluteOrdering;
208     }
209 
210     public org.apache.myfaces.config.element.Ordering getOrdering()
211     {
212         return ordering;
213     }
214 
215     public void setOrdering(org.apache.myfaces.config.element.Ordering ordering)
216     {
217         this.ordering = ordering;
218     }
219 
220     public String getMetadataComplete()
221     {
222         return metadataComplete;
223     }
224 
225     public void setMetadataComplete(String metadataComplete)
226     {
227         this.metadataComplete = metadataComplete;
228     }
229     
230     public String getVersion ()
231     {
232         return version;
233     }
234     
235     public void setVersion (String version)
236     {
237         this.version = version;
238     }
239 
240     @Override
241     public List<org.apache.myfaces.config.element.FacesConfigExtension> getFacesConfigExtensions()
242     {
243         return facesConfigExtensions;
244     }
245     
246     public void addFacesConfigExtension(org.apache.myfaces.config.element.FacesConfigExtension elem)
247     {
248         facesConfigExtensions.add(elem);
249     }
250     
251 }