]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Process disableIndex and databaseId arguments in SCLScriptRunner 80/480/2
authorMarko Luukkainen <marko.luukkainen@vtt.fi>
Thu, 4 May 2017 08:11:45 +0000 (11:11 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 4 May 2017 08:43:41 +0000 (11:43 +0300)
application

fixes #7183

Change-Id: Ia83059a2c2331f770245635685b1b4e77887c904

bundles/org.simantics.scl.db/src/org/simantics/scl/db/SCLScriptRunnerApplication.java
bundles/org.simantics/src/org/simantics/SCLScriptRunnerApplication.java
bundles/org.simantics/src/org/simantics/Simantics.java

index acfce7de990adc16a50aa66384b99d608263051e..5e53808a2b30f039b49d19282c0ad0f1531b5dfa 100644 (file)
@@ -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;
index 977d1c527ce081d6f81ef140c3bafbe654a9d2eb..7919710ff1fcdc2595a937e82e3dbf738d295a6d 100644 (file)
@@ -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);
index 9529628eaee3bab8dc38bec39cd1ee15a6db3e7f..9a1a354f17131b35e1fbfd7bfcc0565645b95616 100644 (file)
@@ -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());
     }
 
     /**