private InjectionSource getPersistenceContextBindingSource(
final DeploymentUnit deploymentUnit,
final String unitName, PersistenceContextType type, Map properties)
throws DeploymentUnitProcessingException {
PersistenceUnitMetadata pu = getPersistenceUnit(deploymentUnit, unitName);
if(pu.getTransactionType() == PersistenceUnitTransactionType.RESOURCE_LOCAL) {
throw new DeploymentUnitProcessingException("Cannot inject RESOURCE_LOCAL entity manager " + unitName + " using " + "<persistence-context-ref>");
}
String scopedPuName = pu.getScopedPersistenceUnitName();
ServiceName puServiceName = getPuServiceName(scopedPuName);
return new PersistenceContextInjectionSource(type, properties, puServiceName, deploymentUnit, scopedPuName, EntityManager.class.getName(), SFSBXPCMap.getXpcMap(deploymentUnit), pu);
}