]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
DB-client fixes 06/106/5
authorjsimomaa <jani.simomaa@gmail.com>
Tue, 27 Sep 2016 11:00:54 +0000 (14:00 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 27 Sep 2016 12:27:34 +0000 (15:27 +0300)
* XSupport.rollback for checking if database rolled back
* Separate read and write directory setting and updating in
ClusterSetsSupport

refs #6710

Change-Id: I3395c7042ab3faf2291ed215d4e5830d80b6d2fa

bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterSetsSupportImpl.java
bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterSetsSupportImpl2.java
bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/GraphSessionVirtual.java
bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java
bundles/org.simantics.db.server/src/org/simantics/db/server/internal/SessionI.java
bundles/org.simantics.db/src/org/simantics/db/Database.java
bundles/org.simantics.db/src/org/simantics/db/service/ClusterSetsSupport.java

index c2030409580b4a184419bfbce4e83d838539b53b..da2c88f2109f7d33f16528870ce32ccf9bbbfe6e 100644 (file)
@@ -70,8 +70,13 @@ public class ClusterSetsSupportImpl implements ClusterSetsSupport, Disposable {
        clusterSets.clear();\r
     }\r
     @Override\r
-    public void updateReadAndWriteDirectories(Path read, Path write) {\r
+    public void updateWriteDirectory(Path write) {\r
         // Nothing to do here\r
     }\r
     \r
+    @Override\r
+    public void setReadDirectory(Path read) {\r
+        \r
+    }\r
+    \r
 }\r
index def2905e362b35d90208a36d131113cb5e32fce0..ed1689ea48c4994baa534d0596fd2f9132decff2 100644 (file)
@@ -70,17 +70,17 @@ public class ClusterSetsSupportImpl2 implements ClusterSetsSupport, Disposable {
        clusterSets.clear();\r
     }\r
     @Override\r
-    public void updateReadAndWriteDirectories(Path read, Path write) {\r
-        setDirectories(read, write);\r
-    }\r
-    \r
-    private void setDirectories(Path readDirectory, Path writeDirectory) {\r
-        this.readDirectory = readDirectory;\r
-        this.writeDirectory = writeDirectory;\r
+    public void updateWriteDirectory(Path write) {\r
+        this.writeDirectory = write;\r
         if(clusterSets != null) {\r
             clusterSets.setWriteDirectory(writeDirectory.toFile());\r
             clusterSets.touch();\r
         }\r
     }\r
+    \r
+    @Override\r
+    public void setReadDirectory(Path read) {\r
+        this.readDirectory = read;\r
+    }\r
 \r
 }\r
index 6defe634a469e28bc198ab4a1c962a3fead0ccc1..d1e0064249ea0314929c40f9cfd4ceab481477b0 100644 (file)
@@ -127,6 +127,11 @@ class GraphSessionVirtual extends GraphSession { // Äsh! This extends relation
         public boolean refreshEnabled() {\r
             return false;\r
         }\r
+        @Override\r
+        public boolean rolledback() {\r
+            // TODO Auto-generated method stub\r
+            return false;\r
+        }\r
     }\r
     private AtomicLong changeSetId = new AtomicLong(Constants.NullChangeSetId);\r
     private AtomicLong transactionId = new AtomicLong(Constants.NullTransactionId);\r
index 9efb0fc38c8eab1f7414437c40df37b5918267f4..7302d13d45d6b0a9f071945d301ba80eed42f1a2 100644 (file)
@@ -294,7 +294,8 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule
         this.clusterControl = new ClusterControlImpl(this);\r
         serviceLocator.registerService(ClusterControl.class, clusterControl);\r
         this.clusterSetsSupport = new ClusterSetsSupportImpl2(); // Using same path as virtual graphs.\r
-        this.clusterSetsSupport.updateReadAndWriteDirectories(t.toPath(), t.toPath());\r
+        this.clusterSetsSupport.setReadDirectory(t.toPath());\r
+        this.clusterSetsSupport.updateWriteDirectory(t.toPath());\r
         serviceLocator.registerService(ClusterSetsSupport.class, clusterSetsSupport);\r
     }\r
 \r
index bb2cdb04059fc21a94c311c01b8d6051f496fe95..2d08de4a68734399a461b7684f98c93f799ae8ff 100644 (file)
@@ -232,6 +232,11 @@ public class SessionI implements Session {
     public boolean refreshEnabled() {\r
         return true;\r
     }\r
+    @Override\r
+    public boolean rolledback() {\r
+        // TODO Auto-generated method stub\r
+        return false;\r
+    }\r
 }\r
 class SessionManager {\r
     private ConcurrentHashMap<Client, SessionI> sessionMap = new ConcurrentHashMap<Client, SessionI>();\r
index c72e72b75933b58d5c59f3a21ee72c5f950df7d2..35f38410030c8ca7a75e8cf8d7115816fed6366b 100644 (file)
@@ -135,6 +135,7 @@ public interface Database {
         \r
         public <T> T clone(ClusterUID clusterUID, ClusterCreator clusterCreator) throws DatabaseException;\r
         public boolean refreshEnabled();\r
+        boolean rolledback();\r
     }\r
     public Session newSession(ServiceLocator locator) throws SDBException;\r
     interface Journal {\r
index 78d47ea986a0c84a39f36aae518ec97778b2acb8..d935a2b54b30c0b641fc47fbdb9a7bc257480f67 100644 (file)
@@ -12,6 +12,7 @@ public interface ClusterSetsSupport {
     void put(long resourceId, long clusterId);\r
     void save() throws IOException;\r
     void clear();\r
-    void updateReadAndWriteDirectories(Path read, Path write);\r
+    void setReadDirectory(Path read);\r
+    void updateWriteDirectory(Path write);\r
        \r
 }\r