openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r1133601 - in /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema: DataSourceFactory.java DriverDataSource.java
Date Wed, 08 Jun 2011 23:36:45 GMT
Author: ppoddar
Date: Wed Jun  8 23:36:45 2011
New Revision: 1133601

URL: http://svn.apache.org/viewvc?rev=1133601&view=rev
Log:
OPENJPA-1050: Use generics wherever possible

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DriverDataSource.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java?rev=1133601&r1=1133600&r2=1133601&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
Wed Jun  8 23:36:45 2011
@@ -81,7 +81,7 @@ public class DataSourceFactory {
         String props = (factory2) ? conf.getConnection2Properties()
             : conf.getConnectionProperties();
         try {
-            Class driverClass;
+            Class<?> driverClass;
             try {
                 driverClass = Class.forName(driver, true, loader);
             } catch (ClassNotFoundException cnfe) {
@@ -146,7 +146,7 @@ public class DataSourceFactory {
             newDecoratingDataSource(ds);
         try {
             // add user-defined decorators
-            List decorators = new ArrayList();
+            List<ConnectionDecorator> decorators = new ArrayList<ConnectionDecorator>();
             decorators.addAll(Arrays.asList(conf.
                 getConnectionDecoratorInstances()));
 
@@ -161,7 +161,7 @@ public class DataSourceFactory {
 
             // ask the DriverDataSource to provide any additional decorators
             if (ds instanceof DriverDataSource) {
-                List decs = ((DriverDataSource) ds).
+                List<ConnectionDecorator> decs = ((DriverDataSource) ds).
                     createConnectionDecorators();
                 if (decs != null)
                     decorators.addAll(decs);
@@ -198,11 +198,10 @@ public class DataSourceFactory {
         Connection conn = null;
 
         try {
-            // add the dictionary as a warning handler on the logging
-            // decorator
+            // add the dictionary as a warning handler on the logging decorator
             ConnectionDecorator cd;
-            for (Iterator itr = ds.getDecorators().iterator(); itr.hasNext();) {
-                cd = (ConnectionDecorator) itr.next();
+            for (Iterator<ConnectionDecorator> itr = ds.getDecorators().iterator();
itr.hasNext();) {
+                cd = itr.next();
                 if (cd instanceof LoggingConnectionDecorator)
                     ((LoggingConnectionDecorator) cd).setWarningHandler(dict);
             }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DriverDataSource.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DriverDataSource.java?rev=1133601&r1=1133600&r2=1133601&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DriverDataSource.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DriverDataSource.java
Wed Jun  8 23:36:45 2011
@@ -23,6 +23,7 @@ import java.util.Properties;
 import javax.sql.DataSource;
 
 import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.lib.jdbc.ConnectionDecorator;
 
 /**
  * A DataSource that allows additional configuration options to be set
@@ -101,8 +102,7 @@ public interface DriverDataSource
     /**
      * Provide any built-in decorators; may be null.
      */
-    @SuppressWarnings("unchecked")
-    public List createConnectionDecorators();
+    public List<ConnectionDecorator> createConnectionDecorators();
 
     /**
      * Initialize self and dictionary once available.



Mime
View raw message