ModuleList moduleLocations = EARContext.MODULE_LIST_KEY.get(webModule.getRootEarContext().getGeneralData());
URI baseUri = URI.create(webModule.getTargetPath());
URI resolutionUri = invertURI(baseUri);
earContext.getCompleteManifestClassPath(webModule.getDeployable(), baseUri, resolutionUri, manifestcp, moduleLocations);
//Security Configuration Validation
WebAppType webApp = (WebAppType) webModule.getSpecDD();
boolean hasSecurityRealmName = (Boolean) module.getEarContext().getGeneralData().get(WEB_MODULE_HAS_SECURITY_REALM);
if ((webApp.getSecurityConstraintArray().length > 0 || webApp.getSecurityRoleArray().length > 0)) {
if (!hasSecurityRealmName) {
throw new DeploymentException("web.xml for web app " + webModule.getName()
+ " includes security elements but Geronimo deployment plan is not provided or does not contain <security-realm-name> element necessary to configure security accordingly.");
}
}
if (hasSecurityRealmName) {
earContext.setHasSecurity(true);
}
//TODO think about how to provide a default security realm name
XmlObject[] securityElements = XmlBeansUtil.selectSubstitutionGroupElements(SECURITY_QNAME, gerWebApp);
if (securityElements.length > 0 && !hasSecurityRealmName) {
throw new DeploymentException("You have supplied a security configuration for web app " + webModule.getName() + " but no security-realm-name to allow login");
}
//Process Naming
getNamingBuilders().buildEnvironment(webApp, webModule.getVendorDD(), webModule.getEnvironment());
getNamingBuilders().initContext(webApp, gerWebApp, webModule);
float originalSpecDDVersion;
String originalSpecDD = module.getOriginalSpecDD();
if (originalSpecDD == null) {
originalSpecDDVersion = 3.0f;
} else {
originalSpecDDVersion = identifySpecDDSchemaVersion(originalSpecDD);
}
earContext.getGeneralData().put(INITIAL_WEB_XML_SCHEMA_VERSION, originalSpecDDVersion);
//Process web fragments and annotations
if (INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()) >= 2.5f && !webApp.getMetadataComplete()) {
MergeHelper.processWebFragmentsAndAnnotations(earContext, webModule, bundle, webApp);
}
//TODO From my understanding, whether we scan ServletContainerInitializer has nothing to do with meta-complete/web.xml schema version
//Might need double-check !
MergeHelper.processServletContainerInitializer(earContext, webModule, bundle);