directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1595435 - /directory/mavibot/branches/with-txns/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java
Date Sat, 17 May 2014 08:33:21 GMT
Author: elecharny
Date: Sat May 17 08:33:21 2014
New Revision: 1595435

URL: http://svn.apache.org/r1595435
Log:
Added some check to forbid operations on a BTree without a transactionManager

Modified:
    directory/mavibot/branches/with-txns/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java

Modified: directory/mavibot/branches/with-txns/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java
URL: http://svn.apache.org/viewvc/directory/mavibot/branches/with-txns/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java?rev=1595435&r1=1595434&r2=1595435&view=diff
==============================================================================
--- directory/mavibot/branches/with-txns/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java
(original)
+++ directory/mavibot/branches/with-txns/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java
Sat May 17 08:33:21 2014
@@ -150,6 +150,12 @@ import org.apache.directory.mavibot.btre
      */
     public TupleCursor<K, V> browse( long revision ) throws IOException, KeyNotFoundException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         ReadTransaction<K, V> transaction = beginReadTransaction( revision );
 
         if ( transaction == null )
@@ -173,6 +179,12 @@ import org.apache.directory.mavibot.btre
      */
     public TupleCursor<K, V> browseFrom( K key ) throws IOException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         ReadTransaction<K, V> transaction = beginReadTransaction();
 
         ParentPos<K, V>[] stack = (ParentPos<K, V>[]) Array.newInstance( ParentPos.class,
32 );
@@ -196,6 +208,12 @@ import org.apache.directory.mavibot.btre
      */
     public TupleCursor<K, V> browseFrom( long revision, K key ) throws IOException,
KeyNotFoundException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         ReadTransaction<K, V> transaction = beginReadTransaction( revision );
 
         if ( transaction == null )
@@ -219,6 +237,12 @@ import org.apache.directory.mavibot.btre
      */
     public boolean contains( K key, V value ) throws IOException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         ReadTransaction<K, V> transaction = beginReadTransaction();
 
         if ( transaction == null )
@@ -248,6 +272,12 @@ import org.apache.directory.mavibot.btre
      */
     public boolean contains( long revision, K key, V value ) throws IOException, KeyNotFoundException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         // Fetch the root page for this revision
         ReadTransaction<K, V> transaction = beginReadTransaction( revision );
 
@@ -274,6 +304,12 @@ import org.apache.directory.mavibot.btre
      */
     public Tuple<K, V> delete( K key ) throws IOException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         if ( key == null )
         {
             throw new IllegalArgumentException( "Key must not be null" );
@@ -306,6 +342,12 @@ import org.apache.directory.mavibot.btre
      */
     public Tuple<K, V> delete( K key, V value ) throws IOException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         if ( key == null )
         {
             throw new IllegalArgumentException( "Key must not be null" );
@@ -356,6 +398,12 @@ import org.apache.directory.mavibot.btre
      */
     public V insert( K key, V value ) throws IOException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         V existingValue = null;
 
         if ( key == null )
@@ -421,6 +469,12 @@ import org.apache.directory.mavibot.btre
      */
     public V get( K key ) throws IOException, KeyNotFoundException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         ReadTransaction<K, V> transaction = beginReadTransaction();
 
         if ( transaction == null )
@@ -446,6 +500,12 @@ import org.apache.directory.mavibot.btre
      */
     public V get( long revision, K key ) throws IOException, KeyNotFoundException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         ReadTransaction<K, V> transaction = beginReadTransaction( revision );
 
         if ( transaction == null )
@@ -483,6 +543,12 @@ import org.apache.directory.mavibot.btre
      */
     public ValueCursor<V> getValues( K key ) throws IOException, KeyNotFoundException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         ReadTransaction<K, V> transaction = beginReadTransaction();
 
         if ( transaction == null )
@@ -508,6 +574,12 @@ import org.apache.directory.mavibot.btre
      */
     public boolean hasKey( K key ) throws IOException, KeyNotFoundException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         if ( key == null )
         {
             return false;
@@ -538,6 +610,12 @@ import org.apache.directory.mavibot.btre
      */
     public boolean hasKey( long revision, K key ) throws IOException, KeyNotFoundException
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         if ( key == null )
         {
             return false;
@@ -624,6 +702,12 @@ import org.apache.directory.mavibot.btre
      */
     public long getRevision()
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         ReadTransaction<K, V> transaction = beginReadTransaction();
 
         if ( transaction == null )
@@ -725,6 +809,12 @@ import org.apache.directory.mavibot.btre
      */
     public long getNbElems()
     {
+        // Check that we have a TransactionManager
+        if ( transactionManager == null )
+        {
+            throw new BTreeCreationException( "We don't have a transactionLManager" );
+        }
+
         ReadTransaction<K, V> transaction = beginReadTransaction();
 
         if ( transaction == null )



Mime
View raw message