From 53062e8f34c2d2a910e4e81835c81ebafef1a374 Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Thu, 4 May 2017 11:11:45 +0300 Subject: [PATCH] Process disableIndex and databaseId arguments in SCLScriptRunner application fixes #7183 Change-Id: Ia83059a2c2331f770245635685b1b4e77887c904 --- .../scl/db/SCLScriptRunnerApplication.java | 2 ++ .../simantics/SCLScriptRunnerApplication.java | 1 + .../src/org/simantics/Simantics.java | 17 ++++++++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bundles/org.simantics.scl.db/src/org/simantics/scl/db/SCLScriptRunnerApplication.java b/bundles/org.simantics.scl.db/src/org/simantics/scl/db/SCLScriptRunnerApplication.java index acfce7de9..5e53808a2 100644 --- a/bundles/org.simantics.scl.db/src/org/simantics/scl/db/SCLScriptRunnerApplication.java +++ b/bundles/org.simantics.scl.db/src/org/simantics/scl/db/SCLScriptRunnerApplication.java @@ -60,6 +60,8 @@ public class SCLScriptRunnerApplication implements IApplication { SimanticsArguments.ONTOLOGY_RECOVERY_POLICY_REINSTALL, SimanticsArguments.SERVER, SimanticsArguments.LOCAL_SERVER_PORT, + SimanticsArguments.DISABLE_INDEX, + SimanticsArguments.DATABASE_ID, }; IArguments result = Arguments.parse(args, accepted); return result; diff --git a/bundles/org.simantics/src/org/simantics/SCLScriptRunnerApplication.java b/bundles/org.simantics/src/org/simantics/SCLScriptRunnerApplication.java index 977d1c527..7919710ff 100644 --- a/bundles/org.simantics/src/org/simantics/SCLScriptRunnerApplication.java +++ b/bundles/org.simantics/src/org/simantics/SCLScriptRunnerApplication.java @@ -59,6 +59,7 @@ public class SCLScriptRunnerApplication implements IApplication { SimanticsArguments.ONTOLOGY_RECOVERY_POLICY_REINSTALL, SimanticsArguments.SERVER, SimanticsArguments.LOCAL_SERVER_PORT, + SimanticsArguments.DISABLE_INDEX, SimanticsArguments.DATABASE_ID, }; IArguments result = Arguments.parse(args, accepted); diff --git a/bundles/org.simantics/src/org/simantics/Simantics.java b/bundles/org.simantics/src/org/simantics/Simantics.java index 9529628ea..9a1a354f1 100644 --- a/bundles/org.simantics/src/org/simantics/Simantics.java +++ b/bundles/org.simantics/src/org/simantics/Simantics.java @@ -27,6 +27,7 @@ import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.WriteGraph; +import org.simantics.db.common.Indexing; import org.simantics.db.common.procedure.adapter.ProcedureAdapter; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.RuntimeDatabaseException; @@ -125,6 +126,16 @@ public class Simantics { ontologyPolicy = OntologyRecoveryPolicy.ReinstallDatabase; } + if (args.contains(SimanticsArguments.DISABLE_INDEX)) { + Indexing.setDefaultDependenciesIndexingEnabled(false); + } + + String databaseDriverId = defaultDatabaseDriverId; + if (args.contains(SimanticsArguments.DATABASE_ID)) { + databaseDriverId = args.get(SimanticsArguments.DATABASE_ID); + Simantics.setDefaultDatabaseDriver(databaseDriverId); + } + int localPort = 0; if (args.contains(SimanticsArguments.LOCAL_SERVER_PORT)) { try { @@ -144,7 +155,7 @@ public class Simantics { // } // } - return startUpHeadless(progress, workspacePolicy, ontologyPolicy, localPort /*, remoteDatabase*/); + return startUpHeadless(progress, workspacePolicy, ontologyPolicy, localPort, databaseDriverId /*, remoteDatabase*/); } /** @@ -156,7 +167,7 @@ public class Simantics { * @return * @throws PlatformException */ - public static ISessionContext startUpHeadless(IProgressMonitor progress, RecoveryPolicy workspacePolicy, OntologyRecoveryPolicy ontologyPolicy, int localPort) throws PlatformException { + public static ISessionContext startUpHeadless(IProgressMonitor progress, RecoveryPolicy workspacePolicy, OntologyRecoveryPolicy ontologyPolicy, int localPort, String databaseDriverId) throws PlatformException { if (SimanticsPlatform.INSTANCE.sessionContext != null) { throw new RuntimeDatabaseException("Simantics is already up and running."); } @@ -169,7 +180,7 @@ public class Simantics { if (progress == null) progress = new NullProgressMonitor(); - return SimanticsPlatform.INSTANCE.startUp(defaultDatabaseDriverId, progress, workspacePolicy, ontologyPolicy, true, new ConsoleUserAgent()); + return SimanticsPlatform.INSTANCE.startUp(databaseDriverId, progress, workspacePolicy, ontologyPolicy, true, new ConsoleUserAgent()); } /** -- 2.47.1