net.ontopia.persistence.proxy
Class HighLowKeyGenerator

java.lang.Object
  extended by net.ontopia.persistence.proxy.HighLowKeyGenerator
All Implemented Interfaces:
KeyGeneratorIF

public final class HighLowKeyGenerator
extends java.lang.Object
implements KeyGeneratorIF

INTERNAL: A key generator using the HIGH/LOW key generator algorithm. It maintains the current counters in a counter table. The key generator is able to preallocate a number of identities which it hand out without having to go the database for every new identity needed. It is used by the RDBMS proxy implementation.


Field Summary
protected  ConnectionFactoryIF connfactory
           
protected  java.lang.String database
           
protected  java.lang.String global_entry
           
protected  int grabsize
           
protected  java.lang.String keycol
           
protected  long max_value
           
protected  java.util.Map properties
           
protected  java.lang.String table
           
protected  java.lang.String valcol
           
protected  long value
           
 
Constructor Summary
HighLowKeyGenerator(ConnectionFactoryIF connfactory, java.lang.String table, java.lang.String keycol, java.lang.String valcol, java.lang.String global_entry, int grabsize, java.lang.String database, java.util.Map properties)
           
 
Method Summary
 IdentityIF generateKey(java.lang.Object type)
          INTERNAL: Generates a new object identity of the specified object type.
protected  long incrementInDatabase(java.lang.Object type)
          INTERNAL: Sends a request to the database to retrieve the current counter value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connfactory

protected ConnectionFactoryIF connfactory

table

protected java.lang.String table

keycol

protected java.lang.String keycol

valcol

protected java.lang.String valcol

grabsize

protected int grabsize

global_entry

protected java.lang.String global_entry

database

protected java.lang.String database

properties

protected java.util.Map properties

value

protected long value

max_value

protected long max_value
Constructor Detail

HighLowKeyGenerator

public HighLowKeyGenerator(ConnectionFactoryIF connfactory,
                           java.lang.String table,
                           java.lang.String keycol,
                           java.lang.String valcol,
                           java.lang.String global_entry,
                           int grabsize,
                           java.lang.String database,
                           java.util.Map properties)
Method Detail

generateKey

public IdentityIF generateKey(java.lang.Object type)
Description copied from interface: KeyGeneratorIF
INTERNAL: Generates a new object identity of the specified object type.

Specified by:
generateKey in interface KeyGeneratorIF

incrementInDatabase

protected long incrementInDatabase(java.lang.Object type)
INTERNAL: Sends a request to the database to retrieve the current counter value. The counter value row is then locked, the counter incremented and the new value stored.



Copyright © 2000-2012 Ontopia.