java.lang.Object
com.jcorporate.expresso.core.dbobj.NextNumber
com.jcorporate.expresso.core.dbobj.NextNumberImpl
- public class NextNumberImpl
- extends NextNumber
this class is a SOLITAIRE, used in NextNumber
- Since:
- $DatabaseSchema $Date: 2004/11/17 20:48:11 $
|
Constructor Summary |
NextNumberImpl()
Create the base level hashes for each db key. |
|
Method Summary |
protected void |
checkParams(java.lang.String db,
DBObject callingObject,
java.lang.String fieldName)
All parameters are
fully checked to avoid potential NullPointerExceptions |
long |
getNext(java.lang.String db,
DBObject callingDBObject,
java.lang.String fieldName)
Get the nextnumber for this dbobject. |
private com.jcorporate.expresso.core.misc.ReusableLong |
getNextNumberObject(java.lang.String db,
DBObject callingDBObject,
java.lang.String fieldName)
Returns the next number object without checking correctness for input parameters
May result in NullPointerException if the table is fed bad input. |
void |
initialize(java.lang.String db,
DBObject callingObject)
Initializes hash entries for all auto-inc fields in a particular DBOBject. |
void |
registerField(java.lang.String db,
DBObject callingDBOBject,
java.lang.String fieldName)
Register a field for next number information. |
void |
reset(java.lang.String db)
Reset the counts for the paritcular db each subsequent operation will
require a new getMax(). |
void |
reset(java.lang.String db,
DBObject callingObject)
Clears the table on a particular dbobject. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
contextMap
protected volatile ConcurrentReaderHashMap contextMap
- Top level hashMap - This level separates the db contexts. The object
returned by a get() is another Map() containing lists of dbobject
fields. The key is DBObject.getTargetTable() + "." + DBField.getFieldName()
this will return the Integer object that will be the number is internally
incremented,
mInitLock
private java.lang.Object mInitLock
NextNumberImpl
public NextNumberImpl()
- Create the base level hashes for each db key.
initialize
public void initialize(java.lang.String db,
DBObject callingObject)
throws com.jcorporate.expresso.core.db.DBException
- Initializes hash entries for all auto-inc fields in a particular DBOBject. This is
called the first time that a particular DBObject has a nextnumber called for any field.
this method should be synchronized externally.
registerField
public void registerField(java.lang.String db,
DBObject callingDBOBject,
java.lang.String fieldName)
throws com.jcorporate.expresso.core.db.DBException
- Register a field for next number information.
- Specified by:
registerField in class NextNumber
getNextNumberObject
private com.jcorporate.expresso.core.misc.ReusableLong getNextNumberObject(java.lang.String db,
DBObject callingDBObject,
java.lang.String fieldName)
throws com.jcorporate.expresso.core.db.DBException
- Returns the next number object without checking correctness for input parameters
May result in NullPointerException if the table is fed bad input.
if the field is not an auto-inc field, a warning will be logged.
- Since:
- $DatabaseSchema $Date: 2004/11/17 20:48:11 $
checkParams
protected void checkParams(java.lang.String db,
DBObject callingObject,
java.lang.String fieldName)
throws com.jcorporate.expresso.core.db.DBException
- All parameters are
fully checked to avoid potential NullPointerExceptions
getNext
public long getNext(java.lang.String db,
DBObject callingDBObject,
java.lang.String fieldName)
throws com.jcorporate.expresso.core.db.DBException
- Get the nextnumber for this dbobject. Increments the internal value.
- Specified by:
getNext in class NextNumber
reset
public void reset(java.lang.String db)
- Reset the counts for the paritcular db each subsequent operation will
require a new getMax(). There is questionable threadsafety about the
reset methods. Please only do it on a "non-live" server. Used after a
DBCreate or DeleteSchema has been called.
- Specified by:
reset in class NextNumber
reset
public void reset(java.lang.String db,
DBObject callingObject)
- Clears the table on a particular dbobject. Similar to reset db
- Specified by:
reset in class NextNumber