|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.akubraproject.impl.AbstractBlobStoreConnection
org.akubraproject.txn.AbstractTransactionalConnection
public abstract class AbstractTransactionalConnection
A basic superclass for transactional store connections. This implements the common blob-handling parts of a transactional connection, leaving subclasses to implement the transactional management of the id-mappings.
Subclasses must implement getRealId
, remNameEntry
,
addNameEntry
, listBlobIds
, and
override close
; in addition they may want to override beforeCompletion
and/or afterCompletion
for pre-
and post-commit/rollback processing.
The subclass is expected to implement id mapping, mapping upper-level blob-id's to underlying
blob-id's; these mappings are managed via the remNameEntry
and
addNameEntry
method, and getRealId
is used to query the mapping.
Nested Class Summary | |
---|---|
protected class |
AbstractTransactionalConnection.TxnBlob
A transactional blob implementation. |
Field Summary | |
---|---|
protected Map<URI,org.akubraproject.Blob> |
blobCache
a cache of blobs |
protected org.akubraproject.BlobStoreConnection |
bStoreCon
the underlying blob-store that actually stores the blobs |
protected List<URI> |
delBlobs
the list of underlying id's of deleted blobs |
protected boolean |
isCompleted
Whether or not the current transaction has been completed yet |
protected List<URI> |
newBlobs
the list of underlying id's of added blobs |
protected Transaction |
tx
the transaction this connection belongs to |
Fields inherited from class org.akubraproject.impl.AbstractBlobStoreConnection |
---|
closed, owner, streamManager |
Constructor Summary | |
---|---|
protected |
AbstractTransactionalConnection(org.akubraproject.BlobStore owner,
org.akubraproject.BlobStore bStore,
Transaction tx,
Map<String,String> hints)
Create a new transactional connection. |
Method Summary | |
---|---|
protected void |
addBlob(URI ourId,
URI storeId)
Add a blob to the underlying store. |
protected abstract 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. |
org.akubraproject.Blob |
getBlob(URI blobId,
Map<String,String> hints)
|
protected abstract URI |
getRealId(URI blobId)
Look up the underlying store's blob-id for the given upper-level blob-id. |
protected void |
remBlob(URI ourId,
URI storeId)
Remove a blob from the underlying store. |
protected abstract void |
remNameEntry(URI ourId,
URI storeId)
Remove an id mapping. |
void |
sync()
|
protected void |
validateId(URI blobId)
Check whether we can store this id. |
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 |
Methods inherited from interface org.akubraproject.BlobStoreConnection |
---|
listBlobIds |
Field Detail |
---|
protected final org.akubraproject.BlobStoreConnection bStoreCon
protected final Transaction tx
protected boolean isCompleted
protected final List<URI> newBlobs
protected final List<URI> delBlobs
protected final Map<URI,org.akubraproject.Blob> blobCache
Constructor Detail |
---|
protected AbstractTransactionalConnection(org.akubraproject.BlobStore owner, org.akubraproject.BlobStore bStore, Transaction tx, Map<String,String> hints) throws IOException
owner
- the blob-store we belong tobStore
- the underlying blob-store to usetx
- the transaction we belong tohints
- A set of hints for the openConnection
on the wrapped store
IOException
- if an error occurs initializing this connectionMethod Detail |
---|
public org.akubraproject.Blob getBlob(URI blobId, Map<String,String> hints) throws IOException
getBlob
in interface org.akubraproject.BlobStoreConnection
IOException
public void sync() throws IOException
sync
in interface org.akubraproject.BlobStoreConnection
IOException
protected void validateId(URI blobId) throws org.akubraproject.UnsupportedIdException
blobId
- the upper level blob-id
org.akubraproject.UnsupportedIdException
- if the id cannot be storedprotected abstract URI getRealId(URI blobId) throws IOException
blobId
- the upper level blob-id
IOException
- if an error occurred looking up the idprotected abstract void remNameEntry(URI ourId, URI storeId) throws IOException
ourId
- the upper-level blob-idstoreId
- the underlying store's blob-id
IOException
- if an error occurred removing the mapping or the mapping does not existprotected abstract void addNameEntry(URI ourId, URI storeId) throws IOException
ourId
- the upper-level blob-id to mapstoreId
- the underlying store's blob-id to map ourId to
IOException
- if an error occurred adding the mapping or the mapping already existsprotected void remBlob(URI ourId, URI storeId) throws IOException
newBlobs
and delBlobs
lists; actual blob deletion is deferred till commit.
ourId
- the upper-level blob-idstoreId
- the underlying store's blob-id
IOException
- if an error occurred removing the blob or the blob does not existprotected void addBlob(URI ourId, URI storeId) throws IOException
newBlobs
list; actual blob writing is done via the blob itself..
ourId
- the upper-level blob-idstoreId
- the underlying store's blob-id
IOException
- if an error occurred removing the blob or the blob does not existpublic void beforeCompletion()
beforeCompletion
in interface Synchronization
Synchronization.beforeCompletion()
public void afterCompletion(int status)
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).
afterCompletion
in interface Synchronization
Synchronization.afterCompletion(int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |