From bf09c2c1f5f32e5c2b2817a9d9d2c5ff2c21cee1 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Wed, 10 Jun 2020 21:16:51 +0300 Subject: [PATCH] Start of AdapterRegistry2 internal query caching. Doesn't do anything yet, more for safekeeping. gitlab #555 Change-Id: I9d72ee72ac6ecf32353f367b235461e79fa70d14 (cherry picked from commit 67c59e5e66ba411e770545a6137b13fe3de60aab) --- .../org/simantics/db/services/adaption/AdapterRegistry2.java | 4 ++-- .../db/services/adaption/reflection/GraphObject2.java | 2 ++ .../db/services/adaption/reflection/ThisResource2.java | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/AdapterRegistry2.java b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/AdapterRegistry2.java index 0db80b1b4..e9b59023f 100644 --- a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/AdapterRegistry2.java +++ b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/AdapterRegistry2.java @@ -237,9 +237,9 @@ public class AdapterRegistry2 { NamedNodeMap attr = n.getAttributes(); IDynamicAdapter2 da = null; if(n.getNodeName().equals("this")) - da = new ThisResource2(); + da = ThisResource2.INSTANCE; else if(n.getNodeName().equals("graph")) - da = new GraphObject2(); + da = GraphObject2.INSTANCE; else if(n.getNodeName().equals("bundle")) { String bundleId = null; Node fc = n.getFirstChild(); diff --git a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/GraphObject2.java b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/GraphObject2.java index e8f171b8c..8a2db578f 100644 --- a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/GraphObject2.java +++ b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/GraphObject2.java @@ -15,6 +15,8 @@ import org.simantics.db.ReadGraph; public class GraphObject2 implements IDynamicAdapter2 { + public static final IDynamicAdapter2 INSTANCE = new GraphObject2(); + @Override public Class getType() { return ReadGraph.class; diff --git a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/ThisResource2.java b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/ThisResource2.java index 24001ee0a..bacf3adee 100644 --- a/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/ThisResource2.java +++ b/bundles/org.simantics.db.services/src/org/simantics/db/services/adaption/reflection/ThisResource2.java @@ -16,6 +16,8 @@ import org.simantics.db.ReadGraph; public class ThisResource2 implements IDynamicAdapter2 { + public static IDynamicAdapter2 INSTANCE = new ThisResource2(); + @Override public Class getType() { return Resource.class; -- 2.47.1