1 28 29 package com.caucho.jsf.application; 30 31 import java.util.*; 32 33 import javax.el.*; 34 35 import javax.faces.*; 36 import javax.faces.application.*; 37 import javax.faces.component.*; 38 import javax.faces.component.html.*; 39 import javax.faces.context.*; 40 import javax.faces.convert.*; 41 import javax.faces.el.*; 42 import javax.faces.event.*; 43 import javax.faces.validator.*; 44 45 import com.caucho.config.*; 46 import com.caucho.util.*; 47 48 public class ApplicationImpl extends Application 49 { 50 private static final L10N L = new L10N(ApplicationImpl.class); 51 52 private ActionListener _actionListener; 53 private ViewHandler _viewHandler; 54 private PropertyResolver _propertyResolver; 55 56 private ExpressionFactory _jsfExpressionFactory; 57 58 private HashMap<String ,Class > _componentClassMap 59 = new HashMap<String ,Class >(); 60 61 public ApplicationImpl() 62 { 63 _jsfExpressionFactory = new JsfExpressionFactoryImpl(); 64 65 addComponent(HtmlOutputText.COMPONENT_TYPE, 66 "javax.faces.component.html.HtmlOutputText"); 67 68 addComponent(HtmlPanelGrid.COMPONENT_TYPE, 69 "javax.faces.component.html.HtmlPanelGrid"); 70 71 addComponent(HtmlForm.COMPONENT_TYPE, 72 "javax.faces.component.html.HtmlForm"); 73 } 74 75 public ActionListener getActionListener() 76 { 77 return _actionListener; 78 } 79 80 public void setActionListener(ActionListener listener) 81 { 82 _actionListener = listener; 83 } 84 85 public Locale getDefaultLocale() 86 { 87 throw new UnsupportedOperationException (); 88 } 89 90 public void setDefaultLocale(Locale locale) 91 { 92 throw new UnsupportedOperationException (); 93 } 94 95 public String getDefaultRenderKitIt() 96 { 97 throw new UnsupportedOperationException (); 98 } 99 100 public void setDefaultRenderKitId(String renderKitId) 101 { 102 throw new UnsupportedOperationException (); 103 } 104 105 public String getMessageBundle() 106 { 107 throw new UnsupportedOperationException (); 108 } 109 110 public void setMessageBundle(String bundle) 111 { 112 throw new UnsupportedOperationException (); 113 } 114 115 public NavigationHandler getNavigationHandler() 116 { 117 throw new UnsupportedOperationException (); 118 } 119 120 public void setNavigationHandler(NavigationHandler handler) 121 { 122 throw new UnsupportedOperationException (); 123 } 124 125 @Deprecated 126 public PropertyResolver getPropertyResolver() 127 { 128 return _propertyResolver; 129 } 130 131 @Deprecated 132 public void setPropertyResolver(PropertyResolver resolver) 133 { 134 _propertyResolver = resolver; 135 } 136 137 @Deprecated 138 public VariableResolver getVariableResolver() 139 { 140 throw new UnsupportedOperationException (); 141 } 142 143 @Deprecated 144 public void setVariableResolver(VariableResolver resolver) 145 { 146 throw new UnsupportedOperationException (); 147 } 148 149 152 public ExpressionFactory getExpressionFactory() 153 { 154 return _jsfExpressionFactory; 155 } 156 157 public ViewHandler getViewHandler() 158 { 159 if (_viewHandler == null) 160 _viewHandler = new JspViewHandler(); 161 162 return _viewHandler; 163 } 164 165 public void setViewHandler(ViewHandler handler) 166 { 167 _viewHandler = handler; 168 } 169 170 public StateManager getStateManager() 171 { 172 throw new UnsupportedOperationException (); 173 } 174 175 public void setStateManager(StateManager manager) 176 { 177 throw new UnsupportedOperationException (); 178 } 179 180 public void addComponent(String componentType, 181 String componentClass) 182 { 183 synchronized (_componentClassMap) { 184 try { 185 ClassLoader loader = Thread.currentThread().getContextClassLoader(); 186 187 Class cl = Class.forName(componentClass, false, loader); 188 189 Config.validate(cl, UIComponent.class); 190 191 _componentClassMap.put(componentType, cl); 192 } catch (RuntimeException e) { 193 throw e; 194 } catch (Exception e) { 195 throw new FacesException(e); 196 } 197 } 198 } 199 200 public UIComponent createComponent(String componentType) 201 throws FacesException 202 { 203 if (componentType == null) 204 throw new NullPointerException (); 205 206 Class cl = null; 207 208 synchronized (_componentClassMap) { 209 cl = _componentClassMap.get(componentType); 210 } 211 212 if (cl == null) 213 throw new FacesException(L.l("'{0}' is an unknown UI componentType to create", 214 componentType)); 215 216 try { 217 return (UIComponent) cl.newInstance(); 218 } catch (RuntimeException e) { 219 throw e; 220 } catch (Exception e) { 221 throw new FacesException(e); 222 } 223 } 224 225 226 @Deprecated 227 public UIComponent createComponent(ValueBinding componentBinding, 228 FacesContext context, 229 String componentType) 230 throws FacesException 231 { 232 throw new UnsupportedOperationException (); 233 } 234 235 public Iterator<String > getComponentTypes() 236 { 237 throw new UnsupportedOperationException (); 238 } 239 240 public void addConverter(String converterId, 241 String converterClass) 242 { 243 throw new UnsupportedOperationException (); 244 } 245 246 public void addConverter(Class targetClass, 247 String converterClass) 248 { 249 throw new UnsupportedOperationException (); 250 } 251 252 public Converter createConverter(String converterId) 253 throws FacesException 254 { 255 throw new UnsupportedOperationException (); 256 } 257 258 public Converter createConverter(Class targetClass) 259 throws FacesException 260 { 261 throw new UnsupportedOperationException (); 262 } 263 264 public Iterator<String > getConverterIds() 265 { 266 throw new UnsupportedOperationException (); 267 } 268 269 public Iterator<Class > getConverterTypes() 270 { 271 throw new UnsupportedOperationException (); 272 } 273 274 @Deprecated 275 public MethodBinding createMethodBinding(String ref, 276 Class []param) 277 throws ReferenceSyntaxException 278 { 279 throw new UnsupportedOperationException (); 280 } 281 282 public Iterator<Locale> getSupportedLocales() 283 { 284 throw new UnsupportedOperationException (); 285 } 286 287 public void setSupportedLocales(Collection<Locale> locales) 288 { 289 throw new UnsupportedOperationException (); 290 } 291 292 public void addValidator(String validatorId, String validatorClass) 293 { 294 throw new UnsupportedOperationException (); 295 } 296 297 public Validator createValidator(String validatorId) 298 throws FacesException 299 { 300 throw new UnsupportedOperationException (); 301 } 302 303 public Iterator<String > getValidatorIds() 304 { 305 throw new UnsupportedOperationException (); 306 } 307 308 @Deprecated 309 public ValueBinding createValueBinding(String ref) 310 throws ReferenceSyntaxException 311 { 312 throw new UnsupportedOperationException (); 313 } 314 315 public String toString() 316 { 317 return "ApplicationImpl[]"; 318 } 319 } 320 | Popular Tags |