edu.indiana.util.db
Class RDBCollectionIDFactory

java.lang.Object
  extended by edu.indiana.util.db.RDBCollectionIDFactory

public class RDBCollectionIDFactory
extends java.lang.Object

Used to obtain the next available unique RDBCollectionID.


Field Summary
protected  int nextIdentifier
           
 
Constructor Summary
RDBCollectionIDFactory(DBInfo info)
          Creates a new instance of RDBcollectionIDFactory and loads the next value of the RDBCollectionID from the constantstable in the database.
 
Method Summary
 void finalize()
          Method finalize
 RDBCollectionID generateIdentifier()
          Generates the next RDBCollectionID
protected  boolean isNextIdentifierValueSet()
          Method isNextIdentifierValueSet
protected  void reset()
          Resets the factory
 void setNextIdentifier(int nextIdentifier)
          Sets the next value of ID to be the passed parameter.
protected  void setNextIdentifierFromDB()
          Reads the next value for the RDBCollectionID form the ConstantsTable in the database
protected  void setNextIdentifierValueSet(boolean nextIdentifierValueSet)
           
 void shutDown()
          Shutsdown the factory by storing the nextIdentifier in the database.
protected  void storeNextIdentifierToDB()
          Stores the nextIdentofoer in the constants table in the database.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextIdentifier

protected int nextIdentifier
Constructor Detail

RDBCollectionIDFactory

public RDBCollectionIDFactory(DBInfo info)
Creates a new instance of RDBcollectionIDFactory and loads the next value of the RDBCollectionID from the constantstable in the database.

Parameters:
info - a DBInfo
Method Detail

generateIdentifier

public RDBCollectionID generateIdentifier()
Generates the next RDBCollectionID

Returns:
a RDBCollectionID

setNextIdentifierValueSet

protected void setNextIdentifierValueSet(boolean nextIdentifierValueSet)
Parameters:
nextIdentifierValueSeta - boolean

isNextIdentifierValueSet

protected boolean isNextIdentifierValueSet()
Method isNextIdentifierValueSet

Returns:
a boolean

setNextIdentifierFromDB

protected void setNextIdentifierFromDB()
Reads the next value for the RDBCollectionID form the ConstantsTable in the database


storeNextIdentifierToDB

protected void storeNextIdentifierToDB()
Stores the nextIdentofoer in the constants table in the database.


setNextIdentifier

public void setNextIdentifier(int nextIdentifier)
                       throws InvalidCollectionIDException
Sets the next value of ID to be the passed parameter. Note: this method must be used only if its required to reset the factory and not at any other time.

Parameters:
nextIdentifier - an int
Throws:
InvalidCollectionIDException

reset

protected void reset()
Resets the factory


shutDown

public void shutDown()
Shutsdown the factory by storing the nextIdentifier in the database.


finalize

public void finalize()
Method finalize

Overrides:
finalize in class java.lang.Object