Map<String, GerPersistenceContextRefType> gerPersistenceContextRefsUntyped = getGerPersistenceContextRefs(plan);
for (Map.Entry<String, PersistenceContextRef> entry : specDD.getPersistenceContextRefMap().entrySet()) {
try {
String persistenceContextRefName = entry.getKey();
PersistenceContextRef persistenceContextRef = entry.getValue();
PersistenceContextType persistenceContextType = persistenceContextRef.getPersistenceContextType();
boolean transactionScoped = persistenceContextType == null || persistenceContextType.equals(PersistenceContextType.TRANSACTION);
List<Property> propertyTypes = persistenceContextRef.getPersistenceProperty();
Map<String, String> properties = new HashMap<String, String>();
for (Property propertyType : propertyTypes) {
String key = propertyType.getName();
String value = propertyType.getValue();
properties.put(key, value);
}
AbstractNameQuery persistenceUnitNameQuery;
GerPersistenceContextRefType gerPersistenceContextRef = gerPersistenceContextRefsUntyped.remove(persistenceContextRefName);
if (gerPersistenceContextRef != null) {
persistenceUnitNameQuery = findPersistenceUnit(gerPersistenceContextRef, localConfiguration);
addProperties(gerPersistenceContextRef, properties);
} else {
persistenceUnitNameQuery = findPersistenceUnitQuery(module, localConfiguration, persistenceContextRef);
}
PersistenceContextReference reference = new PersistenceContextReference(module.getConfigId(), persistenceUnitNameQuery, transactionScoped, properties);
put(persistenceContextRefName, reference, ReferenceType.PERSISTENCE_CONTEXT, module.getJndiContext(), persistenceContextRef.getInjectionTarget(), sharedContext);
} catch (DeploymentException e) {
problems.add(e);
}
}
// Support persistence context refs that are mentioned only in the geronimo plan
for (GerPersistenceContextRefType gerPersistenceContextRef : gerPersistenceContextRefsUntyped.values()) {
try {
String persistenceContextRefName = gerPersistenceContextRef.getPersistenceContextRefName();
GerPersistenceContextTypeType.Enum persistenceContextType = gerPersistenceContextRef.getPersistenceContextType();
boolean transactionScoped = persistenceContextType == null || !persistenceContextType.equals(GerPersistenceContextTypeType.EXTENDED);
Map<String, String> properties = new HashMap<String, String>();
addProperties(gerPersistenceContextRef, properties);
AbstractNameQuery persistenceUnitNameQuery = findPersistenceUnit(gerPersistenceContextRef, localConfiguration);
PersistenceContextReference reference = new PersistenceContextReference(module.getConfigId(), persistenceUnitNameQuery, transactionScoped, properties);
put(persistenceContextRefName, reference, ReferenceType.PERSISTENCE_CONTEXT, module.getJndiContext(), Collections.<InjectionTarget> emptySet(), sharedContext);