1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package javax.faces.application; |
20 | |
|
21 | |
import java.util.Collection; |
22 | |
import java.util.Iterator; |
23 | |
import java.util.Locale; |
24 | |
import java.util.ResourceBundle; |
25 | |
|
26 | |
import javax.el.ELContextListener; |
27 | |
import javax.el.ELException; |
28 | |
import javax.el.ELResolver; |
29 | |
import javax.el.ExpressionFactory; |
30 | |
import javax.el.ValueExpression; |
31 | |
import javax.faces.FacesException; |
32 | |
import javax.faces.component.UIComponent; |
33 | |
import javax.faces.context.ExternalContext; |
34 | |
import javax.faces.context.FacesContext; |
35 | |
import javax.faces.el.ReferenceSyntaxException; |
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
@SuppressWarnings("deprecation") |
53 | 0 | public abstract class Application |
54 | |
{ |
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
private Application getMyfacesApplicationInstance() |
66 | |
{ |
67 | 0 | FacesContext facesContext = FacesContext.getCurrentInstance(); |
68 | 0 | if (facesContext != null) |
69 | |
{ |
70 | 0 | ExternalContext externalContext = facesContext.getExternalContext(); |
71 | 0 | if (externalContext != null) |
72 | |
{ |
73 | 0 | return (Application) externalContext.getApplicationMap().get("org.apache.myfaces.application.ApplicationImpl"); |
74 | |
} |
75 | |
} |
76 | 0 | return null; |
77 | |
} |
78 | |
|
79 | |
private Application getMyfacesApplicationInstance(FacesContext facesContext) |
80 | |
{ |
81 | 0 | if (facesContext != null) |
82 | |
{ |
83 | 0 | ExternalContext externalContext = facesContext.getExternalContext(); |
84 | 0 | if (externalContext != null) |
85 | |
{ |
86 | 0 | return (Application) externalContext.getApplicationMap().get("org.apache.myfaces.application.ApplicationImpl"); |
87 | |
} |
88 | |
} |
89 | 0 | return null; |
90 | |
} |
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
public void addELResolver(ELResolver resolver) { |
96 | 0 | Application application = getMyfacesApplicationInstance(); |
97 | 0 | if (application != null) |
98 | |
{ |
99 | 0 | application.addELResolver(resolver); |
100 | 0 | return; |
101 | |
} |
102 | 0 | throw new UnsupportedOperationException(); |
103 | |
} |
104 | |
|
105 | |
public ELResolver getELResolver() { |
106 | 0 | Application application = getMyfacesApplicationInstance(); |
107 | 0 | if (application != null) |
108 | |
{ |
109 | 0 | return application.getELResolver(); |
110 | |
} |
111 | 0 | throw new UnsupportedOperationException(); |
112 | |
} |
113 | |
|
114 | |
public ResourceBundle getResourceBundle(FacesContext ctx, String name) |
115 | |
throws FacesException, NullPointerException { |
116 | 0 | Application application = getMyfacesApplicationInstance(ctx); |
117 | 0 | if (application != null) |
118 | |
{ |
119 | 0 | return application.getResourceBundle(ctx, name); |
120 | |
} |
121 | 0 | throw new UnsupportedOperationException(); |
122 | |
} |
123 | |
|
124 | |
public UIComponent createComponent(ValueExpression componentExpression, |
125 | |
FacesContext facesContext, |
126 | |
String componentType) |
127 | |
throws FacesException, NullPointerException { |
128 | 0 | Application application = getMyfacesApplicationInstance(facesContext); |
129 | 0 | if (application != null) |
130 | |
{ |
131 | 0 | return application.createComponent(componentExpression, facesContext, componentType); |
132 | |
} |
133 | 0 | throw new UnsupportedOperationException(); |
134 | |
} |
135 | |
|
136 | |
public ExpressionFactory getExpressionFactory() { |
137 | 0 | Application application = getMyfacesApplicationInstance(); |
138 | 0 | if (application != null) |
139 | |
{ |
140 | 0 | return application.getExpressionFactory(); |
141 | |
} |
142 | 0 | throw new UnsupportedOperationException(); |
143 | |
} |
144 | |
|
145 | |
public void addELContextListener(ELContextListener listener) { |
146 | 0 | Application application = getMyfacesApplicationInstance(); |
147 | 0 | if (application != null) |
148 | |
{ |
149 | 0 | application.addELContextListener(listener); |
150 | 0 | return; |
151 | |
} |
152 | 0 | throw new UnsupportedOperationException(); |
153 | |
} |
154 | |
|
155 | |
public void removeELContextListener(ELContextListener listener) { |
156 | 0 | Application application = getMyfacesApplicationInstance(); |
157 | 0 | if (application != null) |
158 | |
{ |
159 | 0 | application.removeELContextListener(listener); |
160 | 0 | return; |
161 | |
} |
162 | 0 | throw new UnsupportedOperationException(); |
163 | |
} |
164 | |
|
165 | |
public ELContextListener[] getELContextListeners() { |
166 | 0 | Application application = getMyfacesApplicationInstance(); |
167 | 0 | if (application != null) |
168 | |
{ |
169 | 0 | return application.getELContextListeners(); |
170 | |
} |
171 | 0 | throw new UnsupportedOperationException(); |
172 | |
} |
173 | |
|
174 | |
public Object evaluateExpressionGet(FacesContext context, |
175 | |
String expression, |
176 | |
Class expectedType) |
177 | |
throws ELException { |
178 | 0 | Application application = getMyfacesApplicationInstance(context); |
179 | 0 | if (application != null) |
180 | |
{ |
181 | 0 | return application.evaluateExpressionGet(context, expression, expectedType); |
182 | |
} |
183 | 0 | throw new UnsupportedOperationException(); |
184 | |
} |
185 | |
|
186 | |
|
187 | |
public abstract javax.faces.event.ActionListener getActionListener(); |
188 | |
|
189 | |
public abstract void setActionListener(javax.faces.event.ActionListener listener); |
190 | |
|
191 | |
public abstract Locale getDefaultLocale(); |
192 | |
|
193 | |
public abstract void setDefaultLocale(Locale locale); |
194 | |
|
195 | |
public abstract String getDefaultRenderKitId(); |
196 | |
|
197 | |
public abstract void setDefaultRenderKitId(String renderKitId); |
198 | |
|
199 | |
public abstract String getMessageBundle(); |
200 | |
|
201 | |
public abstract void setMessageBundle(String bundle); |
202 | |
|
203 | |
|
204 | |
|
205 | |
|
206 | |
|
207 | |
public abstract javax.faces.application.NavigationHandler getNavigationHandler(); |
208 | |
|
209 | |
public abstract void setNavigationHandler(javax.faces.application.NavigationHandler handler); |
210 | |
|
211 | |
|
212 | |
|
213 | |
|
214 | |
|
215 | |
|
216 | |
|
217 | |
|
218 | |
public abstract javax.faces.el.PropertyResolver getPropertyResolver(); |
219 | |
|
220 | |
|
221 | |
|
222 | |
|
223 | |
public abstract void setPropertyResolver(javax.faces.el.PropertyResolver resolver); |
224 | |
|
225 | |
|
226 | |
|
227 | |
|
228 | |
|
229 | |
|
230 | |
public abstract javax.faces.el.VariableResolver getVariableResolver(); |
231 | |
|
232 | |
|
233 | |
|
234 | |
|
235 | |
public abstract void setVariableResolver(javax.faces.el.VariableResolver resolver); |
236 | |
|
237 | |
public abstract javax.faces.application.ViewHandler getViewHandler(); |
238 | |
|
239 | |
public abstract void setViewHandler(javax.faces.application.ViewHandler handler); |
240 | |
|
241 | |
public abstract javax.faces.application.StateManager getStateManager(); |
242 | |
|
243 | |
public abstract void setStateManager(javax.faces.application.StateManager manager); |
244 | |
|
245 | |
|
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
|
252 | |
|
253 | |
|
254 | |
|
255 | |
|
256 | |
|
257 | |
|
258 | |
public abstract void addComponent(String componentType, |
259 | |
String componentClass); |
260 | |
|
261 | |
|
262 | |
|
263 | |
|
264 | |
|
265 | |
|
266 | |
|
267 | |
|
268 | |
|
269 | |
|
270 | |
public abstract javax.faces.component.UIComponent createComponent(String componentType) |
271 | |
throws FacesException; |
272 | |
|
273 | |
|
274 | |
|
275 | |
|
276 | |
|
277 | |
|
278 | |
|
279 | |
|
280 | |
|
281 | |
|
282 | |
|
283 | |
|
284 | |
|
285 | |
public abstract javax.faces.component.UIComponent createComponent( |
286 | |
javax.faces.el.ValueBinding componentBinding, |
287 | |
javax.faces.context.FacesContext context, |
288 | |
String componentType) |
289 | |
throws FacesException; |
290 | |
|
291 | |
public abstract Iterator<String> getComponentTypes(); |
292 | |
|
293 | |
public abstract void addConverter(String converterId, |
294 | |
String converterClass); |
295 | |
|
296 | |
public abstract void addConverter(Class targetClass, |
297 | |
String converterClass); |
298 | |
|
299 | |
public abstract javax.faces.convert.Converter createConverter(String converterId); |
300 | |
|
301 | |
public abstract javax.faces.convert.Converter createConverter(Class targetClass); |
302 | |
|
303 | |
public abstract Iterator<String> getConverterIds(); |
304 | |
|
305 | |
public abstract Iterator<Class> getConverterTypes(); |
306 | |
|
307 | |
|
308 | |
|
309 | |
|
310 | |
|
311 | |
|
312 | |
|
313 | |
|
314 | |
|
315 | |
|
316 | |
|
317 | |
|
318 | |
public abstract javax.faces.el.MethodBinding createMethodBinding( |
319 | |
String ref, Class[] params) |
320 | |
throws ReferenceSyntaxException; |
321 | |
|
322 | |
public abstract Iterator<Locale> getSupportedLocales(); |
323 | |
|
324 | |
public abstract void setSupportedLocales(Collection<Locale> locales); |
325 | |
|
326 | |
public abstract void addValidator(String validatorId, |
327 | |
String validatorClass); |
328 | |
|
329 | |
public abstract javax.faces.validator.Validator createValidator(String validatorId) |
330 | |
throws FacesException; |
331 | |
|
332 | |
public abstract Iterator<String> getValidatorIds(); |
333 | |
|
334 | |
|
335 | |
|
336 | |
|
337 | |
|
338 | |
|
339 | |
|
340 | |
|
341 | |
|
342 | |
|
343 | |
|
344 | |
|
345 | |
public abstract javax.faces.el.ValueBinding createValueBinding(String ref) |
346 | |
throws ReferenceSyntaxException; |
347 | |
} |