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/11/14 16:39:23 UTC

svn commit: r1201753 - in /incubator/jena/Scratch/AFS/Jena-Dev/trunk/src: dev/ reports/archive/ tx/ tx/api/ tx/base/

Author: andy
Date: Mon Nov 14 15:39:22 2011
New Revision: 1201753

URL: http://svn.apache.org/viewvc?rev=1201753&view=rev
Log: (empty)

Added:
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/Builder.java
      - copied unchanged from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/Builder.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/DevTx.java
      - copied unchanged from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/DevTx.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/ExTxTDB.java
      - copied, changed from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/ExTxTDB.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/GraphTDBTransactionHandler.java
      - copied unchanged from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/GraphTDBTransactionHandler.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/IOBytes.java
      - copied unchanged from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/IOBytes.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/TestTransSystemJena91.java
      - copied, changed from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/TestTransSystemJena91.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/TransBlob.java
      - copied unchanged from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/TransBlob.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/TxMain.java
      - copied, changed from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/TxMain.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/
      - copied from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/api/
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetTransactional.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/base/
      - copied from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/base/
Modified:
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143_TDBConcurrency.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/ReportJena131_TxnConcurrency.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/ReportJena154_GraphVarScope.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphTX.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphTrackActive.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphWithLock.java
    incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/Transactional.java

Modified: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143_TDBConcurrency.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143_TDBConcurrency.java?rev=1201753&r1=1201752&r2=1201753&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143_TDBConcurrency.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/ReportJena143_TDBConcurrency.java Mon Nov 14 15:39:22 2011
@@ -30,11 +30,11 @@ import com.hp.hpl.jena.query.QueryCancel
 import com.hp.hpl.jena.query.QueryExecution ;
 import com.hp.hpl.jena.query.QueryExecutionFactory ;
 import com.hp.hpl.jena.query.QuerySolution ;
+import com.hp.hpl.jena.query.ReadWrite ;
 import com.hp.hpl.jena.query.ResultSet ;
 import com.hp.hpl.jena.sparql.api.wait ;
 import com.hp.hpl.jena.sparql.function.FunctionRegistry ;
 import com.hp.hpl.jena.tdb.DatasetGraphTxn ;
-import com.hp.hpl.jena.tdb.ReadWrite ;
 import com.hp.hpl.jena.tdb.StoreConnection ;
 import com.hp.hpl.jena.tdb.TDBFactory ;
 import com.hp.hpl.jena.tdb.TDBLoader ;

Modified: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java?rev=1201753&r1=1201752&r2=1201753&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/Run.java Mon Nov 14 15:39:22 2011
@@ -25,7 +25,7 @@ import org.junit.Test ;
 import org.openjena.atlas.lib.FileOps ;
 import org.openjena.atlas.lib.Lib ;
 import org.openjena.atlas.logging.Log ;
-
+import tx.api.DatasetGraphTX ;
 import arq.update ;
 
 import com.hp.hpl.jena.query.Dataset ;
@@ -36,23 +36,43 @@ import com.hp.hpl.jena.query.QueryExecut
 import com.hp.hpl.jena.query.QueryExecutionFactory ;
 import com.hp.hpl.jena.query.QueryFactory ;
 import com.hp.hpl.jena.query.QuerySolution ;
+import com.hp.hpl.jena.query.ReadWrite ;
 import com.hp.hpl.jena.query.ResultSet ;
 import com.hp.hpl.jena.sparql.api.wait ;
 import com.hp.hpl.jena.sparql.function.FunctionRegistry ;
 import com.hp.hpl.jena.sparql.lang.SyntaxVarScope ;
+import com.hp.hpl.jena.sparql.sse.SSE ;
 import com.hp.hpl.jena.tdb.DatasetGraphTxn ;
-import com.hp.hpl.jena.tdb.ReadWrite ;
 import com.hp.hpl.jena.tdb.StoreConnection ;
 import com.hp.hpl.jena.tdb.TDBFactory ;
 import com.hp.hpl.jena.tdb.TDBLoader ;
