public class FileSequence extends Object
| Modifier and Type | Field and Description |
|---|---|
protected LoggerFacade |
logger |
protected String |
storeDir |
| Constructor and Description |
|---|
FileSequence(String storeDir,
LoggerFacade logger)
Creates a new resouce manager operation on the specified directories.
|
| Modifier and Type | Method and Description |
|---|---|
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) |
protected final LoggerFacade logger
public FileSequence(String storeDir, LoggerFacade logger) throws ResourceManagerException
storeDir - directory where sequence information is storedlogger - logger used for warnings onlyResourceManagerExceptionpublic boolean exists(String sequenceName)
sequenceName - the name of the sequence you want to checktrue if the sequence already exists, false otherwisepublic boolean create(String sequenceName, long initialValue) throws ResourceManagerException
sequenceName - the name of the sequence you want to createtrue if the sequence has been created, false if it already existedResourceManagerException - if anything goes wrong while accessing the sequencepublic boolean delete(String sequenceName)
sequenceName - the name of the sequence you want to deletetrue 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 callResourceManagerException - if anything goes wrong while accessing the sequenceprotected long read(String sequenceName) throws ResourceManagerException
ResourceManagerExceptionprotected void write(String sequenceName, long value) throws ResourceManagerException
ResourceManagerExceptionprotected long readFromPath(String path) throws ResourceManagerException, NumberFormatException, FileNotFoundException, IOException
protected void writeToPath(String path, long value) throws ResourceManagerException
ResourceManagerExceptionCopyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.