inputFactory.setXMLResolver(NoopXmlResolver.create());
XMLStreamReader xmlReader = null;
// 1. Create the initial JDBC App
JDBCApplicationMetaData jdbcMetaData = new JDBCApplicationMetaData(jarMetaData, module.getClassLoader());
// 2. Merge in the defaults from standardjbosscmp-jdbc.xml
InputStream inputStream = null;
try {
inputStream = this.getClass().getClassLoader().getResourceAsStream("standardjbosscmp-jdbc.xml");
xmlReader = inputFactory.createXMLStreamReader(inputStream);
jdbcMetaData = JDBCMetaDataParser.parse(xmlReader, jdbcMetaData);
} catch (Exception e) {
throw new DeploymentUnitProcessingException("Failed to parse 'standardjbosscmp-jdbc.xml'", e);
} finally {
VFSUtils.safeClose(inputStream);
}
// 3. Merge in the app provided from jbosscmp-jdbc.xml
final VirtualFile deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT).getRoot();
// Locate the descriptor
final VirtualFile descriptor = deploymentRoot.getChild("META-INF/jbosscmp-jdbc.xml");
JDBCApplicationMetaData deploymentJdbcApplicationMetaData = null;
if (descriptor != null && descriptor.exists()) {
try {
inputStream = descriptor.openStream();
xmlReader = inputFactory.createXMLStreamReader(inputStream);
jdbcMetaData = JDBCMetaDataParser.parse(xmlReader, jdbcMetaData);