JSF-Spring

de.mindmatters.faces.application
Class ApplicationImpl

java.lang.Object
  extended by javax.faces.application.Application
      extended by de.mindmatters.faces.application.ApplicationImpl

public final class ApplicationImpl
extends Application

Application represents a per-web-application singleton object where applications based on JavaServer Faces (or implementations wishing to provide extended functionality) can register application-wide singletons that provide functionality required by JavaServer Faces.

This implemetation delegates the management and creation of UIComponents, Converters, Validators and MethodBindings to appropriate factories as follows:

Methods which delegates to Factory of type
Application.addComponent(String, String), Application.addComponent(String, String), Application.addComponent(String, String), Application.addComponent(String, String) ComponentFactory
Application.addConverter(Class, String), Application.addConverter(String, String), Application.createConverter(Class), Application.createConverter(String), Application.getConverterIds(), Application.getConverterTypes() ConverterFactory
Application.addValidator(String, String), Application.createValidator(String), Application.getValidatorIds() ValidatorFactory
Application.createMethodBinding(String, Class[]), Application.createValueBinding(String) MethodBindingFactory

Author:
Andreas Kuhrwahl

Field Summary
static java.lang.String COMPONENT_FACTORY_BEAN_NAME
          Name of the ComponentFactory bean in the factory.
static java.lang.String CONVERTER_FACTORY_BEAN_NAME
          Name of the ConverterFactory bean in the factory.
static java.lang.String METHOD_BINDING_FACTORY_BEAN_NAME
          Name of the MethodBindingFactory bean in the factory.
static java.lang.String VALIDATOR_FACTORY_BEAN_NAME
          Name of the ValidatorFactory bean in the factory.
 
Constructor Summary
ApplicationImpl(Application delegate)
          Creates an application with the given original application delegate.
ApplicationImpl(Application delegate, BeanFactory beanFactory)
          Creates an application with the given original application delegate.
 
Method Summary
 void addComponent(java.lang.String componentType, java.lang.String componentClass)
          

Register a new mapping of component type to the name of the corresponding UIComponent class.

 void addConverter(java.lang.Class targetClass, java.lang.String converterClass)
          

Register a new converter class that is capable of performing conversions for the specified target class.

 void addConverter(java.lang.String converterId, java.lang.String converterClass)
          

Register a new mapping of converter id to the name of the corresponding Converter class.

 void addValidator(java.lang.String validatorId, java.lang.String validatorClass)
          

Register a new mapping of validator id to the name of the corresponding Validator class.

 UIComponent createComponent(java.lang.String componentType)
          

Instantiate and return a new UIComponent instance of the class specified by a previous call to addComponent() for the specified component type.

 UIComponent createComponent(ValueBinding componentBinding, FacesContext context, java.lang.String componentType)
          

Call the getValue() method on the specified ValueBinding.

 Converter createConverter(java.lang.Class targetClass)
          

Instantiate and return a new Converter instance of the class that has registered itself as capable of performing conversions for objects of the specified type.

 Converter createConverter(java.lang.String converterId)
          

Instantiate and return a new Converter instance of the class specified by a previous call to addConverter() for the specified converter id.

 MethodBinding createMethodBinding(java.lang.String ref, java.lang.Class[] params)
          

Instantiate and return a new MethodBinding for the specified method binding expression, which may be used to call the corresponding method later.

 Validator createValidator(java.lang.String validatorId)
          

Instantiate and return a new Validator instance of the class specified by a previous call to addValidator() for the specified validator id.

 ValueBinding createValueBinding(java.lang.String ref)
          

Instantiate and return a new ValueBinding for the specified value binding expression, which may be used to manipulate the corresponding property value later.

 ActionListener getActionListener()
          

Return the default ActionListener to be registered for all ActionSource components in this appication.

 java.util.Iterator getComponentTypes()
          

Return an Iterator over the set of currently defined component types for this Application.

 java.util.Iterator getConverterIds()
          

Return an Iterator over the set of currently registered converter ids for this Application.

 java.util.Iterator getConverterTypes()
          

Return an Iterator over the set of Class instances for which Converter classes have been explicitly registered.

 java.util.Locale getDefaultLocale()
          

Return the default Locale for this application.

 java.lang.String getDefaultRenderKitId()
          

Return the renderKitId to be used for rendering this application.

 java.lang.String getMessageBundle()
          

Return the fully qualified class name of the ResourceBundle to be used for JavaServer Faces messages for this application.

 NavigationHandler getNavigationHandler()
          

