jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [06/34] jena git commit: JENA-1089 : TDB changes.
Date Sat, 06 Feb 2016 15:50:55 GMT
JENA-1089 : TDB changes.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/d3c3fe68
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/d3c3fe68
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/d3c3fe68

Branch: refs/heads/master
Commit: d3c3fe6867fdda478f9219621d95582eb421d277
Parents: aefb350
Author: Andy Seaborne <andy@apache.org>
Authored: Wed Feb 3 16:16:05 2016 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Wed Feb 3 16:16:05 2016 +0000

----------------------------------------------------------------------
 .../apache/jena/tdb/store/DatasetGraphTDB.java  | 10 +--
 .../jena/tdb/transaction/DatasetGraphTxn.java   | 71 +++++++++++---------
 .../tdb/transaction/TestTransactionTDB.java     | 31 ++++-----
 3 files changed, 58 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/d3c3fe68/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetGraphTDB.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetGraphTDB.java b/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetGraphTDB.java
index 41d8781..6f9a243 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetGraphTDB.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/store/DatasetGraphTDB.java
@@ -30,6 +30,7 @@ import org.apache.jena.graph.Node ;
 import org.apache.jena.graph.Triple ;
 import org.apache.jena.sparql.core.DatasetGraphTriplesQuads ;
 import org.apache.jena.sparql.core.Quad ;
+import org.apache.jena.sparql.core.TransactionalNotSupported ;
 import org.apache.jena.sparql.engine.optimizer.reorder.ReorderTransformation ;
 import org.apache.jena.tdb.base.file.Location ;
 import org.apache.jena.tdb.lib.NodeLib ;
@@ -38,9 +39,10 @@ import org.apache.jena.tdb.sys.Session ;
 import org.apache.jena.tdb.transaction.DatasetGraphTransaction ;
 import org.apache.jena.tdb.transaction.DatasetGraphTxn ;
 
-/** This is the class that creates a dataset over the storage via
- *  TripleTable, QuadTable and prefixes. These may be transactional.
- *  
+/** This is the class that creates a dataset over the storage. 
+ *  The name is historical. "{@code TDBStorage}" might be ebtter nowadays. 
+ * <p> This class is not {@code Transactional}. It is used within the TDB transaction
system. 
+ * <p> 
  *  See also:
  *  <ul>
  *  <li>{@link DatasetGraphTxn} &ndash; the sublcass that provides a single tranasaction</li>
@@ -49,7 +51,7 @@ import org.apache.jena.tdb.transaction.DatasetGraphTxn ;
  */
 final
 public class DatasetGraphTDB extends DatasetGraphTriplesQuads
