use of org.jboss.as.connector.deployers.ds.DsXmlParser in project wildfly by wildfly.
the class DsXmlDeploymentParsingProcessor method deploy.
/**
* Process a deployment for standard ra deployment files. Will parse the xml
* file and attach a configuration discovered during processing.
*
* @param phaseContext the deployment unit context
* @throws DeploymentUnitProcessingException
*
*/
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
boolean resolveProperties = Util.shouldResolveJBoss(deploymentUnit);
final PropertyResolver propertyResolver = deploymentUnit.getAttachment(org.jboss.as.ee.metadata.property.Attachments.FINAL_PROPERTY_RESOLVER);
final PropertyReplacer propertyReplacer = deploymentUnit.getAttachment(org.jboss.as.ee.metadata.property.Attachments.FINAL_PROPERTY_REPLACER);
final Set<VirtualFile> files = dataSources(deploymentUnit);
boolean loggedDeprication = false;
for (VirtualFile f : files) {
InputStream xmlStream = null;
try {
xmlStream = new FileInputStream(f.getPhysicalFile());
DsXmlParser parser = new DsXmlParser(propertyResolver, propertyReplacer);
parser.setSystemPropertiesResolved(resolveProperties);
DataSources dataSources = parser.parse(xmlStream);
if (dataSources != null) {
if (!loggedDeprication) {
loggedDeprication = true;
ConnectorLogger.ROOT_LOGGER.deprecated();
}
for (DataSource ds : dataSources.getDataSource()) {
if (ds.getDriver() == null) {
throw ConnectorLogger.ROOT_LOGGER.FailedDeployDriverNotSpecified(ds.getJndiName());
}
}
deploymentUnit.addToAttachmentList(DATA_SOURCES_ATTACHMENT_KEY, dataSources);
}
} catch (Exception e) {
throw new DeploymentUnitProcessingException(e.getMessage(), e);
} finally {
VFSUtils.safeClose(xmlStream);
}
}
}
Aggregations