Return the NavigationHandler instance that will be passed the outcome returned by any invoked application action for this web application.

 PropertyResolver getPropertyResolver()
          

Return the PropertyResolver instance that will be utilized to resolve method and value bindings.

 StateManager getStateManager()
          

Return the StateManager instance that will be utilized during the Restore View and Render Response phases of the request processing lifecycle.

 java.util.Iterator getSupportedLocales()
          

Return an Iterator over the supported Locales for this appication.

 java.util.Iterator getValidatorIds()
          

Return an Iterator over the set of currently registered validator ids for this Application.

 VariableResolver getVariableResolver()
          

Return the VariableResolver instance that will be utilized to resolve method and value bindings.

 ViewHandler getViewHandler()
          

Return the ViewHandler instance that will be utilized during the Restore View and Render Response phases of the request processing lifecycle.

 void setActionListener(ActionListener listener)
          

Set the default ActionListener to be registered for all ActionSource components.

 void setDefaultLocale(java.util.Locale locale)
          

Set the default Locale for this application.

 void setDefaultRenderKitId(java.lang.String renderKitId)
          

Set the renderKitId to be used to render this application.

 void setMessageBundle(java.lang.String bundle)
          

Set the fully qualified class name of the ResourceBundle to be used for JavaServer Faces messages for this application.

 void setNavigationHandler(NavigationHandler handler)
          

Set the NavigationHandler instance that will be passed the outcome returned by any invoked application action for this web application.

 void setPropertyResolver(PropertyResolver resolver)
          

Set the PropertyResolver instance that will be utilized to resolve method and value bindings.

 void setStateManager(StateManager manager)
          

Set the StateManager instance that will be utilized during the Restore View and Render Response phases of the request processing lifecycle.

 void setSupportedLocales(java.util.Collection locales)
          

Set the Locale instances representing the supported Locales for this application.

 void setVariableResolver(VariableResolver resolver)
          

Set the VariableResolver instance that will be utilized to resolve method and value bindings.

 void setViewHandler(ViewHandler handler)
          

Set the ViewHandler instance that will be utilized during the Restore View and Render Response phases of the request processing lifecycle.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

METHOD_BINDING_FACTORY_BEAN_NAME

public static final java.lang.String METHOD_BINDING_FACTORY_BEAN_NAME
Name of the MethodBindingFactory bean in the factory.

See Also:
Constant Field Values

VALIDATOR_FACTORY_BEAN_NAME

public static final java.lang.String VALIDATOR_FACTORY_BEAN_NAME
Name of the ValidatorFactory bean in the factory.

See Also:
Constant Field Values

CONVERTER_FACTORY_BEAN_NAME

public static final java.lang.String CONVERTER_FACTORY_BEAN_NAME
Name of the ConverterFactory bean in the factory.

See Also:
Constant Field Values

COMPONENT_FACTORY_BEAN_NAME

public static final java.lang.String COMPONENT_FACTORY_BEAN_NAME
Name of the ComponentFactory bean in the factory.

See Also:
Constant Field Values
Constructor Detail

ApplicationImpl

public ApplicationImpl(Application delegate)
Creates an application with the given original application delegate.

Parameters:
delegate - The original application of the underlying JSF implementation

ApplicationImpl

public ApplicationImpl(Application delegate,
                       BeanFactory beanFactory)
Creates an application with the given original application delegate.

Parameters:
delegate - The original application of the underlying JSF implementation
beanFactory - the Beanfactory
Method Detail

getActionListener

public ActionListener getActionListener()

Return the default ActionListener to be registered for all ActionSource components in this appication. If not explicitly set, a default implementation must be provided that performs the following functions:

Specified by:
getActionListener in class Application

getDefaultLocale

public java.util.Locale getDefaultLocale()

Return the default Locale for this application. If not explicitly set, null is returned.

Specified by:
getDefaultLocale in class Application

getDefaultRenderKitId

public java.lang.String getDefaultRenderKitId()

Return the renderKitId to be used for rendering this application. If not explicitly set, null is returned.

Specified by:
getDefaultRenderKitId in class Application

getMessageBundle

public java.lang.String getMessageBundle()

Return the fully qualified class name of the ResourceBundle to be used for JavaServer Faces messages for this application. If not explicitly set, null is returned.

Specified by:
getMessageBundle in class Application

getNavigationHandler

public NavigationHandler getNavigationHandler()

Return the NavigationHandler instance that will be passed the outcome returned by any invoked application action for this web application. If not explicitly set, a default implementation must be provided that performs the functions described in the NavigationHandler class description.

