openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r423295 - in /incubator/openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/conf/ openjpa-kernel/src/main/java/org/apache/openjpa/util/ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/
Date Tue, 18 Jul 2006 23:52:09 GMT
Author: pcl
Date: Tue Jul 18 16:52:09 2006
New Revision: 423295

URL: http://svn.apache.org/viewvc?rev=423295&view=rev
Log:
moved store facade type registry to Configuration instead of a static in ImplHelper

Modified:
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java
    incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java?rev=423295&r1=423294&r2=423295&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
Tue Jul 18 16:52:09 2006
@@ -1325,4 +1325,10 @@
 	 * Backwards compatibility options.
 	 */
 	public Compatibility getCompatibilityInstance ();
+    
+    /**
+     * Return the {@link StoreFacadeTypeRegistry} instance associated with this
+     * configuration.
+     */
+    public StoreFacadeTypeRegistry getStoreFacadeTypeRegistry();
 }

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java?rev=423295&r1=423294&r2=423295&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
Tue Jul 18 16:52:09 2006
@@ -141,6 +141,9 @@
 
     private Collection supportedOptions = new HashSet(33);
     private String spec = null;
+    
+    private final StoreFacadeTypeRegistry _storeFacadeRegistry =
+        new StoreFacadeTypeRegistry();
 
     /**
      * Default constructor. Attempts to load default properties.
@@ -1412,4 +1415,8 @@
     public Log getConfigurationLog() {
         return getLog(LOG_RUNTIME);
 	}
+
+    public StoreFacadeTypeRegistry getStoreFacadeTypeRegistry() {
+        return _storeFacadeRegistry;
+    }
 }

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java?rev=423295&r1=423294&r2=423295&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java
Tue Jul 18 16:52:09 2006
@@ -19,14 +19,10 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Map;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.enhance.PersistenceCapable;
-import org.apache.openjpa.kernel.BrokerFactory;
-import org.apache.openjpa.kernel.DelegatingBrokerFactory;
 import org.apache.openjpa.kernel.FetchState;
 import org.apache.openjpa.kernel.LockManager;
 import org.apache.openjpa.kernel.OpenJPAStateManager;
@@ -53,7 +49,6 @@
 
     private static final Localizer _loc = Localizer.forPackage
         (ImplHelper.class);
-	private static Map _facadeTypes = new HashMap ();
 
     /**
      * Return the getter method matching the given property name.
@@ -172,43 +167,6 @@
             default:
                 return null;
         }
-    }
-
-    /**
-     * Return the store-specific facade class for the given broker
-     * component class. This method is used by facade implementations to
-     * wrap store-specific components without knowing about all possible
-     * back-ends.
-     *
-     * @param bf broker factory for which an implementation class
-     * @param compType type of desired component (e.g. FetchPlan.class)
-     * @return the class corresponding to the type in the store facade registry,
-     * or <code>null</code> if no registry entry exists.
-     */
-    public static Class getStoreFacadeType(BrokerFactory bf, Class compType) {
-    	
-    	Class bfClass;
-    	if (bf instanceof DelegatingBrokerFactory)
-    		bfClass = ((DelegatingBrokerFactory) bf).getInnermostDelegate()
-    			.getClass();
-    	else
-    		bfClass = bf.getClass();
-    	
-    	return (Class) _facadeTypes.get(storeFacadeKey(bfClass, compType));
-    }
-    
-    /**
-     * Add a facade type for the specified broker factory type and 
-     * component type.
-     * @see #getStoreFacadeType
-     */
-    public static void addStoreFacadeType(Class bfClass, Class compType,
-    	Class facadeType) {
-    	_facadeTypes.put(storeFacadeKey(bfClass, compType), facadeType);
-    }
-    
-    private static String storeFacadeKey(Class bfClass, Class compType) {
-    	return bfClass.getName() + ":" + compType.getName();
     }
 
     /**

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java?rev=423295&r1=423294&r2=423295&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
(original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
Tue Jul 18 16:52:09 2006
@@ -276,8 +276,9 @@
         _factory.lock();
         try {
             if (_plan == null) {
-                Class cls = ImplHelper.getStoreFacadeType(_factory, 
-                	FetchPlan.class);
+                Class cls = _factory.getConfiguration()
+                    .getStoreFacadeTypeRegistry().getImplementation(
+                        FetchPlan.class);
                 if (cls == null)
                     cls = FetchPlan.class;
                 _plan = cls.getConstructor(FetchPlan.class);



Mime
View raw message