|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.transaction.file.FileSequence
public class FileSequence
Fail-Safe sequence store implementation using the file system. Works by versioning values of sequences and throwing away all versions, but the current and the previous one.
Field Summary | |
---|---|
protected LoggerFacade |
logger
|
protected String |
storeDir
|
Constructor Summary | |
---|---|
FileSequence(String storeDir,
LoggerFacade logger)
Creates a new resouce manager operation on the specified directories. |
Method Summary | |
---|---|
boolean |
create(String sequenceName,
long initialValue)
Creates a sequence if it does not already exist. |
boolean |
delete(String sequenceName)
Deletes a sequence if it exists. |
boolean |
exists(String sequenceName)
Checks if the sequence already exists. |
protected String |
getPathI(String sequenceName)
|
protected String |
getPathII(String sequenceName)
|
long |
nextSequenceValueBottom(String sequenceName,
long increment)
Gets the next value of the sequence. |
protected long |
read(String sequenceName)
|
protected long |
readFromPath(String path)
|
protected void |
write(String sequenceName,
long value)
|
protected void |
writeToPath(String path,
long value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final String storeDir
protected final LoggerFacade logger
Constructor Detail |
---|
public FileSequence(String storeDir, LoggerFacade logger) throws ResourceManagerException
storeDir
- directory where sequence information is storedlogger
- logger used for warnings only
ResourceManagerException
Method Detail |
---|
public boolean exists(String sequenceName)
sequenceName
- the name of the sequence you want to check
true
if the sequence already exists, false
otherwisepublic boolean create(String sequenceName, long initialValue) throws ResourceManagerException
sequenceName
- the name of the sequence you want to create
true
if the sequence has been created, false
if it already existed
ResourceManagerException
- if anything goes wrong while accessing the sequencepublic boolean delete(String sequenceName)
sequenceName
- the name of the sequence you want to delete
true
if the sequence has been deleted, false
if notpublic long nextSequenceValueBottom(String sequenceName, long increment) throws ResourceManagerException
sequenceName
- the name of the sequence you want the next value forincrement
- the increment for the sequence, i.e. how much to add to the sequence with this call
ResourceManagerException
- if anything goes wrong while accessing the sequenceprotected long read(String sequenceName) throws ResourceManagerException
ResourceManagerException
protected void write(String sequenceName, long value) throws ResourceManagerException
ResourceManagerException
protected String getPathI(String sequenceName)
protected String getPathII(String sequenceName)
protected long readFromPath(String path) throws ResourceManagerException, NumberFormatException, FileNotFoundException, IOException
ResourceManagerException
NumberFormatException
FileNotFoundException
IOException
protected void writeToPath(String path, long value) throws ResourceManagerException
ResourceManagerException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |