XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(inputStream);
final EarMetaData earMetaData = EarMetaDataParser.parse(xmlReader);
if (earMetaData != null) {
deploymentUnit.putAttachment(Attachments.EAR_METADATA, earMetaData);
if(earMetaData instanceof Ear6xMetaData) {
Ear6xMetaData metaData = (Ear6xMetaData)earMetaData;
if(metaData.getEarEnvironmentRefsGroup() != null) {
final DeploymentDescriptorEnvironment bindings = new DeploymentDescriptorEnvironment("java:app/env/", ((Ear6xMetaData) earMetaData).getEarEnvironmentRefsGroup());
deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT, bindings);
}
}
}