Specified by:
getNavigationHandler in class Application

getPropertyResolver

public PropertyResolver getPropertyResolver()

Return the PropertyResolver instance that will be utilized to resolve method and value bindings. If not explicitly set, a default implementation must be provided that performs the functions described in the PropertyResolver class description.

Specified by:
getPropertyResolver in class Application

getStateManager

public StateManager getStateManager()

Return the StateManager instance that will be utilized during the Restore View and Render Response phases of the request processing lifecycle. If not explicitly set, a default implementation must be provided that performs the functions described in the StateManager description in the JavaServer Faces Specification.

Specified by:
getStateManager in class Application

getSupportedLocales

public java.util.Iterator getSupportedLocales()

Return an Iterator over the supported Locales for this appication.

Specified by:
getSupportedLocales in class Application

getVariableResolver

public VariableResolver getVariableResolver()

Return the VariableResolver instance that will be utilized to resolve method and value bindings. If not explicitly set, a default implementation must be provided that performs the functions described in the VariableResolver class description.

Specified by:
getVariableResolver in class Application

getViewHandler

public ViewHandler getViewHandler()

Return the ViewHandler instance that will be utilized during the Restore View and Render Response phases of the request processing lifecycle. If not explicitly set, a default implementation must be provided that performs the functions described in the ViewHandler description in the JavaServer Faces Specification.

Specified by:
getViewHandler in class Application

setActionListener

public void setActionListener(ActionListener listener)

Set the default ActionListener to be registered for all ActionSource components.

Specified by:
setActionListener in class Application
Parameters:
listener - The new default ActionListener

setDefaultLocale

public void setDefaultLocale(java.util.Locale locale)

Set the default Locale for this application.

Specified by:
setDefaultLocale in class Application
Parameters:
locale - The new default Locale

setDefaultRenderKitId

public void setDefaultRenderKitId(java.lang.String renderKitId)

Set the renderKitId to be used to render this application. Unless the client has provided a custom ViewHandler that supports the use of multiple RenderKit instances in the same application, this method must only be called at application startup, before any Faces requests have been processed. This is a limitation of the current Specification, and may be lifted in a future release.

Specified by:
setDefaultRenderKitId in class Application

setMessageBundle

public void setMessageBundle(java.lang.String bundle)

Set the fully qualified class name of the ResourceBundle to be used for JavaServer Faces messages for this application. See the JavaDocs for the java.util.ResourceBundle class for more information about the syntax for resource bundle names.

Specified by:
setMessageBundle in class Application
Parameters:
bundle - Base name of the resource bundle to be used

setNavigationHandler

public void setNavigationHandler(NavigationHandler handler)

Set the NavigationHandler instance that will be passed the outcome returned by any invoked application action for this web application.

Specified by:
setNavigationHandler in class Application
Parameters:
handler - The new NavigationHandler instance

setPropertyResolver

public void setPropertyResolver(PropertyResolver resolver)

Set the PropertyResolver instance that will be utilized to resolve method and value bindings.

Specified by:
setPropertyResolver in class Application
Parameters:
resolver - The new PropertyResolver instance

setStateManager

public void setStateManager(StateManager manager)

Set the StateManager instance that will be utilized during the Restore View and Render Response phases of the request processing lifecycle.

Specified by:
setStateManager in class Application
Parameters:
manager - The new StateManager instance

setSupportedLocales

public void setSupportedLocales(java.util.Collection locales)

Set the Locale instances representing the supported Locales for this application.

Specified by:
setSupportedLocales in class Application
Parameters:
locales - The set of supported Locales for this application

setVariableResolver

public void setVariableResolver(VariableResolver resolver)

Set the VariableResolver instance that will be utilized to resolve method and value bindings.

Specified by:
setVariableResolver in class Application
Parameters:
resolver - The new VariableResolver instance

setViewHandler

public void setViewHandler(ViewHandler handler)

Set the ViewHandler instance that will be utilized during the Restore View and Render Response phases of the request processing lifecycle.

Specified by:
setViewHandler in class Application
Parameters:
handler - The new ViewHandler instance

addComponent

public void addComponent(java.lang.String componentType,
                         java.lang.String componentClass)

Register a new mapping of component type to the name of the corresponding UIComponent class. This allows subsequent calls to createComponent() to serve as a factory for UIComponent instances.

Specified by:
addComponent in class Application
Parameters:
componentType - The component type to be registered
componentClass - The fully qualified class name of the corresponding UIComponent implementation

createComponent

