Move delegating store manager creation to a separate method

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@786340 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2009-06-19 00:11:04 +00:00
parent 7f0b0234c0
commit 453a6a96fa
1 changed files with 24 additions and 11 deletions

View File

@ -216,17 +216,8 @@ public abstract class AbstractBrokerFactory
BrokerImpl broker, boolean fromDeserialization) { BrokerImpl broker, boolean fromDeserialization) {
assertOpen(); assertOpen();
makeReadOnly(); makeReadOnly();
// decorate the store manager for data caching and custom DelegatingStoreManager dsm = createDelegatingStoreManager();
// result object providers; always make sure it's a delegating
// store manager, because it's easier for users to deal with
// that way
StoreManager sm = newStoreManager();
DelegatingStoreManager dsm = null;
if (_conf.getDataCacheManagerInstance().getSystemDataCache()
!= null)
dsm = new DataCacheStoreManager(sm);
dsm = new ROPStoreManager((dsm == null) ? sm : dsm);
broker.initialize(this, dsm, managed, connRetainMode, broker.initialize(this, dsm, managed, connRetainMode,
fromDeserialization); fromDeserialization);
@ -879,4 +870,26 @@ public abstract class AbstractBrokerFactory
return _pcClassLoaders; return _pcClassLoaders;
} }
/**
* Create a DelegatingStoreManager for use with a Broker created by this
* factory.
*
* @return A DataCacheStoreManager if a DataCache is in use otherwise an
* ROPStoreManager
*/
protected DelegatingStoreManager createDelegatingStoreManager() {
// decorate the store manager for data caching and custom
// result object providers; always make sure it's a delegating
// store manager, because it's easier for users to deal with
// that way
StoreManager sm = newStoreManager();
DelegatingStoreManager dsm = null;
if (_conf.getDataCacheManagerInstance().getSystemDataCache()
!= null)
dsm = new DataCacheStoreManager(sm);
dsm = new ROPStoreManager((dsm == null) ? sm : dsm);
return dsm;
}
} }