You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/02/25 21:46:46 UTC

[31/50] [abbrv] git commit: refs/heads/vim51_win8 - Revert "Revert "Fix fresh db install problem. (still pending one part of finding db""

Revert "Revert "Fix fresh db install problem. (still pending one part of finding db""

This reverts commit ebcf6b1b7cd5175ee826bdfb1443d96fd0a2f9b8.


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

Branch: refs/heads/vim51_win8
Commit: ac1b529f784d865a0c443c3da0367a22902ed5a2
Parents: 1c77ae6
Author: Alex Huang <al...@citrix.com>
Authored: Sat Feb 23 19:16:13 2013 -0800
Committer: Alex Huang <al...@citrix.com>
Committed: Sat Feb 23 19:16:13 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/ac1b529f/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/ac1b529f/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/ac1b529f/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);