use of org.jboss.metadata.ejb.parser.jboss.ejb3.JBossEjb3MetaDataParser in project wildfly by wildfly.
the class EjbJarParsingDeploymentUnitProcessor method parseJBossEjb3Xml.
private static EjbJarMetaData parseJBossEjb3Xml(final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
final VirtualFile deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
// Locate the descriptor
final VirtualFile descriptor = getDescriptor(deploymentRoot, JBOSS_EJB3_XML);
if (descriptor == null) {
//but there may have been an ejb-jar element in jboss-all.xml
return deploymentUnit.getAttachment(EjbJarJBossAllParser.ATTACHMENT_KEY);
}
// get the XMLStreamReader and parse the descriptor
MetaDataElementParser.DTDInfo dtdInfo = new MetaDataElementParser.DTDInfo();
InputStream stream = open(descriptor);
try {
XMLStreamReader reader = getXMLStreamReader(stream, descriptor, dtdInfo);
final JBossEjb3MetaDataParser parser = new JBossEjb3MetaDataParser(createJbossEjbJarParsers());
final EjbJarMetaData ejbJarMetaData = parser.parse(reader, dtdInfo, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit));
return ejbJarMetaData;
} catch (XMLStreamException xmlse) {
throw EjbLogger.ROOT_LOGGER.failedToParse(xmlse, JBOSS_EJB3_XML + ": " + descriptor.getPathName());
} finally {
try {
stream.close();
} catch (IOException ioe) {
EjbLogger.DEPLOYMENT_LOGGER.failToCloseFile(ioe);
}
}
}
Aggregations