Search in sources :

Example 1 with IronJacamarParser

use of org.jboss.as.connector.metadata.ironjacamar.IronJacamarParser in project wildfly by wildfly.

the class IronJacamarDeploymentParsingProcessor method process.

public static IronJacamarXmlDescriptor process(VirtualFile deploymentRoot, boolean resolveProperties) throws DeploymentUnitProcessingException {
    IronJacamarXmlDescriptor xmlDescriptor = null;
    if (deploymentRoot == null || !deploymentRoot.exists())
        return null;
    final String deploymentRootName = deploymentRoot.getName().toLowerCase(Locale.ENGLISH);
    VirtualFile serviceXmlFile = null;
    if (deploymentRootName.endsWith(".rar")) {
        serviceXmlFile = deploymentRoot.getChild("/META-INF/ironjacamar.xml");
    }
    if (serviceXmlFile == null || !serviceXmlFile.exists())
        return null;
    InputStream xmlStream = null;
    Activation result = null;
    try {
        xmlStream = serviceXmlFile.openStream();
        IronJacamarParser ironJacamarParser = new IronJacamarParser();
        ironJacamarParser.setSystemPropertiesResolved(resolveProperties);
        result = ironJacamarParser.parse(xmlStream);
        if (result != null) {
            xmlDescriptor = new IronJacamarXmlDescriptor(result);
        } else
            throw ConnectorLogger.ROOT_LOGGER.failedToParseServiceXml(serviceXmlFile);
    } catch (Exception e) {
        throw ConnectorLogger.ROOT_LOGGER.failedToParseServiceXml(e, serviceXmlFile);
    } finally {
        VFSUtils.safeClose(xmlStream);
    }
    return xmlDescriptor;
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) IronJacamarParser(org.jboss.as.connector.metadata.ironjacamar.IronJacamarParser) InputStream(java.io.InputStream) Activation(org.jboss.jca.common.api.metadata.resourceadapter.Activation) IronJacamarXmlDescriptor(org.jboss.as.connector.metadata.xmldescriptors.IronJacamarXmlDescriptor) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException)

Aggregations

InputStream (java.io.InputStream)1 IronJacamarParser (org.jboss.as.connector.metadata.ironjacamar.IronJacamarParser)1 IronJacamarXmlDescriptor (org.jboss.as.connector.metadata.xmldescriptors.IronJacamarXmlDescriptor)1 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)1 Activation (org.jboss.jca.common.api.metadata.resourceadapter.Activation)1 VirtualFile (org.jboss.vfs.VirtualFile)1