From: Marko Luukkainen Date: Thu, 4 May 2017 08:11:45 +0000 (+0300) Subject: Process disableIndex and databaseId arguments in SCLScriptRunner X-Git-Tag: v1.29.0~76 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F480%2F2;p=simantics%2Fplatform.git Process disableIndex and databaseId arguments in SCLScriptRunner application fixes #7183 Change-Id: Ia83059a2c2331f770245635685b1b4e77887c904 --- 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()); } /**