incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kous...@apache.org
Subject [17/50] [abbrv] git commit: refs/heads/cisco-vnmc-api-integration - Fix fresh db install problem. (still pending one part of finding db script file correctly).
Date Wed, 13 Mar 2013 06:25:05 GMT
Fix fresh db install problem. (still pending one part of finding db
script file correctly).

Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/5b760f90
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/5b760f90
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/5b760f90

Branch: refs/heads/cisco-vnmc-api-integration
Commit: 5b760f903f1a3145f62d05c1d3c142b710248026
Parents: f87759d
Author: Min Chen <min.chen@citrix.com>
Authored: Fri Feb 22 18:01:55 2013 -0800
Committer: Min Chen <min.chen@citrix.com>
Committed: Fri Feb 22 18:01:55 2013 -0800

----------------------------------------------------------------------
 server/src/com/cloud/upgrade/DatabaseCreator.java  |   16 +++++++++++++-
 .../com/cloud/upgrade/DatabaseUpgradeChecker.java  |   10 ++++----
 .../src/com/cloud/upgrade/dao/VersionDaoImpl.java  |    2 +-
 3 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5b760f90/server/src/com/cloud/upgrade/DatabaseCreator.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/upgrade/DatabaseCreator.java b/server/src/com/cloud/upgrade/DatabaseCreator.java
index 4d70634..9841fae 100755
--- a/server/src/com/cloud/upgrade/DatabaseCreator.java
+++ b/server/src/com/cloud/upgrade/DatabaseCreator.java
@@ -29,6 +29,7 @@ import java.util.Properties;
 
 import com.cloud.utils.PropertiesUtil;
 
+import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.component.SystemIntegrityChecker;
 import com.cloud.utils.db.ScriptRunner;
 import com.cloud.utils.db.Transaction;
@@ -192,6 +193,8 @@ public class DatabaseCreator {
             }
         }
 
+        Transaction txn = Transaction.open(Transaction.CLOUD_DB);
+        try {
         // Process db upgrade classes
         for (String upgradeClass: upgradeClasses) {
             System.out.println("========> Processing upgrade: " + upgradeClass);
@@ -202,13 +205,22 @@ public class DatabaseCreator {
                     System.err.println("The class must be of SystemIntegrityChecker: " +
clazz.getName());
                     System.exit(1);
                 }
+                SystemIntegrityChecker checker = (SystemIntegrityChecker)clazz.newInstance();
+                checker.check();
             } catch (ClassNotFoundException e) {
                 System.err.println("Unable to find " + upgradeClass + ": " + e.getMessage());
                 System.exit(1);
+            } catch (InstantiationException e) {
+                System.err.println("Unable to instantiate " + upgradeClass + ": " + e.getMessage());
+                System.exit(1);
+            } catch (IllegalAccessException e) {
+                System.err.println("Unable to access " + upgradeClass + ": " + e.getMessage());
+                System.exit(1);
             }
 
-            //SystemIntegrityChecker checker = (SystemIntegrityChecker)ComponentLocator.inject(clazz);
-            //checker.check();
+         }
+        } finally {
+            txn.close();
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5b760f90/server/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/upgrade/DatabaseUpgradeChecker.java b/server/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
index 00b4b04..5bd749f 100755
--- a/server/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
+++ b/server/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
@@ -31,7 +31,6 @@ import java.util.List;
 import java.util.TreeMap;
 
 import javax.ejb.Local;
-import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
 
@@ -77,9 +76,10 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
 
     protected HashMap<String, DbUpgrade[]> _upgradeMap = new HashMap<String, DbUpgrade[]>();
 
-    @Inject VersionDao _dao;
+    VersionDao _dao;
 
     public DatabaseUpgradeChecker() {
+        _dao = new VersionDaoImpl();
         _upgradeMap.put("2.1.7", new DbUpgrade[] { new Upgrade217to218(), new Upgrade218to22(),
new Upgrade221to222(),
                 new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade224to225(),
new Upgrade225to226(),
                 new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new
Upgrade2210to2211(),
@@ -115,12 +115,12 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker
{
 
         _upgradeMap.put("2.2.4", new DbUpgrade[] { new Upgrade224to225(), new Upgrade225to226(),
new Upgrade227to228(),
                 new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new
Upgrade2211to2212(),
-                new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), 
+                new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(),
                 new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420()
});
 
         _upgradeMap.put("2.2.5", new DbUpgrade[] { new Upgrade225to226(), new Upgrade227to228(),
new Upgrade228to229(),
                 new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
new Upgrade2212to2213(),
-                new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new
Upgrade301to302(), 
+                new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new
Upgrade301to302(),
                 new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420() });
 
         _upgradeMap.put("2.2.6", new DbUpgrade[] { new Upgrade227to228(), new Upgrade228to229(),
new Upgrade229to2210(),
@@ -159,7 +159,7 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker
{
         _upgradeMap.put("3.0.1", new DbUpgrade[] { new Upgrade301to302(), new Upgrade302to40(),
new Upgrade40to41(), new Upgrade410to420() });
 
         _upgradeMap.put("3.0.2", new DbUpgrade[] { new Upgrade302to40(), new Upgrade40to41(),
new Upgrade410to420() });
-        
+
         _upgradeMap.put("4.0.0", new DbUpgrade[] { new Upgrade40to41(), new Upgrade410to420()
});
 
         _upgradeMap.put("4.1.0", new DbUpgrade[] { new Upgrade410to420() });

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5b760f90/server/src/com/cloud/upgrade/dao/VersionDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/upgrade/dao/VersionDaoImpl.java b/server/src/com/cloud/upgrade/dao/VersionDaoImpl.java
index 5e6e7bc..7c5c9cc 100644
--- a/server/src/com/cloud/upgrade/dao/VersionDaoImpl.java
+++ b/server/src/com/cloud/upgrade/dao/VersionDaoImpl.java
@@ -47,7 +47,7 @@ public class VersionDaoImpl extends GenericDaoBase<VersionVO, Long>
implements V
     final GenericSearchBuilder<VersionVO, String> CurrentVersionSearch;
     final SearchBuilder<VersionVO> AllFieldsSearch;
 
-    protected VersionDaoImpl() {
+    public VersionDaoImpl() {
         super();
 
         CurrentVersionSearch = createSearchBuilder(String.class);


Mime
View raw message