|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个 CLASS | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
javax.faces Class FactoryFinder
java.lang.Object javax.faces.FactoryFinder
public final class FactoryFinder
- extends Object
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 afactory
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 anyfactory
entries of the given factory class name, those factories 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 theServletContext
's resource paths, thefactory
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 result 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 factories 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 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.
字段摘要 | |
---|---|
static String |
APPLICATION_FACTORY
The property name for the ApplicationFactory class name. |
static String |
FACES_CONTEXT_FACTORY
The property name for the FacesContextFactory class name. |
static String |
LIFECYCLE_FACTORY
The property name for the LifecycleFactory class name. |
static String |
RENDER_KIT_FACTORY
The property name for the RenderKitFactory class name. |
方法摘要 | |
---|---|
static Object |
getFactory(String 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. |
static void |
releaseFactories()
Release any references to factory instances associated with the class loader for the calling web application. |
static void |
setFactory(String factoryName,
String implName)
This method will store the argument factoryName/implName mapping in such a way that
getFactory(java.lang.String) will find this mapping when searching for a
match. |
类方法继承 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段详细信息 |
---|
APPLICATION_FACTORY
public static final String APPLICATION_FACTORY
The property name for the
ApplicationFactory
class name.- 另请参见:
- 常量字段
FACES_CONTEXT_FACTORY
public static final String FACES_CONTEXT_FACTORY
The property name for the
FacesContextFactory
class name.- 另请参见:
- 常量字段
LIFECYCLE_FACTORY
public static final String LIFECYCLE_FACTORY
The property name for the
LifecycleFactory
class name.- 另请参见:
- 常量字段
RENDER_KIT_FACTORY
public static final String RENDER_KIT_FACTORY
The property name for the
RenderKitFactory
class name.- 另请参见:
- 常量字段
方法详细信息 |
---|
getFactory
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.
- 参数:
factoryName
- Fully qualified name of the JavaServer Faces factory for which an implementation instance is requested- 抛出异常:
FacesException
- if the web application class loader cannot be identifiedFacesException
- if an instance of the configured factory implementation class cannot be loadedFacesException
- if an instance of the configured factory implementation class cannot be instantiatedIllegalArgumentException
- iffactoryName
does not identify a standard JavaServer Faces factory nameIllegalStateException
- if there is no configured factory implementation class for the specified factory nameNullPointerException
- iffactoryname
is null
setFactory
public static void setFactory(String factoryName, String implName)
This method will store the argument
factoryName/implName
mapping in such a way thatgetFactory(java.lang.String)
will find this mapping when searching for a match.This method has no effect if
getFactory()
has already been called looking for a factory for thisfactoryName
.This method can be used by implementations to store a factory mapping while parsing the Faces configuration file
- 抛出异常:
IllegalArgumentException
- iffactoryName
does not identify a standard JavaServer Faces factory nameNullPointerException
- iffactoryname
is null
releaseFactories
public static void releaseFactories() throws FacesException
Release any references to factory instances associated with the class loader for the calling web application. This method should be called as apart of web application shutdown in a container where the JavaServer Faces API classes are part of the container itself, rather than being included inside the web application.
- 抛出异常:
FacesException
- if the web application class loader cannot be identified
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个 CLASS | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.