}
private void attachManagedConnectionFactories(DeploymentUnit unit, Collection<DataSourceDeploymentMetaData> datasourceDeployments)
{
DeploymentUnit nonComponentDU = unit.isComponent() ? unit.getParent() : unit;
ManagedConnectionFactoryDeploymentGroup managedConnectionFactories = nonComponentDU.getAttachment(ManagedConnectionFactoryDeploymentGroup.class);
if (managedConnectionFactories == null)
{
managedConnectionFactories = new ManagedConnectionFactoryDeploymentGroup();
}
for (DataSourceDeploymentMetaData dataSourceDeployment : datasourceDeployments)
{
managedConnectionFactories.addManagedConnectionFactoryDeployment(dataSourceDeployment);
}
nonComponentDU.addAttachment(ManagedConnectionFactoryDeploymentGroup.class, managedConnectionFactories);
}