| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectatg.nucleus.logging.VariableArgumentApplicationLoggingImpl
atg.nucleus.GenericService
atg.service.idgen.AbstractSequentialIdGenerator
atg.service.idgen.PersistentIdGenerator
atg.service.idgen.FileIdGenerator
public class FileIdGenerator
PersistentIdGenerator that stores IdSpaces in a flat
 file as a serialized Map. This implementation is
 not suitable for distributed systems.
This implementation is intended for use in applications that desire simple persistent ids but do not need the transactional features of a database. For example, a file logger may associate ids with log entries. The file logger needs the ids to be unique across JVM restarts, however it does not need to share these ids with loggers in other JVMs.
Different applications can use a single instance of the file id generator. Different file id generators must not use the same data file.
No file locking is attempted. The flat file should not be modified by any other facility, nor should it be read while it is in use.
| Field Summary | |
|---|---|
| static java.lang.String | CLASS_VERSIONClass version string | 
| Fields inherited from class atg.service.idgen.PersistentIdGenerator | 
|---|
| ERR_ADD_BAD_STATE, ERR_ADD_NULL_SPACE, ERR_READING_BOOTSTRAP_SPACES, STATE_ERROR, STATE_INITIALIZING, STATE_NEW, STATE_RUNNING, WARN_PICKING_DEFAULT | 
| Fields inherited from class atg.service.idgen.AbstractSequentialIdGenerator | 
|---|
| ERR_BAD_SPACE, ERR_ROLLBACK, ERR_UNSUPPORTED, mSpaces, RESOURCE_BUNDLE_NAME, sResourceBundle | 
| Fields inherited from class atg.nucleus.GenericService | 
|---|
| SERVICE_INFO_KEY | 
| Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging | 
|---|
| DEFAULT_LOG_TRACE_STATUS | 
| Fields inherited from interface atg.nucleus.logging.ApplicationLogging | 
|---|
| DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS | 
| Constructor Summary | |
|---|---|
| FileIdGenerator() | |
| Method Summary | |
|---|---|
| protected  boolean | addPersistentIdSpace(IdSpace pSpace)Add an id space to the data store. | 
|  java.io.File | getDataFile()Get property dataFile. | 
|  void | initialize()Initialize the id generator mgkmgk: need to override this as we do not want a transaction manager may need to factor the initialize in our parent...bleh | 
| protected  void | initializeIdSpaces()Initialize the id spaces from the data store. | 
|  boolean | isMakeDirs()Returns whether or not the parent directories of the data file should be created if they don't exist. | 
| protected  void | reserveSeeds(IdSpace pSpace)Reserve a batch of seeds for the specified id space from the persistent store. | 
|  void | setDataFile(java.io.File pDataFile)Set property dataFile. | 
|  void | setMakeDirs(boolean pMakeDirs)Sets whether or not the parent directories of the data file should be created if they don't exist. | 
| Methods inherited from class atg.service.idgen.PersistentIdGenerator | 
|---|
| addIdSpace, getInitialIdSpaces, getLoadInitialIdSpacesAtStartup, getTransactionManager, getXMLToolsFactory, removeAllIdSpaces, removeIdSpace, setInitialIdSpaces, setLoadInitialIdSpacesAtStartup, setTransactionManager, setXMLToolsFactory | 
| Methods inherited from class atg.service.idgen.AbstractSequentialIdGenerator | 
|---|
| doStartService, format, format, format, format, generateLongId, generateLongId, generateStringId, generateStringId, getAutoCreate, getBundle, getDefaultIdSpace, getDefaultIdSpaceName, getIdSpace, getIdSpaces, getResourceBundleName, isAutoCreate, postGenerateLongId, postGenerateStringId, setAutoCreate, setDefaultIdSpace, setDefaultIdSpaceName, setHighWaterMark, toString | 
| Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl | 
|---|
| vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface atg.service.idgen.IdGenerator | 
|---|
| generateLongId, generateLongId, generateStringId, generateStringId, getAutoCreate, getDefaultIdSpace, getIdSpace, getIdSpaces, isAutoCreate, setAutoCreate | 
| Field Detail | 
|---|
public static java.lang.String CLASS_VERSION
| Constructor Detail | 
|---|
public FileIdGenerator()
| Method Detail | 
|---|
public void setDataFile(java.io.File pDataFile)
dataFile. This is
 the file to hold the persistent state of this id generator.
pDataFile - new value to setpublic java.io.File getDataFile()
dataFile. This is
 the file to hold the persistent state of this id generator.
dataFilepublic boolean isMakeDirs()
public void setMakeDirs(boolean pMakeDirs)
pMakeDirs - the makeDirs to set
public void initialize()
                throws IdGeneratorException
initialize in interface IdGeneratorinitialize in class PersistentIdGeneratorIdGeneratorException - if there is an error
 initializing. If initialization was unsuccessful the
 IdGeneratorException may have a source exception which is a chain
 of all of the exceptions encountered during the attempt to initialize
protected void initializeIdSpaces()
                           throws IdGeneratorException
initializeIdSpaces in class PersistentIdGeneratorIdGeneratorException - if there is a problem
protected boolean addPersistentIdSpace(IdSpace pSpace)
                                throws IdGeneratorException
addPersistentIdSpace in class PersistentIdGeneratorpSpace - space to add, cannot be null. Nota Bene: this may be
 modified by this method.
IdGeneratorException - if there is trouble adding id space
protected void reserveSeeds(IdSpace pSpace)
                     throws IdGeneratorException
reserveSeeds in class PersistentIdGeneratorpSpace - space in which to reserve seeds, must not be null
IdGeneratorException - if there is a problem with the
 persistent store| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||