public void processDeployment(DeploymentUnitContext context) throws DeploymentUnitProcessingException {
final ConnectorXmlDescriptor connectorXmlDescriptor = context.getAttachment(ConnectorXmlDescriptor.ATTACHMENT_KEY);
final String deploymentName = connectorXmlDescriptor == null ? null : connectorXmlDescriptor.getDeploymentName();
final DataSources datasources = dsValue.getValue();
if (datasources == null || deploymentName == null || !deploymentName.startsWith("jdbc"))
return;
log.tracef("Processing datasource deployement: %s", datasources);
try {
if (deploymentName.indexOf("local") != -1) {
// Local datasources
List<DataSource> dss = datasources.getDataSource();
if (dss != null && dss.size() > 0) {
for (DataSource ds : dss) {
try {
log.tracef("Processing datasource deployement: %s", ds);
if (ds.getModule() != null && !ds.getModule().trim().equals("")) {
ModuleIdentifier jdbcIdentifier = ModuleIdentifier.fromString(ds.getModule());
Module jdbcModule = Module.getDefaultModuleLoader().loadModule(jdbcIdentifier);
// Hack: Link the jdbcModule
ModuleDependencies.addDependency(context, new ModuleConfig.Dependency(jdbcIdentifier, true,
false, false));
} else {
log.warnf("No module defined for %s", ds.getJndiName());
}
} catch (ModuleLoadException mle) {
log.warnf("Unable to resolve %s for %s", ds.getModule(), ds.getJndiName());
}
}
}
} else {
// XA datasources
List<XaDataSource> xadss = datasources.getXaDataSource();
if (xadss != null && xadss.size() > 0) {
for (XaDataSource xads : xadss) {
try {
log.tracef("Processing xa-datasource deployement: %s", xads);