-                             implements /*DatasetGraph,*/ Sync, Closeable, Session
+                             implements /*DatasetGraph,*/ Sync, Closeable, Session, TransactionalNotSupported
 {
     private TripleTable tripleTable ;
     private QuadTable quadTable ;

http://git-wip-us.apache.org/repos/asf/jena/blob/d3c3fe68/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetGraphTxn.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetGraphTxn.java b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetGraphTxn.java
index 89a44b0..6f9cce0 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetGraphTxn.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetGraphTxn.java
@@ -18,50 +18,55 @@
 
 package org.apache.jena.tdb.transaction;
 
-import org.apache.jena.sparql.core.DatasetGraphWrapper ;
-import org.apache.jena.tdb.store.DatasetGraphTDB ;
+import org.apache.jena.sparql.core.DatasetGraphWrapper;
+import org.apache.jena.tdb.store.DatasetGraphTDB;
 
-/** A DatasetGraph that is a single transaction.
- * It does not support transactions, it is a transaction (single use).
+/**
+ * A DatasetGraph that is a single transaction. It does not support
+ * transactions, it is a transaction (single use).
  */
-public class DatasetGraphTxn extends DatasetGraphWrapper
-{
-    private Transaction transaction ;
+public class DatasetGraphTxn extends DatasetGraphWrapper {
+    
+    private Transaction transaction;
 
-    public DatasetGraphTxn(DatasetGraphTDB dsg, Transaction txn)
-    {
-        super(dsg) ;
-        this.transaction = txn ;
+    public DatasetGraphTxn(DatasetGraphTDB dsg, Transaction txn) {
+        super(dsg);
+        this.transaction = txn;
     }
 
-    public Transaction getTransaction() { return transaction ; }
-    
-    /** Return the view (storage) for this transaction */ 
-    public DatasetGraphTDB getView() { return (DatasetGraphTDB)getWrapped() ; }
-    
-    public void commit()
-    {
-        transaction.commit() ;
+    public Transaction getTransaction() {
+        return transaction;
     }
 
-    public void abort()
-    {
-        transaction.abort() ;
+    /** Return the view (storage) for this transaction */
+    public DatasetGraphTDB getView() {
+        return (DatasetGraphTDB)getWrapped();
     }
-    
+
+    @Override
+    public void commit() {
+        transaction.commit();
+    }
+
+    @Override
+    public void abort() {
+        transaction.abort();
+    }
+
     // Context copied in DatasetBuilderTxn.build.
-//    @Override
-//    public Context getContext() { ... }
-    
+    // @Override
+    // public Context getContext() { ... }
+
     @Override
-    public String toString()
-    { return "Txn:"+super.toString() ; }
-    
-    public void end()
-    {
+    public String toString() {
+        return "Txn:" + super.toString();
+    }
+
+    @Override
+    public void end() {
         if ( transaction != null )
-            transaction.close() ;
-        transaction = null ;
+            transaction.close();
+        transaction = null;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/d3c3fe68/jena-tdb/src/test/java/org/apache/jena/tdb/transaction/TestTransactionTDB.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/test/java/org/apache/jena/tdb/transaction/TestTransactionTDB.java
b/jena-tdb/src/test/java/org/apache/jena/tdb/transaction/TestTransactionTDB.java
index ad5265b..e81074e 100644
--- a/jena-tdb/src/test/java/org/apache/jena/tdb/transaction/TestTransactionTDB.java
+++ b/jena-tdb/src/test/java/org/apache/jena/tdb/transaction/TestTransactionTDB.java
@@ -35,34 +35,30 @@ import org.junit.* ;
 
 public class TestTransactionTDB extends AbstractTestTransaction
 {
-    static boolean nonDeleteableMMapFiles = SystemTDB.isWindows ;
-    String DIR = null ; 
+    private String DIR = null ; 
     
     @BeforeClass public static void beforeClassLoggingOff() { LogCtl.disable(SystemTDB.errlog.getName())
; } 
     @AfterClass public static void afterClassLoggingOn()    { LogCtl.setInfo(SystemTDB.errlog.getName())
; }
     
-    @Before public void before()
-    {
-        DIR = ConfigTest.getCleanDir() ;
-        StoreConnection.release(Location.create(DIR)) ;
+    @Before
+    public void before() {
+        DIR = ConfigTest.getCleanDir();
+        StoreConnection.release(Location.create(DIR));
     }
-    
-    @After public void after()
-    {
-        FileOps.clearDirectory(DIR) ; 
+
+    @After
+    public void after() {
+        FileOps.clearDirectory(DIR);
     }
-    
+
     @Override
-    protected Dataset create()
-    { 
-        return TDBFactory.createDataset(DIR) ;
+    protected Dataset create() {
+        return TDBFactory.createDataset(DIR);
     }
     
     private static Triple triple1 = SSE.parseTriple("(<s> <p> <o>)") ;
 
 
-    
-    @Test public void transaction_50()
-    {
+    @Test public void transaction_50() {
         // This assumes you have two datasets on the same location.
         // That's not necessarily true for uncached memory datasets, 
         // where you get two separate datasets so changes to one are
@@ -81,6 +77,7 @@ public class TestTransactionTDB extends AbstractTestTransaction
         ds1.commit() ;
 
         ds2.begin(READ) ;
+        // See ds1 updates
         assertFalse(ds2.getDefaultModel().isEmpty()) ;
         assertEquals(1, ds2.getDefaultModel().size()) ;
         ds2.commit() ;


Mime
View raw message