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