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/28 22:31:16 UTC
svn commit: r1140828 - in /incubator/jena/Experimental/TxTDB/trunk:
src-dev/tx/NodeTableTrans.java src/test/java/com/hp/hpl/jena/tdb/TC_TDB.java
Author: andy
Date: Tue Jun 28 20:31:15 2011
New Revision: 1140828
URL: http://svn.apache.org/viewvc?rev=1140828&view=rev
Log: (empty)
Added:
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/NodeTableTrans.java (with props)
Modified:
incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/TC_TDB.java
Added: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/NodeTableTrans.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/NodeTableTrans.java?rev=1140828&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/NodeTableTrans.java (added)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/NodeTableTrans.java Tue Jun 28 20:31:15 2011
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tx;
+
+import java.util.Iterator ;
+import java.util.Map ;
+
+import org.openjena.atlas.lib.Pair ;
+
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.tdb.base.objectfile.ObjectFile ;
+import com.hp.hpl.jena.tdb.nodetable.NodeTable ;
+import com.hp.hpl.jena.tdb.store.NodeId ;
+
+public class NodeTableTrans implements NodeTable
+{
+ private final NodeTable other ;
+ private final long offset ;
+ private final ObjectFile journal ;
+
+ private Map<Node, NodeId> node2NodeId ;
+ private Map<NodeId, Node> nodeId2Node ;
+
+ public NodeTableTrans(NodeTable sub, long offset, ObjectFile journal)
+ {
+ this.other = sub ;
+ this.offset = offset ;
+ this.journal = journal ;
+ }
+
+ @Override
+ public NodeId getAllocateNodeId(Node node)
+ {
+ NodeId nodeId = getNodeIdForNode(node) ;
+ if ( ! NodeId.doesNotExist(nodeId) )
+ return nodeId ;
+ // add to journal
+ nodeId = allocate(node) ;
+ // Convert
+ long x = nodeId.getId() ;
+ nodeId = new NodeId(x+offset) ;
+ node2NodeId.put(node, nodeId) ;
+ nodeId2Node.put(nodeId, node) ;
+
+ return nodeId ;
+ }
+
+ @Override
+ public NodeId getNodeIdForNode(Node node)
+ {
+ NodeId nodeId = node2NodeId.get(node) ;
+ if ( nodeId != null )
+ return nodeId ;
+ nodeId = other.getNodeIdForNode(node) ;
+ return nodeId ;
+ }
+
+ @Override
+ public Node getNodeForNodeId(NodeId id)
+ {
+ Node node = nodeId2Node.get(id) ;
+ if ( node != null )
+ return node ;
+ node = other.getNodeForNodeId(id) ;
+ return node ;
+ }
+
+ private NodeId allocate(Node node)
+ {
+ return null ;
+ }
+
+ @Override
+ public Iterator<Pair<NodeId, Node>> all()
+ {
+ return null ;
+ }
+
+ @Override
+ public void sync()
+ {}
+
+ @Override
+ public void close()
+ {}
+
+}
+
Propchange: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/NodeTableTrans.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/TC_TDB.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/TC_TDB.java?rev=1140828&r1=1140827&r2=1140828&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/TC_TDB.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/TC_TDB.java Tue Jun 28 20:31:15 2011
@@ -17,11 +17,7 @@ import org.junit.runners.Suite ;
import com.hp.hpl.jena.sparql.engine.optimizer.reorder.ReorderLib ;
import com.hp.hpl.jena.tdb.assembler.TS_TDBAssembler ;
import com.hp.hpl.jena.tdb.base.TC_Base ;
-import com.hp.hpl.jena.tdb.base.block.TS_Block ;
-import com.hp.hpl.jena.tdb.base.file.TS_File ;
import com.hp.hpl.jena.tdb.base.objectfile.TS_ObjectFile ;
-import com.hp.hpl.jena.tdb.base.record.TS_Record ;
-import com.hp.hpl.jena.tdb.base.recordfile.TS_RecordFile ;
import com.hp.hpl.jena.tdb.graph.TS_Graph ;
import com.hp.hpl.jena.tdb.index.TS_Index ;
import com.hp.hpl.jena.tdb.lib.TS_LibTDB ;