buildingContext.put(NamingBuilder.INJECTION_KEY, holder);
XmlObject jettyWebApp = webModule.getVendorDD();
//Parse default web application faces configuration file WEB-INF/faces-config.xml
FacesConfig webAppFacesConfig = getWebAppFacesConfig(webModule);
//Parse all faces-config.xml files found in META-INF folder
Set<ConfigurationResource> metaInfConfigurationResources = JSF_META_INF_CONFIGURATION_RESOURCES.get(module.getEarContext().getGeneralData());
List<FacesConfig> metaInfFacesConfigs = new ArrayList<FacesConfig>(metaInfConfigurationResources.size());
for (ConfigurationResource configurationResource : metaInfConfigurationResources) {
FacesConfig facesConfig = configurationResource.getFacesConfig();
if (facesConfig == null) {
URL url;
try {
url = configurationResource.getConfigurationResourceURL(bundle);
} catch (MalformedURLException e) {
throw new DeploymentException("Fail to read the faces Configuration file " + configurationResource.getConfigurationResourcePath()
+ (configurationResource.getJarFilePath() == null ? "" : " from jar file " + configurationResource.getJarFilePath()), e);
}
if (url == null) {
throw new DeploymentException("Fail to read the faces Configuration file " + configurationResource.getConfigurationResourcePath()
+ (configurationResource.getJarFilePath() == null ? "" : " from jar file " + configurationResource.getJarFilePath()));
}
facesConfig = parseConfigFile(url, url.toExternalForm());
}
metaInfFacesConfigs.add(facesConfig);
}
//Parse all faces-config.xml files found in classloader hierarchy
List<FacesConfig> classloaderFacesConfigs = new ArrayList<FacesConfig>();
classloaderFacesConfigs.addAll(metaInfFacesConfigs);
ServiceReference ref = null;
try {
ref = bundle.getBundleContext().getServiceReference(ConfigRegistry.class.getName());
ConfigRegistry configRegistry = (ConfigRegistry) bundle.getBundleContext().getService(ref);
classloaderFacesConfigs.addAll(configRegistry.getDependentFacesConfigs(bundle.getBundleId()));
} finally {
if (ref != null) {
bundle.getBundleContext().ungetService(ref);
}
}
//Parse all context faces-config.xml files configured in web.xml file
List<FacesConfig> contextSpecifiedFacesConfigs = getContextFacesConfigs(webApp, webModule);
//Scan annotations if required
FacesConfig annotationsFacesConfig = null;
if (webAppFacesConfig == null || !Boolean.parseBoolean(webAppFacesConfig.getMetadataComplete())) {
annotationsFacesConfig = getJSFAnnotationFacesConfig(earContext, webModule, bundle, metaInfConfigurationResources);
}
AbstractName myFacesWebAppContextName = moduleContext.getNaming().createChildName(moduleName, "myFacesWebAppContext", "MyFacesWebAppContext");