org.outerj.xreporter.idgenerator
Class FileBasedIdGenerator
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.outerj.xreporter.idgenerator.FileBasedIdGenerator
- All Implemented Interfaces:
- org.apache.avalon.framework.configuration.Configurable, IdGenerator, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.thread.ThreadSafe
- public class FileBasedIdGenerator
- extends org.apache.avalon.framework.logger.AbstractLogEnabled
- implements IdGenerator, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.thread.ThreadSafe
An ID-generator which reads (and stores) its starting ID from a file, so that always-increasing ID's
are obtained, even between XReporter restarts. The ID generator obtains its ID's in blocks:
each time it has reached the maximum ID in the current block, it reqeusts a new block by writing
(current ID value + block size) to the ID file.
Fields inherited from interface org.outerj.xreporter.idgenerator.IdGenerator |
ROLE |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
counter
protected int counter
maxValue
protected int maxValue
blockSize
protected int blockSize
sequenceFile
protected java.io.File sequenceFile
serverIdentifier
protected java.lang.String serverIdentifier
separator
protected java.lang.String separator
FileBasedIdGenerator
public FileBasedIdGenerator()
configure
public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
throws org.apache.avalon.framework.configuration.ConfigurationException
- Specified by:
configure
in interface org.apache.avalon.framework.configuration.Configurable
- Throws:
org.apache.avalon.framework.configuration.ConfigurationException
initialize
public void initialize()
throws java.lang.Exception
- Specified by:
initialize
in interface org.apache.avalon.framework.activity.Initializable
- Throws:
java.lang.Exception
getNewNumberBlock
public void getNewNumberBlock()
getId
public java.lang.String getId()
- Specified by:
getId
in interface IdGenerator