List<DatabaseMetaData> allMetaData = unit.getAttachmentList( DatabaseMetaData.ATTACHMENTS );
Set<String> adapterIds = new HashSet<String>();
DataSourceInfoListService dsInfoService = new DataSourceInfoListService( org.jboss.logmanager.Logger.getLogger( "com.arjuna.ats" ).getLevel() );
ServiceBuilder<DataSourceInfoList> dsInfoBuilder = phaseContext.getServiceTarget().addService( DataSourceServices.dataSourceInfoName( unit ), dsInfoService );
for (DatabaseMetaData each : allMetaData) {
if (!isXAExplicitlyEnabled( each )) {
continue;
}
if (each.getConfiguration().containsKey( "jndi" )) {
continue;
}
String adapterName = (String) each.getConfiguration().get( "adapter" );
Adapter adapter = getAdapter( adapterName );
if (adapter == null) {
log.warnf( "Not enabling XA for unknown adapter type: %s", adapterName );
continue;
}
if (adapterIds.add( adapter.getId() )) {
processDriver( phaseContext, adapter, applicationDir );
}
try {
ServiceName dsVerifierServiceName = processDataSource( phaseContext, each, adapter );
dsInfoBuilder.addDependency( dsVerifierServiceName, Info.class, dsInfoService.getInfoInjector() );
} catch (ValidateException e) {
log.warnf( "Unable to add data-source: %s", each.getConfigurationName() );
throw new DeploymentUnitProcessingException( e );
}
}