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/06/23 17:25:52 UTC

svn commit: r1138927 - in /incubator/jena/Experimental/TxTDB/trunk: src-dev/tx/ src/main/java/com/hp/hpl/jena/tdb/base/block/ src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ src/main/java/com/hp/hpl/jena/tdb/nodetable/ src/main/java/com/hp/hpl/jena/...

Author: andy
Date: Thu Jun 23 15:25:51 2011
New Revision: 1138927

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

Added:
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrSwitcher.java   (with props)
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileSwitcher.java   (with props)
Modified:
    incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrWrapper.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileWrapper.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTupleTableWrapper.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/BlockMgrJournal.java

Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java?rev=1138927&r1=1138926&r2=1138927&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java Thu Jun 23 15:25:51 2011
@@ -2,6 +2,14 @@ package tx;
 
 public class DevTx
 {
+    // Build original with necessary indirects at right points 
+    //   1 - gets cache postioning right
+    //   2 - fast to start
+    // => change DatasetGraphTDB, DatasetBuilderStd
+    // See BlockMgrSwitcher(normal, BlockMgrJournal), ObjectFileSwitcher, 
+    //    Prefixes and NodeTupelTables will just work if the BlockMgrs and ObjectFiles at top-of-stack switchover.
+    
+    
     // DSG.add(Quad(tripleInQuad, triple)) does not affect default graph.
     
     // DatasetGraphTxnTDB to graph the NodeTable and it's caches from the dsg wrapped.

Added: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrSwitcher.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrSwitcher.java?rev=1138927&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrSwitcher.java (added)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrSwitcher.java Thu Jun 23 15:25:51 2011
@@ -0,0 +1,54 @@
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ * [See end of file]
+ */
+
+package com.hp.hpl.jena.tdb.base.block;
+
+public class BlockMgrSwitcher extends BlockMgrWrapper 
+{
+    protected final BlockMgr blockMgr1 ;
+    protected final BlockMgr blockMgr2 ;
+
+    public BlockMgrSwitcher(BlockMgr blockMgr1, BlockMgr blockMgr2)
+    {
+        super(blockMgr1) ;
+        this.blockMgr1 = blockMgr1 ;
+        this.blockMgr2 = blockMgr2 ;
+    }
+
+    public void switchover()
+    {
+        if ( super.blockMgr == blockMgr1 )
+            setBlockMgr(blockMgr2) ;
+        else
+            setBlockMgr(blockMgr1) ;
+    }
+}
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
\ No newline at end of file

Propchange: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrSwitcher.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrWrapper.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrWrapper.java?rev=1138927&r1=1138926&r2=1138927&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrWrapper.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrWrapper.java Thu Jun 23 15:25:51 2011
@@ -12,13 +12,21 @@ import java.util.Iterator ;
 
 public class BlockMgrWrapper implements BlockMgr
 {
-    protected final BlockMgr blockMgr ;
+    protected BlockMgr blockMgr ;
 
     public BlockMgrWrapper(BlockMgr blockMgr)
     {
-        this.blockMgr = blockMgr ;
+        setBlockMgr(blockMgr) ;
     }
 
+    /** Set another BlockMgr as the target of the wrapper - return the old one */ 
+    protected final BlockMgr setBlockMgr(BlockMgr blockMgr)
+    {
+        BlockMgr old = blockMgr ;
+        this.blockMgr = blockMgr ;
+        return old ;
+    }
+    
     @Override
     public Block allocate(int blockSize)
     {

Added: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileSwitcher.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileSwitcher.java?rev=1138927&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileSwitcher.java (added)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileSwitcher.java Thu Jun 23 15:25:51 2011
@@ -0,0 +1,61 @@
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ * [See end of file]
+ */
+
+package com.hp.hpl.jena.tdb.base.objectfile;
+
+
+/** 
+ * An ObjectFile is an append-read file, that is you can append data
+ * to the stream or read any block.
+ */
+
+public class ObjectFileSwitcher extends ObjectFileWrapper
+{
+    protected final ObjectFile objFile1 ;
+    protected final ObjectFile objFile2 ;
+
+    public ObjectFileSwitcher(ObjectFile objFile1, ObjectFile objFile2)
+    {
+        super(objFile1) ;
+        this.objFile1 = objFile1 ;
+        this.objFile2 = objFile2 ;
+    }
+    
+    public final void switchover()
+    {
+        if ( super.other == objFile1 )
+            super.other = objFile2 ;
+        else
+            super.other = objFile1 ;
+    }
+}
+
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
\ No newline at end of file

Propchange: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileSwitcher.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileWrapper.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileWrapper.java?rev=1138927&r1=1138926&r2=1138927&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileWrapper.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileWrapper.java Thu Jun 23 15:25:51 2011
@@ -20,7 +20,7 @@ import org.openjena.atlas.lib.Pair ;
 
 public class ObjectFileWrapper implements ObjectFile
 {
-    protected final ObjectFile other ;
+    protected ObjectFile other ;
 
     public ObjectFileWrapper(ObjectFile other)      { this.other = other ; }
     

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTupleTableWrapper.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTupleTableWrapper.java?rev=1138927&r1=1138926&r2=1138927&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTupleTableWrapper.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTupleTableWrapper.java Thu Jun 23 15:25:51 2011
@@ -17,9 +17,19 @@ import com.hp.hpl.jena.tdb.store.NodeId 
 
 public class NodeTupleTableWrapper implements NodeTupleTable
 {
-    protected final NodeTupleTable nodeTupleTable ;
+    protected NodeTupleTable nodeTupleTable ;
 
-    public NodeTupleTableWrapper(NodeTupleTable ntt) { this.nodeTupleTable = ntt ; }
+    public NodeTupleTableWrapper(NodeTupleTable ntt)
+    { 
+        setNodeTupleTable(ntt) ;
+    }
+    
+    protected NodeTupleTable setNodeTupleTable(NodeTupleTable ntt)
+    {
+        NodeTupleTable old = nodeTupleTable ;
+        nodeTupleTable = ntt ;
+        return old ;
+    }
      
     @Override
     public boolean addRow(Node... nodes)

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/BlockMgrJournal.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/BlockMgrJournal.java?rev=1138927&r1=1138926&r2=1138927&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/BlockMgrJournal.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/BlockMgrJournal.java Thu Jun 23 15:25:51 2011
@@ -33,6 +33,7 @@ public class BlockMgrJournal implements 
     final private Map<Long, Block> writeBlocks = new HashMap<Long, Block>() ;
     final private Map<Long, Block> freedBlocks = new HashMap<Long, Block>() ;
     private boolean closed = false ;
+    private boolean active = false ;
     
     public BlockMgrJournal(Transaction txn, FileRef fileRef, BlockMgr underlyingBlockMgr, Journal journal)
     {