use of org.jboss.as.server.deployment.module.ResourceRoot in project wildfly by wildfly.
the class EarMetaDataParsingProcessor method deploy.
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
return;
}
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT);
final VirtualFile deploymentFile = deploymentRoot.getRoot();
EarMetaData earMetaData = handleSpecMetadata(deploymentFile, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit));
JBossAppMetaData jbossMetaData = handleJbossMetadata(deploymentFile, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit), deploymentUnit);
if (earMetaData == null && jbossMetaData == null) {
return;
}
// the jboss-app.xml has a distinct-name configured then attach it to the deployment unit
if (jbossMetaData != null && jbossMetaData.getDistinctName() != null) {
deploymentUnit.putAttachment(Attachments.DISTINCT_NAME, jbossMetaData.getDistinctName());
}
JBossAppMetaData merged;
if (earMetaData != null) {
merged = new JBossAppMetaData(earMetaData.getEarVersion());
} else {
merged = new JBossAppMetaData();
}
JBossAppMetaDataMerger.merge(merged, jbossMetaData, earMetaData);
deploymentUnit.putAttachment(Attachments.EAR_METADATA, merged);
if (merged.getEarEnvironmentRefsGroup() != null) {
final DeploymentDescriptorEnvironment bindings = new DeploymentDescriptorEnvironment("java:app/env/", merged.getEarEnvironmentRefsGroup());
deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT, bindings);
}
}
Aggregations