X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics%2Fsrc%2Forg%2Fsimantics%2FSimantics.java;h=daa9e7e10afd49e250767e29822d8f749eb166cd;hp=1e01acf71f1c7cc097a418ac18deaa82c214add5;hb=e67e00d01d30f362e7a4f599cbcf24770ce13e22;hpb=969bd23cab98a79ca9101af33334000879fb60c5 diff --git a/bundles/org.simantics/src/org/simantics/Simantics.java b/bundles/org.simantics/src/org/simantics/Simantics.java index 1e01acf71..daa9e7e10 100644 --- a/bundles/org.simantics/src/org/simantics/Simantics.java +++ b/bundles/org.simantics/src/org/simantics/Simantics.java @@ -56,6 +56,8 @@ import org.simantics.utils.FileService; import org.simantics.utils.FileUtils; import org.simantics.utils.TempFiles; import org.simantics.utils.threads.ThreadUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A facade for accessing basic Simantics platform services. Usable without a @@ -67,10 +69,35 @@ import org.simantics.utils.threads.ThreadUtils; * TODO: duplicate of org.simantics.db.layer0.util.Simantics, do something about this!! */ public class Simantics { + private static final Logger LOGGER = LoggerFactory.getLogger(Simantics.class); + + /** + * Default database driver ID + */ + private static final String DEFAULT_DATABASE_DRIVER_ID = "procore"; + + private static String defaultDatabaseDriverId = DEFAULT_DATABASE_DRIVER_ID; private static ISessionContextProviderSource providerSource = null; private static volatile FileServiceImpl fileService = null; + /** + * Sets the database driver to be used by the platform. To have any effect, + * this must be set before platform startup. + * + * @param id driver id + */ + public static void setDefaultDatabaseDriver(String id) { + defaultDatabaseDriverId = id; + } + + /** + * Returns currently set default database driver id. + */ + public static String getDefaultDatabaseDriver() { + return defaultDatabaseDriverId; + } + /** * @param args * @param progress @@ -142,7 +169,7 @@ public class Simantics { if (progress == null) progress = new NullProgressMonitor(); - return SimanticsPlatform.INSTANCE.startUp(null, progress, workspacePolicy, ontologyPolicy, true, new ConsoleUserAgent()); + return SimanticsPlatform.INSTANCE.startUp(defaultDatabaseDriverId, progress, workspacePolicy, ontologyPolicy, true, new ConsoleUserAgent()); } /** @@ -416,7 +443,7 @@ public class Simantics { try { IndexUtils.flushIndexCaches(progress, session); } catch (Exception e) { - Logger.defaultLogError(e); + LOGGER.error("Flushing index caches failed.", e); } }