Top Description Fields Constructors Methods
com.sun.faces.config

public Class ConfigManager

extends Object
Class Inheritance
Static Imports
com.sun.faces.RIConstants.FACES_PREFIX, com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter.DisableFaceletJSFViewHandler, .WebConfiguration.BooleanWebContextInitParameter.DisableFaceletJSFViewHandlerDeprecated, .WebConfiguration.BooleanWebContextInitParameter.EnableThreading, .WebConfiguration.BooleanWebContextInitParameter.ValidateFacesConfigFiles, com.sun.faces.config.manager.Documents.getProgrammaticDocuments, .Documents.getXMLDocuments, .Documents.mergeDocuments, .Documents.sortDocuments, com.sun.faces.spi.ConfigurationResourceProviderFactory.createProviders, .ConfigurationResourceProviderFactory.ProviderType.FaceletConfig, .ConfigurationResourceProviderFactory.ProviderType.FacesConfig, java.util.Arrays.asList, .Collections.emptyMap, .Collections.unmodifiableList, java.util.logging.Level.FINE

This class manages the initialization of each web application that uses JSF.

Field Summary

Modifier and TypeField and Description
private static final String
ANNOTATIONS_SCAN_TASK_KEY

The application-scoped key under which the Future responsible for annotation scanning is associated with.

private static final String
private final List<ConfigProcessor>
private final ConfigProcessor
faceletTaglibConfigProcessor

The chain of ConfigProcessor instances to processing of facelet-taglib documents.

private final List<ConfigurationResourceProvider>
facesConfigProviders

A List of resource providers that search for faces-config documents.

private final List<ConfigurationResourceProvider>
facesletsTagLibConfigProviders

A List of resource providers that search for faces-config documents.

private List<ServletContext>
initializedContexts

Contains each ServletContext that we've initialized.

public static final String
INJECTION_PROVIDER_KEY

The initialization time FacesContext scoped key under which the InjectionProvider is stored.

private static final Logger
private static final int
NUMBER_OF_TASK_THREADS

The ConfigManager will multithread the calls to the ConfigurationResourceProviders as well as any calls to parse a resources into a DOM.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private boolean

Returns:

true if Facelets should be disabled
_isFaceletsDisabled
(WebConfiguration
configuration for this application
webconfig
,
FacesConfigInfo
object representing WEB-INF/faces-config.xml
facesConfigInfo
)

Utility method to check if JSF 2.0 Facelets should be disabled.

private static ExecutorService
createExecutorService()

Create a new ExecutorService with NUMBER_OF_TASK_THREADS threads.

public static ConfigManager
public void
destroy(ServletContext
the ServletContext for the application that needs to be removed
servletContext
,
FacesContext
the FacesContext for the application that needs to be removed
facesContext
)

This method will remove any information about the application.

private void
findAnnotations(DocumentInfo[] facesDocuments, InjectionProvider containerConnector, ServletContext servletContext, InitFacesContext context, ExecutorService executor)

Execute the Task responsible for finding annotation classes

public static Map<Class<? extends Annotation>, Set<Class<?>>>

Returns:

the results of the annotation scan task
getAnnotatedClasses
(FacesContext ctx)

private List<ApplicationConfigurationPopulator>
private List<ConfigurationResourceProvider>
private List<ConfigurationResourceProvider>
private List<ConfigurationResourceProvider>
public static ConfigManager

Returns:

a ConfigManager instance
getInstance
(ServletContext servletContext)

private ThreadContext
getThreadContext(InjectionProvider containerConnector)

public boolean

Returns:

true if this application has already been initialized, otherwise returns fase
hasBeenInitialized
(ServletContext
the ServletContext for the application in question
servletContext
)

public void
initialize(ServletContext
the ServletContext for the application that requires initialization
servletContext
,
InitFacesContext facesContext)

This method bootstraps JSF based on the parsed configuration resources.

private void
private boolean

Returns:

true if Facelets should be disabled
isFaceletsDisabled
(WebConfiguration
configuration for this application
webConfig
,
FacesConfigInfo
object representing WEB-INF/faces-config.xml
lastFacesConfigInfo
)

Utility method to check if JSF 2.0 Facelets should be disabled, but that doesn't perform the check unless lastFacesConfigInfo is indeed *the* WEB-INF/faces-config.xml

pack-priv void
private void
pushTaskToContext(ServletContext sc, Future<Map<Class<? extends Annotation>, Set<Class<?>>>> scanTask)

Push the provided Future to the specified ServletContext.

private void
releaseFactories()

Calls through to javax.faces.FactoryFinder#releaseFactories() ignoring any exceptions.

public static void
private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ANNOTATIONS_SCAN_TASK_KEYback to summary
private static final String ANNOTATIONS_SCAN_TASK_KEY

The application-scoped key under which the Future responsible for annotation scanning is associated with.

CONFIG_MANAGER_INSTANCE_KEYback to summary
private static final String CONFIG_MANAGER_INSTANCE_KEY
configProcessorsback to summary
private final List<ConfigProcessor> configProcessors
faceletTaglibConfigProcessorback to summary
private final ConfigProcessor faceletTaglibConfigProcessor

