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.EnableThreading, .WebConfiguration.BooleanWebContextInitParameter.ValidateFacesConfigFiles, com.sun.faces.config.manager.Documents.getProgrammaticDocuments, .Documents.getXMLDocuments, .Documents.mergeDocuments, .Documents.sortDocuments, com.sun.faces.spi.ConfigurationResourceProviderFactory.ProviderType.FaceletConfig, .ConfigurationResourceProviderFactory.ProviderType.FacesConfig, .ConfigurationResourceProviderFactory.createProviders, java.util.Arrays.asList, .Collections.emptyMap, .Collections.unmodifiableList, java.util.logging.Level.FINE

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

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 final 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 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
the involved faces context
ctx
)

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

Returns:

a ConfigManager instance
getInstance
(ServletContext
the involved servlet context
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
the involved initialization faces context
facesContext
)

This method bootstraps Faces based on the parsed configuration resources.

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

Push the provided Future to the specified ServletContext.

private void
releaseFactories()

Calls through to jakarta.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 final 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

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)
Parameters
ctx:FacesContext

the involved faces context

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)
Parameters
servletContext:ServletContext

the involved servlet context

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 Faces based on the parsed configuration resources.

Parameters
servletContext:ServletContext

the ServletContext for the application that requires initialization

facesContext:InitFacesContext

the involved initialization faces context

initializeConfigProcessorsback to summary
private void initializeConfigProcessors(ServletContext servletContext, FacesContext facesContext)
publishPostConfigEventback to summary
pack-priv void publishPostConfigEvent()

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

pushTaskToContextback to summary
private void pushTaskToContext(ServletContext servletContext, 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 jakarta.faces.FactoryFinder#releaseFactories() ignoring any exceptions.

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