]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics/src/org/simantics/SimanticsPlatform.java
Merge commit 'ffdf837'
[simantics/platform.git] / bundles / org.simantics / src / org / simantics / SimanticsPlatform.java
index d59fff9c2fa85de2ef1afb2eab3e18bbd8a16f12..11013eaf7e32ffd1f09fbc4477ed074c2dad21e7 100644 (file)
@@ -103,6 +103,7 @@ import org.simantics.project.management.WorkspaceUtil;
 import org.simantics.utils.FileUtils;
 import org.simantics.utils.datastructures.Pair;
 import org.simantics.utils.logging.TimeLogger;
+import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
@@ -131,7 +132,7 @@ import org.slf4j.LoggerFactory;
  */
 public class SimanticsPlatform implements LifecycleListener {
 
-    private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(SimanticsPlatform.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(SimanticsPlatform.class);
     
     /**
      * The policy is relevant when developing Simantics from Eclipse IDE.
@@ -736,7 +737,17 @@ public class SimanticsPlatform implements LifecycleListener {
         // 1. Assert there is a database at <workspace>/db
         session = setupDatabase(databaseDriverId, progressMonitor, workspacePolicy, userAgent);
         TimeLogger.log("Database setup complete");
-
+        
+        // 1.1 
+        XSupport support = session.getService(XSupport.class);
+        if (support.rolledback()) {
+            try {
+                DatabaseIndexing.deleteAllIndexes();
+            } catch (IOException e) {
+                throw new PlatformException(e);
+            }
+        }
+        
         // 2. Assert all graphs, and correct versions, are installed to the database
         synchronizeOntologies(progressMonitor, ontologyPolicy, requireSynchronize);
         TimeLogger.log("Synchronized ontologies");
@@ -768,7 +779,7 @@ public class SimanticsPlatform implements LifecycleListener {
             });
             TimeLogger.log("Flushed queries");
         } catch (DatabaseException e) {
-            Logger.defaultLogError(e);
+            LOGGER.error("Flushing queries failed.", e);
         }
         boolean loadProject = true;
         try {
@@ -809,7 +820,7 @@ public class SimanticsPlatform implements LifecycleListener {
             }
 
         } catch (DatabaseException e) {
-            Logger.defaultLogError(e);
+            LOGGER.error("Platform startup failed.", e);
             throw new PlatformException(e);
         } catch (ProjectException e) {
             boolean hasStackTrace = e.getStackTrace().length > 0;
@@ -931,7 +942,7 @@ public class SimanticsPlatform implements LifecycleListener {
                     try {
                         Simantics.flushIndexCaches(progress.newChild(20), s);
                     } catch (Throwable t) {
-                        Logger.defaultLogError(t);
+                        LOGGER.error("Failed to flush index caches.", t);
                     }
                 }
 
@@ -972,7 +983,7 @@ public class SimanticsPlatform implements LifecycleListener {
             if (null != databasebManagement)
                 databasebManagement.shutdown();
         } catch (Throwable t) {
-            Logger.defaultLogError(t);
+            LOGGER.error("Database shutdown failed.", t);
         }
         progress.worked(10);
 
@@ -980,7 +991,7 @@ public class SimanticsPlatform implements LifecycleListener {
         try {
             Simantics.clearTemporaryDirectory();
         } catch (Throwable t) {
-            Logger.defaultLogError(t);
+            LOGGER.error("Failed to clear the temporary directory.", t);
         }
         progress.worked(10);
         if (null != platformException)