Search in sources :

Example 1 with JBossEjb3MetaDataParser

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);
        }
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) XMLStreamReader(javax.xml.stream.XMLStreamReader) XMLStreamException(javax.xml.stream.XMLStreamException) InputStream(java.io.InputStream) EjbJarMetaData(org.jboss.metadata.ejb.spec.EjbJarMetaData) MetaDataElementParser(org.jboss.metadata.parser.util.MetaDataElementParser) IOException(java.io.IOException) JBossEjb3MetaDataParser(org.jboss.metadata.ejb.parser.jboss.ejb3.JBossEjb3MetaDataParser)

Aggregations

IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1 JBossEjb3MetaDataParser (org.jboss.metadata.ejb.parser.jboss.ejb3.JBossEjb3MetaDataParser)1 EjbJarMetaData (org.jboss.metadata.ejb.spec.EjbJarMetaData)1 MetaDataElementParser (org.jboss.metadata.parser.util.MetaDataElementParser)1 VirtualFile (org.jboss.vfs.VirtualFile)1