|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.service.idgen.AbstractSequentialIdGenerator atg.service.idgen.PersistentIdGenerator
public abstract class PersistentIdGenerator
An IdGenerator
that gives out ids suitable for use
with persistent objects. The ids are reserved in batches from some
a persistent data store. The ids generated generally sequential and
strictly increasing. A PersistentIdGenerator will not avoid ever
giving out the same id twice for a given IdSpace
, even
across restarts of the JVM.
This class reserves batches of ids from the data store and doles
them out one at a time. Thus the ids given out are generally
sequential and strictly increasing. Subclasses should indicate
whether or not they are safe to use in a distributed system.
IdGenerator
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
protected static java.lang.String |
ERR_ADD_BAD_STATE
|
protected static java.lang.String |
ERR_ADD_NULL_SPACE
|
protected static java.lang.String |
ERR_READING_BOOTSTRAP_SPACES
|
protected static int |
STATE_ERROR
|
protected static int |
STATE_INITIALIZING
|
protected static int |
STATE_NEW
|
protected static int |
STATE_RUNNING
|
protected static java.lang.String |
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 | |
---|---|
PersistentIdGenerator()
|
Method Summary | |
---|---|
boolean |
addIdSpace(IdSpace pSpace)
Add an id space to the id generator. |
protected abstract boolean |
addPersistentIdSpace(IdSpace pSpace)
Add id space to the data store. |
atg.xml.XMLFile |
getInitialIdSpaces()
Get property initialIdSpaces |
boolean |
getLoadInitialIdSpacesAtStartup()
Get property loadInitialIdSpacesAtStartup . |
javax.transaction.TransactionManager |
getTransactionManager()
Get property TransactionManager |
atg.xml.tools.XMLToolsFactory |
getXMLToolsFactory()
Get property XMLToolsFactory |
void |
initialize()
Initialize the generator. |
protected abstract void |
initializeIdSpaces()
Initialize the id spaces from the data store. |
void |
removeAllIdSpaces()
Remove all id spaces from the id generator. |
boolean |
removeIdSpace(IdSpace pSpace)
Remove an id space from the id generator. |
protected abstract void |
reserveSeeds(IdSpace pSpace)
Reserve a batch of seeds for the specified id space and update the id space itself with the new seed information. |
void |
setInitialIdSpaces(atg.xml.XMLFile pInitialIdSpaces)
Set property initialIdSpaces |
void |
setLoadInitialIdSpacesAtStartup(boolean pLoadInitialIdSpacesAtStartup)
Set property loadInitialIdSpacesAtStartup . |
void |
setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Set property TransactionManager |
void |
setXMLToolsFactory(atg.xml.tools.XMLToolsFactory pXMLToolsFactory)
Set property XMLToolsFactory |
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, 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
protected static int STATE_NEW
protected static int STATE_INITIALIZING
protected static int STATE_RUNNING
protected static int STATE_ERROR
protected static java.lang.String WARN_PICKING_DEFAULT
protected static java.lang.String ERR_READING_BOOTSTRAP_SPACES
protected static java.lang.String ERR_ADD_NULL_SPACE
protected static java.lang.String ERR_ADD_BAD_STATE
Constructor Detail |
---|
public PersistentIdGenerator()
Method Detail |
---|
public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
TransactionManager
pTransactionManager
- new value to setpublic javax.transaction.TransactionManager getTransactionManager()
TransactionManager
TransactionManager
public void setXMLToolsFactory(atg.xml.tools.XMLToolsFactory pXMLToolsFactory)
XMLToolsFactory
pXMLToolsFactory
- new value to setpublic atg.xml.tools.XMLToolsFactory getXMLToolsFactory()
XMLToolsFactory
XMLToolsFactory
public void setInitialIdSpaces(atg.xml.XMLFile pInitialIdSpaces)
initialIdSpaces
pInitialIdSpaces
- new value to setpublic atg.xml.XMLFile getInitialIdSpaces()
initialIdSpaces
initialIdSpaces
public void setLoadInitialIdSpacesAtStartup(boolean pLoadInitialIdSpacesAtStartup)
loadInitialIdSpacesAtStartup
. This is if true
the XML file specified by the initialIdSpaces property is loaded at
startup. If false the XML file is only loaded when no persistent ids are
found in the DB. The default is true.
pLoadInitialIdSpacesAtStartup
- new value to setpublic boolean getLoadInitialIdSpacesAtStartup()
loadInitialIdSpacesAtStartup
. If this is true
the XML file specified by the initialIdSpaces property is loaded at
startup. If false the XML file is only loaded when no persistent ids are
found in the DB. The default is true.
loadInitialIdSpacesAtStartup
public void initialize() throws IdGeneratorException
initialize
in interface IdGenerator
initialize
in class AbstractSequentialIdGenerator
IdGeneratorException
- 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 initializeprotected abstract void reserveSeeds(IdSpace pSpace) throws IdGeneratorException
pSpace
- id space to reserve seeds in, cannot be null
IdGeneratorException
- if there is a problem reserving
the seedsprotected abstract void initializeIdSpaces() throws IdGeneratorException
IdGeneratorException
public boolean addIdSpace(IdSpace pSpace) throws IdGeneratorException
addIdSpace
in interface IdGenerator
addIdSpace
in class AbstractSequentialIdGenerator
pSpace
- space to add, cannot be null
IdGeneratorException
- if there is trouble adding the spaceprotected abstract boolean addPersistentIdSpace(IdSpace pSpace) throws IdGeneratorException
pSpace
- space to add, will not be null
IdGeneratorException
public boolean removeIdSpace(IdSpace pSpace) throws IdGeneratorException
removeIdSpace
in interface IdGenerator
removeIdSpace
in class AbstractSequentialIdGenerator
pSpace
- space to remove, cannot be null
IdGeneratorException
- not yet supportedpublic void removeAllIdSpaces() throws IdGeneratorException
removeAllIdSpaces
in interface IdGenerator
removeAllIdSpaces
in class AbstractSequentialIdGenerator
IdGeneratorException
- not yet supported
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |