javax.faces.application
Class Application

java.lang.Object
  extended byjavax.faces.application.Application

public abstract class Application
extends java.lang.Object

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. Default implementations of each object are provided for cases where the application does not choose to customize the behavior.

The instance of Application is created by calling the getApplication() method of ApplicationFactory. Because this instance is shared, it must be implemented in a thread-safe manner.

The application also acts as a factory for several types of Objects specified in the Faces Configuration file. Please see getComponent(java.lang.String), getConverter(java.lang.String), getMessageResources(java.lang.String), and getValidator(java.lang.String).


Constructor Summary
Application()
           
 
Method Summary
abstract  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.
abstract  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.
abstract  void addMessageResources(java.lang.String messageResourcesId, java.lang.String messageResourcesClass)
          Register a new mapping of message resources id to the name of the corresponding MessageResources class.
abstract  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.
abstract  ActionListener getActionListener()
          Return the ActionListener that will be the default ActionListener to be registered with relevant components during the Reconstitute Component Tree phase of the request processing lifecycle.
abstract  UIComponent getComponent(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.
abstract  java.util.Iterator getComponentTypes()
          Return an Iterator over the set of currently defined component types for this Application.
abstract  Converter getConverter(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.
abstract  java.util.Iterator getConverterIds()
          Return an Iterator over the set of currently registered converter ids for this Application.
abstract  MessageResources getMessageResources(java.lang.String messageResourcesId)
          Instantiate (if necessary) and return a MessageResources instance of the class specified by a previous call to addMessageResources.
abstract  java.util.Iterator getMessageResourcesIds()
          Return an Iterator over the set of currently registered message resources ids for this Application.
abstract  NavigationHandler getNavigationHandler()
          Return the NavigationHandler instance that will be passed the outcome returned by any invoked Action for this web application.
abstract  PropertyResolver getPropertyResolver()
          Return the PropertyResolver instance that will be utilized to resolve action and valus references.
abstract  Validator getValidator(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.
abstract  java.util.Iterator getValidatorIds()
          Return an Iterator over the set of currently registered validator ids for this Application.
abstract  ValueBinding getValueBinding(java.lang.String ref)
          Return a ValueBinding for the specified action or value reference expression, which may be used to manipulate the corresponding property value later.
abstract  VariableResolver getVariableResolver()
          Return the VariableResolver instance that will be utilized to resolve action and value references.
abstract  void setActionListener(ActionListener listener)
          Replace the default ActionListener that will be registered with relevant components during the Reconstitute Component Tree phase of the requset processing lifecycle.
abstract  void setNavigationHandler(NavigationHandler handler)
          Set the NavigationHandler instance that will be passed the outcome returned by any invoked Action for this web application.
abstract  void setPropertyResolver(PropertyResolver resolver)
          Set the PropertyResolver instance that will be utilized to resolve action and value references.
abstract  void setVariableResolver(VariableResolver resolver)
          Set the VariableResolver instance that will be utilized to resolve action and value references.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Application

public Application()
Method Detail

getActionListener

public abstract ActionListener getActionListener()

Return the ActionListener that will be the default ActionListener to be registered with relevant components during the Reconstitute Component Tree phase of the request processing lifecycle. The default implementation will perform the following functions:


setActionListener

public abstract void setActionListener(ActionListener listener)

Replace the default ActionListener that will be registered with relevant components during the Reconstitute Component Tree phase of the requset processing lifecycle. This listener must return PhaseId.INVOKE_APPLICATION from its getPhaseId() method.

Parameters:
listener - The new ActionListener
Throws:
java.lang.IllegalArgumentException - if the specified listener does not return PhaseId.INVOKE_APPLICATION from its getPhaseId() method
java.lang.NullPointerException - if listener is null

getNavigationHandler

public abstract NavigationHandler getNavigationHandler()

Return the NavigationHandler instance that will be passed the outcome returned by any invoked Action for this web application. The default implementation must provide the behavior described in the NavigationHandler class description.


setNavigationHandler

public abstract void setNavigationHandler(NavigationHandler handler)

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

Parameters:
handler - The new NavigationHandler instance
Throws:
java.lang.NullPointerException - if handler is null

getPropertyResolver

public abstract PropertyResolver getPropertyResolver()

Return the PropertyResolver instance that will be utilized to resolve action and valus references. The default implementation must provide the behavior described in the PropertyResolver class description.


setPropertyResolver

public abstract void setPropertyResolver(PropertyResolver resolver)

Set the PropertyResolver instance that will be utilized to resolve action and value references.

Parameters:
resolver - The new PropertyResolver instance
Throws:
java.lang.NullPointerException - if resolver is null

getValueBinding

public abstract ValueBinding getValueBinding(java.lang.String ref)
                                      throws ReferenceSyntaxException

Return a ValueBinding for the specified action or value reference expression, which may be used to manipulate the corresponding property value later. The returned ValueBinding instance must utilize the PropertyResolver and VariableResolver instances registered with this Application instance at the time that the ValueBinding instance was initially created.

For maximum performance, implementations of Application may, but are not required to, cache ValueBinding instances in order to avoid repeated parsing of the reference expression. However, under no circumstances may a particular ValueBinding instance be shared across multiple web applications.

Parameters:
ref - Reference expression for which to return a ValueBinding instance
Throws:
java.lang.NullPointerException - if ref is null
ReferenceSyntaxException - if the specified ref has invalid syntax

getVariableResolver

public abstract VariableResolver getVariableResolver()

Return the VariableResolver instance that will be utilized to resolve action and value references. The default implementation must provide the behavior described in the VariableResolver class description.


setVariableResolver

public abstract void setVariableResolver(VariableResolver resolver)

Set the VariableResolver instance that will be utilized to resolve action and value references.

Parameters:
resolver - The new VariableResolver instance
Throws:
java.lang.NullPointerException - if resolver is null

addComponent

public abstract 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 getComponent() to serve as a factory for UIComponent instances.

Parameters:
componentType - The component type to be registered
componentClass - The fully qualified class name of the corresponding UIComponent implementation
Throws:
java.lang.NullPointerException - if componentType or componentClass is null

getComponent

public abstract UIComponent getComponent(java.lang.String componentType)
                                  throws FacesException

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

Parameters:
componentType - The component type for which to create and return a new UIComponent instance
Throws:
FacesException - if a UIComponent of the specified type cannot be created
java.lang.NullPointerException - if componentType is null

getComponentTypes

public abstract java.util.Iterator getComponentTypes()

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


addConverter

public abstract 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 getConverter() to serve as a factory for Converter instances.

Parameters:
converterId - The converter id to be registered
converterClass - The fully qualified class name of the corresponding Converter implementation
Throws:
java.lang.NullPointerException - if converterId or converterClass is null

getConverter

public abstract Converter getConverter(java.lang.String converterId)
                                throws FacesException

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

Parameters:
converterId - The converter id for which to create and return a new Converter instance
Throws:
FacesException - if a Converter of the specified id cannot be created
java.lang.NullPointerException - if converterId is null

getConverterIds

public abstract java.util.Iterator getConverterIds()

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


addMessageResources

public abstract void addMessageResources(java.lang.String messageResourcesId,
                                         java.lang.String messageResourcesClass)

Register a new mapping of message resources id to the name of the corresponding MessageResources class. This allows subsequent calls to getMessageResources() to serve as a factory for MessageResources instances.

Parameters:
messageResourcesId - The message resources id to be registered
messageResourcesClass - The fully qualified class name of the corresponding MessageResources implementation
Throws:
java.lang.NullPointerException - if messageResourcesId or messageResourcesClass is null

getMessageResources

public abstract MessageResources getMessageResources(java.lang.String messageResourcesId)
                                              throws FacesException

Instantiate (if necessary) and return a MessageResources instance of the class specified by a previous call to addMessageResources.

Parameters:
messageResourcesId - The message resources id for which to create (if necessary) and return a MessageResources instance
Throws:
FacesException - if a MessageResources instance of the specified id cannot be created
java.lang.NullPointerException - if messageResourcesId is null

getMessageResourcesIds

public abstract java.util.Iterator getMessageResourcesIds()

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


addValidator

public abstract 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 getValidator() to serve as a factory for Validator instances.

Parameters:
validatorId - The validator id to be registered
validatorClass - The fully qualified class name of the corresponding Validator implementation
Throws:
java.lang.NullPointerException - if validatorId or validatorClass is null

getValidator

public abstract Validator getValidator(java.lang.String validatorId)
                                throws FacesException

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

Parameters:
validatorId - The validator id for which to create and return a new Validator instance
Throws:
FacesException - if a Validator of the specified id cannot be created
java.lang.NullPointerException - if validatorId is null

getValidatorIds

public abstract java.util.Iterator getValidatorIds()

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