You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2011/08/16 22:04:35 UTC

svn commit: r1158434 - /incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DatasetGraphX.java

Author: andy
Date: Tue Aug 16 20:04:35 2011
New Revision: 1158434

URL: http://svn.apache.org/viewvc?rev=1158434&view=rev
Log:
Sketching final API.

Modified:
    incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DatasetGraphX.java

Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DatasetGraphX.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DatasetGraphX.java?rev=1158434&r1=1158433&r2=1158434&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DatasetGraphX.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DatasetGraphX.java Tue Aug 16 20:04:35 2011
@@ -22,6 +22,7 @@ import java.util.Iterator ;
 
 import com.hp.hpl.jena.graph.Graph ;
 import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.shared.JenaException ;
 import com.hp.hpl.jena.shared.Lock ;
 import com.hp.hpl.jena.sparql.core.Quad ;
 import com.hp.hpl.jena.sparql.util.Context ;
@@ -38,6 +39,13 @@ public class DatasetGraphX implements Tr
     private final Location location ;
     private final StoreConnection sConn ;
     
+    static class JenaTransactionException extends JenaException
+    {
+        public JenaTransactionException()                                  { super(); }
+        public JenaTransactionException(String message)                    { super(message); }
+        public JenaTransactionException(Throwable cause)                   { super(cause) ; }
+        public JenaTransactionException(String message, Throwable cause)   { super(message, cause) ; }
+    }
     
     @Override
     public void begin(ReadWrite readWrite)
@@ -61,10 +69,16 @@ public class DatasetGraphX implements Tr
     }
     
     private void checkInTransaction()
-    {}
+    {
+        if ( dsg == null )
+            throw new JenaTransactionException("Not in a transaction ("+location+")") ;
+    }
     
     private void checkNotInTransaction()
-    {}
+    {
+        if ( dsg != null )
+            throw new JenaTransactionException("Currently in a transaction ("+location+")") ;
+    }
     
     // For each operation, checkInTransaction()
 
@@ -76,7 +90,10 @@ public class DatasetGraphX implements Tr
 
     //@Override
     public boolean containsGraph(Node graphNode)
-    { return dsg.containsGraph(graphNode) ; }
+    { 
+        checkInTransaction() ;
+        return dsg.containsGraph(graphNode) ;
+    }
 
     //@Override
     public Graph getDefaultGraph()