Search in sources :

Example 1 with RaParser

use of org.jboss.jca.common.metadata.spec.RaParser in project wildfly by wildfly.

the class RaDeploymentParsingProcessor method process.

public static ConnectorXmlDescriptor process(boolean resolveProperties, VirtualFile file, VirtualFile alternateDescriptor, String deploymentName) throws DeploymentUnitProcessingException {
    // Locate the descriptor
    final VirtualFile serviceXmlFile;
    if (alternateDescriptor != null) {
        serviceXmlFile = alternateDescriptor;
    } else {
        serviceXmlFile = file.getChild("/META-INF/ra.xml");
    }
    InputStream xmlStream = null;
    Connector result = null;
    try {
        if (serviceXmlFile != null && serviceXmlFile.exists()) {
            xmlStream = serviceXmlFile.openStream();
            RaParser raParser = new RaParser();
            raParser.setSystemPropertiesResolved(resolveProperties);
            result = raParser.parse(xmlStream);
            if (result == null)
                throw ConnectorLogger.ROOT_LOGGER.failedToParseServiceXml(serviceXmlFile);
        }
        File root = file.getPhysicalFile();
        URL url = root.toURI().toURL();
        return new ConnectorXmlDescriptor(result, root, url, deploymentName);
    } catch (Exception e) {
        throw ConnectorLogger.ROOT_LOGGER.failedToParseServiceXml(e, serviceXmlFile);
    } finally {
        VFSUtils.safeClose(xmlStream);
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) Connector(org.jboss.jca.common.api.metadata.spec.Connector) RaParser(org.jboss.jca.common.metadata.spec.RaParser) InputStream(java.io.InputStream) ConnectorXmlDescriptor(org.jboss.as.connector.metadata.xmldescriptors.ConnectorXmlDescriptor) File(java.io.File) VirtualFile(org.jboss.vfs.VirtualFile) URL(java.net.URL) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException)

Aggregations

File (java.io.File)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 ConnectorXmlDescriptor (org.jboss.as.connector.metadata.xmldescriptors.ConnectorXmlDescriptor)1 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)1 Connector (org.jboss.jca.common.api.metadata.spec.Connector)1 RaParser (org.jboss.jca.common.metadata.spec.RaParser)1 VirtualFile (org.jboss.vfs.VirtualFile)1