public AbstractWarDeployment getDeployment(DeploymentUnit unit, JBossWebMetaData metaData) throws Exception
{
String className = (deploymentClass == null)
? "org.jboss.web.tomcat.service.deployers.TomcatDeployment"
: deploymentClass;
AbstractWarDeployment deployment = (AbstractWarDeployment) (getClass().getClassLoader().loadClass(className))
.newInstance();
DeployerConfig config = new DeployerConfig();
config.setDefaultSecurityDomain(this.defaultSecurityDomain);
config.setSubjectAttributeName(this.subjectAttributeName);
config.setServiceClassLoader((getServiceClassLoader() == null)
? getClass().getClassLoader()
: getServiceClassLoader());
config.setJava2ClassLoadingCompliance(this.java2ClassLoadingCompliance);
config.setUnpackWars(this.unpackWars);
config.setLenientEjbLink(this.lenientEjbLink);
config.setCatalinaDomain(catalinaDomain);
config.setContextClassName(contextClassName);
config.setServiceName(null);
config.setSubjectAttributeName(this.subjectAttributeName);
config.setAllowSelfPrivilegedWebApps(this.allowSelfPrivilegedWebApps);
config.setSecurityManagerService(this.secMgrService);
config.setDeleteWorkDirs(deleteWorkDirOnContextDestroy);
config.setDynamicClassloaders(dynamicClassloaders);
config.setStandalone(standalone);
config.setSecurityContextClassName(securityContextClassName);
deployment.setSecurityManagementName(securityManagement);
deployment.setPolicyRegistrationName(policyRegistrationName);
// TODO: I haven't got a clue as to why this is set very late in WebModule, but the informer depends on it
deployment.setDeploymentUnit(unit);
// TODO: until deployment is a MC bean
((TomcatDeployment) deployment).setJavaEEComponentInformer(componentInformer);
// Add a dependency on the webserver itself
List<String> depends = metaData.getDepends();
if (depends == null)
depends = new ArrayList<String>();
depends.add(TOMCAT_SERVICE_NAME.getCanonicalName());
depends.add(((TomcatDeployment) deployment).getJavaEEModuleName());
metaData.setDepends(depends);
deployment.setServer(super.getServer());
deployment.init(config);
return deployment;
}