From 453a6a96fa1f227c9420d04bbe82812418ba6d76 Mon Sep 17 00:00:00 2001 From: Michael Dick Date: Fri, 19 Jun 2009 00:11:04 +0000 Subject: [PATCH] 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 --- .../openjpa/kernel/AbstractBrokerFactory.java | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java index f7365c8b6..3d2146bd7 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java @@ -216,17 +216,8 @@ public abstract class AbstractBrokerFactory BrokerImpl broker, boolean fromDeserialization) { assertOpen(); makeReadOnly(); - - // 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); + + DelegatingStoreManager dsm = createDelegatingStoreManager(); broker.initialize(this, dsm, managed, connRetainMode, fromDeserialization); @@ -879,4 +870,26 @@ public abstract class AbstractBrokerFactory 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; + } }