public UIComponent createComponent(java.lang.String componentType)

Instantiate and return a new UIComponent instance of the class specified by a previous call to addComponent() for the specified component type.

Specified by:
createComponent in class Application
Parameters:
componentType - The component type for which to create and return a new UIComponent instance

createComponent

public UIComponent createComponent(ValueBinding componentBinding,
                                   FacesContext context,
                                   java.lang.String componentType)

Call the getValue() method on the specified ValueBinding. If it returns a UIComponent instance, return it as the value of this method. If it does not, instantiate a new UIComponent instance of the specified component type, pass the new component to the setValue() method of the specified ValueBinding, and return it.

Specified by:
createComponent in class Application
Parameters:
componentBinding - ValueBinding representing a component value binding expression (typically specified by the component attribute of a custom tag)
context - FacesContext for the current request
componentType - Component type to create if the ValueBinding does not return a component instance

getComponentTypes

public java.util.Iterator getComponentTypes()

Return an Iterator over the set of currently defined component types for this Application.

Specified by:
getComponentTypes in class Application

addConverter

public void addConverter(java.lang.Class targetClass,
                         java.lang.String converterClass)

Register a new converter class that is capable of performing conversions for the specified target class.

Specified by:
addConverter in class Application
Parameters:
targetClass - The class for which this converter is registered
converterClass - The fully qualified class name of the corresponding Converter implementation

addConverter

public void addConverter(java.lang.String converterId,
                         java.lang.String converterClass)

Register a new mapping of converter id to the name of the corresponding Converter class. This allows subsequent calls to createConverter() to serve as a factory for Converter instances.

Specified by:
addConverter in class Application
Parameters:
converterId - The converter id to be registered
converterClass - The fully qualified class name of the corresponding Converter implementation

createConverter

public Converter createConverter(java.lang.Class targetClass)

Instantiate and return a new Converter instance of the class that has registered itself as capable of performing conversions for objects of the specified type. If no such Converter class can be identified, return null.

To locate an appropriate Converter class, the following algorithm is performed, stopping as soon as an appropriate Converter class is found:

Specified by:
createConverter in class Application
Parameters:
targetClass - Target class for which to return a Converter

createConverter

public Converter createConverter(java.lang.String converterId)

Instantiate and return a new Converter instance of the class specified by a previous call to addConverter() for the specified converter id. If there is no such registration for this converter id, return null.

Specified by:
createConverter in class Application
Parameters:
converterId - The converter id for which to create and return a new Converter instance

getConverterIds

public java.util.Iterator getConverterIds()

Return an Iterator over the set of currently registered converter ids for this Application.

Specified by:
getConverterIds in class Application

getConverterTypes

public java.util.Iterator getConverterTypes()

Return an Iterator over the set of Class instances for which Converter classes have been explicitly registered.

Specified by:
getConverterTypes in class Application

createMethodBinding

public MethodBinding createMethodBinding(java.lang.String ref,
                                         java.lang.Class[] params)

Instantiate and return a new MethodBinding for the specified method binding expression, which may be used to call the corresponding method later.

Specified by:
createMethodBinding in class Application
Parameters:
ref - Method binding expression for which to return a MethodBinding instance
params - Parameter signatures that must be compatible with those of the method to be invoked, or a zero-length array or null for a method that takes no parameters

createValueBinding

public ValueBinding createValueBinding(java.lang.String ref)

Instantiate and return a new ValueBinding for the specified value binding expression, which may be used to manipulate the corresponding property value later.

Specified by:
createValueBinding in class Application
Parameters:
ref - Value binding expression for which to return a ValueBinding instance

addValidator

public void addValidator(java.lang.String validatorId,
                         java.lang.String validatorClass)

Register a new mapping of validator id to the name of the corresponding Validator class. This allows subsequent calls to createValidator() to serve as a factory for Validator instances.

Specified by:
addValidator in class Application
Parameters:
validatorId - The validator id to be registered
validatorClass - The fully qualified class name of the corresponding Validator implementation

createValidator

public Validator createValidator(java.lang.String validatorId)

Instantiate and return a new Validator instance of the class specified by a previous call to addValidator() for the specified validator id.

Specified by:
createValidator in class Application
Parameters:
validatorId - The validator id for which to create and return a new Validator instance

getValidatorIds

public java.util.Iterator getValidatorIds()

Return an Iterator over the set of currently registered validator ids for this Application.

Specified by:
getValidatorIds in class Application

JSF-Spring

Copyright © 2006 mindmatters GmbH & Co. KG