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); } }
@Override public Connector parse(InputStream xmlInputStream) throws Exception { XMLStreamReader reader = null; XMLInputFactory inputFactory = XMLInputFactory.newInstance(); inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); reader = inputFactory.createXMLStreamReader(xmlInputStream); return parse(reader); }
input = new FileInputStream(metadataFile); result = (new RaParser()).parse(input);
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); } }