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 2017/06/29 10:45:37 UTC

[01/11] jena git commit: Remove unused.

Repository: jena
Updated Branches:
  refs/heads/master f529f782a -> 13aa5535a


Remove unused.

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

Branch: refs/heads/master
Commit: 0ab57c0467d6cdb43309629e399a8cc4bba87d2f
Parents: 0fb7122
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Jun 27 22:40:17 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Tue Jun 27 22:40:17 2017 +0100

----------------------------------------------------------------------
 .../jena/sparql/engine/optimizer/StatsMatcher.java     | 13 -------------
 1 file changed, 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/0ab57c04/jena-arq/src/main/java/org/apache/jena/sparql/engine/optimizer/StatsMatcher.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/optimizer/StatsMatcher.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/optimizer/StatsMatcher.java
index 7798f71..b1baacb 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/optimizer/StatsMatcher.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/optimizer/StatsMatcher.java
@@ -269,19 +269,6 @@ public final class StatsMatcher
         entry.add(pattern) ;
     }
     
-//    public void addPattern(Triple triple)
-//    {
-//        if ( triple.getSubject().isVariable() )
-//        {
-//            // PO, P and O
-//        }
-//        else
-//        {
-//            //SPO, SP and SO
-//        }
-//        throw new NotImplementedException("StatsMatcher.addPattern") ;
-//    }
-    
     private static void check(Pattern pattern)
     {
         check(pattern.subjItem) ;


[11/11] jena git commit: Add jena-spatial to Dev build

Posted by an...@apache.org.
Add jena-spatial to Dev build


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

Branch: refs/heads/master
Commit: 13aa5535a859b43c3c4ffe805c0151291ddc79a5
Parents: b436c72
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Jun 29 11:45:27 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Jun 29 11:45:27 2017 +0100

----------------------------------------------------------------------
 pom.xml | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/13aa5535/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6bdeebd..acb8c74 100644
--- a/pom.xml
+++ b/pom.xml
@@ -79,7 +79,7 @@
         
         <module>jena-text</module>
         <!--<module>jena-text-es</module>-->
-        <!--<module>jena-spatial</module>-->
+        <module>jena-spatial</module>
         <!--<module>jena-fuseki1</module>-->
         <module>jena-fuseki2</module>
 
@@ -153,9 +153,7 @@
         <module>jena-cmds</module>
 
         <module>jena-text</module>
-        <!-- Move later? -->
         <module>jena-text-es</module>
-
         <module>jena-spatial</module>
         <module>jena-csv</module>
 
@@ -173,6 +171,7 @@
         <module>jena-integration-tests</module>
 
         <module>jena-permissions</module>
+        <module>jena-extras</module>
 
         <module>jena-jdbc</module>
         <!-- Removed because this breaks the build after the 
@@ -184,7 +183,6 @@
         <module>apache-jena</module>
         <module>apache-jena-osgi</module>
 
-        <module>jena-extras</module>
       </modules>
     </profile>
   </profiles>


[04/11] jena git commit: Make private as only used in this class.

Posted by an...@apache.org.
Make private as only used in this class.

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

Branch: refs/heads/master
Commit: 9dc27c4ef2865c840555892f9ffa6ae714e6bfc6
Parents: 053c06a
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Jun 27 22:42:13 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Tue Jun 27 22:42:13 2017 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/jena/tdb/base/block/BlockMgrFactory.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/9dc27c4e/jena-tdb/src/main/java/org/apache/jena/tdb/base/block/BlockMgrFactory.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/base/block/BlockMgrFactory.java b/jena-tdb/src/main/java/org/apache/jena/tdb/base/block/BlockMgrFactory.java
index 2a84d78..16e1454 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/base/block/BlockMgrFactory.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/base/block/BlockMgrFactory.java
@@ -54,8 +54,7 @@ public class BlockMgrFactory {
         return create(fileSet, ext, null, blockSize, readBlockCacheSize, writeBlockCacheSize) ;
     }
 
-    // XXX Deprecate?
-    public static BlockMgr create(FileSet fileSet, String ext, FileMode fileMode, int blockSize, int readBlockCacheSize, int writeBlockCacheSize) {
+    private static BlockMgr create(FileSet fileSet, String ext, FileMode fileMode, int blockSize, int readBlockCacheSize, int writeBlockCacheSize) {
         if ( fileSet.isMem() )
             return createMem(fileSet.filename(ext), blockSize) ;
         else


[03/11] jena git commit: Remove out of date comment.

Posted by an...@apache.org.
Remove out of date comment.

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

Branch: refs/heads/master
Commit: 053c06a937e0c2cdf4b344526a036a9e5c356a2e
Parents: 91a65ad
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Jun 27 22:41:38 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Tue Jun 27 22:41:38 2017 +0100

----------------------------------------------------------------------
 jena-tdb/src/main/java/org/apache/jena/tdb/TDBLoader.java | 9 ---------
 1 file changed, 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/053c06a9/jena-tdb/src/main/java/org/apache/jena/tdb/TDBLoader.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/TDBLoader.java b/jena-tdb/src/main/java/org/apache/jena/tdb/TDBLoader.java
index a9ef021..85be470 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/TDBLoader.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/TDBLoader.java
@@ -149,15 +149,6 @@ public class TDBLoader
     private Logger loaderLog  = TDB.logLoader ;
     private boolean checking ;
     
-    // XXX Context control block
-    // Checker
-    // Error handler
-    // verbose flag?
-    // logger
-    // generateStats
-    // checking flag
-    
-    
     // ---- The class itself.
     
     public TDBLoader() {}


[08/11] jena git commit: JENA-1369: Cleaning up TDB Transaction setup.

Posted by an...@apache.org.
JENA-1369: Cleaning up TDB Transaction setup.

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

Branch: refs/heads/master
Commit: 3764a2aedd86e9ca0edd4faac1f36850074dd51d
Parents: b92ba1a
Author: Andy Seaborne <an...@apache.org>
Authored: Wed Jun 28 09:28:57 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Wed Jun 28 09:28:57 2017 +0100

----------------------------------------------------------------------
 .../org/apache/jena/tdb/index/SetupIndex.java   |  50 +--------
 .../jena/tdb/setup/DatasetBuilderStd.java       |  82 ++++++++++-----
 .../apache/jena/tdb/store/StorageConfig.java    |  14 ++-
 .../tdb/store/nodetable/NodeTableNative.java    |  23 +++--
 .../java/org/apache/jena/tdb/sys/SetupTDB.java  |  51 +---------
 .../jena/tdb/transaction/DatasetBuilderTxn.java | 101 ++++++++++++-------
 .../jena/tdb/transaction/JournalControl.java    |  21 ++--
 .../tdb/transaction/TransactionManager.java     |   2 +-
 8 files changed, 168 insertions(+), 176 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/3764a2ae/jena-tdb/src/main/java/org/apache/jena/tdb/index/SetupIndex.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/index/SetupIndex.java b/jena-tdb/src/main/java/org/apache/jena/tdb/index/SetupIndex.java
index ded91e3..dfcee8b 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/index/SetupIndex.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/index/SetupIndex.java
@@ -122,52 +122,8 @@ public class SetupIndex {
     }
 
     public static RecordFactory makeRecordFactory(int keyLen, int valueLen)
-        {
-            return new RecordFactory(keyLen, valueLen) ;
-        }
-    //    
-    //    /** Make a NodeTable without cache and inline wrappers */ 
-    //    public static NodeTable makeNodeTableBase(Location location, String indexNode2Id, String indexId2Node)
-    //    {
-    //        if (location.isMem()) 
-    //            return NodeTableFactory.createMem() ;
-    //
-    //        // -- make id to node mapping -- Names.indexId2Node
-    //        FileSet fsIdToNode = new FileSet(location, indexId2Node) ;
-    //        
-    //        ObjectFile stringFile = makeObjectFile(fsIdToNode) ;
-    //        
-    //        // -- make node to id mapping -- Names.indexNode2Id
-    //        // Make index of id to node (data table)
-    //        
-    //        // No caching at the index level - we use the internal caches of the node table.
-    //        Index nodeToId = makeIndex(location, indexNode2Id, LenNodeHash, SizeOfNodeId, -1 ,-1) ;
-    //        
-    //        // -- Make the node table using the components established above.
-    //        NodeTable nodeTable = new NodeTableNative(nodeToId, stringFile) ;
-    //        return nodeTable ;
-    //    }
-    //
-    //    /** Make a NodeTable with cache and inline wrappers */ 
-    //    public static NodeTable makeNodeTable(Location location)
-    //    {
-    //        return makeNodeTable(location,
-    //                             Names.indexNode2Id, SystemTDB.Node2NodeIdCacheSize,
-    //                             Names.indexId2Node, SystemTDB.NodeId2NodeCacheSize,
-    //                             SystemTDB.NodeMissCacheSize) ;
-    //    }
-    //
-    //    /** Make a NodeTable with cache and inline wrappers */ 
-    //    public static NodeTable makeNodeTable(Location location,
-    //                                          String indexNode2Id, int nodeToIdCacheSize,
-    //                                          String indexId2Node, int idToNodeCacheSize,
-    //                                          int nodeMissCacheSize)
-    //    {
-    //        NodeTable nodeTable = makeNodeTableBase(location, indexNode2Id, indexId2Node) ;
-    //        nodeTable = NodeTableCache.create(nodeTable, nodeToIdCacheSize, idToNodeCacheSize, nodeMissCacheSize) ; 
-    //        nodeTable = NodeTableInline.create(nodeTable) ;
-    //        return nodeTable ;
-    //    }
-    //
+    {
+        return new RecordFactory(keyLen, valueLen) ;
+    }
 }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/3764a2ae/jena-tdb/src/main/java/org/apache/jena/tdb/setup/DatasetBuilderStd.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/setup/DatasetBuilderStd.java b/jena-tdb/src/main/java/org/apache/jena/tdb/setup/DatasetBuilderStd.java
index 1319e0e..d538c0a 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/setup/DatasetBuilderStd.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/setup/DatasetBuilderStd.java
@@ -34,6 +34,7 @@ import org.apache.jena.tdb.base.block.BlockMgr ;
 import org.apache.jena.tdb.base.file.BufferChannel ;
 import org.apache.jena.tdb.base.file.FileSet ;
 import org.apache.jena.tdb.base.file.Location ;
+import org.apache.jena.tdb.base.objectfile.ObjectFile;
 import org.apache.jena.tdb.index.BuilderStdIndex ;
 import org.apache.jena.tdb.index.IndexBuilder ;
 import org.apache.jena.tdb.index.IndexParams ;
@@ -105,15 +106,18 @@ public class DatasetBuilderStd implements DatasetBuilder {
 
     // Used by DatasetBuilderTxn
     public DatasetBuilderStd(BlockMgrBuilder blockMgrBuilder, NodeTableBuilder nodeTableBuilder) {
-        set(blockMgrBuilder, nodeTableBuilder) ;
+        setupRecord(blockMgrBuilder, nodeTableBuilder) ;
     }
 
-    protected void set(NodeTableBuilder nodeTableBuilder, TupleIndexBuilder tupleIndexBuilder) {
-        this.nodeTableBuilder = nodeTableBuilder ;
-        this.tupleIndexBuilder = tupleIndexBuilder ;
+    private void standardSetup() {
+        ObjectFileBuilder objectFileBuilder = new BuilderStdDB.ObjectFileBuilderStd() ;
+        BlockMgrBuilder blockMgrBuilder = new BuilderStdIndex.BlockMgrBuilderStd() ;
+        IndexBuilder indexBuilderNT = new BuilderStdIndex.IndexBuilderStd(blockMgrBuilder, blockMgrBuilder) ;
+        NodeTableBuilder nodeTableBuilder = new BuilderStdDB.NodeTableBuilderStd(indexBuilderNT, objectFileBuilder) ;
+        setupRecord(blockMgrBuilder, nodeTableBuilder) ;
     }
-    
-    protected void set(BlockMgrBuilder blockMgrBuilder, NodeTableBuilder nodeTableBuilder) {
+
+    protected void setupRecord(BlockMgrBuilder blockMgrBuilder, NodeTableBuilder nodeTableBuilder) {
         recorder = new Recorder() ;
         BlockMgrBuilder blockMgrBuilderRec = new BlockMgrBuilderRecorder(blockMgrBuilder, recorder) ;
 
@@ -127,6 +131,11 @@ public class DatasetBuilderStd implements DatasetBuilder {
         set(nodeTableBuilder, tupleIndexBuilder) ;
     }
 
+    protected void set(NodeTableBuilder nodeTableBuilder, TupleIndexBuilder tupleIndexBuilder) {
+        this.nodeTableBuilder = nodeTableBuilder ;
+        this.tupleIndexBuilder = tupleIndexBuilder ;
+    }
+    
 
     private static void checkLocation(Location location) { 
         if ( location.isMem() )
@@ -144,14 +153,6 @@ public class DatasetBuilderStd implements DatasetBuilder {
             error(log, "Directory not writeable: "+dirname) ;
     }
 
-    private void standardSetup() {
-        ObjectFileBuilder objectFileBuilder = new BuilderStdDB.ObjectFileBuilderStd() ;
-        BlockMgrBuilder blockMgrBuilder = new BuilderStdIndex.BlockMgrBuilderStd() ;
-        IndexBuilder indexBuilderNT = new BuilderStdIndex.IndexBuilderStd(blockMgrBuilder, blockMgrBuilder) ;
-        NodeTableBuilder nodeTableBuilder = new BuilderStdDB.NodeTableBuilderStd(indexBuilderNT, objectFileBuilder) ;
-        set(blockMgrBuilder, nodeTableBuilder) ;
-    }
-
     @Override
     public DatasetGraphTDB build(Location location, StoreParams params) {
         // Ensure that there is global synchronization
@@ -182,8 +183,8 @@ public class DatasetBuilderStd implements DatasetBuilder {
 
         ReorderTransformation transform = (_transform == null) ? chooseReorderTransformation(location) : _transform ;
 
-        StorageConfig storageConfig = new StorageConfig(location, params, writeable, 
-                                                        recorder.blockMgrs, recorder.bufferChannels, recorder.nodeTables) ;
+        StorageConfig storageConfig = new StorageConfig(location, params, writeable,
+                                                        recorder.blockMgrs, recorder.objectFiles, recorder.bufferChannels, recorder.nodeTables) ;
         
         recorder.finish() ;
         
@@ -377,13 +378,17 @@ public class DatasetBuilderStd implements DatasetBuilder {
         void record(FileRef fileRef, BlockMgr blockMgr) ;
     }
 
+    interface RecordObjectFile {
+        void record(FileRef fileRef, ObjectFile objFile);
+    }
+
     interface RecordNodeTable {
         void record(FileRef fileRef, NodeTable nodeTable) ;
     }
 
     static class NodeTableBuilderRecorder implements NodeTableBuilder {
-        private NodeTableBuilder builder ;
-        private RecordNodeTable  recorder ;
+        private final NodeTableBuilder builder ;
+        private final RecordNodeTable  recorder ;
 
         NodeTableBuilderRecorder(NodeTableBuilder ntb, RecordNodeTable recorder) {
             this.builder = ntb ;
@@ -401,9 +406,27 @@ public class DatasetBuilderStd implements DatasetBuilder {
 
     }
 
+    static class ObjectFileBuilderRecorder implements ObjectFileBuilder {
+        private final ObjectFileBuilder builder ;
+        private final RecordObjectFile  recorder ;
+        
+        ObjectFileBuilderRecorder(ObjectFileBuilder objFileBuilder, RecordObjectFile recorder) {
+            this.builder = objFileBuilder ;
+            this.recorder = recorder ;
+        }
+        
+        @Override
+        public ObjectFile buildObjectFile(FileSet fsObjectFile, String ext) {
+            ObjectFile objectFile = builder.buildObjectFile(fsObjectFile, ext);
+            FileRef ref = FileRef.create(fsObjectFile, ext) ;
+            recorder.record(ref, objectFile);
+            return objectFile;
+        }
+    }
+    
     static class BlockMgrBuilderRecorder implements BlockMgrBuilder {
-        private BlockMgrBuilder builder ;
-        private RecordBlockMgr  recorder ;
+        private final BlockMgrBuilder builder ;
+        private final RecordBlockMgr  recorder ;
 
         BlockMgrBuilderRecorder(BlockMgrBuilder blkMgrBuilder, RecordBlockMgr recorder) {
             this.builder = blkMgrBuilder ;
@@ -414,16 +437,19 @@ public class DatasetBuilderStd implements DatasetBuilder {
         public BlockMgr buildBlockMgr(FileSet fileSet, String ext, IndexParams params) {
             BlockMgr blkMgr = builder.buildBlockMgr(fileSet, ext, params) ;
             FileRef ref = FileRef.create(fileSet, ext) ;
+            //System.err.println("Record (BlockMgr)   = "+ref);
             recorder.record(ref, blkMgr) ;
             return blkMgr ;
         }
     }
 
-    static class Recorder implements RecordBlockMgr, RecordNodeTable {
+    static class Recorder implements RecordBlockMgr, RecordObjectFile, RecordNodeTable {
 
         Map<FileRef, BlockMgr>      blockMgrs      = null ;
+        Map<FileRef, ObjectFile>    objectFiles    = null ;
+        // Not used currently.
         Map<FileRef, BufferChannel> bufferChannels = null ;
-        Map<FileRef, NodeTable>     nodeTables     = null ;
+        Map<FileRef, NodeTable>     nodeTables = null ;
         boolean recording = false ;
 
         Recorder() { }
@@ -433,15 +459,18 @@ public class DatasetBuilderStd implements DatasetBuilder {
                 throw new TDBException("Recorder already recording") ;
             recording      = true ;
             blockMgrs      = new HashMap<>() ;
+            
+            objectFiles    = new HashMap<>() ;
             bufferChannels = new HashMap<>() ;
             nodeTables     = new HashMap<>() ;
         } 
         void finish() {
             if ( ! recording )
                 throw new TDBException("Recorder not recording") ;
+            // null out, not .clear.
             blockMgrs      = null ;
+            objectFiles    = null ;
             bufferChannels = null ;
-            nodeTables     = null ;
             recording      = false ;
         }
         
@@ -453,6 +482,13 @@ public class DatasetBuilderStd implements DatasetBuilder {
         }
 
         @Override
+        public void record(FileRef fileRef, ObjectFile objFile) {
+            if ( recording )
+                // log.info("ObjectTable: "+fileRef) ;
+                objectFiles.put(fileRef, objFile);
+        }
+        
+        @Override
         public void record(FileRef fileRef, NodeTable nodeTable) {
             if ( recording )
                 // log.info("NodeTable: "+fileRef) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/3764a2ae/jena-tdb/src/main/java/org/apache/jena/tdb/store/StorageConfig.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/store/StorageConfig.java b/jena-tdb/src/main/java/org/apache/jena/tdb/store/StorageConfig.java
index 9c01f42..1da389b 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/store/StorageConfig.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/store/StorageConfig.java
@@ -23,29 +23,33 @@ import java.util.Map ;
 import org.apache.jena.tdb.base.block.BlockMgr ;
 import org.apache.jena.tdb.base.file.BufferChannel ;
 import org.apache.jena.tdb.base.file.Location ;
+import org.apache.jena.tdb.base.objectfile.ObjectFile;
 import org.apache.jena.tdb.setup.StoreParams ;
-import org.apache.jena.tdb.store.nodetable.NodeTable ;
+import org.apache.jena.tdb.store.nodetable.NodeTable;
 import org.apache.jena.tdb.sys.FileRef ;
 
 public class StorageConfig
 {
     public final StoreParams params ;
     public final Map<FileRef, BlockMgr> blockMgrs ;
-    public final Map<FileRef, BufferChannel> bufferChannels ;
-    public final Map<FileRef, NodeTable> nodeTables ;
+    public final Map<FileRef, ObjectFile> objectFiles;
+    public final Map<FileRef, BufferChannel> bufferChannels;
+    public final Map<FileRef, NodeTable> nodeTables;
     public final Location location ;
     public final boolean writeable ;
 
     public StorageConfig(Location location, StoreParams params, boolean writeable, 
                          Map<FileRef, BlockMgr> blockMgrs, 
-                         Map<FileRef, BufferChannel> bufferChannels,
+                         Map<FileRef, ObjectFile> objectFiles,
+                         Map<FileRef, BufferChannel> bufferChannels, 
                          Map<FileRef, NodeTable> nodeTables)
     {
         this.location = location ;
         this.params = params ;
         this.blockMgrs = blockMgrs ;
+        this.objectFiles = objectFiles ;
         this.bufferChannels = bufferChannels ;
-        this.nodeTables = nodeTables ;
+        this.nodeTables = nodeTables;
         this.writeable = writeable ;
     }
     

http://git-wip-us.apache.org/repos/asf/jena/blob/3764a2ae/jena-tdb/src/main/java/org/apache/jena/tdb/store/nodetable/NodeTableNative.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/store/nodetable/NodeTableNative.java b/jena-tdb/src/main/java/org/apache/jena/tdb/store/nodetable/NodeTableNative.java
index 51ceee1..9974c5d 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/store/nodetable/NodeTableNative.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/store/nodetable/NodeTableNative.java
@@ -228,23 +228,24 @@ public class NodeTableNative implements NodeTable
     }
 
     @Override
-    public void sync() 
-    { 
-        if ( syncNeeded )
-        {
-            if ( nodeHashToId != null )
-                nodeHashToId.sync() ;
+    public void sync() {
+        if ( syncNeeded ) {
             if ( getObjects() != null )
-                getObjects().sync() ;
-            syncNeeded = false ;
+                getObjects().sync();
+            if ( nodeHashToId != null )
+                nodeHashToId.sync();
+            syncNeeded = false;
         }
     }
 
-    public ObjectFile getObjects()
-    {
+    public ObjectFile getObjects() {
         return objects;
     }
-    
+
+    public Index getIndex() {
+        return nodeHashToId;
+    }
+
     @Override
     public String toString() { return objects.getLabel() ; }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/3764a2ae/jena-tdb/src/main/java/org/apache/jena/tdb/sys/SetupTDB.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/sys/SetupTDB.java b/jena-tdb/src/main/java/org/apache/jena/tdb/sys/SetupTDB.java
index 29ff118..bbed8eb 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/sys/SetupTDB.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/sys/SetupTDB.java
@@ -104,55 +104,10 @@ public class SetupTDB
     }
 
     public static RecordFactory makeRecordFactory(int keyLen, int valueLen)
-        {
-            return SetupIndex.makeRecordFactory(keyLen, valueLen) ;
-        }
-    //    
-    //    /** Make a NodeTable without cache and inline wrappers */ 
-    //    public static NodeTable makeNodeTableBase(Location location, String indexNode2Id, String indexId2Node)
-    //    {
-    //        if (location.isMem()) 
-    //            return NodeTableFactory.createMem() ;
-    //
-    //        // -- make id to node mapping -- Names.indexId2Node
-    //        FileSet fsIdToNode = new FileSet(location, indexId2Node) ;
-    //        
-    //        ObjectFile stringFile = makeObjectFile(fsIdToNode) ;
-    //        
-    //        // -- make node to id mapping -- Names.indexNode2Id
-    //        // Make index of id to node (data table)
-    //        
-    //        // No caching at the index level - we use the internal caches of the node table.
-    //        Index nodeToId = makeIndex(location, indexNode2Id, LenNodeHash, SizeOfNodeId, -1 ,-1) ;
-    //        
-    //        // -- Make the node table using the components established above.
-    //        NodeTable nodeTable = new NodeTableNative(nodeToId, stringFile) ;
-    //        return nodeTable ;
-    //    }
-    //
-    //    /** Make a NodeTable with cache and inline wrappers */ 
-    //    public static NodeTable makeNodeTable(Location location)
-    //    {
-    //        return makeNodeTable(location,
-    //                             Names.indexNode2Id, SystemTDB.Node2NodeIdCacheSize,
-    //                             Names.indexId2Node, SystemTDB.NodeId2NodeCacheSize,
-    //                             SystemTDB.NodeMissCacheSize) ;
-    //    }
-    //
-    //    /** Make a NodeTable with cache and inline wrappers */ 
-    //    public static NodeTable makeNodeTable(Location location,
-    //                                          String indexNode2Id, int nodeToIdCacheSize,
-    //                                          String indexId2Node, int idToNodeCacheSize,
-    //                                          int nodeMissCacheSize)
-    //    {
-    //        NodeTable nodeTable = makeNodeTableBase(location, indexNode2Id, indexId2Node) ;
-    //        nodeTable = NodeTableCache.create(nodeTable, nodeToIdCacheSize, idToNodeCacheSize, nodeMissCacheSize) ; 
-    //        nodeTable = NodeTableInline.create(nodeTable) ;
-    //        return nodeTable ;
-    //    }
-    //
+    {
+        return SetupIndex.makeRecordFactory(keyLen, valueLen) ;
+    }
     
-    // XXX Move to FileFactory
     public static ObjectFile makeObjectFile(FileSet fsIdToNode)
     {
         String filename = fsIdToNode.filename(Names.extNodeData) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/3764a2ae/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetBuilderTxn.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetBuilderTxn.java b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetBuilderTxn.java
index 1a052f4..7a3adb5 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetBuilderTxn.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetBuilderTxn.java
@@ -25,53 +25,52 @@ import org.apache.jena.tdb.TDBException ;
 import org.apache.jena.tdb.base.block.BlockMgr ;
 import org.apache.jena.tdb.base.block.BlockMgrLogger ;
 import org.apache.jena.tdb.base.block.BlockMgrReadonly ;
-import org.apache.jena.tdb.base.file.FileFactory ;
+import org.apache.jena.tdb.base.file.FileFactory;
 import org.apache.jena.tdb.base.file.FileSet ;
 import org.apache.jena.tdb.base.objectfile.ObjectFile ;
-import org.apache.jena.tdb.base.record.RecordFactory ;
-import org.apache.jena.tdb.index.Index ;
-import org.apache.jena.tdb.index.IndexMap ;
-import org.apache.jena.tdb.index.IndexParams ;
-import org.apache.jena.tdb.setup.BlockMgrBuilder ;
-import org.apache.jena.tdb.setup.DatasetBuilderStd ;
-import org.apache.jena.tdb.setup.NodeTableBuilder ;
-import org.apache.jena.tdb.setup.StoreParams ;
+import org.apache.jena.tdb.base.objectfile.ObjectFileReadonly;
+import org.apache.jena.tdb.base.record.RecordFactory;
+import org.apache.jena.tdb.index.*;
+import org.apache.jena.tdb.setup.*;
 import org.apache.jena.tdb.store.DatasetGraphTDB ;
-import org.apache.jena.tdb.store.nodetable.NodeTable ;
-import org.apache.jena.tdb.store.nodetable.NodeTableInline ;
-import org.apache.jena.tdb.store.nodetable.NodeTableReadonly ;
+import org.apache.jena.tdb.store.nodetable.NodeTable;
+import org.apache.jena.tdb.store.nodetable.NodeTableInline;
+import org.apache.jena.tdb.store.nodetable.NodeTableReadonly;
 import org.apache.jena.tdb.sys.FileRef ;
-import org.apache.jena.tdb.sys.Names ;
-import org.apache.jena.tdb.sys.SystemTDB ;
+import org.apache.jena.tdb.sys.Names;
+import org.apache.jena.tdb.sys.SystemTDB;
 
 public class DatasetBuilderTxn
 {
     // Ideally, don't make a DatasetGraphTDB to pass to new DatasetGraphTxn as it rips it apart.
     
     // Context for the build.
-    private TransactionManager txnMgr ;
-    private Map<FileRef, BlockMgr> blockMgrs ; 
-    private Map<FileRef, NodeTable> nodeTables ;
-    private Transaction txn ;
-    private DatasetGraphTDB dsg ;
-
-    public DatasetBuilderTxn(TransactionManager txnMgr) { this.txnMgr = txnMgr ; }
-    
-    public DatasetGraphTxn build(Transaction transaction, ReadWrite mode, DatasetGraphTDB dsg) {
+    private final TransactionManager txnMgr ;
+    private final Map<FileRef, BlockMgr> blockMgrs ; 
+    private final Map<FileRef, ObjectFile> objectFiles; 
+    private final Map<FileRef, NodeTable> nodeTables;
+    private final DatasetGraphTDB dsg ;
+    private Transaction txn;
+
+    public DatasetBuilderTxn(TransactionManager txnMgr, DatasetGraphTDB dsg) {
+        this.txnMgr = txnMgr ;
         this.blockMgrs = dsg.getConfig().blockMgrs ;
+        this.objectFiles = dsg.getConfig().objectFiles ;
         this.nodeTables = dsg.getConfig().nodeTables ;
-        this.txn = transaction ;
         this.dsg = dsg ;
-
+    }
+    
+    DatasetGraphTxn build(Transaction txn, ReadWrite mode) {
+        this.txn = txn;
         DatasetGraphTDB dsgTDB ;
-            
+
         switch(mode)
         {
-            case READ : dsgTDB = buildReadonly() ; break ;
-            case WRITE : dsgTDB = buildWritable() ;  break ;
-            default: dsgTDB = null ;  // Silly Java.
+            case READ :   dsgTDB = buildReadonly() ; break ;
+            case WRITE :  dsgTDB = buildWritable() ;  break ;
+            default:      dsgTDB = null ;
         }
-        
+
         DatasetGraphTxn dsgTxn = new DatasetGraphTxn(dsgTDB, txn) ;
         // Copy context. Changes not propagated back to the base dataset. 
         dsgTxn.getContext().putAll(dsg.getContext()) ;
@@ -79,17 +78,16 @@ public class DatasetBuilderTxn
     }
 
     private DatasetGraphTDB buildReadonly() {
-        BlockMgrBuilder blockMgrBuilder = new BlockMgrBuilderReadonly() ;
-        NodeTableBuilder nodeTableBuilder = new NodeTableBuilderReadonly() ;
+        BlockMgrBuilder blockMgrBuilder = new BlockMgrBuilderReadonly();
+        NodeTableBuilder nodeTableBuilder = new NodeTableBuilderReadonly();
         DatasetBuilderStd x = new DatasetBuilderStd(blockMgrBuilder, nodeTableBuilder) ;
         DatasetGraphTDB dsg2 = x._build(dsg.getLocation(), dsg.getConfig().params, false, dsg.getReorderTransform()) ;
-
         return dsg2 ;
     }
 
     private DatasetGraphTDB buildWritable() {
         BlockMgrBuilder blockMgrBuilder = new BlockMgrBuilderTx() ;
-        NodeTableBuilder nodeTableBuilder = new NodeTableBuilderTx() ;
+        NodeTableBuilder nodeTableBuilder = new NodeTableBuilderTx();
         DatasetBuilderStd x = new DatasetBuilderStd(blockMgrBuilder, nodeTableBuilder) ;
         DatasetGraphTDB dsg2 = x._build(dsg.getLocation(), dsg.getConfig().params, true, dsg.getReorderTransform()) ;
         dsg2.getContext().putAll(dsg.getContext()) ;
@@ -135,7 +133,10 @@ public class DatasetBuilderTxn
             else
                 objectFile = FileFactory.createObjectFileDisk(objFilename) ;
 
-            NodeTableTrans ntt = new NodeTableTrans(txn, fsObjectFile.getBasename(), ntBase, idx, objectFile) ;
+            // Allow for a modified base NodeTable. 
+            NodeTable ntBaseTrans = ntBase;
+            
+            NodeTableTrans ntt = new NodeTableTrans(txn, fsObjectFile.getBasename(), ntBaseTrans, idx, objectFile) ;
             txn.addComponent(ntt) ;
 
             // Add inline wrapper.
@@ -159,6 +160,22 @@ public class DatasetBuilderTxn
         }
     }
 
+    // Object files currently, don't need journalling. Because they aer apend only, they 
+    // are "self journalling" - can append to them which used read-only elsewhere if the
+    // index to access them is transactional.
+//    class ObjectFileBuilderTx implements ObjectFileBuilder
+//    {
+//        @Override
+//        public ObjectFile buildObjectFile(FileSet fileSet, String ext) {
+//            FileRef ref = FileRef.create(fileSet, ext) ;
+//            ObjectFile baseObjFile = objectFiles.get(ref);
+//            if ( baseObjFile == null )
+//                throw new TDBException("No ObjectFile for " + ref) ;
+//            ObjectFileJournal objFile = new ObjectFileJournal(txn, ref, baseObjectFile); 
+//            return objFile;
+//        }
+//    }
+    
     // ---- Build passthrough versions for readonly access
     
     class BlockMgrBuilderReadonly implements BlockMgrBuilder
@@ -184,4 +201,18 @@ public class DatasetBuilderTxn
             return nt ;
         }
     }
+ 
+    class ObjectFileBuilderReadonly implements ObjectFileBuilder
+    {
+        @Override
+        public ObjectFile buildObjectFile(FileSet fileSet, String ext) {
+            FileRef ref = FileRef.create(fileSet, ext) ;
+            ObjectFile objFile = objectFiles.get(ref);
+            if ( objFile == null )
+                throw new TDBException("No ObjectFile for " + ref) ;
+            objFile = new ObjectFileReadonly(objFile) ;
+            return objFile;
+        }
+    }
+ 
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/3764a2ae/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java
index a2282c6..f384908 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java
@@ -29,22 +29,23 @@ import java.util.Iterator ;
 
 import org.apache.jena.atlas.iterator.Iter ;
 import org.apache.jena.atlas.lib.FileOps ;
+import org.apache.jena.atlas.logging.FmtLog;
 import org.apache.jena.tdb.TDBException ;
 import org.apache.jena.tdb.base.block.Block ;
 import org.apache.jena.tdb.base.block.BlockMgr ;
 import org.apache.jena.tdb.base.file.BufferChannel ;
 import org.apache.jena.tdb.base.file.BufferChannelFile ;
-import org.apache.jena.tdb.base.file.FileFactory ;
+import org.apache.jena.tdb.base.file.FileFactory;
 import org.apache.jena.tdb.base.file.Location ;
-import org.apache.jena.tdb.base.objectfile.ObjectFile ;
-import org.apache.jena.tdb.base.record.RecordFactory ;
-import org.apache.jena.tdb.index.IndexMap ;
+import org.apache.jena.tdb.base.objectfile.ObjectFile;
+import org.apache.jena.tdb.base.record.RecordFactory;
+import org.apache.jena.tdb.index.IndexMap;
 import org.apache.jena.tdb.store.DatasetGraphTDB ;
 import org.apache.jena.tdb.store.StorageConfig ;
-import org.apache.jena.tdb.store.nodetable.NodeTable ;
+import org.apache.jena.tdb.store.nodetable.NodeTable;
 import org.apache.jena.tdb.sys.FileRef ;
 import org.apache.jena.tdb.sys.Names ;
-import org.apache.jena.tdb.sys.SystemTDB ;
+import org.apache.jena.tdb.sys.SystemTDB;
 import org.slf4j.Logger ;
 import org.slf4j.LoggerFactory ;
 
@@ -91,8 +92,12 @@ public class JournalControl
         if ( journal == null || journal.isEmpty() )
             return ;
         
+        
         for ( FileRef fileRef : dsg.getConfig().nodeTables.keySet() )
             recoverNodeDat(dsg, fileRef) ;
+        // Not used currently.
+//        for ( FileRef fileRef : dsg.getConfig().objectFiles.keySet() )
+//            recoverObjectFile(dsg, fileRef) ;
         recoverFromJournal(dsg.getConfig(), journal) ;
         
         journal.close() ;
@@ -196,6 +201,10 @@ public class JournalControl
         } finally { Iter.close(iter) ; }
     }
     
+    private static void recoverObjectFile(DatasetGraphTDB dsg, FileRef fileRef) {
+        FmtLog.warn(log, "Not recovered: recoverObjectFile[%s]", fileRef);
+    }
+
     /** Recover a node data file (".dat").
      *  Node data files are append-only so recovering, then not using the data is safe.
      *  Node data file is a precursor for full recovery that works from the master journal.

http://git-wip-us.apache.org/repos/asf/jena/blob/3764a2ae/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/TransactionManager.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/TransactionManager.java b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/TransactionManager.java
index 433da45..c87b977 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/TransactionManager.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/TransactionManager.java
@@ -466,7 +466,7 @@ public class TransactionManager
             }
         }
         
-        DatasetGraphTxn dsgTxn = new DatasetBuilderTxn(this).build(txn, mode, dsg) ;
+        DatasetGraphTxn dsgTxn = new DatasetBuilderTxn(this, dsg).build(txn, mode);
         if ( mode == ReadWrite.READ ) {
             // If a READ transaction, cache the storage view.
             // This is cleared when a WRITE commits


[10/11] jena git commit: JENA-1369: Merge commit 'refs/pull/267/head' of github.com:apache/jena

Posted by an...@apache.org.
JENA-1369: Merge commit 'refs/pull/267/head' of github.com:apache/jena

This closes #267.


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

Branch: refs/heads/master
Commit: b436c72208ddb6d5d6aa57810f20e37e5044194b
Parents: f529f78 70d958a
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Jun 29 11:20:28 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Jun 29 11:20:28 2017 +0100

----------------------------------------------------------------------
 .../sparql/engine/optimizer/StatsMatcher.java   |  13 --
 .../src/main/java/tdb/tools/dumpnodes.java      | 188 +++++++++++++++++++
 .../src/main/java/tdb/tools/dumpnodetable.java  | 184 ------------------
 .../src/main/java/tdb/tools/dumpnodetable1.java | 184 ------------------
 .../java/org/apache/jena/tdb/TDBLoader.java     |   9 -
 .../jena/tdb/base/block/BlockMgrFactory.java    |   3 +-
 .../tdb/base/objectfile/ObjectFileReadonly.java |  37 ++++
 .../org/apache/jena/tdb/index/SetupIndex.java   |  50 +----
 .../jena/tdb/setup/DatasetBuilderStd.java       |  82 +++++---
 .../apache/jena/tdb/store/StorageConfig.java    |  14 +-
 .../tdb/store/nodetable/NodeTableNative.java    |  23 +--
 .../java/org/apache/jena/tdb/sys/SetupTDB.java  |  51 +----
 .../jena/tdb/transaction/BlockMgrJournal.java   |   2 +-
 .../jena/tdb/transaction/DatasetBuilderTxn.java | 100 ++++++----
 .../jena/tdb/transaction/JournalControl.java    |  21 ++-
 .../jena/tdb/transaction/NodeTableTrans.java    |   9 +-
 .../tdb/transaction/TransactionManager.java     |   2 +-
 17 files changed, 400 insertions(+), 572 deletions(-)
----------------------------------------------------------------------



[02/11] jena git commit: Rename is dumpnodes

Posted by an...@apache.org.
Rename is dumpnodes

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

Branch: refs/heads/master
Commit: 91a65ad2a7e6e0d11dbd1672837b0addb5d12423
Parents: 0ab57c0
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Jun 27 22:41:03 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Tue Jun 27 22:41:03 2017 +0100

----------------------------------------------------------------------
 .../src/main/java/tdb/tools/dumpnodes.java      | 188 +++++++++++++++++++
 .../src/main/java/tdb/tools/dumpnodetable.java  | 184 ------------------
 .../src/main/java/tdb/tools/dumpnodetable1.java | 184 ------------------
 3 files changed, 188 insertions(+), 368 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/91a65ad2/jena-cmds/src/main/java/tdb/tools/dumpnodes.java
----------------------------------------------------------------------
diff --git a/jena-cmds/src/main/java/tdb/tools/dumpnodes.java b/jena-cmds/src/main/java/tdb/tools/dumpnodes.java
new file mode 100644
index 0000000..933517f
--- /dev/null
+++ b/jena-cmds/src/main/java/tdb/tools/dumpnodes.java
@@ -0,0 +1,188 @@
+/*
+ * 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 tdb.tools ;
+
+import java.io.OutputStream ;
+import java.nio.ByteBuffer ;
+import java.util.Iterator ;
+import java.util.function.Function ;
+
+import arq.cmdline.CmdARQ;
+import org.apache.jena.atlas.io.IndentedWriter ;
+import org.apache.jena.atlas.iterator.Iter ;
+import org.apache.jena.atlas.lib.Lib ;
+import org.apache.jena.atlas.lib.Pair ;
+import org.apache.jena.atlas.logging.Log ;
+import org.apache.jena.atlas.logging.LogCtl ;
+import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.Node_Literal ;
+import org.apache.jena.sparql.util.FmtUtils ;
+import org.apache.jena.tdb.base.file.FileFactory ;
+import org.apache.jena.tdb.base.file.FileSet ;
+import org.apache.jena.tdb.base.file.Location ;
+import org.apache.jena.tdb.base.objectfile.ObjectFile ;
+import org.apache.jena.tdb.lib.NodeLib ;
+import org.apache.jena.tdb.setup.StoreParams ;
+import org.apache.jena.tdb.store.NodeId ;
+import org.apache.jena.tdb.sys.Names ;
+import tdb.cmdline.ModLocation ;
+
+public class dumpnodes extends CmdARQ {
+    ModLocation modLocation = new ModLocation() ;
+
+    static public void main(String... argv) {
+        LogCtl.setLog4j() ;
+        new dumpnodes(argv).mainRun() ;
+    }
+
+    @Override
+    protected void exec() {
+        Location loc = modLocation.getLocation() ;
+        ObjectFile objFile = determineNodeTable(loc);
+        dump(System.out, objFile) ;
+    }
+    
+    private ObjectFile determineNodeTable(Location loc) {
+        // Directly open the nodes.dat file.
+        StoreParams storeParams = StoreParams.getDftStoreParams();
+        FileSet fsId2Node = new FileSet(loc, storeParams.getIndexId2Node()) ;
+        
+        String file = fsId2Node.filename(Names.extNodeData);
+        ObjectFile objFile = FileFactory.createObjectFileDisk(file);
+        return objFile;
+    }
+
+    protected dumpnodes(String[] argv) {
+        super(argv) ;
+        super.addModule(modLocation) ;
+    }
+
+    // Taken from NodeTableNative.
+    private static Iterator<Pair<NodeId, Node>> all(ObjectFile objFile)
+    {
+        Iterator<Pair<Long, ByteBuffer>> objs = objFile.all() ; 
+        Function<Pair<Long, ByteBuffer>, Pair<NodeId, Node>> transform = item -> {
+            NodeId id = NodeId.create(item.car().longValue());
+            ByteBuffer bb = item.cdr();
+            Node n = NodeLib.decode(bb);
+            return new Pair<>(id, n);
+        };
+        return Iter.map(objs, transform) ;
+    }
+    
+    public static void dump(OutputStream w, ObjectFile objFile) {
+        // Better to hack the indexes?
+        Iterator<Pair<NodeId, Node>> iter = all(objFile) ;
+        long count = 0 ;
+        try (IndentedWriter iw = new IndentedWriter(w)) {
+            if ( ! iter.hasNext() ) {
+                iw.println("No nodes in the .dat file");
+                return ;
+            }
+            
+            for ( ; iter.hasNext() ; ) {
+                Pair<NodeId, Node> pair = iter.next() ;
+                iw.print(pair.car().toString()) ;
+                iw.print(" : ") ;
+                // iw.print(pair.cdr()) ;
+                Node n = pair.cdr() ;
+                String $ = stringForNode(n) ;
+                iw.print($) ;
+                iw.println() ;
+                count++ ;
+            }
+            iw.println() ;
+            iw.printf("Total: " + count) ;
+            iw.println() ;
+            iw.flush() ;
+        }
+    }
+
+    private static String stringForNode(Node n) {
+        if ( n == null )
+            return "<<null>>" ;
+
+        if ( n.isBlank() )
+            return "_:" + n.getBlankNodeLabel() ;
+
+        if ( n.isLiteral() )
+            return stringForLiteral((Node_Literal)n) ;
+
+        if ( n.isURI() ) {
+            String uri = n.getURI() ;
+            return stringForURI(uri) ;
+        }
+
+        if ( n.isVariable() )
+            return "?" + n.getName() ;
+
+        if ( n.equals(Node.ANY) )
+            return "ANY" ;
+
+        Log.warn(FmtUtils.class, "Failed to turn a node into a string: " + n) ;
+        return n.toString() ;
+    }
+
+    public static String stringForURI(String uri) {
+        return "<" + uri + ">" ;
+    }
+
+    public static String stringForLiteral(Node_Literal literal) {
+        String datatype = literal.getLiteralDatatypeURI() ;
+        String lang = literal.getLiteralLanguage() ;
+        String s = literal.getLiteralLexicalForm() ;
+
+        StringBuilder sbuff = new StringBuilder() ;
+        sbuff.append("\"") ;
+        FmtUtils.stringEsc(sbuff, s, true) ;
+        sbuff.append("\"") ;
+
+        // Format the language tag
+        if ( lang != null && lang.length() > 0 ) {
+            sbuff.append("@") ;
+            sbuff.append(lang) ;
+        }
+
+        if ( datatype != null ) {
+            sbuff.append("^^") ;
+            sbuff.append(stringForURI(datatype)) ;
+        }
+
+        return sbuff.toString() ;
+    }
+
+    @Override
+    protected void processModulesAndArgs() {
+        if ( modVersion.getVersionFlag() )
+            modVersion.printVersionAndExit() ;
+        if ( modLocation.getLocation() == null )
+            cmdError("Location required") ;
+    }
+
+    @Override
+    protected String getSummary() {
+        return getCommandName() + " --loc=DIR IndexName" ;
+    }
+
+    @Override
+    protected String getCommandName() {
+        return Lib.className(this) ;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/91a65ad2/jena-cmds/src/main/java/tdb/tools/dumpnodetable.java
----------------------------------------------------------------------
diff --git a/jena-cmds/src/main/java/tdb/tools/dumpnodetable.java b/jena-cmds/src/main/java/tdb/tools/dumpnodetable.java
deleted file mode 100644
index c163e8d..0000000
--- a/jena-cmds/src/main/java/tdb/tools/dumpnodetable.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * 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 tdb.tools ;
-
-import java.io.OutputStream ;
-import java.nio.ByteBuffer ;
-import java.util.Iterator ;
-import java.util.function.Function ;
-
-import arq.cmdline.CmdARQ;
-import org.apache.jena.atlas.io.IndentedWriter ;
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.lib.Lib ;
-import org.apache.jena.atlas.lib.Pair ;
-import org.apache.jena.atlas.logging.Log ;
-import org.apache.jena.atlas.logging.LogCtl ;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.Node_Literal ;
-import org.apache.jena.sparql.util.FmtUtils ;
-import org.apache.jena.tdb.base.file.FileFactory ;
-import org.apache.jena.tdb.base.file.FileSet ;
-import org.apache.jena.tdb.base.file.Location ;
-import org.apache.jena.tdb.base.objectfile.ObjectFile ;
-import org.apache.jena.tdb.lib.NodeLib ;
-import org.apache.jena.tdb.setup.StoreParams ;
-import org.apache.jena.tdb.store.NodeId ;
-import org.apache.jena.tdb.sys.Names ;
-import tdb.cmdline.ModLocation ;
-
-public class dumpnodetable extends CmdARQ {
-    ModLocation modLocation = new ModLocation() ;
-
-    static public void main(String... argv) {
-        LogCtl.setLog4j() ;
-        new dumpnodetable(argv).mainRun() ;
-    }
-
-    @Override
-    protected void exec() {
-        Location loc = modLocation.getLocation() ;
-
-        ObjectFile objFile = determineNodeTable(loc);
-        dump(System.out, objFile) ;
-    }
-    
-    private ObjectFile determineNodeTable(Location loc) {
-        // Directly open the nodes.dat file.
-        StoreParams storeParams = StoreParams.getDftStoreParams();
-        FileSet fsId2Node = new FileSet(loc, storeParams.getIndexId2Node()) ;
-        
-        String file = fsId2Node.filename(Names.extNodeData);
-        ObjectFile objFile = FileFactory.createObjectFileDisk(file);
-        return objFile;
-    }
-
-    protected dumpnodetable(String[] argv) {
-        super(argv) ;
-        super.addModule(modLocation) ;
-    }
-
-    // Taken from NodeTableNative.
-    private static Iterator<Pair<NodeId, Node>> all(ObjectFile objFile)
-    {
-        Iterator<Pair<Long, ByteBuffer>> objs = objFile.all() ; 
-        Function<Pair<Long, ByteBuffer>, Pair<NodeId, Node>> transform = item -> {
-            NodeId id = NodeId.create(item.car().longValue());
-            ByteBuffer bb = item.cdr();
-            Node n = NodeLib.decode(bb);
-            return new Pair<>(id, n);
-        };
-        return Iter.map(objs, transform) ;
-    }
-    
-    public static void dump(OutputStream w, ObjectFile objFile) {
-        // Better to hack the indexes?
-        Iterator<Pair<NodeId, Node>> iter = all(objFile) ;
-        long count = 0 ;
-        try (IndentedWriter iw = new IndentedWriter(w)) {
-            for ( ; iter.hasNext() ; ) {
-                Pair<NodeId, Node> pair = iter.next() ;
-                iw.print(pair.car().toString()) ;
-                iw.print(" : ") ;
-                // iw.print(pair.cdr()) ;
-                Node n = pair.cdr() ;
-                String $ = stringForNode(n) ;
-                iw.print($) ;
-                iw.println() ;
-                count++ ;
-            }
-            iw.println() ;
-            iw.printf("Total: " + count) ;
-            iw.println() ;
-            iw.flush() ;
-        }
-    }
-
-    private static String stringForNode(Node n) {
-        if ( n == null )
-            return "<<null>>" ;
-
-        if ( n.isBlank() )
-            return "_:" + n.getBlankNodeLabel() ;
-
-        if ( n.isLiteral() )
-            return stringForLiteral((Node_Literal)n) ;
-
-        if ( n.isURI() ) {
-            String uri = n.getURI() ;
-            return stringForURI(uri) ;
-        }
-
-        if ( n.isVariable() )
-            return "?" + n.getName() ;
-
-        if ( n.equals(Node.ANY) )
-            return "ANY" ;
-
-        Log.warn(FmtUtils.class, "Failed to turn a node into a string: " + n) ;
-        return n.toString() ;
-    }
-
-    public static String stringForURI(String uri) {
-        return "<" + uri + ">" ;
-    }
-
-    public static String stringForLiteral(Node_Literal literal) {
-        String datatype = literal.getLiteralDatatypeURI() ;
-        String lang = literal.getLiteralLanguage() ;
-        String s = literal.getLiteralLexicalForm() ;
-
-        StringBuilder sbuff = new StringBuilder() ;
-        sbuff.append("\"") ;
-        FmtUtils.stringEsc(sbuff, s, true) ;
-        sbuff.append("\"") ;
-
-        // Format the language tag
-        if ( lang != null && lang.length() > 0 ) {
-            sbuff.append("@") ;
-            sbuff.append(lang) ;
-        }
-
-        if ( datatype != null ) {
-            sbuff.append("^^") ;
-            sbuff.append(stringForURI(datatype)) ;
-        }
-
-        return sbuff.toString() ;
-    }
-
-    @Override
-    protected void processModulesAndArgs() {
-        if ( modVersion.getVersionFlag() )
-            modVersion.printVersionAndExit() ;
-        if ( modLocation.getLocation() == null )
-            cmdError("Location required") ;
-    }
-
-    @Override
-    protected String getSummary() {
-        return getCommandName() + " --loc=DIR IndexName" ;
-    }
-
-    @Override
-    protected String getCommandName() {
-        return Lib.className(this) ;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/91a65ad2/jena-cmds/src/main/java/tdb/tools/dumpnodetable1.java
----------------------------------------------------------------------
diff --git a/jena-cmds/src/main/java/tdb/tools/dumpnodetable1.java b/jena-cmds/src/main/java/tdb/tools/dumpnodetable1.java
deleted file mode 100644
index 05f6da2..0000000
--- a/jena-cmds/src/main/java/tdb/tools/dumpnodetable1.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * 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 tdb.tools ;
-
-import java.io.OutputStream ;
-import java.util.Iterator ;
-
-import arq.cmdline.CmdARQ;
-import org.apache.jena.atlas.io.IndentedWriter ;
-import org.apache.jena.atlas.lib.Lib ;
-import org.apache.jena.atlas.lib.Pair ;
-import org.apache.jena.atlas.logging.Log ;
-import org.apache.jena.atlas.logging.LogCtl ;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.Node_Literal ;
-import org.apache.jena.sparql.util.FmtUtils ;
-import org.apache.jena.tdb.StoreConnection ;
-import org.apache.jena.tdb.base.file.Location ;
-import org.apache.jena.tdb.setup.Build ;
-import org.apache.jena.tdb.store.DatasetGraphTDB ;
-import org.apache.jena.tdb.store.NodeId ;
-import org.apache.jena.tdb.store.nodetable.NodeTable ;
-import org.apache.jena.tdb.sys.Names ;
-import org.apache.jena.tdb.sys.SystemTDB ;
-import tdb.cmdline.ModLocation ;
-
-public class dumpnodetable1 extends CmdARQ {
-    ModLocation modLocation = new ModLocation() ;
-
-    static public void main(String... argv) {
-        LogCtl.setLog4j() ;
-        new dumpnodetable1(argv).mainRun() ;
-    }
-
-    @Override
-    protected void exec() {
-        Location loc = modLocation.getLocation() ;
-        NodeTable nodeTable = determineNodeTable(loc);
-        dump(System.out, nodeTable) ;
-    }
-    
-
-
-    private NodeTable determineNodeTable(Location loc) {
-        // Causes recovery.
-        StoreConnection sConn = StoreConnection.make(loc) ;
-        DatasetGraphTDB dsg = sConn.getBaseDataset() ;
-        NodeTable nodeTable = dsg.getQuadTable().getNodeTupleTable().getNodeTable() ;
-        return nodeTable;
-    }
-
-    protected dumpnodetable1(String[] argv) {
-        super(argv) ;
-        super.addModule(modLocation) ;
-    }
-
-    public static void dumpNodes(OutputStream w, String location) {
-        dump(w, location, Names.indexNode2Id, SystemTDB.Node2NodeIdCacheSize, Names.indexId2Node, SystemTDB.NodeId2NodeCacheSize,
-             SystemTDB.NodeMissCacheSize) ;
-    }
-
-    public static void dumpPrefixes(OutputStream w, String location) {
-        dump(w, location, Names.prefixNode2Id, 100, Names.prefixId2Node, 100, 10) ;
-    }
-
-    public static void dump(OutputStream w, String location, String indexNode2Id, int node2NodeIdCacheSize, String indexId2Node,
-                            int nodeId2NodeCacheSize, //
-
-                            int sizeNodeMissCacheSize) {
-        NodeTable nodeTable = Build.makeNodeTable(Location.create(location), indexNode2Id, node2NodeIdCacheSize, indexId2Node,
-                                                  nodeId2NodeCacheSize, sizeNodeMissCacheSize) ;
-    }
-
-    public static void dump(OutputStream w, NodeTable nodeTable) {
-        // Better to hack the indexes?
-        Iterator<Pair<NodeId, Node>> iter = nodeTable.all() ;
-        long count = 0 ;
-        try (IndentedWriter iw = new IndentedWriter(w)) {
-            for ( ; iter.hasNext() ; ) {
-                Pair<NodeId, Node> pair = iter.next() ;
-                iw.print(pair.car().toString()) ;
-                iw.print(" : ") ;
-                // iw.print(pair.cdr()) ;
-                Node n = pair.cdr() ;
-                String $ = stringForNode(n) ;
-                iw.print($) ;
-                iw.println() ;
-                count++ ;
-            }
-            iw.println() ;
-            iw.printf("Total: " + count) ;
-            iw.println() ;
-            iw.flush() ;
-        }
-    }
-
-    private static String stringForNode(Node n) {
-        if ( n == null )
-            return "<<null>>" ;
-
-        if ( n.isBlank() )
-            return "_:" + n.getBlankNodeLabel() ;
-
-        if ( n.isLiteral() )
-            return stringForLiteral((Node_Literal)n) ;
-
-        if ( n.isURI() ) {
-            String uri = n.getURI() ;
-            return stringForURI(uri) ;
-        }
-
-        if ( n.isVariable() )
-            return "?" + n.getName() ;
-
-        if ( n.equals(Node.ANY) )
-            return "ANY" ;
-
-        Log.warn(FmtUtils.class, "Failed to turn a node into a string: " + n) ;
-        return n.toString() ;
-    }
-
-    public static String stringForURI(String uri) {
-        return "<" + uri + ">" ;
-    }
-
-    public static String stringForLiteral(Node_Literal literal) {
-        String datatype = literal.getLiteralDatatypeURI() ;
-        String lang = literal.getLiteralLanguage() ;
-        String s = literal.getLiteralLexicalForm() ;
-
-        StringBuilder sbuff = new StringBuilder() ;
-        sbuff.append("\"") ;
-        FmtUtils.stringEsc(sbuff, s, true) ;
-        sbuff.append("\"") ;
-
-        // Format the language tag
-        if ( lang != null && lang.length() > 0 ) {
-            sbuff.append("@") ;
-            sbuff.append(lang) ;
-        }
-
-        if ( datatype != null ) {
-            sbuff.append("^^") ;
-            sbuff.append(stringForURI(datatype)) ;
-        }
-
-        return sbuff.toString() ;
-    }
-
-    @Override
-    protected void processModulesAndArgs() {
-        if ( modVersion.getVersionFlag() )
-            modVersion.printVersionAndExit() ;
-        if ( modLocation.getLocation() == null )
-            cmdError("Location required") ;
-    }
-
-    @Override
-    protected String getSummary() {
-        return getCommandName() + " --loc=DIR IndexName" ;
-    }
-
-    @Override
-    protected String getCommandName() {
-        return Lib.className(this) ;
-    }
-
-}


[07/11] jena git commit: Tidy up.

Posted by an...@apache.org.
Tidy up.

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

Branch: refs/heads/master
Commit: b92ba1a56a011479aa6f3cfef556fc512c507fae
Parents: e1abec9
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Jun 27 22:45:40 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Tue Jun 27 22:45:40 2017 +0100

----------------------------------------------------------------------
 .../org/apache/jena/tdb/transaction/NodeTableTrans.java     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/b92ba1a5/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/NodeTableTrans.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/NodeTableTrans.java b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/NodeTableTrans.java
index f8090d2..98615e1 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/NodeTableTrans.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/NodeTableTrans.java
@@ -58,12 +58,13 @@ public class NodeTableTrans implements NodeTable, TransactionLifecycle
     private final String label ;
     private final Transaction txn ;     // Can be null (during recovery).
     
-    public NodeTableTrans(Transaction txn, String label, NodeTable sub, Index nodeIndex, ObjectFile objFile)
+    public NodeTableTrans(Transaction txn, String label, NodeTable sub, Index nodeIndex, ObjectFile journalObjFile)
     {
         this.txn = txn ;
         this.base = sub ;
         this.nodeIndex = nodeIndex ;
-        this.journalObjFile = objFile ;
+        // Workspace for 
+        this.journalObjFile = journalObjFile ;
         // Clear bytes from an old run
         // (a crash while writing means the old transaction did not commit
         //  any bytes in the file are junk)
@@ -280,6 +281,7 @@ public class NodeTableTrans implements NodeTable, TransactionLifecycle
     @Override
     public void commitPrepare(Transaction txn)
     {
+        // The index "node2id", which is Node hash to NodeId, is done because it has a BlockMgr.
         debug("commitPrepare") ;
         
         // The node table is append-only so it can be written during prepare.
@@ -314,7 +316,8 @@ public class NodeTableTrans implements NodeTable, TransactionLifecycle
             warn(log, "Inconsistency: base.allocOffset() = %d : allocOffset = %d", expected, allocOffset) ;
         
         long newbase = -1 ; 
-        append() ;      // Calls all() which does a buffer flish.
+        // Copy to the base NodeTable. 
+        append() ;
         // Reset (in case we use this again)
         nodeIndex.clear() ;
         journalObjFile.truncate(journalObjFileStartOffset) ;    // Side effect is a buffer flush.


[06/11] jena git commit: Typo

Posted by an...@apache.org.
Typo

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

Branch: refs/heads/master
Commit: e1abec9268bccc35fefa24dc135ea66e31bb0887
Parents: 9d6c6e3
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Jun 27 22:43:12 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Tue Jun 27 22:43:12 2017 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/jena/tdb/transaction/BlockMgrJournal.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/e1abec92/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/BlockMgrJournal.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/BlockMgrJournal.java b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/BlockMgrJournal.java
index 89ab95d..ba0b8e8 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/BlockMgrJournal.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/BlockMgrJournal.java
@@ -42,7 +42,7 @@ import org.slf4j.Logger ;
 import org.slf4j.LoggerFactory ;
 
 /**
- * Block manager that keeps temporary copies of updated blocks, then writes then
+ * Block manager that keeps temporary copies of updated blocks, then writes them
  * to a journal when commitPrepare happens. No work is done in commitEnact
  * because the {@link TransactionManager} is responsible to writing 
  * the blocks to the main storage.


[09/11] jena git commit: Edit comment

Posted by an...@apache.org.
Edit comment


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

Branch: refs/heads/master
Commit: 70d958aa8897fa467bc81cc145146abb0607c16a
Parents: 3764a2a
Author: Andy Seaborne <an...@apache.org>
Authored: Wed Jun 28 12:31:44 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Wed Jun 28 12:40:06 2017 +0100

----------------------------------------------------------------------
 .../apache/jena/tdb/transaction/DatasetBuilderTxn.java   | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/70d958aa/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetBuilderTxn.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetBuilderTxn.java b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetBuilderTxn.java
index 7a3adb5..e32bc2a 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetBuilderTxn.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/DatasetBuilderTxn.java
@@ -33,9 +33,7 @@ import org.apache.jena.tdb.base.record.RecordFactory;
 import org.apache.jena.tdb.index.*;
 import org.apache.jena.tdb.setup.*;
 import org.apache.jena.tdb.store.DatasetGraphTDB ;
-import org.apache.jena.tdb.store.nodetable.NodeTable;
-import org.apache.jena.tdb.store.nodetable.NodeTableInline;
-import org.apache.jena.tdb.store.nodetable.NodeTableReadonly;
+import org.apache.jena.tdb.store.nodetable.*;
 import org.apache.jena.tdb.sys.FileRef ;
 import org.apache.jena.tdb.sys.Names;
 import org.apache.jena.tdb.sys.SystemTDB;
@@ -160,9 +158,10 @@ public class DatasetBuilderTxn
         }
     }
 
-    // Object files currently, don't need journalling. Because they aer apend only, they 
-    // are "self journalling" - can append to them which used read-only elsewhere if the
-    // index to access them is transactional.
+    // Object files currently don't need journalling. Because they are append only, they
+    // are "self journalling" - we can append to them while used read-only elsewhere if
+    // the index to access them is transactional and does not point into the appended new
+    // bytes.
 //    class ObjectFileBuilderTx implements ObjectFileBuilder
 //    {
 //        @Override


[05/11] jena git commit: Readonly enforcement wrapper.

Posted by an...@apache.org.
Readonly enforcement wrapper.

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

Branch: refs/heads/master
Commit: 9d6c6e3c4436fa2f0f23f3bfa8415296015251ef
Parents: 9dc27c4
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Jun 27 22:43:04 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Tue Jun 27 22:43:04 2017 +0100

----------------------------------------------------------------------
 .../tdb/base/objectfile/ObjectFileReadonly.java | 37 ++++++++++++++++++++
 1 file changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/9d6c6e3c/jena-tdb/src/main/java/org/apache/jena/tdb/base/objectfile/ObjectFileReadonly.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/base/objectfile/ObjectFileReadonly.java b/jena-tdb/src/main/java/org/apache/jena/tdb/base/objectfile/ObjectFileReadonly.java
new file mode 100644
index 0000000..9044b82
--- /dev/null
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/base/objectfile/ObjectFileReadonly.java
@@ -0,0 +1,37 @@
+/*
+ * 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 org.apache.jena.tdb.base.objectfile;
+
+import java.nio.ByteBuffer ;
+
+import org.apache.jena.tdb.TDBException;
+import org.apache.jena.tdb.base.block.Block ;
+
+public class ObjectFileReadonly extends ObjectFileWrapper
+{
+    public ObjectFileReadonly(ObjectFile other)         { super(other) ; }
+    @Override public Block allocWrite(int maxBytes)     { throw new TDBException("Read-only object file") ; }
+    @Override public void completeWrite(Block buffer)   { throw new TDBException("Read-only object file") ; }
+    @Override public void abortWrite(Block buffer)      { throw new TDBException("Read-only object file") ; }
+    @Override public long write(ByteBuffer buffer)      { throw new TDBException("Read-only object file") ; }
+    @Override public void reposition(long id)           { throw new TDBException("Read-only object file") ; }
+    @Override public void truncate(long size)           { throw new TDBException("Read-only object file") ; }
+    
+    @Override public String toString()              { return "RO:"+super.toString() ; } 
+}