org.apache.commons.transaction.file
Class TxFileResourceManager

java.lang.Object
  extended by org.apache.commons.transaction.AbstractTransactionalResourceManager<TxFileResourceManager.FileTxContext>
      extended by org.apache.commons.transaction.file.TxFileResourceManager
All Implemented Interfaces:
ManageableResourceManager, ResourceManager<StreamableResource>, TransactionalResourceManager

public class TxFileResourceManager
extends AbstractTransactionalResourceManager<TxFileResourceManager.FileTxContext>
implements ManageableResourceManager, ResourceManager<StreamableResource>

Transactional file system implementation of a resource manager.

All meaningful actions that ensure ACID transactions are delegated to special components. This allows for customization of all kinds:

This implementation is thread-safe.

See Also:
FileResourceUndoManager, ResourceManager, HierarchicalLockManager, LockManager

Nested Class Summary
 class TxFileResourceManager.FileTxContext
           
 
Nested classes/interfaces inherited from class org.apache.commons.transaction.AbstractTransactionalResourceManager
AbstractTransactionalResourceManager.AbstractTxContext
 
Field Summary
protected  HierarchicalLockManager hlm
           
protected  FileResourceUndoManager undoManager
           
protected  FileResourceManager wrapped
           
 
Fields inherited from class org.apache.commons.transaction.AbstractTransactionalResourceManager
activeTx
 
Constructor Summary
TxFileResourceManager(String name, String rootPath)
           
 
Method Summary
 boolean commitCanFail()
          Checks whether a tried commit could possibly fail because of logical reasons.
protected  TxFileResourceManager.FileTxContext createContext()
           
protected  HierarchicalLockManager getHLM()
           
 FileResourceManager.FileResource getResource(String path)
          Gets the resource denoted by the path
 String getRootPath()
          Gets the root path of this manager.
protected  FileResourceUndoManager getUndoManager()
           
 void setLm(LockManager<Object,Object> lm)
           
 void setUndoManager(FileResourceUndoManager undoManager)
           
 
Methods inherited from class org.apache.commons.transaction.AbstractTransactionalResourceManager
commitTransaction, forgetTransaction, getActiveTx, getCheckedActiveTx, getLm, getName, isPartofComplexTransaction, isReadOnly, isRollbackOnly, joinTransaction, prepareTransaction, rollbackTransaction, setActiveTx, setName, startTransaction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.transaction.ManageableResourceManager
forgetTransaction, isReadOnly, isRollbackOnly, joinTransaction, prepareTransaction
 
Methods inherited from interface org.apache.commons.transaction.TransactionalResourceManager
commitTransaction, rollbackTransaction, startTransaction
 

Field Detail

wrapped

protected FileResourceManager wrapped

undoManager

protected FileResourceUndoManager undoManager

hlm

protected HierarchicalLockManager hlm
Constructor Detail

TxFileResourceManager

public TxFileResourceManager(String name,
                             String rootPath)
Method Detail

setLm

public void setLm(LockManager<Object,Object> lm)
Overrides:
setLm in class AbstractTransactionalResourceManager<TxFileResourceManager.FileTxContext>

commitCanFail

public boolean commitCanFail()
Description copied from interface: ManageableResourceManager
Checks whether a tried commit could possibly fail because of logical reasons.

Specified by:
commitCanFail in interface ManageableResourceManager
Specified by:
commitCanFail in class AbstractTransactionalResourceManager<TxFileResourceManager.FileTxContext>
Returns:
true if a commit could fail

getResource

public FileResourceManager.FileResource getResource(String path)
                                             throws ResourceException
Description copied from interface: ResourceManager
Gets the resource denoted by the path

Specified by:
getResource in interface ResourceManager<StreamableResource>
Parameters:
path - the path of the resource
Returns:
the resource denoted by the path
Throws:
ResourceException - in case anything goes fatally wrong

getRootPath

public String getRootPath()
Description copied from interface: ResourceManager
Gets the root path of this manager.

Specified by:
getRootPath in interface ResourceManager<StreamableResource>
Returns:
the root path or null if no applicable

setUndoManager

public void setUndoManager(FileResourceUndoManager undoManager)

createContext

protected TxFileResourceManager.FileTxContext createContext()
Specified by:
createContext in class AbstractTransactionalResourceManager<TxFileResourceManager.FileTxContext>

getHLM

protected HierarchicalLockManager getHLM()

getUndoManager

protected FileResourceUndoManager getUndoManager()


Copyright © 2004-2007 The Apache Software Foundation. All Rights Reserved.