Set<String> propNamesWithDatastore = getPersistenceConfiguration().getPropertyNamesWithPrefix("datanucleus.datastore.");
if (propNamesWithDatastore == null)
{
// Find the StoreManager using the persistence property if specified
Map<String, Object> datastoreProps = getPersistenceConfiguration().getDatastoreProperties();
StoreManager storeMgr = createStoreManagerForProperties(
getPersistenceConfiguration().getPersistenceProperties(), datastoreProps, clr, this);
setStoreManager(storeMgr);
// Make sure the isolation level is valid for this StoreManager and correct if necessary
String transactionIsolation = config.getStringProperty("datanucleus.transactionIsolation");
if (transactionIsolation != null)
{
String reqdIsolation = getTransactionIsolationForStoreManager(storeMgr, transactionIsolation);
if (!transactionIsolation.equalsIgnoreCase(reqdIsolation))
{
config.setProperty("datanucleus.transactionIsolation", reqdIsolation);
}
}
}
else
{
NucleusLogger.DATASTORE.info("Creating FederatedStoreManager to handle federation of primary StoreManager and " + propNamesWithDatastore.size() + " secondary datastores");
FederatedStoreManager fedStoreMgr = new FederatedStoreManager(clr, this);
setStoreManager(fedStoreMgr);
}
// Load up any persistence-unit classes into the StoreManager
String puName = config.getStringProperty("datanucleus.PersistenceUnitName");
if (puName != null)
{
boolean loadClasses = config.getBooleanProperty("datanucleus.persistenceUnitLoadClasses");
if (loadClasses)
{
// Load all classes into StoreManager so it knows about them
Collection<String> loadedClasses = getMetaDataManager().getClassesWithMetaData();
storeMgr.addClasses(loadedClasses.toArray(new String[loadedClasses.size()]), clr);
}
}
logConfiguration();
}