com.sun.faces.config
public class ConfigManager extends java.lang.Object
This class manages the initialization of each web application that uses JSF.
Modifier and Type | Class and Description |
---|---|
private static class |
ConfigManager.AnnotationScanTask
Scans the class files within a web application returning a
Set
of classes that have been annotated with a standard Faces annotation. |
private static class |
ConfigManager.ParseTask
This
Callable will be used by getConfigDocuments(javax.servlet.ServletContext, java.util.List, java.util.concurrent.ExecutorService, boolean) . |
private static class |
ConfigManager.ProvideMetadataToAnnotationScanTask |
private static class |
ConfigManager.URITask
This
Callable will be used by getConfigDocuments(javax.servlet.ServletContext, java.util.List, java.util.concurrent.ExecutorService, boolean) . |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ANNOTATIONS_SCAN_TASK_KEY
The application-scoped key under which the Future responsible for annotation
scanning is associated with.
|
private static ConfigManager |
CONFIG_MANAGER
There is only once instance of
ConfigManager . |
private static ConfigProcessor |
FACELET_TAGLIB_CONFIG_PROCESSOR_CHAIN
The chain of
ConfigProcessor instances to processing of
facelet-taglib documents. |
private static java.util.List<ConfigurationResourceProvider> |
FACELET_TAGLIBRARY_RESOURCE_PROVIDERS
A List of resource providers that search for faces-config documents.
|
private static java.lang.String |
FACELETS_1_0_DEFAULT_NS |
private static java.lang.String |
FACELETS_TO_2_0_XSL
Stylesheet to convert 1.0 facelet-taglib documents
from 1.0 to 2.0 for schema validation purposes.
|
private static java.lang.String |
FACES_CONFIG_1_X_DEFAULT_NS |
private static ConfigProcessor |
FACES_CONFIG_PROCESSOR_CHAIN
The chain of
ConfigProcessor instances to processing of
faces-config documents. |
private static java.util.List<ConfigurationResourceProvider> |
FACES_CONFIG_RESOURCE_PROVIDERS
A List of resource providers that search for faces-config documents.
|
private static java.lang.String |
FACES_TO_1_1_PRIVATE_XSL
Stylesheet to convert 1.0 and 1.1 based faces-config documents
to our private 1.1 schema for validation.
|
private java.util.List<javax.servlet.ServletContext> |
initializedContexts
Contains each
ServletContext that we've initialized. |
static java.lang.String |
INJECTION_PROVIDER_KEY
The initialization time FacesContext scoped key under which the
InjectionProvider is stored.
|
private static java.util.regex.Pattern |
JAR_PATTERN |
private static java.util.logging.Logger |
LOGGER |
private static int |
NUMBER_OF_TASK_THREADS
The
ConfigManager will multithread the calls to the
ConfigurationResourceProvider s as well as any calls
to parse a resources into a DOM. |
static java.lang.String |
WEB_INF_MARKER
Name of the attribute added by ParseTask to indicate a
Document instance as a representation of
/WEB-INF/faces-config.xml . |
Constructor and Description |
---|
ConfigManager() |
Modifier and Type | Method and Description |
---|---|
private static java.util.concurrent.ExecutorService |
createExecutorService()
Create a new
ExecutorService with
NUMBER_OF_TASK_THREADS threads. |
void |
destroy(javax.servlet.ServletContext sc)
This method will remove any information about the application.
|
static java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.util.Set<java.lang.Class<?>>> |
getAnnotatedClasses(javax.faces.context.FacesContext ctx) |
private static DocumentInfo[] |
getConfigDocuments(javax.servlet.ServletContext sc,
java.util.List<ConfigurationResourceProvider> providers,
java.util.concurrent.ExecutorService executor,
boolean validating)
Obtains an array of
Document s to be processed
by FACES_CONFIG_PROCESSOR_CHAIN . |
private java.util.List<ConfigurationResourceProvider> |
getConfigurationResourceProviders(java.util.List<ConfigurationResourceProvider> defaultProviders,
ConfigurationResourceProviderFactory.ProviderType providerType) |
private java.util.List<ConfigurationResourceProvider> |
getFaceletConfigResourceProviders() |
private java.util.List<ConfigurationResourceProvider> |
getFacesConfigResourceProviders() |
static ConfigManager |
getInstance() |
boolean |
hasBeenInitialized(javax.servlet.ServletContext sc) |
void |
initialize(javax.servlet.ServletContext sc)
This method bootstraps JSF based on the parsed configuration resources.
|
private boolean |
isFaceletsDisabled(WebConfiguration webconfig,
FacesConfigInfo facesConfigInfo)
Utility method to check if JSF 2.0 Facelets should be disabled.
|
private void |
publishPostConfigEvent()
Publishes a
PostConstructApplicationEvent event for the current
Application instance. |
private void |
pushTaskToContext(javax.servlet.ServletContext sc,
java.util.concurrent.Future<java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.util.Set<java.lang.Class<?>>>> scanTask)
Push the provided
Future to the specified ServletContext . |
private void |
releaseFactories()
Calls through to
FactoryFinder.releaseFactories()
ignoring any exceptions. |
private DocumentInfo[] |
sortDocuments(DocumentInfo[] facesDocuments,
FacesConfigInfo webInfFacesConfig)
Sort the
faces-config documents found on the classpath
and those specified by the javax.faces.CONFIG_FILES context
init parameter. |
private java.lang.Throwable |
unwind(java.lang.Throwable throwable) |
private static boolean |
useThreads(javax.servlet.ServletContext ctx) |
private static final java.util.logging.Logger LOGGER
private static final java.util.regex.Pattern JAR_PATTERN
private static final java.util.List<ConfigurationResourceProvider> FACES_CONFIG_RESOURCE_PROVIDERS
A List of resource providers that search for faces-config documents. By default, this contains a provider for the Mojarra, and two other providers to satisfy the requirements of the specification.
private static final java.util.List<ConfigurationResourceProvider> FACELET_TAGLIBRARY_RESOURCE_PROVIDERS
A List of resource providers that search for faces-config documents. By default, this contains a provider for the Mojarra, and one other providers to satisfy the requirements of the specification.
private static final int NUMBER_OF_TASK_THREADS
The ConfigManager
will multithread the calls to the
ConfigurationResourceProvider
s as well as any calls
to parse a resources into a DOM. By default, we'll use only 5 threads
per web application.
private static final ConfigManager CONFIG_MANAGER
There is only once instance of ConfigManager
.
private static final java.lang.String ANNOTATIONS_SCAN_TASK_KEY
public static final java.lang.String INJECTION_PROVIDER_KEY
public static final java.lang.String WEB_INF_MARKER
Document
instance as a representation of
/WEB-INF/faces-config.xml
.private java.util.List<javax.servlet.ServletContext> initializedContexts
Contains each ServletContext
that we've initialized.
The ServletContext
will be removed when the application
is destroyed.
private static final ConfigProcessor FACES_CONFIG_PROCESSOR_CHAIN
The chain of ConfigProcessor
instances to processing of
faces-config documents.
private static final ConfigProcessor FACELET_TAGLIB_CONFIG_PROCESSOR_CHAIN
The chain of ConfigProcessor
instances to processing of
facelet-taglib documents.
private static final java.lang.String FACES_TO_1_1_PRIVATE_XSL
private static final java.lang.String FACELETS_TO_2_0_XSL
private static final java.lang.String FACES_CONFIG_1_X_DEFAULT_NS
private static final java.lang.String FACELETS_1_0_DEFAULT_NS
public static ConfigManager getInstance()
ConfigManager
instancepublic void initialize(javax.servlet.ServletContext sc)
This method bootstraps JSF based on the parsed configuration resources.
sc
- the ServletContext
for the application that
requires initializationpublic void destroy(javax.servlet.ServletContext sc)
This method will remove any information about the application.
sc
- the ServletContext
for the application that
needs to be removedpublic boolean hasBeenInitialized(javax.servlet.ServletContext sc)
sc
- the ServletContext
for the application in questiontrue
if this application has already been initialized,
otherwise returns fasepublic static java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.util.Set<java.lang.Class<?>>> getAnnotatedClasses(javax.faces.context.FacesContext ctx)
private static boolean useThreads(javax.servlet.ServletContext ctx)
private java.util.List<ConfigurationResourceProvider> getFacesConfigResourceProviders()
private java.util.List<ConfigurationResourceProvider> getFaceletConfigResourceProviders()
private java.util.List<ConfigurationResourceProvider> getConfigurationResourceProviders(java.util.List<ConfigurationResourceProvider> defaultProviders, ConfigurationResourceProviderFactory.ProviderType providerType)
private DocumentInfo[] sortDocuments(DocumentInfo[] facesDocuments, FacesConfigInfo webInfFacesConfig)
Sort the faces-config
documents found on the classpath
and those specified by the javax.faces.CONFIG_FILES
context
init parameter.
facesDocuments
- an array of all faces-config
documentswebInfFacesConfig
- FacesConfigInfo representing the WEB-INF/faces-config.xml
for this appprivate boolean isFaceletsDisabled(WebConfiguration webconfig, FacesConfigInfo facesConfigInfo)
Utility method to check if JSF 2.0 Facelets should be disabled. If it's not explicitly disabled by the context init parameter, then check the version of the WEB-INF/faces-config.xml document. If the version is less than 2.0, then override the default value for the context init parameter so that other parts of the system that use that config option will know it has been disabled.
NOTE: Since this method overrides a configuration value, it should
be called before *any* document parsing is performed the configuration
value may be queried by the ConfigParser
s.
webconfig
- configuration for this applicationfacesConfigInfo
- object representing WEB-INF/faces-config.xmltrue
if Facelets should be disabledprivate void pushTaskToContext(javax.servlet.ServletContext sc, java.util.concurrent.Future<java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.util.Set<java.lang.Class<?>>>> scanTask)
Future
to the specified ServletContext
.private void publishPostConfigEvent()
PostConstructApplicationEvent
event for the current
Application
instance.private static DocumentInfo[] getConfigDocuments(javax.servlet.ServletContext sc, java.util.List<ConfigurationResourceProvider> providers, java.util.concurrent.ExecutorService executor, boolean validating)
Obtains an array of Document
s to be processed
by FACES_CONFIG_PROCESSOR_CHAIN
.
sc
- the ServletContext
for the application to be
processedproviders
- List
of ConfigurationResourceProvider
instances that provide the URL of the documents to parse.executor
- the ExecutorService
used to dispatch parse
request tovalidating
- flag indicating whether or not the documents
should be validatedDocumentInfo
sprivate static java.util.concurrent.ExecutorService createExecutorService()
ExecutorService
with
NUMBER_OF_TASK_THREADS
threads.private java.lang.Throwable unwind(java.lang.Throwable throwable)
throwable
- Throwableprivate void releaseFactories()
FactoryFinder.releaseFactories()
ignoring any exceptions.Copyright © 2002-2010 Oracle America, Inc. All Rights Reserved.