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;
/**
*/
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.
// 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");
});
TimeLogger.log("Flushed queries");
} catch (DatabaseException e) {
- Logger.defaultLogError(e);
+ LOGGER.error("Flushing queries failed.", e);
}
boolean loadProject = true;
try {
}
} 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;
try {
Simantics.flushIndexCaches(progress.newChild(20), s);
} catch (Throwable t) {
- Logger.defaultLogError(t);
+ LOGGER.error("Failed to flush index caches.", t);
}
}
if (null != databasebManagement)
databasebManagement.shutdown();
} catch (Throwable t) {
- Logger.defaultLogError(t);
+ LOGGER.error("Database shutdown failed.", t);
}
progress.worked(10);
try {
Simantics.clearTemporaryDirectory();
} catch (Throwable t) {
- Logger.defaultLogError(t);
+ LOGGER.error("Failed to clear the temporary directory.", t);
}
progress.worked(10);
if (null != platformException)