edu.indiana.iucbrf.feature
Class FeatureKeyIntFactory

java.lang.Object
  extended by edu.indiana.iucbrf.feature.FeatureKeyFactory
      extended by edu.indiana.iucbrf.feature.FeatureKeyIntFactory
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DBFeatureKeyIntFactory

public class FeatureKeyIntFactory
extends FeatureKeyFactory

Used to obtain the next available unique FeatureKey.

See Also:
Serialized Form

Field Summary
protected  int nextKey
           
 
Fields inherited from class edu.indiana.iucbrf.feature.FeatureKeyFactory
constantName, dbFactory, info, nextKeyValueSet
 
Constructor Summary
FeatureKeyIntFactory()
          Creates a new instance of FeatureKeyFactory
FeatureKeyIntFactory(DBInfo info)
          Creates a new instance of FeatureKeyFactory and loads the next value of the nextKey from the constantstable in the database.
FeatureKeyIntFactory(int startKey)
          Constructor
 
Method Summary
 FeatureKey convertDBStringToKey(java.lang.String dbEntry)
          Assumes that the dbEntry String contains an integer.
 FeatureKey generateKey()
          Method generateKey
protected  void reset()
          Resets the factory
 void setNextKey(int nextKey)
          Sets the next value of nextKey to be the passed parameter.
protected  void setNextKeyFromDB()
          Reads the next value for nextKey from the ConstantsTable in the database
protected  void setNextKeyFromDB(boolean checkIfSetAlready)
          Reads the next value for nextKey from the ConstantsTable in the database
protected  void storeNextKeyToDB()
          Stores the nextKey in the constants table in the database.
 
Methods inherited from class edu.indiana.iucbrf.feature.FeatureKeyFactory
finalize, isDBFactory, isNextKeyValueSet, setDBFactory, setNextKeyValueSet, shutDown
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextKey

protected int nextKey
Constructor Detail

FeatureKeyIntFactory

public FeatureKeyIntFactory()
Creates a new instance of FeatureKeyFactory


FeatureKeyIntFactory

public FeatureKeyIntFactory(int startKey)
Constructor

Parameters:
startKey - an int

FeatureKeyIntFactory

public FeatureKeyIntFactory(DBInfo info)
Creates a new instance of FeatureKeyFactory and loads the next value of the nextKey from the constantstable in the database.

Parameters:
info - a DBInfo
Method Detail

generateKey

public FeatureKey generateKey()
Method generateKey

Specified by:
generateKey in class FeatureKeyFactory
Returns:
a FeatureKey

convertDBStringToKey

public FeatureKey convertDBStringToKey(java.lang.String dbEntry)
Assumes that the dbEntry String contains an integer.

Overrides:
convertDBStringToKey in class FeatureKeyFactory

setNextKeyFromDB

protected void setNextKeyFromDB()
Reads the next value for nextKey from the ConstantsTable in the database

Overrides:
setNextKeyFromDB in class FeatureKeyFactory

setNextKeyFromDB

protected void setNextKeyFromDB(boolean checkIfSetAlready)
Reads the next value for nextKey from the ConstantsTable in the database


setNextKey

public void setNextKey(int nextKey)
Sets the next value of nextKey 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:
nextKey - an int

reset

protected void reset()
Resets the factory


storeNextKeyToDB

protected void storeNextKeyToDB()
Stores the nextKey in the constants table in the database.

Overrides:
storeNextKeyToDB in class FeatureKeyFactory