org.akubraproject.txn.derby
Class TransactionalConnection

java.lang.Object
  extended by org.akubraproject.impl.AbstractBlobStoreConnection
      extended by org.akubraproject.txn.AbstractTransactionalConnection
          extended by org.akubraproject.txn.SQLTransactionalConnection
              extended by org.akubraproject.txn.derby.TransactionalConnection
All Implemented Interfaces:
Synchronization, org.akubraproject.BlobStoreConnection

public class TransactionalConnection
extends SQLTransactionalConnection

A connection for the transactional store.

Author:
Ronald Tschalär

Nested Class Summary
 
Nested classes/interfaces inherited from class org.akubraproject.txn.SQLTransactionalConnection
SQLTransactionalConnection.RSBlobIdIterator
 
Nested classes/interfaces inherited from class org.akubraproject.txn.AbstractTransactionalConnection
AbstractTransactionalConnection.TxnBlob
 
Field Summary
 
Fields inherited from class org.akubraproject.txn.SQLTransactionalConnection
con, xaCon
 
Fields inherited from class org.akubraproject.txn.AbstractTransactionalConnection
blobCache, bStoreCon, delBlobs, isCompleted, newBlobs, tx
 
Fields inherited from class org.akubraproject.impl.AbstractBlobStoreConnection
closed, owner, streamManager
 
Method Summary
protected  void addNameEntry(URI ourId, URI storeId)
          Add an id mapping.
 void afterCompletion(int status)
          Invoked after the transaction has completed, i.e.
 void beforeCompletion()
          Invoked before the transaction is completed, i.e.
protected  URI getRealId(URI blobId)
          Look up the underlying store's blob-id for the given upper-level blob-id.
 Iterator<URI> listBlobIds(String filterPrefix)
           
protected  void remBlob(URI ourId, URI storeId)
          Remove a blob from the underlying store.
protected  void remNameEntry(URI ourId, URI storeId)
          Remove an id mapping.
protected  void validateId(URI blobId)
          Check whether we can store this id.
 
Methods inherited from class org.akubraproject.txn.AbstractTransactionalConnection
addBlob, getBlob, sync
 
Methods inherited from class org.akubraproject.impl.AbstractBlobStoreConnection
close, ensureOpen, getBlob, getBlobStore, isClosed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

listBlobIds

public Iterator<URI> listBlobIds(String filterPrefix)
                          throws IOException
Throws:
IOException

validateId

protected void validateId(URI blobId)
                   throws org.akubraproject.UnsupportedIdException
Description copied from class: AbstractTransactionalConnection
Check whether we can store this id.

Overrides:
validateId in class AbstractTransactionalConnection
Parameters:
blobId - the upper level blob-id
Throws:
org.akubraproject.UnsupportedIdException - if the id cannot be stored

getRealId

protected URI getRealId(URI blobId)
                 throws IOException
Description copied from class: AbstractTransactionalConnection
Look up the underlying store's blob-id for the given upper-level blob-id.

Specified by:
getRealId in class AbstractTransactionalConnection
Parameters:
blobId - the upper level blob-id
Returns:
the underlying blob-id that blobId maps to, or null if no such mapping exists (i.e. blobId is not a known upper-level blob-id)
Throws:
IOException - if an error occurred looking up the id

remNameEntry

protected void remNameEntry(URI ourId,
                            URI storeId)
                     throws IOException
Description copied from class: AbstractTransactionalConnection
Remove an id mapping.

Specified by:
remNameEntry in class AbstractTransactionalConnection
Parameters:
ourId - the upper-level blob-id
storeId - the underlying store's blob-id
Throws:
IOException - if an error occurred removing the mapping or the mapping does not exist

addNameEntry

protected void addNameEntry(URI ourId,
                            URI storeId)
                     throws IOException
Description copied from class: AbstractTransactionalConnection
Add an id mapping.

Specified by:
addNameEntry in class AbstractTransactionalConnection
Parameters:
ourId - the upper-level blob-id to map
storeId - the underlying store's blob-id to map ourId to
Throws:
IOException - if an error occurred adding the mapping or the mapping already exists

remBlob

protected void remBlob(URI ourId,
                       URI storeId)
                throws IOException
Description copied from class: AbstractTransactionalConnection
Remove a blob from the underlying store. This implementation just updates the AbstractTransactionalConnection.newBlobs and AbstractTransactionalConnection.delBlobs lists; actual blob deletion is deferred till commit.

Overrides:
remBlob in class AbstractTransactionalConnection
Parameters:
ourId - the upper-level blob-id
storeId - the underlying store's blob-id
Throws:
IOException - if an error occurred removing the blob or the blob does not exist

beforeCompletion

public void beforeCompletion()
Description copied from class: AbstractTransactionalConnection
Invoked before the transaction is completed, i.e. before a rollback or commit is started. Whether or not this is called on a rollback may vary.

Specified by:
beforeCompletion in interface Synchronization
Overrides:
beforeCompletion in class AbstractTransactionalConnection
See Also:
Synchronization.beforeCompletion()

afterCompletion

public void afterCompletion(int status)
Description copied from class: AbstractTransactionalConnection
Invoked after the transaction has completed, i.e. after a rollback or commit has finished. This is always callled.

Subclasses that override this must make sure to invoke super.afterCompletion so that the cleanup code in this implementation is run. This implementation cleans up deleted or added blobs (depending on the outcome of the transaction).

Specified by:
afterCompletion in interface Synchronization
Overrides:
afterCompletion in class SQLTransactionalConnection
See Also:
Synchronization.afterCompletion(int)


Copyright © 2009-2012 DuraSpace. All Rights Reserved.