From 1fdc8ebae4c0d112bcb2533103d9c15c3f3966cc Mon Sep 17 00:00:00 2001 From: lehtonen Date: Fri, 22 Apr 2016 12:27:28 +0000 Subject: [PATCH] Fixed org.simantics.r trunk to compile after the changes done in #6287. refs #6287 git-svn-id: https://www.simantics.org/svn/simantics/r/trunk@32696 ac1ea38d-2e2b-0410-8846-a27921b304fc --- org.simantics.r.ontology/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 6 +++--- org.simantics.r.ontology/META-INF/MANIFEST.MF | 2 +- org.simantics.r.scl/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 6 +++--- org.simantics.r.scl/META-INF/MANIFEST.MF | 5 +++-- org.simantics.r.scl/scl/R/R.scl | 2 +- .../src/org/simantics/r/scl/RSession.java | 3 +-- .../org/simantics/r/scl/RSessionManager.java | 16 ++++++++++++++++ org.simantics.r/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 6 +++--- org.simantics.r/META-INF/MANIFEST.MF | 2 +- .../src/org/simantics/r/RVariableBuilder.java | 18 +++++++++++++----- 13 files changed, 48 insertions(+), 24 deletions(-) diff --git a/org.simantics.r.ontology/.classpath b/org.simantics.r.ontology/.classpath index b1dabee..b862a29 100644 --- a/org.simantics.r.ontology/.classpath +++ b/org.simantics.r.ontology/.classpath @@ -1,6 +1,6 @@ - + diff --git a/org.simantics.r.ontology/.settings/org.eclipse.jdt.core.prefs b/org.simantics.r.ontology/.settings/org.eclipse.jdt.core.prefs index 11f6e46..295926d 100644 --- a/org.simantics.r.ontology/.settings/org.eclipse.jdt.core.prefs +++ b/org.simantics.r.ontology/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,7 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/org.simantics.r.ontology/META-INF/MANIFEST.MF b/org.simantics.r.ontology/META-INF/MANIFEST.MF index 2b5576d..9db08a6 100644 --- a/org.simantics.r.ontology/META-INF/MANIFEST.MF +++ b/org.simantics.r.ontology/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: http://www.simantics.org/R Bundle-SymbolicName: org.simantics.r.ontology Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.simantics.layer0;bundle-version="1.1.0", org.simantics.simulation.ontology;bundle-version="1.1.0", org.simantics.selectionview.ontology;bundle-version="1.2.0", diff --git a/org.simantics.r.scl/.classpath b/org.simantics.r.scl/.classpath index b1dabee..b862a29 100644 --- a/org.simantics.r.scl/.classpath +++ b/org.simantics.r.scl/.classpath @@ -1,6 +1,6 @@ - + diff --git a/org.simantics.r.scl/.settings/org.eclipse.jdt.core.prefs b/org.simantics.r.scl/.settings/org.eclipse.jdt.core.prefs index 467b8c4..62b7e4d 100644 --- a/org.simantics.r.scl/.settings/org.eclipse.jdt.core.prefs +++ b/org.simantics.r.scl/.settings/org.eclipse.jdt.core.prefs @@ -6,8 +6,8 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore @@ -92,4 +92,4 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/org.simantics.r.scl/META-INF/MANIFEST.MF b/org.simantics.r.scl/META-INF/MANIFEST.MF index e483735..5676aa6 100644 --- a/org.simantics.r.scl/META-INF/MANIFEST.MF +++ b/org.simantics.r.scl/META-INF/MANIFEST.MF @@ -3,12 +3,13 @@ Bundle-ManifestVersion: 2 Bundle-Name: RServe connectivity Bundle-SymbolicName: org.simantics.r.scl;singleton:=true Bundle-Version: 0.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.simantics.scl.runtime;bundle-version="0.4.0", gnu.trove3;bundle-version="3.0.3", org.simantics.simulator.variable;bundle-version="1.0.0", org.simantics.structural.ontology, - org.simantics.utils.datastructures;bundle-version="1.1.0" + org.simantics.utils.datastructures;bundle-version="1.1.0", + org.simantics.db.layer0 Export-Package: org.rosuda.REngine, org.rosuda.REngine.Rserve, org.rosuda.REngine.Rserve.protocol, diff --git a/org.simantics.r.scl/scl/R/R.scl b/org.simantics.r.scl/scl/R/R.scl index ef82084..28b2bac 100644 --- a/org.simantics.r.scl/scl/R/R.scl +++ b/org.simantics.r.scl/scl/R/R.scl @@ -53,7 +53,7 @@ readFileAsStringR :: String -> String readFileAsStringR name = runProc (readAllString (openFileR name)) test () = do - conf = SessionConfiguration "130.188.198.138" 6311 "simupedia" "simupedia" + conf = SessionConfiguration "localhost" 6311 "simupedia" "simupedia" session = createSession conf print $ syncExec session (evalR "1+1") closeSession session \ No newline at end of file diff --git a/org.simantics.r.scl/src/org/simantics/r/scl/RSession.java b/org.simantics.r.scl/src/org/simantics/r/scl/RSession.java index 62812a2..120ce05 100644 --- a/org.simantics.r.scl/src/org/simantics/r/scl/RSession.java +++ b/org.simantics.r.scl/src/org/simantics/r/scl/RSession.java @@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit; import org.rosuda.REngine.Rserve.RConnection; import org.rosuda.REngine.Rserve.RserveException; import org.simantics.r.scl.variable.RNodeManager; -import org.simantics.r.scl.variable.RVariableNode; import org.simantics.scl.runtime.SCLContext; import org.simantics.scl.runtime.function.Function; import org.simantics.scl.runtime.tuple.Tuple0; @@ -148,7 +147,7 @@ public class RSession implements Realm { connection.close(); } - public NodeManager getNodeManager() { + public NodeManager getNodeManager() { return nodeManager; } } diff --git a/org.simantics.r.scl/src/org/simantics/r/scl/RSessionManager.java b/org.simantics.r.scl/src/org/simantics/r/scl/RSessionManager.java index 8f1a92d..86c6f96 100644 --- a/org.simantics.r.scl/src/org/simantics/r/scl/RSessionManager.java +++ b/org.simantics.r.scl/src/org/simantics/r/scl/RSessionManager.java @@ -16,11 +16,15 @@ import java.util.concurrent.ConcurrentHashMap; import org.rosuda.REngine.Rserve.RConnection; import org.rosuda.REngine.Rserve.RserveException; +import org.simantics.db.layer0.variable.NodeSupport; import org.simantics.scl.runtime.function.Function; public class RSessionManager { static ConcurrentHashMap CONNECTIONS = new ConcurrentHashMap(); + + static ConcurrentHashMap> SUPPORTS = + new ConcurrentHashMap>(); public static RSession getSession(String id) { // CONNECTIONS is ConcurrentHashMap so no synchronization is needed here @@ -65,4 +69,16 @@ public class RSessionManager { return managedConnection; } } + + public static NodeSupport getOrCreateNodeSupport(String id) { + synchronized(SUPPORTS) { + NodeSupport result = SUPPORTS.get(id); + if(result == null) { + RSession session = getSession(id); + result = new NodeSupport(session.getNodeManager()); + SUPPORTS.put(id, result); + } + return result; + } + } } diff --git a/org.simantics.r/.classpath b/org.simantics.r/.classpath index b1dabee..b862a29 100644 --- a/org.simantics.r/.classpath +++ b/org.simantics.r/.classpath @@ -1,6 +1,6 @@ - + diff --git a/org.simantics.r/.settings/org.eclipse.jdt.core.prefs b/org.simantics.r/.settings/org.eclipse.jdt.core.prefs index 11f6e46..295926d 100644 --- a/org.simantics.r/.settings/org.eclipse.jdt.core.prefs +++ b/org.simantics.r/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,7 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/org.simantics.r/META-INF/MANIFEST.MF b/org.simantics.r/META-INF/MANIFEST.MF index 7b9ea88..4a8a87e 100644 --- a/org.simantics.r/META-INF/MANIFEST.MF +++ b/org.simantics.r/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: R Variable for Simantics Bundle-SymbolicName: org.simantics.r;singleton:=true Bundle-Version: 0.1.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.simantics.r.ontology;bundle-version="1.0.0", org.simantics.r.scl;bundle-version="0.0.1", org.simantics.scl.runtime;bundle-version="0.4.0", diff --git a/org.simantics.r/src/org/simantics/r/RVariableBuilder.java b/org.simantics.r/src/org/simantics/r/RVariableBuilder.java index 90261a3..6c0366f 100644 --- a/org.simantics.r/src/org/simantics/r/RVariableBuilder.java +++ b/org.simantics.r/src/org/simantics/r/RVariableBuilder.java @@ -8,6 +8,7 @@ * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation + * Semantum Oy *******************************************************************************/ package org.simantics.r; @@ -16,9 +17,10 @@ import org.simantics.databoard.Bindings; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.variable.NodeManagerVariableBuilder; +import org.simantics.db.layer0.variable.NodeSupport; import org.simantics.db.layer0.variable.StandardGraphChildVariable; import org.simantics.db.layer0.variable.Variable; -import org.simantics.db.layer0.variable.VariableBuilder; import org.simantics.db.layer0.variable.VariableNode; import org.simantics.layer0.Layer0; import org.simantics.r.scl.RSession; @@ -27,7 +29,7 @@ import org.simantics.r.scl.RSessionManager; import org.simantics.r.scl.variable.RVariableNode; import org.simantics.simulator.variable.NodeManager; -public class RVariableBuilder implements VariableBuilder { +public class RVariableBuilder extends NodeManagerVariableBuilder { @Override public Variable buildChild(ReadGraph graph, Variable parent, VariableNode node, Resource child) throws DatabaseException { @@ -49,13 +51,19 @@ public class RVariableBuilder implements VariableBuilder { } } + NodeSupport support = getNodeSupport(graph, name); NodeManager nodeManager = session.getNodeManager(); - return new StandardGraphChildVariable(parent, new VariableNode(nodeManager, /*node=*/nodeManager), child); + return new StandardGraphChildVariable(parent, new VariableNode(support, nodeManager), child); } @Override - public Variable buildProperty(ReadGraph graph, Variable parent, VariableNode node, Resource subject, Resource predicate) throws DatabaseException { - throw new UnsupportedOperationException(); + protected NodeSupport getNodeSupport(ReadGraph graph, String sessionName) throws DatabaseException { + return RSessionManager.getOrCreateNodeSupport(sessionName); + } + + @Override + protected Object getRoot(ReadGraph graph, NodeSupport support, String sessionName) throws DatabaseException { + return support.manager; } } -- 2.47.1