FactoryFinder implements the standard discovery algorithm for all factory objects specified in the JavaServer Faces APIs. For a given factory class name, a corresponding implementation class is searched for based on the following algorithm. Items are listed in order of decreasing search precedence:
If the JavaServer Faces configuration file bundled into the
WEB-INF directory of the webapp contains a
factory entry of the given factory class name, that
factory is used.
If the JavaServer Faces configuration files named by the
javax.faces.CONFIG_FILES ServletContext init
parameter contain any factory entries of the given
factory class name, those injectionProvider are used, with the last one taking
precedence.
If there are any JavaServer Faces configuration files bundled
into the META-INF directory of any jars on the
ServletContext's resource paths, the
factory entries of the given factory class name in those
files are used, with the last one taking precedence.
If a META-INF/services/{factory-class-name}
resource is visible to the web application class loader for the
calling application (typically as a injectionProvider of being present in the
manifest of a JAR file), its first line is read and assumed to be the
name of the factory implementation class to use.
If none of the above steps yield a match, the JavaServer Faces implementation specific class is used.
If any of the injectionProvider found on any of the steps above happen to
have a one-argument constructor, with argument the type being the
abstract factory class, that constructor is invoked, and the previous
match is passed to the constructor. For example, say the container
vendor provided an implementation of javax.faces.context.FacesContextFactory, and identified it in
META-INF/services/javax.faces.context.FacesContextFactory
in a jar on the webapp ClassLoader. Also say this implementation
provided by the container vendor had a one argument constructor that
took a FacesContextFactory instance. The
FactoryFinder system would call that one-argument
constructor, passing the implementation of
FacesContextFactory provided by the JavaServer Faces
implementation.
If a Factory implementation does not provide a proper one-argument constructor, it must provide a zero-arguments constructor in order to be successfully instantiated.
Once the name of the factory implementation class is located, the web application class loader for the calling application is requested to load this class, and a corresponding instance of the class will be created. A side effect of this rule is that each web application will receive its own instance of each factory class, whether the JavaServer Faces implementation is included within the web application or is made visible through the container's facilities for shared libraries.
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public static Object | Returns: the found factory instanceFully qualified name of the JavaServer Faces factory
for which an implementation instance is requested factoryName)Create (if necessary) and return a per-web-application instance of the appropriate implementation class for the specified JavaServer Faces factory class, based on the discovery algorithm described in the class description. |
| private static void | |
| public static void | releaseFactories()
Release any references to factory instances associated with the class loader for the calling web application. |
| public static void | setFactory(String
the name to be used in a subsequent call to factoryName, String getFactory.the fully qualified class name of the factory corresponding
to implName)factoryName.This method will store the argument
|
| APPLICATION_FACTORY | back to summary |
|---|---|
| public static final String APPLICATION_FACTORY The property name for the
| |
| CLIENT_WINDOW_FACTORY | back to summary |
|---|---|
| public static final String CLIENT_WINDOW_FACTORY The property name for the
| |
| EXCEPTION_HANDLER_FACTORY | back to summary |
|---|---|
| public static final String EXCEPTION_HANDLER_FACTORY The property name for the | |
| EXTERNAL_CONTEXT_FACTORY | back to summary |
|---|---|
| public static final String EXTERNAL_CONTEXT_FACTORY The property name for the | |
| FACELET_CACHE_FACTORY | back to summary |
|---|---|
| public static final String FACELET_CACHE_FACTORY The property name for the
| |
| FACES_CONTEXT_FACTORY | back to summary |
|---|---|
| public static final String FACES_CONTEXT_FACTORY The property name for the
| |
| FACTORIES_CACHE | back to summary |
|---|---|
| pack-priv static final CurrentThreadToServletContext FACTORIES_CACHE | |
| FLASH_FACTORY | back to summary |
|---|---|
| public static final String FLASH_FACTORY The property name for the
| |
| FLOW_HANDLER_FACTORY | back to summary |
|---|---|
| public static final String FLOW_HANDLER_FACTORY The property name for the
| |
| LIFECYCLE_FACTORY | back to summary |
|---|---|
| public static final String LIFECYCLE_FACTORY The property name for the
| |
| PARTIAL_VIEW_CONTEXT_FACTORY | back to summary |
|---|---|
| public static final String PARTIAL_VIEW_CONTEXT_FACTORY The property name for the | |
| RENDER_KIT_FACTORY | back to summary |
|---|---|
| public static final String RENDER_KIT_FACTORY The property name for the
| |
| SEARCH_EXPRESSION_CONTEXT_FACTORY | back to summary |
|---|---|
| public static final String SEARCH_EXPRESSION_CONTEXT_FACTORY The property name for the | |
| TAG_HANDLER_DELEGATE_FACTORY | back to summary |
|---|---|
| public static final String TAG_HANDLER_DELEGATE_FACTORY The property name for the | |
| VIEW_DECLARATION_LANGUAGE_FACTORY | back to summary |
|---|---|
| public static final String VIEW_DECLARATION_LANGUAGE_FACTORY The property name for the | |
| VISIT_CONTEXT_FACTORY | back to summary |
|---|---|
| public static final String VISIT_CONTEXT_FACTORY The property name for the | |
| FactoryFinder | back to summary |
|---|---|
| pack-priv FactoryFinder() Package-private constructor to disable instantiation of this class. | |
| getFactory | back to summary |
|---|---|
| public static Object getFactory(String factoryName) throws FacesException Create (if necessary) and return a per-web-application instance of the appropriate implementation class for the specified JavaServer Faces factory class, based on the discovery algorithm described in the class description. The standard injectionProvider and wrappers
in JSF all implement the interface
| |
| reInitializeFactoryManager | back to summary |
|---|---|
| private static void reInitializeFactoryManager() | |
| releaseFactories | back to summary |
|---|---|
| public static void releaseFactories() throws FacesException Release any references to factory instances associated with the class loader for the calling web application. This method must be called during of web application shutdown.
| |
| setFactory | back to summary |
|---|---|
| public static void setFactory(String factoryName, String implName) This method will store the argument
This method has no effect if This method can be used by implementations to store a factory mapping while parsing the Faces configuration file
| |