The chain of ConfigProcessor instances to processing of facelet-taglib documents.

facesConfigProvidersback to summary
private final List<ConfigurationResourceProvider> facesConfigProviders

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.

facesletsTagLibConfigProvidersback to summary
private final List<ConfigurationResourceProvider> facesletsTagLibConfigProviders

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.

initializedContextsback to summary
private List<ServletContext> initializedContexts

Contains each ServletContext that we've initialized. The ServletContext will be removed when the application is destroyed.

INJECTION_PROVIDER_KEYback to summary
public static final String INJECTION_PROVIDER_KEY

The initialization time FacesContext scoped key under which the InjectionProvider is stored.

LOGGERback to summary
private static final Logger LOGGER
NUMBER_OF_TASK_THREADSback to summary
private static final int NUMBER_OF_TASK_THREADS

The ConfigManager will multithread the calls to the ConfigurationResourceProviders as well as any calls to parse a resources into a DOM. By default, we'll use only 5 threads per web application.

Constructor Detail

ConfigManagerback to summary
public ConfigManager()

Method Detail

_isFaceletsDisabledback to summary
private 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 ConfigParsers.

Parameters
webconfig:WebConfiguration

configuration for this application

facesConfigInfo:FacesConfigInfo

object representing WEB-INF/faces-config.xml

Returns:boolean

true if Facelets should be disabled

createExecutorServiceback to summary
private static ExecutorService createExecutorService()

Create a new ExecutorService with NUMBER_OF_TASK_THREADS threads.

createInstanceback to summary
public static ConfigManager createInstance(ServletContext servletContext)
destroyback to summary
public void destroy(ServletContext servletContext, FacesContext facesContext)

This method will remove any information about the application.

Parameters
servletContext:ServletContext

the ServletContext for the application that needs to be removed

facesContext:FacesContext

the FacesContext for the application that needs to be removed

findAnnotationsback to summary
private void findAnnotations(DocumentInfo[] facesDocuments, InjectionProvider containerConnector, ServletContext servletContext, InitFacesContext context, ExecutorService executor)

Execute the Task responsible for finding annotation classes

getAnnotatedClassesback to summary
public static Map<Class<? extends Annotation>, Set<Class<?>>> getAnnotatedClasses(FacesContext ctx)
Returns:Map<Class<? extends Annotation>, Set<Class<?>>>

the results of the annotation scan task

getConfigPopulatorsback to summary
private List<ApplicationConfigurationPopulator> getConfigPopulators()
getConfigurationResourceProvidersback to summary
private List<ConfigurationResourceProvider> getConfigurationResourceProviders(List<ConfigurationResourceProvider> defaultProviders, ConfigurationResourceProviderFactory.ProviderType providerType)
getFaceletConfigResourceProvidersback to summary
private List<ConfigurationResourceProvider> getFaceletConfigResourceProviders()
getFacesConfigResourceProvidersback to summary
private List<ConfigurationResourceProvider> getFacesConfigResourceProviders()
getInstanceback to summary
public static ConfigManager getInstance(ServletContext servletContext)
Returns:ConfigManager

a ConfigManager instance

getThreadContextback to summary
private ThreadContext getThreadContext(InjectionProvider containerConnector)
hasBeenInitializedback to summary
public boolean hasBeenInitialized(ServletContext servletContext)
Parameters
servletContext:ServletContext

the ServletContext for the application in question

Returns:boolean

true if this application has already been initialized, otherwise returns fase

initializeback to summary
public void initialize(ServletContext servletContext, InitFacesContext facesContext)

This method bootstraps JSF based on the parsed configuration resources.

Parameters
servletContext:ServletContext

the ServletContext for the application that requires initialization

initializeConfigProcessersback to summary
private void initializeConfigProcessers(ServletContext servletContext, FacesContext facesContext)
isFaceletsDisabledback to summary
private boolean isFaceletsDisabled(WebConfiguration webConfig, FacesConfigInfo lastFacesConfigInfo)

Utility method to check if JSF 2.0 Facelets should be disabled, but that doesn't perform the check unless lastFacesConfigInfo is indeed *the* WEB-INF/faces-config.xml

Parameters
webConfig:WebConfiguration

configuration for this application

lastFacesConfigInfo:FacesConfigInfo

object representing WEB-INF/faces-config.xml

Returns:boolean

true if Facelets should be disabled

publishPostConfigEventback to summary
pack-priv void publishPostConfigEvent()

Publishes a javax.faces.event.PostConstructApplicationEvent event for the current Application instance.

pushTaskToContextback to summary
private void pushTaskToContext(ServletContext sc, Future<Map<Class<? extends Annotation>, Set<Class<?>>>> scanTask)

Push the provided Future to the specified ServletContext.

releaseFactoriesback to summary
private void releaseFactories()

Calls through to javax.faces.FactoryFinder#releaseFactories() ignoring any exceptions.

removeInstanceback to summary
public static void removeInstance(ServletContext servletContext)
useThreadsback to summary
private boolean useThreads(ServletContext ctx)