|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.transaction.file.FileResourceManager
org.apache.commons.transaction.file.VirtualAdminCommandsFileResourceManager
public class VirtualAdminCommandsFileResourceManager
A resource manager for streamable objects stored in a file system that features additional administration commands.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.commons.transaction.file.FileResourceManager |
---|
FileResourceManager.TransactionContext |
Field Summary | |
---|---|
protected String |
virtualAdminPath
|
Fields inherited from class org.apache.commons.transaction.file.FileResourceManager |
---|
cleanUp, CONTEXT_FILE, debug, DEFAULT_COMMIT_TIMEOUT_FACTOR, DEFAULT_ISOLATION_LEVEL, DEFAULT_PARAMETER_ENCODING, DEFAULT_TIMEOUT_MSECS, defaultTimeout, dirty, globalOpenResources, globalTransactions, idCnt, idMapper, LOCK_ACCESS, LOCK_COMMIT, LOCK_EXCLUSIVE, LOCK_SHARED, lockManager, logger, NATIVE_ISOLATION_LEVEL, NO_LOCK, OPERATION_MODE_RECOVERING, OPERATION_MODE_STARTED, OPERATION_MODE_STARTING, OPERATION_MODE_STOPPED, OPERATION_MODE_STOPPING, operationMode, storeDir, txIdMapper, WORK_CHANGE_DIR, WORK_DELETE_DIR, workDir |
Fields inherited from interface org.apache.commons.transaction.file.ResourceManager |
---|
ISOLATION_LEVEL_READ_COMMITTED, ISOLATION_LEVEL_READ_UNCOMMITTED, ISOLATION_LEVEL_REPEATABLE_READ, ISOLATION_LEVEL_SERIALIZABLE, PREPARE_FAILURE, PREPARE_SUCCESS, PREPARE_SUCCESS_READONLY, SHUTDOWN_MODE_KILL, SHUTDOWN_MODE_NORMAL, SHUTDOWN_MODE_ROLLBACK |
Fields inherited from interface javax.transaction.Status |
---|
STATUS_ACTIVE, STATUS_COMMITTED, STATUS_COMMITTING, STATUS_MARKED_ROLLBACK, STATUS_NO_TRANSACTION, STATUS_PREPARED, STATUS_PREPARING, STATUS_ROLLEDBACK, STATUS_ROLLING_BACK, STATUS_UNKNOWN |
Fields inherited from interface org.apache.commons.transaction.file.ResourceManagerErrorCodes |
---|
ERR_DEAD_LOCK, ERR_DUP_TX, ERR_ISOLATION_LEVEL_UNSUPPORTED, ERR_LOCK, ERR_MARKED_FOR_ROLLBACK, ERR_NO_LOCK, ERR_NO_SUCH_RESOURCE, ERR_NO_TX, ERR_RESOURCE_EXISTS, ERR_RESOURCEID_INVALID, ERR_SYSTEM, ERR_SYSTEM_INCONSISTENT, ERR_THREAD_INVALID, ERR_TX_INACTIVE, ERR_TX_INCONSISTENT, ERR_TXID_INVALID, ERR_UNKNOWN |
Constructor Summary | |
---|---|
VirtualAdminCommandsFileResourceManager(String storeDir,
String workDir,
boolean urlEncodePath,
LoggerFacade logger)
Creates a new resource manager operation on the specified directories. |
|
VirtualAdminCommandsFileResourceManager(String storeDir,
String workDir,
boolean urlEncodePath,
LoggerFacade logger,
boolean debug)
Creates a new resource manager operation on the specified directories. |
|
VirtualAdminCommandsFileResourceManager(String storeDir,
String workDir,
ResourceIdToPathMapper idMapper,
LoggerFacade logger,
boolean debug)
Creates a new resource manager operation on the specified directories. |
|
VirtualAdminCommandsFileResourceManager(String storeDir,
String workDir,
ResourceIdToPathMapper idMapper,
TransactionIdToPathMapper txIdMapper,
LoggerFacade logger,
boolean debug)
Creates a new resource manager operation on the specified directories. |
Method Summary | |
---|---|
protected void |
checkForVirtualAdminCommand(Object resourceId)
|
void |
copyResource(Object txId,
Object fromResourceId,
Object toResourceId,
boolean overwrite)
|
void |
createResource(Object txId,
Object resourceId)
Creates a resource. |
void |
createResource(Object txId,
Object resourceId,
boolean assureOnly)
Creates a resource. |
void |
deleteResource(Object txId,
Object resourceId)
Deletes a resource. |
void |
deleteResource(Object txId,
Object resourceId,
boolean assureOnly)
Deletes a resource. |
protected InputStream |
executeAdminCommand(Object resourceId)
|
String |
getVirtualAdminPath()
|
protected boolean |
isAKnowCommand(String command)
|
protected boolean |
isVirtualAdminId(Object resourceId)
|
void |
moveResource(Object txId,
Object fromResourceId,
Object toResourceId,
boolean overwrite)
|
InputStream |
readResource(Object resourceId)
Opens a streamable resource for a single reading request not inside the scope of a transaction. |
InputStream |
readResource(Object txId,
Object resourceId)
Opens a streamable resource for reading. |
boolean |
resourceExists(Object resourceId)
Checks if a resource exists wihtout being in a transaction. |
boolean |
resourceExists(Object txId,
Object resourceId)
Checks if a resource exists. |
void |
setVirtualAdminPath(String virutalAdminPath)
|
OutputStream |
writeResource(Object txId,
Object resourceId,
boolean append)
|
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.file.ResourceManager |
---|
commitTransaction, getDefaultIsolationLevel, getDefaultTransactionTimeout, getIsolationLevel, getSupportedIsolationLevels, getTransactionState, getTransactionTimeout, isIsolationLevelSupported, lockResource, lockResource, lockResource, markTransactionForRollback, prepareTransaction, recover, rollbackTransaction, setIsolationLevel, setTransactionTimeout, start, startTransaction, stop, stop, writeResource |
Field Detail |
---|
protected String virtualAdminPath
Constructor Detail |
---|
public VirtualAdminCommandsFileResourceManager(String storeDir, String workDir, boolean urlEncodePath, LoggerFacade logger)
storeDir
- directory where main data should go after commitworkDir
- directory where transactions store temporary dataurlEncodePath
- if set to true
encodes all paths to allow for
any kind of characterslogger
- the logger to be used by this storepublic VirtualAdminCommandsFileResourceManager(String storeDir, String workDir, boolean urlEncodePath, LoggerFacade logger, boolean debug)
storeDir
- directory where main data should go after commitworkDir
- directory where transactions store temporary dataurlEncodePath
- if set to true
encodes all paths to allow for
any kind of characterslogger
- the logger to be used by this storedebug
- if set to true
logs all locking information to
"transaction.log" for debugging inspectionpublic VirtualAdminCommandsFileResourceManager(String storeDir, String workDir, ResourceIdToPathMapper idMapper, LoggerFacade logger, boolean debug)
storeDir
- directory where main data should go after commitworkDir
- directory where transactions store temporary dataidMapper
- mapper for resourceId to pathlogger
- the logger to be used by this storedebug
- if set to true
logs all locking information to
"transaction.log" for debugging inspectionpublic VirtualAdminCommandsFileResourceManager(String storeDir, String workDir, ResourceIdToPathMapper idMapper, TransactionIdToPathMapper txIdMapper, LoggerFacade logger, boolean debug)
storeDir
- directory where main data should go after commitworkDir
- directory where transactions store temporary dataidMapper
- mapper for resourceId to pathtxIdMapper
- mapper for transaction id to pathlogger
- the logger to be used by this storedebug
- if set to true
logs all locking information to
"transaction.log" for debugging inspectionMethod Detail |
---|
public String getVirtualAdminPath()
public void setVirtualAdminPath(String virutalAdminPath)
public boolean resourceExists(Object resourceId) throws ResourceManagerException
ResourceManager
resourceExists
in interface ResourceManager
resourceExists
in class FileResourceManager
resourceId
- identifier for the resource to check for
true
if the resource exists
ResourceManagerException
- if an error occuredpublic boolean resourceExists(Object txId, Object resourceId) throws ResourceManagerException
ResourceManager
resourceExists
in interface ResourceManager
resourceExists
in class FileResourceManager
txId
- identifier for the transaction in which the resource is to be checked forresourceId
- identifier for the resource to check for
true
if the resource exists
ResourceManagerException
- if an error occuredpublic void deleteResource(Object txId, Object resourceId) throws ResourceManagerException
ResourceManager
deleteResource
in interface ResourceManager
deleteResource
in class FileResourceManager
txId
- identifier for the transaction in which the resource is to be deletedresourceId
- identifier for the resource to be deleted
ResourceManagerException
- if the resource does not exist or any other error occuredpublic void deleteResource(Object txId, Object resourceId, boolean assureOnly) throws ResourceManagerException
ResourceManager
deleteResource
in interface ResourceManager
deleteResource
in class FileResourceManager
txId
- identifier for the transaction in which the resource is to be deletedresourceId
- identifier for the resource to be deletedassureOnly
- if set to true
this method will not throw an exception when the resource does not exist
ResourceManagerException
- if the resource does not exist and assureOnly
was not set to true
or any other error occuredpublic void createResource(Object txId, Object resourceId) throws ResourceManagerException
ResourceManager
createResource
in interface ResourceManager
createResource
in class FileResourceManager
txId
- identifier for the transaction in which the resource is to be createdresourceId
- identifier for the resource to be created
ResourceManagerException
- if the resource already exist or any other error occuredpublic void createResource(Object txId, Object resourceId, boolean assureOnly) throws ResourceManagerException
ResourceManager
createResource
in interface ResourceManager
createResource
in class FileResourceManager
txId
- identifier for the transaction in which the resource is to be createdresourceId
- identifier for the resource to be createdassureOnly
- if set to true
this method will not throw an exception when the resource already exists
ResourceManagerException
- if the resource already exists and assureOnly
was not set to true
or any other error occuredpublic void copyResource(Object txId, Object fromResourceId, Object toResourceId, boolean overwrite) throws ResourceManagerException
copyResource
in class FileResourceManager
ResourceManagerException
public void moveResource(Object txId, Object fromResourceId, Object toResourceId, boolean overwrite) throws ResourceManagerException
moveResource
in class FileResourceManager
ResourceManagerException
public InputStream readResource(Object resourceId) throws ResourceManagerException
ResourceManager
readResource
in interface ResourceManager
readResource
in class FileResourceManager
resourceId
- identifier for the streamable resource to be opened
ResourceManagerException
- if the resource does not exist or any other error occuredpublic InputStream readResource(Object txId, Object resourceId) throws ResourceManagerException
ResourceManager
readResource
in interface ResourceManager
readResource
in class FileResourceManager
txId
- identifier for the transaction in which the streamable resource is to be openendresourceId
- identifier for the streamable resource to be opened
ResourceManagerException
- if the resource does not exist or any other error occuredprotected void checkForVirtualAdminCommand(Object resourceId) throws ResourceManagerException
ResourceManagerException
protected boolean isVirtualAdminId(Object resourceId)
protected InputStream executeAdminCommand(Object resourceId)
protected boolean isAKnowCommand(String command)
public OutputStream writeResource(Object txId, Object resourceId, boolean append) throws ResourceManagerException
writeResource
in class FileResourceManager
ResourceManagerException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |