cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r526592 - /cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DataSourceWizard.java
Date Sun, 08 Apr 2007 18:55:59 GMT
Author: aadamchik
Date: Sun Apr  8 11:55:58 2007
New Revision: 526592

URL: http://svn.apache.org/viewvc?view=rev&rev=526592
Log:
CAY-776: 1.2 -> 2.0/3.0 Migration - modeler preferences still store org.objectstyle adapter
names
(brute force fix - whenever preferences data is read, a scan for legacy adapter names is performed
and the object is updated)

Modified:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DataSourceWizard.java

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DataSourceWizard.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DataSourceWizard.java?view=diff&rev=526592&r1=526591&r2=526592
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DataSourceWizard.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DataSourceWizard.java
Sun Apr  8 11:55:58 2007
@@ -23,6 +23,7 @@
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.Arrays;
+import java.util.Iterator;
 import java.util.Map;
 
 import javax.swing.DefaultComboBoxModel;
@@ -186,6 +187,19 @@
     protected void refreshDataSources() {
         this.dataSources = getApplication().getPreferenceDomain().getDetailsMap(
                 DBConnectionInfo.class);
+
+        // 1.2 migration fix - update data source adapter names
+        Iterator it = dataSources.values().iterator();
+
+        final String _12package = "org.objectstyle.cayenne.";
+        while (it.hasNext()) {
+            DBConnectionInfo info = (DBConnectionInfo) it.next();
+            if (info.getDbAdapter() != null && info.getDbAdapter().startsWith(_12package))
{
+                info.setDbAdapter("org.apache.cayenne."
+                        + info.getDbAdapter().substring(_12package.length()));
+                info.getObjectContext().commitChanges();
+            }
+        }
 
         if (altDataSourceKey != null
                 && !dataSources.containsKey(altDataSourceKey)



Mime
View raw message