+import com.hp.hpl.jena.tdb.base.file.Location ;
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 
-public class Run
+public class Run extends RunBase
 {
     static { Log.setLog4j() ; }
     
     public static void main(String[] argv) throws Exception
     {
+        DatasetGraphTX dsg = new DatasetGraphTX(Location.mem()) ;
+        dsg.begin(ReadWrite.WRITE) ;
+        dsg.add(SSE.parseQuad("(<g> <s> <p> <o>)")) ;
+        dsg.commit() ;
+        
+        dsg.begin(ReadWrite.WRITE) ;
+        dsg.begin(ReadWrite.WRITE) ;
+        
+        dsg.begin(ReadWrite.READ) ;
+        SSE.write(dsg) ;
+        dsg.close() ;
+        System.out.println(dsg.isInTransaction()) ;
+        
+        exit(0) ;
+        
+        
+        
+        
         //UpdateEngineWorker L167
         update.main("--file=U.ru") ;
     }

Modified: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/ReportJena131_TxnConcurrency.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/ReportJena131_TxnConcurrency.java?rev=1201753&r1=1201752&r2=1201753&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/ReportJena131_TxnConcurrency.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/ReportJena131_TxnConcurrency.java Mon Nov 14 15:39:22 2011
@@ -18,9 +18,9 @@
 
 package reports.archive;
 
+import com.hp.hpl.jena.query.ReadWrite ;
 import com.hp.hpl.jena.sparql.sse.SSE ;
 import com.hp.hpl.jena.tdb.DatasetGraphTxn ;
-import com.hp.hpl.jena.tdb.ReadWrite ;
 import com.hp.hpl.jena.tdb.StoreConnection ;
 
 public class ReportJena131_TxnConcurrency

Modified: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/ReportJena154_GraphVarScope.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/ReportJena154_GraphVarScope.java?rev=1201753&r1=1201752&r2=1201753&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/ReportJena154_GraphVarScope.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/reports/archive/ReportJena154_GraphVarScope.java Mon Nov 14 15:39:22 2011
@@ -34,7 +34,6 @@ import com.hp.hpl.jena.sparql.engine.Que
 import com.hp.hpl.jena.sparql.mgt.Explain ;
 import com.hp.hpl.jena.sparql.sse.SSE ;
 import com.hp.hpl.jena.tdb.DatasetGraphTxn ;
-import com.hp.hpl.jena.tdb.ReadWrite ;
 import com.hp.hpl.jena.tdb.StoreConnection ;
 import com.hp.hpl.jena.tdb.TDBFactory ;
 import com.hp.hpl.jena.tdb.base.file.Location ;

Copied: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/ExTxTDB.java (from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/ExTxTDB.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/ExTxTDB.java?p2=incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/ExTxTDB.java&p1=incubator/jena/Jena2/TDB/trunk/src-dev/tx/ExTxTDB.java&r1=1199692&r2=1201753&rev=1201753&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src-dev/tx/ExTxTDB.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/ExTxTDB.java Mon Nov 14 15:39:22 2011
@@ -23,10 +23,10 @@ import com.hp.hpl.jena.query.Dataset ;
 import com.hp.hpl.jena.query.DatasetFactory ;
 import com.hp.hpl.jena.query.QueryExecution ;
 import com.hp.hpl.jena.query.QueryExecutionFactory ;
+import com.hp.hpl.jena.query.ReadWrite ;
 import com.hp.hpl.jena.query.ResultSet ;
 import com.hp.hpl.jena.query.ResultSetFormatter ;
 import com.hp.hpl.jena.tdb.DatasetGraphTxn ;
-import com.hp.hpl.jena.tdb.ReadWrite ;
 import com.hp.hpl.jena.tdb.StoreConnection ;
 import com.hp.hpl.jena.update.UpdateExecutionFactory ;
 import com.hp.hpl.jena.update.UpdateFactory ;

Copied: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/TestTransSystemJena91.java (from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/TestTransSystemJena91.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/TestTransSystemJena91.java?p2=incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/TestTransSystemJena91.java&p1=incubator/jena/Jena2/TDB/trunk/src-dev/tx/TestTransSystemJena91.java&r1=1199692&r2=1201753&rev=1201753&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src-dev/tx/TestTransSystemJena91.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/TestTransSystemJena91.java Mon Nov 14 15:39:22 2011
@@ -42,6 +42,7 @@ import org.slf4j.LoggerFactory ;
 import com.hp.hpl.jena.datatypes.xsd.XSDDatatype ;
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.query.Dataset ;
+import com.hp.hpl.jena.query.ReadWrite ;
 import com.hp.hpl.jena.rdf.model.Model ;
 import com.hp.hpl.jena.rdf.model.Property ;
 import com.hp.hpl.jena.rdf.model.RDFNode ;
@@ -52,7 +53,6 @@ import com.hp.hpl.jena.sparql.core.Quad 
 import com.hp.hpl.jena.sparql.sse.SSE ;
 import com.hp.hpl.jena.tdb.ConfigTest ;
 import com.hp.hpl.jena.tdb.DatasetGraphTxn ;
-import com.hp.hpl.jena.tdb.ReadWrite ;
 import com.hp.hpl.jena.tdb.StoreConnection ;
 import com.hp.hpl.jena.tdb.base.block.FileMode ;
 import com.hp.hpl.jena.tdb.base.file.Location ;

Copied: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/TxMain.java (from r1199692, incubator/jena/Jena2/TDB/trunk/src-dev/tx/TxMain.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/TxMain.java?p2=incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/TxMain.java&p1=incubator/jena/Jena2/TDB/trunk/src-dev/tx/TxMain.java&r1=1199692&r2=1201753&rev=1201753&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src-dev/tx/TxMain.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/TxMain.java Mon Nov 14 15:39:22 2011
@@ -37,13 +37,13 @@ import com.hp.hpl.jena.query.Query ;
 import com.hp.hpl.jena.query.QueryExecution ;
 import com.hp.hpl.jena.query.QueryExecutionFactory ;
 import com.hp.hpl.jena.query.QueryFactory ;
+import com.hp.hpl.jena.query.ReadWrite ;
 import com.hp.hpl.jena.query.Syntax ;
 import com.hp.hpl.jena.rdf.model.Model ;
 import com.hp.hpl.jena.rdf.model.ModelFactory ;
 import com.hp.hpl.jena.sparql.core.DatasetGraph ;
 import com.hp.hpl.jena.sparql.util.QueryExecUtils ;
 import com.hp.hpl.jena.tdb.DatasetGraphTxn ;
-import com.hp.hpl.jena.tdb.ReadWrite ;
 import com.hp.hpl.jena.tdb.StoreConnection ;
 import com.hp.hpl.jena.tdb.base.file.BufferChannel ;
 import com.hp.hpl.jena.tdb.base.file.BufferChannelFile ;

Modified: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphTX.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphTX.java?rev=1201753&r1=1199692&r2=1201753&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphTX.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphTX.java Mon Nov 14 15:39:22 2011
@@ -18,18 +18,31 @@
 
 package tx.api;
 
+import com.hp.hpl.jena.query.ReadWrite ;
 import com.hp.hpl.jena.shared.JenaException ;
 import com.hp.hpl.jena.sparql.core.DatasetGraph ;
 import com.hp.hpl.jena.tdb.DatasetGraphTxn ;
-import com.hp.hpl.jena.tdb.ReadWrite ;
 import com.hp.hpl.jena.tdb.StoreConnection ;
 import com.hp.hpl.jena.tdb.base.file.Location ;
+import com.hp.hpl.jena.tdb.transaction.TDBTransactionException ;
+
+/** Transactional DatasetGraph that allows one active transaction.
+ * For multiple read transactions, create multiple DatasetGraphTX objects.
+ */
 
 public class DatasetGraphTX extends DatasetGraphTrackActive 
 {
-    // DatasetGraphWrapper with mutable DatasetGraph
-    private DatasetGraphTxn dsg = null ;
-    private ReadWrite ReadWrite = null ;
+    // This is analogous to a "connection" in JDBC.
+    
+    /* Initially, the app can use this DatasetGraph non-transactionally.
+     * But as soon as it starts a trasnaction, the dataset can only be used
+     * inside transactions. 
+     */
+
+    // TODO Concurrency
+    
+    private DatasetGraphTxn dsgTxn = null ;
+    private boolean haveUsedInTransaction = false ;
     private final Location location ;
     private final StoreConnection sConn ;
     
@@ -50,47 +63,55 @@ public class DatasetGraphTX extends Data
     @Override
     protected DatasetGraph get()
     {
-        return dsg ;
+        if ( isInTransaction() )
+        {
+            if ( dsgTxn == null )
+                throw new TDBTransactionException("In a transaction but no translational DatasetGraph") ;
+            return dsgTxn ;
+        }
+        
+        if ( haveUsedInTransaction )
+            throw new TDBTransactionException("Not in a transaction") ;
+
+        // Never used in a transaction - return underlying dadabase for old style (non-transactional) usage.  
+        return sConn.getBaseDataset() ;
     }
 
     @Override
     protected void checkActive()
     {
-        if ( ! inTransaction )
+        if ( ! isInTransaction() )
             throw new JenaTransactionException("Not in a transaction ("+location+")") ;
     }
 
     @Override
     protected void checkNotActive()
     {
-        if ( inTransaction )
+        if ( isInTransaction() )
             throw new JenaTransactionException("Currently in a transaction ("+location+")") ;
     }
 
     @Override
-    protected void _begin(com.hp.hpl.jena.tdb.ReadWrite readWrite)
+    protected void _begin(ReadWrite readWrite)
     {
-        dsg = sConn.begin(ReadWrite) ;
-        inTransaction = true ;
+        dsgTxn = sConn.begin(readWrite) ;
     }
 
     @Override
     protected void _commit()
     {
-        dsg.commit() ;
-        inTransaction = false ;
+        dsgTxn.commit() ;
     }
 
     @Override
     protected void _abort()
     {
-        dsg.abort() ;
-        inTransaction = false ;
+        dsgTxn.abort() ;
     }
 
     @Override
     protected void _close()
     {
-        dsg.close() ;
+        dsgTxn.close() ;
     }
 }

Modified: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphTrackActive.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphTrackActive.java?rev=1201753&r1=1199692&r2=1201753&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphTrackActive.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphTrackActive.java Mon Nov 14 15:39:22 2011
@@ -20,19 +20,21 @@ package tx.api;
 
 import java.util.Iterator ;
 
-
 import com.hp.hpl.jena.graph.Graph ;
 import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.query.ReadWrite ;
 import com.hp.hpl.jena.shared.Lock ;
 import com.hp.hpl.jena.sparql.core.DatasetGraph ;
 import com.hp.hpl.jena.sparql.core.Quad ;
 import com.hp.hpl.jena.sparql.util.Context ;
-import com.hp.hpl.jena.tdb.ReadWrite ;
 
 public abstract class DatasetGraphTrackActive implements DatasetGraph, Transactional
 {
+    // Layer - make this extend DatasetGraphWrapper - i.e. a switching wrapper.
+    // Canuse switcher for switching betwen locations?
+    
     protected abstract DatasetGraph get() ;
-    protected boolean inTransaction = false ; 
+    private boolean inTransaction = false ; 
 
     protected DatasetGraphTrackActive()
     {
@@ -69,10 +71,16 @@ public abstract class DatasetGraphTrackA
     @Override
     public void close()
     {
+        _close() ;
+        inTransaction = false ;
+        // Can call close repeatedly 
         if (get() != null)
             get().close() ;
     }
 
+    @Override
+    public boolean isInTransaction()    { return inTransaction ; }
+    
     protected abstract void _begin(ReadWrite readWrite) ;
     protected abstract void  _commit() ;
     protected abstract void  _abort() ;

Modified: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphWithLock.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphWithLock.java?rev=1201753&r1=1199692&r2=1201753&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphWithLock.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetGraphWithLock.java Mon Nov 14 15:39:22 2011
@@ -18,9 +18,9 @@
 
 package tx.api;
 
+import com.hp.hpl.jena.query.ReadWrite ;
 import com.hp.hpl.jena.shared.JenaException ;
 import com.hp.hpl.jena.sparql.core.DatasetGraph ;
-import com.hp.hpl.jena.tdb.ReadWrite ;
 
 public class DatasetGraphWithLock extends DatasetGraphTrackActive 
 {
@@ -48,14 +48,14 @@ public class DatasetGraphWithLock extend
     @Override
     protected void checkActive()
     {
-        if ( ! inTransaction )
+        if ( ! isInTransaction() )
             throw new JenaLockException("Not in a locked region") ;
     }
 
     @Override
     protected void checkNotActive()
     {
-        if ( inTransaction )
+        if ( isInTransaction() )
             throw new JenaLockException("Currently in a locked region") ;
     }
 

Added: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetTransactional.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetTransactional.java?rev=1201753&view=auto
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetTransactional.java (added)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/DatasetTransactional.java Mon Nov 14 15:39:22 2011
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tx.api;
+
+import com.hp.hpl.jena.query.ReadWrite ;
+import com.hp.hpl.jena.sparql.core.DatasetImpl ;
+
+public class DatasetTransactional extends DatasetImpl
+{
+    private DatasetGraphTX dsgTxn ;
+    public DatasetTransactional(DatasetGraphTX dsg)
+    {
+        super(dsg) ;
+        this.dsgTxn = dsg ;
+    }
+    
+    @Override public boolean supportsTransactions() { return true ; }
+    @Override public void begin(ReadWrite mode)     { dsgTxn.begin(mode) ; }
+    @Override public void commit()                  {  }
+    @Override public void abort()                   {  }
+}
+

Modified: incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/Transactional.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/Transactional.java?rev=1201753&r1=1199692&r2=1201753&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/Transactional.java (original)
+++ incubator/jena/Scratch/AFS/Jena-Dev/trunk/src/tx/api/Transactional.java Mon Nov 14 15:39:22 2011
@@ -20,7 +20,7 @@ package tx.api;
 
 import org.openjena.atlas.lib.Closeable ;
 
-import com.hp.hpl.jena.tdb.ReadWrite ;
+import com.hp.hpl.jena.query.ReadWrite ;
 
 /** Interface that encapulsated begin/abort|commit/close.
  * <p>The read lifcycle is:
@@ -34,6 +34,7 @@ public interface Transactional extends C
     public void begin(ReadWrite readWrite) ;
     public void commit() ;
     public void abort() ;
+    public boolean isInTransaction() ;
     @Override
     public void close() ;
 }