cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1080004 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactory.java test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
Date Wed, 09 Mar 2011 21:17:20 GMT
Author: aadamchik
Date: Wed Mar  9 21:17:19 2011
New Revision: 1080004

URL: http://svn.apache.org/viewvc?rev=1080004&view=rev
Log:
CAY-1549 Migrate BatchQueryBuilderFactory to DI

actually injecting stuff in DbAdapter

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactory.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactory.java?rev=1080004&r1=1080003&r2=1080004&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactory.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactory.java
Wed Mar  9 21:17:19 2011
@@ -26,13 +26,13 @@ import java.util.List;
 import javax.sql.DataSource;
 
 import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.access.QueryLogger;
 import org.apache.cayenne.configuration.AdhocObjectFactory;
 import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.dba.AutoAdapter;
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.di.Provider;
 import org.apache.cayenne.log.JdbcEventLogger;
 
@@ -47,6 +47,9 @@ public class DefaultDbAdapterFactory imp
     public static final String DETECTORS_LIST = "org.apache.cayenne.configuration.server.DefaultDbAdapterFactory.detectors";
 
     @Inject
+    protected Injector injector;
+
+    @Inject
     protected JdbcEventLogger jdbcEventLogger;
 
     @Inject
@@ -119,6 +122,10 @@ public class DefaultDbAdapterFactory imp
             if (adapter != null) {
                 jdbcEventLogger.log("Detected and installed adapter: "
                         + adapter.getClass().getName());
+                
+                // TODO: should detector do this??
+                injector.injectMembers(adapter);
+                
                 return adapter;
             }
         }
@@ -128,6 +135,6 @@ public class DefaultDbAdapterFactory imp
 
     protected DbAdapter defaultAdapter() {
         jdbcEventLogger.log("Failed to detect database type, using generic adapter");
-        return new JdbcAdapter();
+        return objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java?rev=1080004&r1=1080003&r2=1080004&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
Wed Mar  9 21:17:19 2011
@@ -96,6 +96,8 @@ public class DefaultDbAdapterFactoryTest
             public void configure(Binder binder) {
                 binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);
                 binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
+                binder.bind(BatchQueryBuilderFactory.class).toInstance(
+                        mock(BatchQueryBuilderFactory.class));
             }
         };
 



Mime
View raw message