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);
}
}
Aggregations