jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1166864 - in /incubator/jena/Experimental/TxTDB/trunk/src-dev/tx: GraphTDBTransactionHandler.java TransBlob.java
Date Thu, 08 Sep 2011 19:06:56 GMT
Author: andy
Date: Thu Sep  8 19:06:55 2011
New Revision: 1166864

URL: http://svn.apache.org/viewvc?rev=1166864&view=rev
Log:
Sketch graph transactions.

Added:
    incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/GraphTDBTransactionHandler.java   (with
props)
    incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TransBlob.java   (with props)

Added: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/GraphTDBTransactionHandler.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/GraphTDBTransactionHandler.java?rev=1166864&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/GraphTDBTransactionHandler.java (added)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/GraphTDBTransactionHandler.java Thu
Sep  8 19:06:55 2011
@@ -0,0 +1,65 @@
+/**
+ * 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 com.hp.hpl.jena.graph.TransactionHandler ;
+import com.hp.hpl.jena.shared.Command ;
+import com.hp.hpl.jena.tdb.store.GraphTDB ;
+
+public class GraphTDBTransactionHandler implements TransactionHandler 
+{
+    // Replaces: TransactionHandlerTDB
+    // Don't know read or write :-(
+    // So grab the real transaction when first update occurs.
+    // Start read.
+    // If update, start write, end read.
+    // 
+    
+    
+    private final GraphTDB graph ;
+
+    public GraphTDBTransactionHandler(GraphTDB graph)
+    { this.graph = graph ; }
+    
+    @Override
+    public boolean transactionsSupported()
+    {
+        return false ;
+    }
+
+    @Override
+    public void begin()
+    {}
+
+    @Override
+    public void abort()
+    {}
+
+    @Override
+    public void commit()
+    {}
+
+    @Override
+    public Object executeInTransaction(Command c)
+    {
+        return null ;
+    }
+
+}
+

Propchange: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/GraphTDBTransactionHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TransBlob.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TransBlob.java?rev=1166864&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TransBlob.java (added)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TransBlob.java Thu Sep  8 19:06:55
2011
@@ -0,0 +1,88 @@
+/**
+ * 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.nio.ByteBuffer ;
+
+import com.hp.hpl.jena.tdb.base.file.BlockAccess ;
+import com.hp.hpl.jena.tdb.sys.FileRef ;
+import com.hp.hpl.jena.tdb.transaction.Journal ;
+import com.hp.hpl.jena.tdb.transaction.JournalEntryType ;
+import com.hp.hpl.jena.tdb.transaction.Transaction ;
+import com.hp.hpl.jena.tdb.transaction.TransactionLifecycle ;
+
+/** Write a blob, transactional */
+public class TransBlob implements TransactionLifecycle
+{
+    // And need a block mgr
+    
+    private ByteBuffer bytes ;
+    private final FileRef file ;
+    private final BlockAccess access ;
+
+    public TransBlob(BlockAccess blockAccess, FileRef file)
+    {
+        this.access = blockAccess ;
+        // BlockMgrFileAccess.
+        this.file = file ;
+    }
+    
+    public void setValue(ByteBuffer bytes)
+    {
+        // Copy for safety?
+        this.bytes= bytes ;
+    }
+
+    public ByteBuffer getValue()
+    {
+        return bytes ;
+    }
+    
+    @Override
+    public void begin(Transaction txn)
+    {
+    }
+
+    @Override
+    public void abort(Transaction txn)
+    {}
+
+    @Override
+    public void commitPrepare(Transaction txn)
+    {
+        Journal journal = txn.getJournal() ;
+        //Block blk = new Block(0, bytes) ;
+        //JournalEntry entry = new JournalEntry(file, blk) ;
+
+        // And reply?
+        journal.writeJournal(JournalEntryType.Buffer, file, bytes) ;
+        
+       // replay : fileref -> remembered BlockMgr = BlockMgrFileAccess
+        
+    }
+
+    @Override
+    public void commitEnact(Transaction txn)
+    {}
+
+    @Override
+    public void commitClearup(Transaction txn)
+    {}
+}
+

Propchange: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TransBlob.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message