|
||||||||||
| 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 String |
storeDir
|
| Constructor Summary | |
|---|---|
FileSequence(String storeDir)
Creates a new resource 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
| Constructor Detail |
|---|
public FileSequence(String storeDir)
storeDir - directory where sequence information is stored| Method Detail |
|---|
public boolean exists(String sequenceName)
sequenceName - the name of the sequence you want to check
true if the sequence already exists,
false otherwise
public boolean create(String sequenceName,
long initialValue)
sequenceName - the name of the sequence you want to create
true if the sequence has been created,
false if it already existedpublic boolean delete(String sequenceName)
sequenceName - the name of the sequence you want to delete
true if the sequence has been deleted,
false if not
public long nextSequenceValueBottom(String sequenceName,
long increment)
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)
protected void write(String sequenceName,
long value)
protected String getPathI(String sequenceName)
protected String getPathII(String sequenceName)
protected long readFromPath(String path)
throws NumberFormatException,
FileNotFoundException,
IOException
NumberFormatException
FileNotFoundException
IOException
protected void writeToPath(String path,
long value)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||